diff --git a/2.0.0-alpha.33/angular2.dev.js b/2.0.0-alpha.33/angular2.dev.js new file mode 100644 index 0000000000..9d671bece4 --- /dev/null +++ b/2.0.0-alpha.33/angular2.dev.js @@ -0,0 +1,31035 @@ +/** + @license +Copyright 2014-2015 Google, Inc. http://angularjs.org + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + + */ + +(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 -1; + +// TODO(vicb): remove '!isFirefox' when the bug gets fixed: +// https://bugzilla.mozilla.org/show_bug.cgi?id=1162013 +if (hasNativePromise && !isFirefox) { + // When available use a native Promise to schedule microtasks. + // When not available, es6-promise fallback will be used + var resolvedPromise = Promise.resolve(); + es6Promise._setScheduler(function(fn) { + resolvedPromise.then(fn); + }); +} + + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"es6-promise":15}],4:[function(require,module,exports){ +(function (global){ +'use strict'; + +var fnPatch = require('./functions'); +var promisePatch = require('./promise'); +var mutationObserverPatch = require('./mutation-observer'); +var definePropertyPatch = require('./define-property'); +var registerElementPatch = require('./register-element'); +var webSocketPatch = require('./websocket'); +var eventTargetPatch = require('./event-target'); +var propertyDescriptorPatch = require('./property-descriptor'); +var geolocationPatch = require('./geolocation'); + +function apply() { + fnPatch.patchSetClearFunction(global, [ + 'timeout', + 'interval', + 'immediate' + ]); + + fnPatch.patchSetFunction(global, [ + 'requestAnimationFrame', + 'mozRequestAnimationFrame', + 'webkitRequestAnimationFrame' + ]); + + fnPatch.patchFunction(global, [ + 'alert', + 'prompt' + ]); + + eventTargetPatch.apply(); + + propertyDescriptorPatch.apply(); + + promisePatch.apply(); + + mutationObserverPatch.patchClass('MutationObserver'); + mutationObserverPatch.patchClass('WebKitMutationObserver'); + + definePropertyPatch.apply(); + + registerElementPatch.apply(); + + geolocationPatch.apply(); +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./define-property":5,"./event-target":6,"./functions":7,"./geolocation":8,"./mutation-observer":9,"./promise":10,"./property-descriptor":11,"./register-element":12,"./websocket":13}],5:[function(require,module,exports){ +'use strict'; + +// might need similar for object.freeze +// i regret nothing + +var _defineProperty = Object.defineProperty; +var _getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; +var _create = Object.create; + +function apply() { + Object.defineProperty = function (obj, prop, desc) { + if (isUnconfigurable(obj, prop)) { + throw new TypeError('Cannot assign to read only property \'' + prop + '\' of ' + obj); + } + if (prop !== 'prototype') { + desc = rewriteDescriptor(obj, prop, desc); + } + return _defineProperty(obj, prop, desc); + }; + + Object.defineProperties = function (obj, props) { + Object.keys(props).forEach(function (prop) { + Object.defineProperty(obj, prop, props[prop]); + }); + return obj; + }; + + Object.create = function (obj, proto) { + if (typeof proto === 'object') { + Object.keys(proto).forEach(function (prop) { + proto[prop] = rewriteDescriptor(obj, prop, proto[prop]); + }); + } + return _create(obj, proto); + }; + + Object.getOwnPropertyDescriptor = function (obj, prop) { + var desc = _getOwnPropertyDescriptor(obj, prop); + if (isUnconfigurable(obj, prop)) { + desc.configurable = false; + } + return desc; + }; +}; + +function _redefineProperty(obj, prop, desc) { + desc = rewriteDescriptor(obj, prop, desc); + return _defineProperty(obj, prop, desc); +}; + +function isUnconfigurable (obj, prop) { + return obj && obj.__unconfigurables && obj.__unconfigurables[prop]; +} + +function rewriteDescriptor (obj, prop, desc) { + desc.configurable = true; + if (!desc.configurable) { + if (!obj.__unconfigurables) { + _defineProperty(obj, '__unconfigurables', { writable: true, value: {} }); + } + obj.__unconfigurables[prop] = true; + } + return desc; +} + +module.exports = { + apply: apply, + _redefineProperty: _redefineProperty +}; + + + +},{}],6:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function apply() { + // patched properties depend on addEventListener, so this needs to come first + if (global.EventTarget) { + utils.patchEventTargetMethods(global.EventTarget.prototype); + + // Note: EventTarget is not available in all browsers, + // if it's not available, we instead patch the APIs in the IDL that inherit from EventTarget + } else { + var apis = [ 'ApplicationCache', + 'EventSource', + 'FileReader', + 'InputMethodContext', + 'MediaController', + 'MessagePort', + 'Node', + 'Performance', + 'SVGElementInstance', + 'SharedWorker', + 'TextTrack', + 'TextTrackCue', + 'TextTrackList', + 'WebKitNamedFlow', + 'Window', + 'Worker', + 'WorkerGlobalScope', + 'XMLHttpRequest', + 'XMLHttpRequestEventTarget', + 'XMLHttpRequestUpload' + ]; + + apis.forEach(function(thing) { + global[thing] && utils.patchEventTargetMethods(global[thing].prototype); + }); + } +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],7:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function patchSetClearFunction(obj, fnNames) { + fnNames.map(function (name) { + return name[0].toUpperCase() + name.substr(1); + }).forEach(function (name) { + var setName = 'set' + name; + var delegate = obj[setName]; + + if (delegate) { + var clearName = 'clear' + name; + var ids = {}; + + var bindArgs = setName === 'setInterval' ? utils.bindArguments : utils.bindArgumentsOnce; + + global.zone[setName] = function (fn) { + var id, fnRef = fn; + arguments[0] = function () { + delete ids[id]; + return fnRef.apply(this, arguments); + }; + var args = bindArgs(arguments); + id = delegate.apply(obj, args); + ids[id] = true; + return id; + }; + + obj[setName] = function () { + return global.zone[setName].apply(this, arguments); + }; + + var clearDelegate = obj[clearName]; + + global.zone[clearName] = function (id) { + if (ids[id]) { + delete ids[id]; + global.zone.dequeueTask(); + } + return clearDelegate.apply(this, arguments); + }; + + obj[clearName] = function () { + return global.zone[clearName].apply(this, arguments); + }; + } + }); +}; + +function patchSetFunction(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + + if (delegate) { + global.zone[name] = function (fn) { + var fnRef = fn; + arguments[0] = function () { + return fnRef.apply(this, arguments); + }; + var args = utils.bindArgumentsOnce(arguments); + return delegate.apply(obj, args); + }; + + obj[name] = function () { + return zone[name].apply(this, arguments); + }; + } + }); +}; + +function patchFunction(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + global.zone[name] = function () { + return delegate.apply(obj, arguments); + }; + + obj[name] = function () { + return global.zone[name].apply(this, arguments); + }; + }); +}; + + +module.exports = { + patchSetClearFunction: patchSetClearFunction, + patchSetFunction: patchSetFunction, + patchFunction: patchFunction +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],8:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function apply() { + if (global.navigator && global.navigator.geolocation) { + utils.patchPrototype(global.navigator.geolocation, [ + 'getCurrentPosition', + 'watchPosition' + ]); + } +} + +module.exports = { + apply: apply +} + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],9:[function(require,module,exports){ +(function (global){ +'use strict'; + +// wrap some native API on `window` +function patchClass(className) { + var OriginalClass = global[className]; + if (!OriginalClass) return; + + global[className] = function (fn) { + this._o = new OriginalClass(global.zone.bind(fn, true)); + // Remember where the class was instantiate to execute the enqueueTask and dequeueTask hooks + this._creationZone = global.zone; + }; + + var instance = new OriginalClass(function () {}); + + global[className].prototype.disconnect = function () { + var result = this._o.disconnect.apply(this._o, arguments); + if (this._active) { + this._creationZone.dequeueTask(); + this._active = false; + } + return result; + }; + + global[className].prototype.observe = function () { + if (!this._active) { + this._creationZone.enqueueTask(); + this._active = true; + } + return this._o.observe.apply(this._o, arguments); + }; + + var prop; + for (prop in instance) { + (function (prop) { + if (typeof global[className].prototype !== undefined) { + return; + } + if (typeof instance[prop] === 'function') { + global[className].prototype[prop] = function () { + return this._o[prop].apply(this._o, arguments); + }; + } else { + Object.defineProperty(global[className].prototype, prop, { + set: function (fn) { + if (typeof fn === 'function') { + this._o[prop] = global.zone.bind(fn); + } else { + this._o[prop] = fn; + } + }, + get: function () { + return this._o[prop]; + } + }); + } + }(prop)); + } +}; + +module.exports = { + patchClass: patchClass +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],10:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +/* + * Patches a function that returns a Promise-like instance. + * + * This function must be used when either: + * - Native Promises are not available, + * - The function returns a Promise-like object. + * + * This is required because zones rely on a Promise monkey patch that could not be applied when + * Promise is not natively available or when the returned object is not an instance of Promise. + * + * Note that calling `bindPromiseFn` on a function that returns a native Promise will also work + * with minimal overhead. + * + * ``` + * var boundFunction = bindPromiseFn(FunctionReturningAPromise); + * + * boundFunction.then(successHandler, errorHandler); + * ``` + */ +var bindPromiseFn; + +if (global.Promise) { + bindPromiseFn = function (delegate) { + return function() { + var delegatePromise = delegate.apply(this, arguments); + + // if the delegate returned an instance of Promise, forward it. + if (delegatePromise instanceof Promise) { + return delegatePromise; + } + + // Otherwise wrap the Promise-like in a global Promise + return new Promise(function(resolve, reject) { + delegatePromise.then(resolve, reject); + }); + }; + }; +} else { + bindPromiseFn = function (delegate) { + return function () { + return _patchThenable(delegate.apply(this, arguments)); + }; + }; +} + + +function _patchPromiseFnsOnObject(objectPath, fnNames) { + var obj = global; + + var exists = objectPath.every(function (segment) { + obj = obj[segment]; + return obj; + }); + + if (!exists) { + return; + } + + fnNames.forEach(function (name) { + var fn = obj[name]; + if (fn) { + obj[name] = bindPromiseFn(fn); + } + }); +} + +function _patchThenable(thenable) { + var then = thenable.then; + thenable.then = function () { + var args = utils.bindArguments(arguments); + var nextThenable = then.apply(thenable, args); + return _patchThenable(nextThenable); + }; + + var ocatch = thenable.catch; + thenable.catch = function () { + var args = utils.bindArguments(arguments); + var nextThenable = ocatch.apply(thenable, args); + return _patchThenable(nextThenable); + }; + + return thenable; +} + + +function apply() { + // Patch .then() and .catch() on native Promises to execute callbacks in the zone where + // those functions are called. + if (global.Promise) { + utils.patchPrototype(Promise.prototype, [ + 'then', + 'catch' + ]); + + // Patch browser APIs that return a Promise + var patchFns = [ + // fetch + [[], ['fetch']], + [['Response', 'prototype'], ['arrayBuffer', 'blob', 'json', 'text']] + ]; + + patchFns.forEach(function(objPathAndFns) { + _patchPromiseFnsOnObject(objPathAndFns[0], objPathAndFns[1]); + }); + } +} + +module.exports = { + apply: apply, + bindPromiseFn: bindPromiseFn +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],11:[function(require,module,exports){ +(function (global){ +'use strict'; + +var webSocketPatch = require('./websocket'); +var utils = require('../utils'); + +var eventNames = 'copy cut paste abort blur focus canplay canplaythrough change click contextmenu dblclick drag dragend dragenter dragleave dragover dragstart drop durationchange emptied ended input invalid keydown keypress keyup load loadeddata loadedmetadata loadstart message mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup pause play playing progress ratechange reset scroll seeked seeking select show stalled submit suspend timeupdate volumechange waiting mozfullscreenchange mozfullscreenerror mozpointerlockchange mozpointerlockerror error webglcontextrestored webglcontextlost webglcontextcreationerror'.split(' '); + +function apply() { + if (canPatchViaPropertyDescriptor()) { + // for browsers that we can patch the descriptor: Chrome & Firefox + var onEventNames = eventNames.map(function (property) { + return 'on' + property; + }); + utils.patchProperties(HTMLElement.prototype, onEventNames); + utils.patchProperties(XMLHttpRequest.prototype); + if (typeof WebSocket !== 'undefined') { + utils.patchProperties(WebSocket.prototype); + } + } else { + // Safari + patchViaCapturingAllTheEvents(); + utils.patchClass('XMLHttpRequest'); + webSocketPatch.apply(); + } +} + +function canPatchViaPropertyDescriptor() { + if (!Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'onclick') && typeof Element !== 'undefined') { + // WebKit https://bugs.webkit.org/show_bug.cgi?id=134364 + // IDL interface attributes are not configurable + var desc = Object.getOwnPropertyDescriptor(Element.prototype, 'onclick'); + if (desc && !desc.configurable) return false; + } + + Object.defineProperty(HTMLElement.prototype, 'onclick', { + get: function () { + return true; + } + }); + var elt = document.createElement('div'); + var result = !!elt.onclick; + Object.defineProperty(HTMLElement.prototype, 'onclick', {}); + return result; +}; + +// Whenever any event fires, we check the event target and all parents +// for `onwhatever` properties and replace them with zone-bound functions +// - Chrome (for now) +function patchViaCapturingAllTheEvents() { + eventNames.forEach(function (property) { + var onproperty = 'on' + property; + document.addEventListener(property, function (event) { + var elt = event.target, bound; + while (elt) { + if (elt[onproperty] && !elt[onproperty]._unbound) { + bound = global.zone.bind(elt[onproperty]); + bound._unbound = elt[onproperty]; + elt[onproperty] = bound; + } + elt = elt.parentElement; + } + }, true); + }); +}; + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14,"./websocket":13}],12:[function(require,module,exports){ +(function (global){ +'use strict'; + +var _redefineProperty = require('./define-property')._redefineProperty; + +function apply() { + if (!('registerElement' in global.document)) { + return; + } + + var _registerElement = document.registerElement; + var callbacks = [ + 'createdCallback', + 'attachedCallback', + 'detachedCallback', + 'attributeChangedCallback' + ]; + + document.registerElement = function (name, opts) { + if (opts && opts.prototype) { + callbacks.forEach(function (callback) { + if (opts.prototype.hasOwnProperty(callback)) { + var descriptor = Object.getOwnPropertyDescriptor(opts.prototype, callback); + if (descriptor.value) { + descriptor.value = global.zone.bind(descriptor.value); + _redefineProperty(opts.prototype, callback, descriptor); + } else { + opts.prototype[callback] = global.zone.bind(opts.prototype[callback]); + } + } else if (opts.prototype[callback]) { + opts.prototype[callback] = global.zone.bind(opts.prototype[callback]); + } + }); + } + + return _registerElement.apply(document, [name, opts]); + }; +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./define-property":5}],13:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +// we have to patch the instance since the proto is non-configurable +function apply() { + var WS = global.WebSocket; + utils.patchEventTargetMethods(WS.prototype); + global.WebSocket = function(a, b) { + var socket = arguments.length > 1 ? new WS(a, b) : new WS(a); + var proxySocket; + + // Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance + var onmessageDesc = Object.getOwnPropertyDescriptor(socket, 'onmessage'); + if (onmessageDesc && onmessageDesc.configurable === false) { + proxySocket = Object.create(socket); + ['addEventListener', 'removeEventListener', 'send', 'close'].forEach(function(propName) { + proxySocket[propName] = function() { + return socket[propName].apply(socket, arguments); + }; + }); + } else { + // we can patch the real socket + proxySocket = socket; + } + + utils.patchProperties(proxySocket, ['onclose', 'onerror', 'onmessage', 'onopen']); + + return proxySocket; + }; +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],14:[function(require,module,exports){ +(function (global){ +'use strict'; + +function bindArguments(args) { + for (var i = args.length - 1; i >= 0; i--) { + if (typeof args[i] === 'function') { + args[i] = global.zone.bind(args[i]); + } + } + return args; +}; + +function bindArgumentsOnce(args) { + for (var i = args.length - 1; i >= 0; i--) { + if (typeof args[i] === 'function') { + args[i] = global.zone.bindOnce(args[i]); + } + } + return args; +}; + +function patchPrototype(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + if (delegate) { + obj[name] = function () { + return delegate.apply(this, bindArguments(arguments)); + }; + } + }); +}; + +function patchProperty(obj, prop) { + var desc = Object.getOwnPropertyDescriptor(obj, prop) || { + enumerable: true, + configurable: true + }; + + // A property descriptor cannot have getter/setter and be writable + // deleting the writable and value properties avoids this error: + // + // TypeError: property descriptors must not specify a value or be writable when a + // getter or setter has been specified + delete desc.writable; + delete desc.value; + + // substr(2) cuz 'onclick' -> 'click', etc + var eventName = prop.substr(2); + var _prop = '_' + prop; + + desc.set = function (fn) { + if (this[_prop]) { + this.removeEventListener(eventName, this[_prop]); + } + + if (typeof fn === 'function') { + this[_prop] = fn; + this.addEventListener(eventName, fn, false); + } else { + this[_prop] = null; + } + }; + + desc.get = function () { + return this[_prop]; + }; + + Object.defineProperty(obj, prop, desc); +}; + +function patchProperties(obj, properties) { + + (properties || (function () { + var props = []; + for (var prop in obj) { + props.push(prop); + } + return props; + }()). + filter(function (propertyName) { + return propertyName.substr(0,2) === 'on'; + })). + forEach(function (eventName) { + patchProperty(obj, eventName); + }); +}; + +function patchEventTargetMethods(obj) { + var addDelegate = obj.addEventListener; + obj.addEventListener = function (eventName, fn) { + fn._bound = fn._bound || {}; + arguments[1] = fn._bound[eventName] = zone.bind(fn); + return addDelegate.apply(this, arguments); + }; + + var removeDelegate = obj.removeEventListener; + obj.removeEventListener = function (eventName, fn) { + if(arguments[1]._bound && arguments[1]._bound[eventName]) { + var _bound = arguments[1]._bound; + arguments[1] = _bound[eventName]; + delete _bound[eventName]; + } + var result = removeDelegate.apply(this, arguments); + global.zone.dequeueTask(fn); + return result; + }; +}; + +// wrap some native API on `window` +function patchClass(className) { + var OriginalClass = global[className]; + if (!OriginalClass) return; + + global[className] = function () { + var a = bindArguments(arguments); + switch (a.length) { + case 0: this._o = new OriginalClass(); break; + case 1: this._o = new OriginalClass(a[0]); break; + case 2: this._o = new OriginalClass(a[0], a[1]); break; + case 3: this._o = new OriginalClass(a[0], a[1], a[2]); break; + case 4: this._o = new OriginalClass(a[0], a[1], a[2], a[3]); break; + default: throw new Error('what are you even doing?'); + } + }; + + var instance = new OriginalClass(); + + var prop; + for (prop in instance) { + (function (prop) { + if (typeof instance[prop] === 'function') { + global[className].prototype[prop] = function () { + return this._o[prop].apply(this._o, arguments); + }; + } else { + Object.defineProperty(global[className].prototype, prop, { + set: function (fn) { + if (typeof fn === 'function') { + this._o[prop] = global.zone.bind(fn); + } else { + this._o[prop] = fn; + } + }, + get: function () { + return this._o[prop]; + } + }); + } + }(prop)); + } + + for (prop in OriginalClass) { + if (prop !== 'prototype' && OriginalClass.hasOwnProperty(prop)) { + global[className][prop] = OriginalClass[prop]; + } + } +}; + +module.exports = { + bindArguments: bindArguments, + bindArgumentsOnce: bindArgumentsOnce, + patchPrototype: patchPrototype, + patchProperty: patchProperty, + patchProperties: patchProperties, + patchEventTargetMethods: patchEventTargetMethods, + patchClass: patchClass +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],15:[function(require,module,exports){ +(function (process,global){ +/*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE + * @version 2.3.0 + */ + +(function() { + "use strict"; + function lib$es6$promise$utils$$objectOrFunction(x) { + return typeof x === 'function' || (typeof x === 'object' && x !== null); + } + + function lib$es6$promise$utils$$isFunction(x) { + return typeof x === 'function'; + } + + function lib$es6$promise$utils$$isMaybeThenable(x) { + return typeof x === 'object' && x !== null; + } + + var lib$es6$promise$utils$$_isArray; + if (!Array.isArray) { + lib$es6$promise$utils$$_isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; + } else { + lib$es6$promise$utils$$_isArray = Array.isArray; + } + + var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray; + var lib$es6$promise$asap$$len = 0; + var lib$es6$promise$asap$$toString = {}.toString; + var lib$es6$promise$asap$$vertxNext; + var lib$es6$promise$asap$$customSchedulerFn; + + var lib$es6$promise$asap$$asap = function asap(callback, arg) { + lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback; + lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg; + lib$es6$promise$asap$$len += 2; + if (lib$es6$promise$asap$$len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + if (lib$es6$promise$asap$$customSchedulerFn) { + lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush); + } else { + lib$es6$promise$asap$$scheduleFlush(); + } + } + } + + function lib$es6$promise$asap$$setScheduler(scheduleFn) { + lib$es6$promise$asap$$customSchedulerFn = scheduleFn; + } + + function lib$es6$promise$asap$$setAsap(asapFn) { + lib$es6$promise$asap$$asap = asapFn; + } + + var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined; + var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {}; + var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver; + var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + + // test for web worker but not in IE10 + var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' && + typeof importScripts !== 'undefined' && + typeof MessageChannel !== 'undefined'; + + // node + function lib$es6$promise$asap$$useNextTick() { + var nextTick = process.nextTick; + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // setImmediate should be used instead instead + var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/); + if (Array.isArray(version) && version[1] === '0' && version[2] === '10') { + nextTick = setImmediate; + } + return function() { + nextTick(lib$es6$promise$asap$$flush); + }; + } + + // vertx + function lib$es6$promise$asap$$useVertxTimer() { + return function() { + lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush); + }; + } + + function lib$es6$promise$asap$$useMutationObserver() { + var iterations = 0; + var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return function() { + node.data = (iterations = ++iterations % 2); + }; + } + + // web worker + function lib$es6$promise$asap$$useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = lib$es6$promise$asap$$flush; + return function () { + channel.port2.postMessage(0); + }; + } + + function lib$es6$promise$asap$$useSetTimeout() { + return function() { + setTimeout(lib$es6$promise$asap$$flush, 1); + }; + } + + var lib$es6$promise$asap$$queue = new Array(1000); + function lib$es6$promise$asap$$flush() { + for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) { + var callback = lib$es6$promise$asap$$queue[i]; + var arg = lib$es6$promise$asap$$queue[i+1]; + + callback(arg); + + lib$es6$promise$asap$$queue[i] = undefined; + lib$es6$promise$asap$$queue[i+1] = undefined; + } + + lib$es6$promise$asap$$len = 0; + } + + function lib$es6$promise$asap$$attemptVertex() { + try { + var r = require; + var vertx = r('vertx'); + lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext; + return lib$es6$promise$asap$$useVertxTimer(); + } catch(e) { + return lib$es6$promise$asap$$useSetTimeout(); + } + } + + var lib$es6$promise$asap$$scheduleFlush; + // Decide what async method to use to triggering processing of queued callbacks: + if (lib$es6$promise$asap$$isNode) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick(); + } else if (lib$es6$promise$asap$$BrowserMutationObserver) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver(); + } else if (lib$es6$promise$asap$$isWorker) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel(); + } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertex(); + } else { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout(); + } + + function lib$es6$promise$$internal$$noop() {} + + var lib$es6$promise$$internal$$PENDING = void 0; + var lib$es6$promise$$internal$$FULFILLED = 1; + var lib$es6$promise$$internal$$REJECTED = 2; + + var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject(); + + function lib$es6$promise$$internal$$selfFullfillment() { + return new TypeError("You cannot resolve a promise with itself"); + } + + function lib$es6$promise$$internal$$cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); + } + + function lib$es6$promise$$internal$$getThen(promise) { + try { + return promise.then; + } catch(error) { + lib$es6$promise$$internal$$GET_THEN_ERROR.error = error; + return lib$es6$promise$$internal$$GET_THEN_ERROR; + } + } + + function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) { + try { + then.call(value, fulfillmentHandler, rejectionHandler); + } catch(e) { + return e; + } + } + + function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) { + lib$es6$promise$asap$$asap(function(promise) { + var sealed = false; + var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) { + if (sealed) { return; } + sealed = true; + if (thenable !== value) { + lib$es6$promise$$internal$$resolve(promise, value); + } else { + lib$es6$promise$$internal$$fulfill(promise, value); + } + }, function(reason) { + if (sealed) { return; } + sealed = true; + + lib$es6$promise$$internal$$reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + lib$es6$promise$$internal$$reject(promise, error); + } + }, promise); + } + + function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) { + if (thenable._state === lib$es6$promise$$internal$$FULFILLED) { + lib$es6$promise$$internal$$fulfill(promise, thenable._result); + } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, thenable._result); + } else { + lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) { + lib$es6$promise$$internal$$resolve(promise, value); + }, function(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + }); + } + } + + function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) { + if (maybeThenable.constructor === promise.constructor) { + lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable); + } else { + var then = lib$es6$promise$$internal$$getThen(maybeThenable); + + if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error); + } else if (then === undefined) { + lib$es6$promise$$internal$$fulfill(promise, maybeThenable); + } else if (lib$es6$promise$utils$$isFunction(then)) { + lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then); + } else { + lib$es6$promise$$internal$$fulfill(promise, maybeThenable); + } + } + } + + function lib$es6$promise$$internal$$resolve(promise, value) { + if (promise === value) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment()); + } else if (lib$es6$promise$utils$$objectOrFunction(value)) { + lib$es6$promise$$internal$$handleMaybeThenable(promise, value); + } else { + lib$es6$promise$$internal$$fulfill(promise, value); + } + } + + function lib$es6$promise$$internal$$publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + + lib$es6$promise$$internal$$publish(promise); + } + + function lib$es6$promise$$internal$$fulfill(promise, value) { + if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } + + promise._result = value; + promise._state = lib$es6$promise$$internal$$FULFILLED; + + if (promise._subscribers.length !== 0) { + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise); + } + } + + function lib$es6$promise$$internal$$reject(promise, reason) { + if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } + promise._state = lib$es6$promise$$internal$$REJECTED; + promise._result = reason; + + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise); + } + + function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) { + var subscribers = parent._subscribers; + var length = subscribers.length; + + parent._onerror = null; + + subscribers[length] = child; + subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment; + subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection; + + if (length === 0 && parent._state) { + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent); + } + } + + function lib$es6$promise$$internal$$publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + + if (subscribers.length === 0) { return; } + + var child, callback, detail = promise._result; + + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + + promise._subscribers.length = 0; + } + + function lib$es6$promise$$internal$$ErrorObject() { + this.error = null; + } + + var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject(); + + function lib$es6$promise$$internal$$tryCatch(callback, detail) { + try { + return callback(detail); + } catch(e) { + lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e; + return lib$es6$promise$$internal$$TRY_CATCH_ERROR; + } + } + + function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) { + var hasCallback = lib$es6$promise$utils$$isFunction(callback), + value, error, succeeded, failed; + + if (hasCallback) { + value = lib$es6$promise$$internal$$tryCatch(callback, detail); + + if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) { + failed = true; + error = value.error; + value = null; + } else { + succeeded = true; + } + + if (promise === value) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn()); + return; + } + + } else { + value = detail; + succeeded = true; + } + + if (promise._state !== lib$es6$promise$$internal$$PENDING) { + // noop + } else if (hasCallback && succeeded) { + lib$es6$promise$$internal$$resolve(promise, value); + } else if (failed) { + lib$es6$promise$$internal$$reject(promise, error); + } else if (settled === lib$es6$promise$$internal$$FULFILLED) { + lib$es6$promise$$internal$$fulfill(promise, value); + } else if (settled === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } + } + + function lib$es6$promise$$internal$$initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value){ + lib$es6$promise$$internal$$resolve(promise, value); + }, function rejectPromise(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + }); + } catch(e) { + lib$es6$promise$$internal$$reject(promise, e); + } + } + + function lib$es6$promise$enumerator$$Enumerator(Constructor, input) { + var enumerator = this; + + enumerator._instanceConstructor = Constructor; + enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (enumerator._validateInput(input)) { + enumerator._input = input; + enumerator.length = input.length; + enumerator._remaining = input.length; + + enumerator._init(); + + if (enumerator.length === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } else { + enumerator.length = enumerator.length || 0; + enumerator._enumerate(); + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } + } + } else { + lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError()); + } + } + + lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) { + return lib$es6$promise$utils$$isArray(input); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() { + return new Error('Array Methods must be provided an Array'); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._init = function() { + this._result = new Array(this.length); + }; + + var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator; + + lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() { + var enumerator = this; + + var length = enumerator.length; + var promise = enumerator.promise; + var input = enumerator._input; + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + enumerator._eachEntry(input[i], i); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) { + var enumerator = this; + var c = enumerator._instanceConstructor; + + if (lib$es6$promise$utils$$isMaybeThenable(entry)) { + if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) { + entry._onerror = null; + enumerator._settledAt(entry._state, i, entry._result); + } else { + enumerator._willSettleAt(c.resolve(entry), i); + } + } else { + enumerator._remaining--; + enumerator._result[i] = entry; + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) { + var enumerator = this; + var promise = enumerator.promise; + + if (promise._state === lib$es6$promise$$internal$$PENDING) { + enumerator._remaining--; + + if (state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } else { + enumerator._result[i] = value; + } + } + + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(promise, enumerator._result); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) { + var enumerator = this; + + lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) { + enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value); + }, function(reason) { + enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason); + }); + }; + function lib$es6$promise$promise$all$$all(entries) { + return new lib$es6$promise$enumerator$$default(this, entries).promise; + } + var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all; + function lib$es6$promise$promise$race$$race(entries) { + /*jshint validthis:true */ + var Constructor = this; + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (!lib$es6$promise$utils$$isArray(entries)) { + lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.')); + return promise; + } + + var length = entries.length; + + function onFulfillment(value) { + lib$es6$promise$$internal$$resolve(promise, value); + } + + function onRejection(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + } + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); + } + + return promise; + } + var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race; + function lib$es6$promise$promise$resolve$$resolve(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$resolve(promise, object); + return promise; + } + var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve; + function lib$es6$promise$promise$reject$$reject(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$reject(promise, reason); + return promise; + } + var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject; + + var lib$es6$promise$promise$$counter = 0; + + function lib$es6$promise$promise$$needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); + } + + function lib$es6$promise$promise$$needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); + } + + var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise; + /** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + var promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + var xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {function} resolver + Useful for tooling. + @constructor + */ + function lib$es6$promise$promise$$Promise(resolver) { + this._id = lib$es6$promise$promise$$counter++; + this._state = undefined; + this._result = undefined; + this._subscribers = []; + + if (lib$es6$promise$$internal$$noop !== resolver) { + if (!lib$es6$promise$utils$$isFunction(resolver)) { + lib$es6$promise$promise$$needsResolver(); + } + + if (!(this instanceof lib$es6$promise$promise$$Promise)) { + lib$es6$promise$promise$$needsNew(); + } + + lib$es6$promise$$internal$$initializePromise(this, resolver); + } + } + + lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default; + lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default; + lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default; + lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default; + lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler; + lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap; + lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap; + + lib$es6$promise$promise$$Promise.prototype = { + constructor: lib$es6$promise$promise$$Promise, + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + + Chaining + -------- + + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + + Assimilation + ------------ + + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + + If the assimliated promise rejects, then the downstream promise will also reject. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + + Simple Example + -------------- + + Synchronous Example + + ```javascript + var result; + + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + + Promise Example; + + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + + Advanced Example + -------------- + + Synchronous Example + + ```javascript + var author, books; + + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + + function foundBooks(books) { + + } + + function failure(reason) { + + } + + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + + Promise Example; + + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + then: function(onFulfillment, onRejection) { + var parent = this; + var state = parent._state; + + if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) { + return this; + } + + var child = new this.constructor(lib$es6$promise$$internal$$noop); + var result = parent._result; + + if (state) { + var callback = arguments[state - 1]; + lib$es6$promise$asap$$asap(function(){ + lib$es6$promise$$internal$$invokeCallback(state, child, callback, result); + }); + } else { + lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection); + } + + return child; + }, + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + 'catch': function(onRejection) { + return this.then(null, onRejection); + } + }; + function lib$es6$promise$polyfill$$polyfill() { + var local; + + if (typeof global !== 'undefined') { + local = global; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + + var P = local.Promise; + + if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) { + return; + } + + local.Promise = lib$es6$promise$promise$$default; + } + var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill; + + var lib$es6$promise$umd$$ES6Promise = { + 'Promise': lib$es6$promise$promise$$default, + 'polyfill': lib$es6$promise$polyfill$$default + }; + + /* global define:true module:true window: true */ + if (typeof define === 'function' && define['amd']) { + define(function() { return lib$es6$promise$umd$$ES6Promise; }); + } else if (typeof module !== 'undefined' && module['exports']) { + module['exports'] = lib$es6$promise$umd$$ES6Promise; + } else if (typeof this !== 'undefined') { + this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise; + } + + lib$es6$promise$polyfill$$default(); +}).call(this); + + +}).call(this,{},typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}]},{},[1]); + +(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 Reflect.defineMetadata("custom:annotation", options, target, key); + * } + * + */ + function defineMetadata(metadataKey, metadataValue, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey); + } + Reflect.defineMetadata = defineMetadata; + /** + * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.hasMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasMetadata("custom:annotation", C.prototype, "method"); + * + */ + function hasMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryHasMetadata(metadataKey, target, targetKey); + } + Reflect.hasMetadata = hasMetadata; + /** + * Gets a value indicating whether the target object has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasOwnMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "method"); + * + */ + function hasOwnMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryHasOwnMetadata(metadataKey, target, targetKey); + } + Reflect.hasOwnMetadata = hasOwnMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object or its prototype chain. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.getMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadata("custom:annotation", C.prototype, "method"); + * + */ + function getMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryGetMetadata(metadataKey, target, targetKey); + } + Reflect.getMetadata = getMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "method"); + * + */ + function getOwnMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryGetOwnMetadata(metadataKey, target, targetKey); + } + Reflect.getOwnMetadata = getOwnMetadata; + /** + * Gets the metadata keys defined on the target object or its prototype chain. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadataKeys(C); + * + * // property (on constructor) + * result = Reflect.getMetadataKeys(C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadataKeys(C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadataKeys(C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadataKeys(C.prototype, "method"); + * + */ + function getMetadataKeys(target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryMetadataKeys(target, targetKey); + } + Reflect.getMetadataKeys = getMetadataKeys; + /** + * Gets the unique metadata keys defined on the target object. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadataKeys(C); + * + * // property (on constructor) + * result = Reflect.getOwnMetadataKeys(C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadataKeys(C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadataKeys(C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadataKeys(C.prototype, "method"); + * + */ + function getOwnMetadataKeys(target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryOwnMetadataKeys(target, targetKey); + } + Reflect.getOwnMetadataKeys = getOwnMetadataKeys; + /** + * Deletes the metadata entry from the target object with the provided key. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata entry was found and deleted; otherwise, false. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.deleteMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "method"); + * + */ + function deleteMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#deletemetadata-metadatakey-p- + var metadataMap = GetOrCreateMetadataMap(target, targetKey, false); + if (IsUndefined(metadataMap)) { + return false; + } + if (!metadataMap.delete(metadataKey)) { + return false; + } + if (metadataMap.size > 0) { + return true; + } + var targetMetadata = __Metadata__.get(target); + targetMetadata.delete(targetKey); + if (targetMetadata.size > 0) { + return true; + } + __Metadata__.delete(target); + return true; + } + Reflect.deleteMetadata = deleteMetadata; + function DecorateConstructor(decorators, target) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target); + if (!IsUndefined(decorated)) { + if (!IsConstructor(decorated)) { + throw new TypeError(); + } + target = decorated; + } + } + return target; + } + function DecoratePropertyWithDescriptor(decorators, target, propertyKey, descriptor) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target, propertyKey, descriptor); + if (!IsUndefined(decorated)) { + if (!IsObject(decorated)) { + throw new TypeError(); + } + descriptor = decorated; + } + } + return descriptor; + } + function DecoratePropertyWithoutDescriptor(decorators, target, propertyKey) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + decorator(target, propertyKey); + } + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#getorcreatemetadatamap--o-p-create- + function GetOrCreateMetadataMap(target, targetKey, create) { + var targetMetadata = __Metadata__.get(target); + if (!targetMetadata) { + if (!create) { + return undefined; + } + targetMetadata = new _Map(); + __Metadata__.set(target, targetMetadata); + } + var keyMetadata = targetMetadata.get(targetKey); + if (!keyMetadata) { + if (!create) { + return undefined; + } + keyMetadata = new _Map(); + targetMetadata.set(targetKey, keyMetadata); + } + return keyMetadata; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasmetadata--metadatakey-o-p- + function OrdinaryHasMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) { + return true; + } + var parent = GetPrototypeOf(O); + if (parent !== null) { + return OrdinaryHasMetadata(MetadataKey, parent, P); + } + return false; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasownmetadata--metadatakey-o-p- + function OrdinaryHasOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, false); + if (metadataMap === undefined) { + return false; + } + return Boolean(metadataMap.has(MetadataKey)); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetmetadata--metadatakey-o-p- + function OrdinaryGetMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) { + return OrdinaryGetOwnMetadata(MetadataKey, O, P); + } + var parent = GetPrototypeOf(O); + if (parent !== null) { + return OrdinaryGetMetadata(MetadataKey, parent, P); + } + return undefined; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetownmetadata--metadatakey-o-p- + function OrdinaryGetOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, false); + if (metadataMap === undefined) { + return undefined; + } + return metadataMap.get(MetadataKey); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarydefineownmetadata--metadatakey-metadatavalue-o-p- + function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, true); + metadataMap.set(MetadataKey, MetadataValue); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarymetadatakeys--o-p- + function OrdinaryMetadataKeys(O, P) { + var ownKeys = OrdinaryOwnMetadataKeys(O, P); + var parent = GetPrototypeOf(O); + if (parent === null) { + return ownKeys; + } + var parentKeys = OrdinaryMetadataKeys(parent, P); + if (parentKeys.length <= 0) { + return ownKeys; + } + if (ownKeys.length <= 0) { + return parentKeys; + } + var set = new _Set(); + var keys = []; + for (var _i = 0; _i < ownKeys.length; _i++) { + var key = ownKeys[_i]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + for (var _a = 0; _a < parentKeys.length; _a++) { + var key = parentKeys[_a]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + return keys; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryownmetadatakeys--o-p- + function OrdinaryOwnMetadataKeys(target, targetKey) { + var metadataMap = GetOrCreateMetadataMap(target, targetKey, false); + var keys = []; + if (metadataMap) { + metadataMap.forEach(function (_, key) { return keys.push(key); }); + } + return keys; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-undefined-type + function IsUndefined(x) { + return x === undefined; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isarray + function IsArray(x) { + return Array.isArray(x); + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type + function IsObject(x) { + return typeof x === "object" ? x !== null : typeof x === "function"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor + function IsConstructor(x) { + return typeof x === "function"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-symbol-type + function IsSymbol(x) { + return typeof x === "symbol"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey + function ToPropertyKey(value) { + if (IsSymbol(value)) { + return value; + } + return String(value); + } + function GetPrototypeOf(O) { + var proto = Object.getPrototypeOf(O); + if (typeof O !== "function" || O === functionPrototype) { + return proto; + } + // TypeScript doesn't set __proto__ in ES5, as it's non-standard. + // Try to determine the superclass constructor. Compatible implementations + // must either set __proto__ on a subclass constructor to the superclass constructor, + // or ensure each class has a valid `constructor` property on its prototype that + // points back to the constructor. + // If this is not the same as Function.[[Prototype]], then this is definately inherited. + // This is the case when in ES6 or when using __proto__ in a compatible browser. + if (proto !== functionPrototype) { + return proto; + } + // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage. + var prototype = O.prototype; + var prototypeProto = Object.getPrototypeOf(prototype); + if (prototypeProto == null || prototypeProto === Object.prototype) { + return proto; + } + // if the constructor was not a function, then we cannot determine the heritage. + var constructor = prototypeProto.constructor; + if (typeof constructor !== "function") { + return proto; + } + // if we have some kind of self-reference, then we cannot determine the heritage. + if (constructor === O) { + return proto; + } + // we have a pretty good guess at the heritage. + return constructor; + } + // naive Map shim + function CreateMapPolyfill() { + var cacheSentinel = {}; + function Map() { + this._keys = []; + this._values = []; + this._cache = cacheSentinel; + } + Map.prototype = { + get size() { + return this._keys.length; + }, + has: function (key) { + if (key === this._cache) { + return true; + } + if (this._find(key) >= 0) { + this._cache = key; + return true; + } + return false; + }, + get: function (key) { + var index = this._find(key); + if (index >= 0) { + this._cache = key; + return this._values[index]; + } + return undefined; + }, + set: function (key, value) { + this.delete(key); + this._keys.push(key); + this._values.push(value); + this._cache = key; + return this; + }, + delete: function (key) { + var index = this._find(key); + if (index >= 0) { + this._keys.splice(index, 1); + this._values.splice(index, 1); + this._cache = cacheSentinel; + return true; + } + return false; + }, + clear: function () { + this._keys.length = 0; + this._values.length = 0; + this._cache = cacheSentinel; + }, + forEach: function (callback, thisArg) { + var size = this.size; + for (var i = 0; i < size; ++i) { + var key = this._keys[i]; + var value = this._values[i]; + this._cache = key; + callback.call(this, value, key, this); + } + }, + _find: function (key) { + var keys = this._keys; + var size = keys.length; + for (var i = 0; i < size; ++i) { + if (keys[i] === key) { + return i; + } + } + return -1; + } + }; + return Map; + } + // naive Set shim + function CreateSetPolyfill() { + var cacheSentinel = {}; + function Set() { + this._map = new _Map(); + } + Set.prototype = { + get size() { + return this._map.length; + }, + has: function (value) { + return this._map.has(value); + }, + add: function (value) { + this._map.set(value, value); + return this; + }, + delete: function (value) { + return this._map.delete(value); + }, + clear: function () { + this._map.clear(); + }, + forEach: function (callback, thisArg) { + this._map.forEach(callback, thisArg); + } + }; + return Set; + } + // naive WeakMap shim + function CreateWeakMapPolyfill() { + var UUID_SIZE = 16; + var isNode = typeof global !== "undefined" && + typeof module === "object" && + typeof module.exports === "object" && + typeof require === "function"; + var nodeCrypto = isNode && require("crypto"); + var hasOwn = Object.prototype.hasOwnProperty; + var keys = {}; + var rootKey = CreateUniqueKey(); + function WeakMap() { + this._key = CreateUniqueKey(); + } + WeakMap.prototype = { + has: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table) { + return this._key in table; + } + return false; + }, + get: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table) { + return table[this._key]; + } + return undefined; + }, + set: function (target, value) { + var table = GetOrCreateWeakMapTable(target, true); + table[this._key] = value; + return this; + }, + delete: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table && this._key in table) { + return delete table[this._key]; + } + return false; + }, + clear: function () { + // NOTE: not a real clear, just makes the previous data unreachable + this._key = CreateUniqueKey(); + } + }; + function FillRandomBytes(buffer, size) { + for (var i = 0; i < size; ++i) { + buffer[i] = Math.random() * 255 | 0; + } + } + function GenRandomBytes(size) { + if (nodeCrypto) { + var data = nodeCrypto.randomBytes(size); + return data; + } + else if (typeof Uint8Array === "function") { + var data = new Uint8Array(size); + if (typeof crypto !== "undefined") { + crypto.getRandomValues(data); + } + else if (typeof msCrypto !== "undefined") { + msCrypto.getRandomValues(data); + } + else { + FillRandomBytes(data, size); + } + return data; + } + else { + var data = new Array(size); + FillRandomBytes(data, size); + return data; + } + } + function CreateUUID() { + var data = GenRandomBytes(UUID_SIZE); + // mark as random - RFC 4122 § 4.4 + data[6] = data[6] & 0x4f | 0x40; + data[8] = data[8] & 0xbf | 0x80; + var result = ""; + for (var offset = 0; offset < UUID_SIZE; ++offset) { + var byte = data[offset]; + if (offset === 4 || offset === 6 || offset === 8) { + result += "-"; + } + if (byte < 16) { + result += "0"; + } + result += byte.toString(16).toLowerCase(); + } + return result; + } + function CreateUniqueKey() { + var key; + do { + key = "@@WeakMap@@" + CreateUUID(); + } while (hasOwn.call(keys, key)); + keys[key] = true; + return key; + } + function GetOrCreateWeakMapTable(target, create) { + if (!hasOwn.call(target, rootKey)) { + if (!create) { + return undefined; + } + Object.defineProperty(target, rootKey, { value: Object.create(null) }); + } + return target[rootKey]; + } + return WeakMap; + } + // hook global Reflect + (function (__global) { + if (typeof __global.Reflect !== "undefined") { + if (__global.Reflect !== Reflect) { + for (var p in Reflect) { + __global.Reflect[p] = Reflect[p]; + } + } + } + else { + __global.Reflect = Reflect; + } + })(typeof window !== "undefined" ? window : + typeof WorkerGlobalScope !== "undefined" ? self : + typeof global !== "undefined" ? global : + Function("return this;")()); +})(Reflect || (Reflect = {})); +//# sourceMappingURLDisabled=Reflect.js.map +/** + @license + + Apache License + Version 2.0, January 2011 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + */ + +"format register"; +/** + @license +Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +Microsoft Open Technologies would like to thank its contributors, a list +of whom are at http://rx.codeplex.com/wikipage?title=Contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); you +may not use this file except in compliance with the License. You may +obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied. See the License for the specific language governing permissions +and limitations under the License. + + */ +System.register("rx", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + ; + (function(undefined) { + var objectTypes = { + 'boolean': false, + 'function': true, + 'object': true, + 'number': false, + 'string': false, + 'undefined': false + }; + var root = (objectTypes[typeof window] && window) || this, + freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports, + freeModule = objectTypes[typeof module] && module && !module.nodeType && module, + moduleExports = freeModule && freeModule.exports === freeExports && freeExports, + freeGlobal = objectTypes[typeof global] && global; + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { + root = freeGlobal; + } + var Rx = { + internals: {}, + config: {Promise: root.Promise}, + helpers: {} + }; + var noop = Rx.helpers.noop = function() {}, + notDefined = Rx.helpers.notDefined = function(x) { + return typeof x === 'undefined'; + }, + isScheduler = Rx.helpers.isScheduler = function(x) { + return x instanceof Rx.Scheduler; + }, + identity = Rx.helpers.identity = function(x) { + return x; + }, + pluck = Rx.helpers.pluck = function(property) { + return function(x) { + return x[property]; + }; + }, + just = Rx.helpers.just = function(value) { + return function() { + return value; + }; + }, + defaultNow = Rx.helpers.defaultNow = Date.now, + defaultComparer = Rx.helpers.defaultComparer = function(x, y) { + return isEqual(x, y); + }, + defaultSubComparer = Rx.helpers.defaultSubComparer = function(x, y) { + return x > y ? 1 : (x < y ? -1 : 0); + }, + defaultKeySerializer = Rx.helpers.defaultKeySerializer = function(x) { + return x.toString(); + }, + defaultError = Rx.helpers.defaultError = function(err) { + throw err; + }, + isPromise = Rx.helpers.isPromise = function(p) { + return !!p && typeof p.then === 'function'; + }, + asArray = Rx.helpers.asArray = function() { + return Array.prototype.slice.call(arguments); + }, + not = Rx.helpers.not = function(a) { + return !a; + }, + isFunction = Rx.helpers.isFunction = (function() { + var isFn = function(value) { + return typeof value == 'function' || false; + }; + if (isFn(/x/)) { + isFn = function(value) { + return typeof value == 'function' && toString.call(value) == '[object Function]'; + }; + } + return isFn; + }()); + function cloneArray(arr) { + for (var a = [], + i = 0, + len = arr.length; i < len; i++) { + a.push(arr[i]); + } + return a; + } + Rx.config.longStackSupport = false; + var hasStacks = false; + try { + throw new Error(); + } catch (e) { + hasStacks = !!e.stack; + } + var rStartingLine = captureLine(), + rFileName; + var STACK_JUMP_SEPARATOR = "From previous event:"; + function makeStackTraceLong(error, observable) { + if (hasStacks && observable.stack && typeof error === "object" && error !== null && error.stack && error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1) { + var stacks = []; + for (var o = observable; !!o; o = o.source) { + if (o.stack) { + stacks.unshift(o.stack); + } + } + stacks.unshift(error.stack); + var concatedStacks = stacks.join("\n" + STACK_JUMP_SEPARATOR + "\n"); + error.stack = filterStackString(concatedStacks); + } + } + function filterStackString(stackString) { + var lines = stackString.split("\n"), + desiredLines = []; + for (var i = 0, + len = lines.length; i < len; i++) { + var line = lines[i]; + if (!isInternalFrame(line) && !isNodeFrame(line) && line) { + desiredLines.push(line); + } + } + return desiredLines.join("\n"); + } + function isInternalFrame(stackLine) { + var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine); + if (!fileNameAndLineNumber) { + return false; + } + var fileName = fileNameAndLineNumber[0], + lineNumber = fileNameAndLineNumber[1]; + return fileName === rFileName && lineNumber >= rStartingLine && lineNumber <= rEndingLine; + } + function isNodeFrame(stackLine) { + return stackLine.indexOf("(module.js:") !== -1 || stackLine.indexOf("(node.js:") !== -1; + } + function captureLine() { + if (!hasStacks) { + return ; + } + try { + throw new Error(); + } catch (e) { + var lines = e.stack.split("\n"); + var firstLine = lines[0].indexOf("@") > 0 ? lines[1] : lines[2]; + var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine); + if (!fileNameAndLineNumber) { + return ; + } + rFileName = fileNameAndLineNumber[0]; + return fileNameAndLineNumber[1]; + } + } + function getFileNameAndLineNumber(stackLine) { + var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine); + if (attempt1) { + return [attempt1[1], Number(attempt1[2])]; + } + var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine); + if (attempt2) { + return [attempt2[1], Number(attempt2[2])]; + } + var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine); + if (attempt3) { + return [attempt3[1], Number(attempt3[2])]; + } + } + var EmptyError = Rx.EmptyError = function() { + this.message = 'Sequence contains no elements.'; + Error.call(this); + }; + EmptyError.prototype = Error.prototype; + var ObjectDisposedError = Rx.ObjectDisposedError = function() { + this.message = 'Object has been disposed'; + Error.call(this); + }; + ObjectDisposedError.prototype = Error.prototype; + var ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError = function() { + this.message = 'Argument out of range'; + Error.call(this); + }; + ArgumentOutOfRangeError.prototype = Error.prototype; + var NotSupportedError = Rx.NotSupportedError = function(message) { + this.message = message || 'This operation is not supported'; + Error.call(this); + }; + NotSupportedError.prototype = Error.prototype; + var NotImplementedError = Rx.NotImplementedError = function(message) { + this.message = message || 'This operation is not implemented'; + Error.call(this); + }; + NotImplementedError.prototype = Error.prototype; + var notImplemented = Rx.helpers.notImplemented = function() { + throw new NotImplementedError(); + }; + var notSupported = Rx.helpers.notSupported = function() { + throw new NotSupportedError(); + }; + var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) || '_es6shim_iterator_'; + if (root.Set && typeof new root.Set()['@@iterator'] === 'function') { + $iterator$ = '@@iterator'; + } + var doneEnumerator = Rx.doneEnumerator = { + done: true, + value: undefined + }; + var isIterable = Rx.helpers.isIterable = function(o) { + return o[$iterator$] !== undefined; + }; + var isArrayLike = Rx.helpers.isArrayLike = function(o) { + return o && o.length !== undefined; + }; + Rx.helpers.iterator = $iterator$; + var bindCallback = Rx.internals.bindCallback = function(func, thisArg, argCount) { + if (typeof thisArg === 'undefined') { + return func; + } + switch (argCount) { + case 0: + return function() { + return func.call(thisArg); + }; + case 1: + return function(arg) { + return func.call(thisArg, arg); + }; + case 2: + return function(value, index) { + return func.call(thisArg, value, index); + }; + case 3: + return function(value, index, collection) { + return func.call(thisArg, value, index, collection); + }; + } + return function() { + return func.apply(thisArg, arguments); + }; + }; + var dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor'], + dontEnumsLength = dontEnums.length; + var argsClass = '[object Arguments]', + arrayClass = '[object Array]', + boolClass = '[object Boolean]', + dateClass = '[object Date]', + errorClass = '[object Error]', + funcClass = '[object Function]', + numberClass = '[object Number]', + objectClass = '[object Object]', + regexpClass = '[object RegExp]', + stringClass = '[object String]'; + var toString = Object.prototype.toString, + hasOwnProperty = Object.prototype.hasOwnProperty, + supportsArgsClass = toString.call(arguments) == argsClass, + supportNodeClass, + errorProto = Error.prototype, + objectProto = Object.prototype, + stringProto = String.prototype, + propertyIsEnumerable = objectProto.propertyIsEnumerable; + try { + supportNodeClass = !(toString.call(document) == objectClass && !({'toString': 0} + '')); + } catch (e) { + supportNodeClass = true; + } + var nonEnumProps = {}; + nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { + 'constructor': true, + 'toLocaleString': true, + 'toString': true, + 'valueOf': true + }; + nonEnumProps[boolClass] = nonEnumProps[stringClass] = { + 'constructor': true, + 'toString': true, + 'valueOf': true + }; + nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { + 'constructor': true, + 'toString': true + }; + nonEnumProps[objectClass] = {'constructor': true}; + var support = {}; + (function() { + var ctor = function() { + this.x = 1; + }, + props = []; + ctor.prototype = { + 'valueOf': 1, + 'y': 1 + }; + for (var key in new ctor) { + props.push(key); + } + for (key in arguments) {} + support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name'); + support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype'); + support.nonEnumArgs = key != 0; + support.nonEnumShadows = !/valueOf/.test(props); + }(1)); + var isObject = Rx.internals.isObject = function(value) { + var type = typeof value; + return value && (type == 'function' || type == 'object') || false; + }; + function keysIn(object) { + var result = []; + if (!isObject(object)) { + return result; + } + if (support.nonEnumArgs && object.length && isArguments(object)) { + object = slice.call(object); + } + var skipProto = support.enumPrototypes && typeof object == 'function', + skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error); + for (var key in object) { + if (!(skipProto && key == 'prototype') && !(skipErrorProps && (key == 'message' || key == 'name'))) { + result.push(key); + } + } + if (support.nonEnumShadows && object !== objectProto) { + var ctor = object.constructor, + index = -1, + length = dontEnumsLength; + if (object === (ctor && ctor.prototype)) { + var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object), + nonEnum = nonEnumProps[className]; + } + while (++index < length) { + key = dontEnums[index]; + if (!(nonEnum && nonEnum[key]) && hasOwnProperty.call(object, key)) { + result.push(key); + } + } + } + return result; + } + function internalFor(object, callback, keysFunc) { + var index = -1, + props = keysFunc(object), + length = props.length; + while (++index < length) { + var key = props[index]; + if (callback(object[key], key, object) === false) { + break; + } + } + return object; + } + function internalForIn(object, callback) { + return internalFor(object, callback, keysIn); + } + function isNode(value) { + return typeof value.toString != 'function' && typeof(value + '') == 'string'; + } + var isArguments = function(value) { + return (value && typeof value == 'object') ? toString.call(value) == argsClass : false; + }; + if (!supportsArgsClass) { + isArguments = function(value) { + return (value && typeof value == 'object') ? hasOwnProperty.call(value, 'callee') : false; + }; + } + var isEqual = Rx.internals.isEqual = function(x, y) { + return deepEquals(x, y, [], []); + }; + function deepEquals(a, b, stackA, stackB) { + if (a === b) { + return a !== 0 || (1 / a == 1 / b); + } + var type = typeof a, + otherType = typeof b; + if (a === a && (a == null || b == null || (type != 'function' && type != 'object' && otherType != 'function' && otherType != 'object'))) { + return false; + } + var className = toString.call(a), + otherClass = toString.call(b); + if (className == argsClass) { + className = objectClass; + } + if (otherClass == argsClass) { + otherClass = objectClass; + } + if (className != otherClass) { + return false; + } + switch (className) { + case boolClass: + case dateClass: + return +a == +b; + case numberClass: + return (a != +a) ? b != +b : (a == 0 ? (1 / a == 1 / b) : a == +b); + case regexpClass: + case stringClass: + return a == String(b); + } + var isArr = className == arrayClass; + if (!isArr) { + if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) { + return false; + } + var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor, + ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor; + if (ctorA != ctorB && !(hasOwnProperty.call(a, 'constructor') && hasOwnProperty.call(b, 'constructor')) && !(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) && ('constructor' in a && 'constructor' in b)) { + return false; + } + } + var initedStack = !stackA; + stackA || (stackA = []); + stackB || (stackB = []); + var length = stackA.length; + while (length--) { + if (stackA[length] == a) { + return stackB[length] == b; + } + } + var size = 0; + var result = true; + stackA.push(a); + stackB.push(b); + if (isArr) { + length = a.length; + size = b.length; + result = size == length; + if (result) { + while (size--) { + var index = length, + value = b[size]; + if (!(result = deepEquals(a[size], value, stackA, stackB))) { + break; + } + } + } + } else { + internalForIn(b, function(value, key, b) { + if (hasOwnProperty.call(b, key)) { + size++; + return (result = hasOwnProperty.call(a, key) && deepEquals(a[key], value, stackA, stackB)); + } + }); + if (result) { + internalForIn(a, function(value, key, a) { + if (hasOwnProperty.call(a, key)) { + return (result = --size > -1); + } + }); + } + } + stackA.pop(); + stackB.pop(); + return result; + } + var hasProp = {}.hasOwnProperty, + slice = Array.prototype.slice; + var inherits = this.inherits = Rx.internals.inherits = function(child, parent) { + function __() { + this.constructor = child; + } + __.prototype = parent.prototype; + child.prototype = new __(); + }; + var addProperties = Rx.internals.addProperties = function(obj) { + for (var sources = [], + i = 1, + len = arguments.length; i < len; i++) { + sources.push(arguments[i]); + } + for (var idx = 0, + ln = sources.length; idx < ln; idx++) { + var source = sources[idx]; + for (var prop in source) { + obj[prop] = source[prop]; + } + } + }; + var addRef = Rx.internals.addRef = function(xs, r) { + return new AnonymousObservable(function(observer) { + return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer)); + }); + }; + function arrayInitialize(count, factory) { + var a = new Array(count); + for (var i = 0; i < count; i++) { + a[i] = factory(); + } + return a; + } + var errorObj = {e: {}}; + var tryCatchTarget; + function tryCatcher() { + try { + return tryCatchTarget.apply(this, arguments); + } catch (e) { + errorObj.e = e; + return errorObj; + } + } + function tryCatch(fn) { + if (!isFunction(fn)) { + throw new TypeError('fn must be a function'); + } + tryCatchTarget = fn; + return tryCatcher; + } + function thrower(e) { + throw e; + } + function IndexedItem(id, value) { + this.id = id; + this.value = value; + } + IndexedItem.prototype.compareTo = function(other) { + var c = this.value.compareTo(other.value); + c === 0 && (c = this.id - other.id); + return c; + }; + var PriorityQueue = Rx.internals.PriorityQueue = function(capacity) { + this.items = new Array(capacity); + this.length = 0; + }; + var priorityProto = PriorityQueue.prototype; + priorityProto.isHigherPriority = function(left, right) { + return this.items[left].compareTo(this.items[right]) < 0; + }; + priorityProto.percolate = function(index) { + if (index >= this.length || index < 0) { + return ; + } + var parent = index - 1 >> 1; + if (parent < 0 || parent === index) { + return ; + } + if (this.isHigherPriority(index, parent)) { + var temp = this.items[index]; + this.items[index] = this.items[parent]; + this.items[parent] = temp; + this.percolate(parent); + } + }; + priorityProto.heapify = function(index) { + +index || (index = 0); + if (index >= this.length || index < 0) { + return ; + } + var left = 2 * index + 1, + right = 2 * index + 2, + first = index; + if (left < this.length && this.isHigherPriority(left, first)) { + first = left; + } + if (right < this.length && this.isHigherPriority(right, first)) { + first = right; + } + if (first !== index) { + var temp = this.items[index]; + this.items[index] = this.items[first]; + this.items[first] = temp; + this.heapify(first); + } + }; + priorityProto.peek = function() { + return this.items[0].value; + }; + priorityProto.removeAt = function(index) { + this.items[index] = this.items[--this.length]; + this.items[this.length] = undefined; + this.heapify(); + }; + priorityProto.dequeue = function() { + var result = this.peek(); + this.removeAt(0); + return result; + }; + priorityProto.enqueue = function(item) { + var index = this.length++; + this.items[index] = new IndexedItem(PriorityQueue.count++, item); + this.percolate(index); + }; + priorityProto.remove = function(item) { + for (var i = 0; i < this.length; i++) { + if (this.items[i].value === item) { + this.removeAt(i); + return true; + } + } + return false; + }; + PriorityQueue.count = 0; + var CompositeDisposable = Rx.CompositeDisposable = function() { + var args = [], + i, + len; + if (Array.isArray(arguments[0])) { + args = arguments[0]; + len = args.length; + } else { + len = arguments.length; + args = new Array(len); + for (i = 0; i < len; i++) { + args[i] = arguments[i]; + } + } + for (i = 0; i < len; i++) { + if (!isDisposable(args[i])) { + throw new TypeError('Not a disposable'); + } + } + this.disposables = args; + this.isDisposed = false; + this.length = args.length; + }; + var CompositeDisposablePrototype = CompositeDisposable.prototype; + CompositeDisposablePrototype.add = function(item) { + if (this.isDisposed) { + item.dispose(); + } else { + this.disposables.push(item); + this.length++; + } + }; + CompositeDisposablePrototype.remove = function(item) { + var shouldDispose = false; + if (!this.isDisposed) { + var idx = this.disposables.indexOf(item); + if (idx !== -1) { + shouldDispose = true; + this.disposables.splice(idx, 1); + this.length--; + item.dispose(); + } + } + return shouldDispose; + }; + CompositeDisposablePrototype.dispose = function() { + if (!this.isDisposed) { + this.isDisposed = true; + var len = this.disposables.length, + currentDisposables = new Array(len); + for (var i = 0; i < len; i++) { + currentDisposables[i] = this.disposables[i]; + } + this.disposables = []; + this.length = 0; + for (i = 0; i < len; i++) { + currentDisposables[i].dispose(); + } + } + }; + var Disposable = Rx.Disposable = function(action) { + this.isDisposed = false; + this.action = action || noop; + }; + Disposable.prototype.dispose = function() { + if (!this.isDisposed) { + this.action(); + this.isDisposed = true; + } + }; + var disposableCreate = Disposable.create = function(action) { + return new Disposable(action); + }; + var disposableEmpty = Disposable.empty = {dispose: noop}; + var isDisposable = Disposable.isDisposable = function(d) { + return d && isFunction(d.dispose); + }; + var checkDisposed = Disposable.checkDisposed = function(disposable) { + if (disposable.isDisposed) { + throw new ObjectDisposedError(); + } + }; + var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = (function() { + function BooleanDisposable() { + this.isDisposed = false; + this.current = null; + } + var booleanDisposablePrototype = BooleanDisposable.prototype; + booleanDisposablePrototype.getDisposable = function() { + return this.current; + }; + booleanDisposablePrototype.setDisposable = function(value) { + var shouldDispose = this.isDisposed; + if (!shouldDispose) { + var old = this.current; + this.current = value; + } + old && old.dispose(); + shouldDispose && value && value.dispose(); + }; + booleanDisposablePrototype.dispose = function() { + if (!this.isDisposed) { + this.isDisposed = true; + var old = this.current; + this.current = null; + } + old && old.dispose(); + }; + return BooleanDisposable; + }()); + var SerialDisposable = Rx.SerialDisposable = SingleAssignmentDisposable; + var RefCountDisposable = Rx.RefCountDisposable = (function() { + function InnerDisposable(disposable) { + this.disposable = disposable; + this.disposable.count++; + this.isInnerDisposed = false; + } + InnerDisposable.prototype.dispose = function() { + if (!this.disposable.isDisposed && !this.isInnerDisposed) { + this.isInnerDisposed = true; + this.disposable.count--; + if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) { + this.disposable.isDisposed = true; + this.disposable.underlyingDisposable.dispose(); + } + } + }; + function RefCountDisposable(disposable) { + this.underlyingDisposable = disposable; + this.isDisposed = false; + this.isPrimaryDisposed = false; + this.count = 0; + } + RefCountDisposable.prototype.dispose = function() { + if (!this.isDisposed && !this.isPrimaryDisposed) { + this.isPrimaryDisposed = true; + if (this.count === 0) { + this.isDisposed = true; + this.underlyingDisposable.dispose(); + } + } + }; + RefCountDisposable.prototype.getDisposable = function() { + return this.isDisposed ? disposableEmpty : new InnerDisposable(this); + }; + return RefCountDisposable; + })(); + function ScheduledDisposable(scheduler, disposable) { + this.scheduler = scheduler; + this.disposable = disposable; + this.isDisposed = false; + } + function scheduleItem(s, self) { + if (!self.isDisposed) { + self.isDisposed = true; + self.disposable.dispose(); + } + } + ScheduledDisposable.prototype.dispose = function() { + this.scheduler.scheduleWithState(this, scheduleItem); + }; + var ScheduledItem = Rx.internals.ScheduledItem = function(scheduler, state, action, dueTime, comparer) { + this.scheduler = scheduler; + this.state = state; + this.action = action; + this.dueTime = dueTime; + this.comparer = comparer || defaultSubComparer; + this.disposable = new SingleAssignmentDisposable(); + }; + ScheduledItem.prototype.invoke = function() { + this.disposable.setDisposable(this.invokeCore()); + }; + ScheduledItem.prototype.compareTo = function(other) { + return this.comparer(this.dueTime, other.dueTime); + }; + ScheduledItem.prototype.isCancelled = function() { + return this.disposable.isDisposed; + }; + ScheduledItem.prototype.invokeCore = function() { + return this.action(this.scheduler, this.state); + }; + var Scheduler = Rx.Scheduler = (function() { + function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) { + this.now = now; + this._schedule = schedule; + this._scheduleRelative = scheduleRelative; + this._scheduleAbsolute = scheduleAbsolute; + } + function invokeAction(scheduler, action) { + action(); + return disposableEmpty; + } + var schedulerProto = Scheduler.prototype; + schedulerProto.schedule = function(action) { + return this._schedule(action, invokeAction); + }; + schedulerProto.scheduleWithState = function(state, action) { + return this._schedule(state, action); + }; + schedulerProto.scheduleWithRelative = function(dueTime, action) { + return this._scheduleRelative(action, dueTime, invokeAction); + }; + schedulerProto.scheduleWithRelativeAndState = function(state, dueTime, action) { + return this._scheduleRelative(state, dueTime, action); + }; + schedulerProto.scheduleWithAbsolute = function(dueTime, action) { + return this._scheduleAbsolute(action, dueTime, invokeAction); + }; + schedulerProto.scheduleWithAbsoluteAndState = function(state, dueTime, action) { + return this._scheduleAbsolute(state, dueTime, action); + }; + Scheduler.now = defaultNow; + Scheduler.normalize = function(timeSpan) { + timeSpan < 0 && (timeSpan = 0); + return timeSpan; + }; + return Scheduler; + }()); + var normalizeTime = Scheduler.normalize; + (function(schedulerProto) { + function invokeRecImmediate(scheduler, pair) { + var state = pair[0], + action = pair[1], + group = new CompositeDisposable(); + function recursiveAction(state1) { + action(state1, function(state2) { + var isAdded = false, + isDone = false, + d = scheduler.scheduleWithState(state2, function(scheduler1, state3) { + if (isAdded) { + group.remove(d); + } else { + isDone = true; + } + recursiveAction(state3); + return disposableEmpty; + }); + if (!isDone) { + group.add(d); + isAdded = true; + } + }); + } + recursiveAction(state); + return group; + } + function invokeRecDate(scheduler, pair, method) { + var state = pair[0], + action = pair[1], + group = new CompositeDisposable(); + function recursiveAction(state1) { + action(state1, function(state2, dueTime1) { + var isAdded = false, + isDone = false, + d = scheduler[method](state2, dueTime1, function(scheduler1, state3) { + if (isAdded) { + group.remove(d); + } else { + isDone = true; + } + recursiveAction(state3); + return disposableEmpty; + }); + if (!isDone) { + group.add(d); + isAdded = true; + } + }); + } + ; + recursiveAction(state); + return group; + } + function scheduleInnerRecursive(action, self) { + action(function(dt) { + self(action, dt); + }); + } + schedulerProto.scheduleRecursive = function(action) { + return this.scheduleRecursiveWithState(action, function(_action, self) { + _action(function() { + self(_action); + }); + }); + }; + schedulerProto.scheduleRecursiveWithState = function(state, action) { + return this.scheduleWithState([state, action], invokeRecImmediate); + }; + schedulerProto.scheduleRecursiveWithRelative = function(dueTime, action) { + return this.scheduleRecursiveWithRelativeAndState(action, dueTime, scheduleInnerRecursive); + }; + schedulerProto.scheduleRecursiveWithRelativeAndState = function(state, dueTime, action) { + return this._scheduleRelative([state, action], dueTime, function(s, p) { + return invokeRecDate(s, p, 'scheduleWithRelativeAndState'); + }); + }; + schedulerProto.scheduleRecursiveWithAbsolute = function(dueTime, action) { + return this.scheduleRecursiveWithAbsoluteAndState(action, dueTime, scheduleInnerRecursive); + }; + schedulerProto.scheduleRecursiveWithAbsoluteAndState = function(state, dueTime, action) { + return this._scheduleAbsolute([state, action], dueTime, function(s, p) { + return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState'); + }); + }; + }(Scheduler.prototype)); + (function(schedulerProto) { + Scheduler.prototype.schedulePeriodic = function(period, action) { + return this.schedulePeriodicWithState(null, period, action); + }; + Scheduler.prototype.schedulePeriodicWithState = function(state, period, action) { + if (typeof root.setInterval === 'undefined') { + throw new NotSupportedError(); + } + period = normalizeTime(period); + var s = state, + id = root.setInterval(function() { + s = action(s); + }, period); + return disposableCreate(function() { + root.clearInterval(id); + }); + }; + }(Scheduler.prototype)); + (function(schedulerProto) { + schedulerProto.catchError = schedulerProto['catch'] = function(handler) { + return new CatchScheduler(this, handler); + }; + }(Scheduler.prototype)); + var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function() { + function tick(command, recurse) { + recurse(0, this._period); + try { + this._state = this._action(this._state); + } catch (e) { + this._cancel.dispose(); + throw e; + } + } + function SchedulePeriodicRecursive(scheduler, state, period, action) { + this._scheduler = scheduler; + this._state = state; + this._period = period; + this._action = action; + } + SchedulePeriodicRecursive.prototype.start = function() { + var d = new SingleAssignmentDisposable(); + this._cancel = d; + d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this))); + return d; + }; + return SchedulePeriodicRecursive; + }()); + var immediateScheduler = Scheduler.immediate = (function() { + function scheduleNow(state, action) { + return action(this, state); + } + return new Scheduler(defaultNow, scheduleNow, notSupported, notSupported); + }()); + var currentThreadScheduler = Scheduler.currentThread = (function() { + var queue; + function runTrampoline() { + while (queue.length > 0) { + var item = queue.dequeue(); + !item.isCancelled() && item.invoke(); + } + } + function scheduleNow(state, action) { + var si = new ScheduledItem(this, state, action, this.now()); + if (!queue) { + queue = new PriorityQueue(4); + queue.enqueue(si); + var result = tryCatch(runTrampoline)(); + queue = null; + if (result === errorObj) { + return thrower(result.e); + } + } else { + queue.enqueue(si); + } + return si.disposable; + } + var currentScheduler = new Scheduler(defaultNow, scheduleNow, notSupported, notSupported); + currentScheduler.scheduleRequired = function() { + return !queue; + }; + return currentScheduler; + }()); + var scheduleMethod, + clearMethod; + var localTimer = (function() { + var localSetTimeout, + localClearTimeout = noop; + if (!!root.WScript) { + localSetTimeout = function(fn, time) { + root.WScript.Sleep(time); + fn(); + }; + } else if (!!root.setTimeout) { + localSetTimeout = root.setTimeout; + localClearTimeout = root.clearTimeout; + } else { + throw new NotSupportedError(); + } + return { + setTimeout: localSetTimeout, + clearTimeout: localClearTimeout + }; + }()); + var localSetTimeout = localTimer.setTimeout, + localClearTimeout = localTimer.clearTimeout; + (function() { + var nextHandle = 1, + tasksByHandle = {}, + currentlyRunning = false; + clearMethod = function(handle) { + delete tasksByHandle[handle]; + }; + function runTask(handle) { + if (currentlyRunning) { + localSetTimeout(function() { + runTask(handle); + }, 0); + } else { + var task = tasksByHandle[handle]; + if (task) { + currentlyRunning = true; + var result = tryCatch(task)(); + clearMethod(handle); + currentlyRunning = false; + if (result === errorObj) { + return thrower(result.e); + } + } + } + } + var reNative = RegExp('^' + String(toString).replace(/[.*+?^${}()|[\]\\]/g, '\\$&').replace(/toString| for [^\]]+/g, '.*?') + '$'); + var setImmediate = typeof(setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' && !reNative.test(setImmediate) && setImmediate; + function postMessageSupported() { + if (!root.postMessage || root.importScripts) { + return false; + } + var isAsync = false, + oldHandler = root.onmessage; + root.onmessage = function() { + isAsync = true; + }; + root.postMessage('', '*'); + root.onmessage = oldHandler; + return isAsync; + } + if (isFunction(setImmediate)) { + scheduleMethod = function(action) { + var id = nextHandle++; + tasksByHandle[id] = action; + setImmediate(function() { + runTask(id); + }); + return id; + }; + } else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') { + scheduleMethod = function(action) { + var id = nextHandle++; + tasksByHandle[id] = action; + process.nextTick(function() { + runTask(id); + }); + return id; + }; + } else if (postMessageSupported()) { + var MSG_PREFIX = 'ms.rx.schedule' + Math.random(); + function onGlobalPostMessage(event) { + if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) { + runTask(event.data.substring(MSG_PREFIX.length)); + } + } + if (root.addEventListener) { + root.addEventListener('message', onGlobalPostMessage, false); + } else { + root.attachEvent('onmessage', onGlobalPostMessage, false); + } + scheduleMethod = function(action) { + var id = nextHandle++; + tasksByHandle[id] = action; + root.postMessage(MSG_PREFIX + currentId, '*'); + return id; + }; + } else if (!!root.MessageChannel) { + var channel = new root.MessageChannel(); + channel.port1.onmessage = function(e) { + runTask(e.data); + }; + scheduleMethod = function(action) { + var id = nextHandle++; + tasksByHandle[id] = action; + channel.port2.postMessage(id); + return id; + }; + } else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) { + scheduleMethod = function(action) { + var scriptElement = root.document.createElement('script'); + var id = nextHandle++; + tasksByHandle[id] = action; + scriptElement.onreadystatechange = function() { + runTask(id); + scriptElement.onreadystatechange = null; + scriptElement.parentNode.removeChild(scriptElement); + scriptElement = null; + }; + root.document.documentElement.appendChild(scriptElement); + return id; + }; + } else { + scheduleMethod = function(action) { + var id = nextHandle++; + tasksByHandle[id] = action; + localSetTimeout(function() { + runTask(id); + }, 0); + return id; + }; + } + }()); + var timeoutScheduler = Scheduler.timeout = Scheduler.default = (function() { + function scheduleNow(state, action) { + var scheduler = this, + disposable = new SingleAssignmentDisposable(); + var id = scheduleMethod(function() { + if (!disposable.isDisposed) { + disposable.setDisposable(action(scheduler, state)); + } + }); + return new CompositeDisposable(disposable, disposableCreate(function() { + clearMethod(id); + })); + } + function scheduleRelative(state, dueTime, action) { + var scheduler = this, + dt = Scheduler.normalize(dueTime); + if (dt === 0) { + return scheduler.scheduleWithState(state, action); + } + var disposable = new SingleAssignmentDisposable(); + var id = localSetTimeout(function() { + if (!disposable.isDisposed) { + disposable.setDisposable(action(scheduler, state)); + } + }, dt); + return new CompositeDisposable(disposable, disposableCreate(function() { + localClearTimeout(id); + })); + } + function scheduleAbsolute(state, dueTime, action) { + return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action); + } + return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute); + })(); + var CatchScheduler = (function(__super__) { + function scheduleNow(state, action) { + return this._scheduler.scheduleWithState(state, this._wrap(action)); + } + function scheduleRelative(state, dueTime, action) { + return this._scheduler.scheduleWithRelativeAndState(state, dueTime, this._wrap(action)); + } + function scheduleAbsolute(state, dueTime, action) { + return this._scheduler.scheduleWithAbsoluteAndState(state, dueTime, this._wrap(action)); + } + inherits(CatchScheduler, __super__); + function CatchScheduler(scheduler, handler) { + this._scheduler = scheduler; + this._handler = handler; + this._recursiveOriginal = null; + this._recursiveWrapper = null; + __super__.call(this, this._scheduler.now.bind(this._scheduler), scheduleNow, scheduleRelative, scheduleAbsolute); + } + CatchScheduler.prototype._clone = function(scheduler) { + return new CatchScheduler(scheduler, this._handler); + }; + CatchScheduler.prototype._wrap = function(action) { + var parent = this; + return function(self, state) { + try { + return action(parent._getRecursiveWrapper(self), state); + } catch (e) { + if (!parent._handler(e)) { + throw e; + } + return disposableEmpty; + } + }; + }; + CatchScheduler.prototype._getRecursiveWrapper = function(scheduler) { + if (this._recursiveOriginal !== scheduler) { + this._recursiveOriginal = scheduler; + var wrapper = this._clone(scheduler); + wrapper._recursiveOriginal = scheduler; + wrapper._recursiveWrapper = wrapper; + this._recursiveWrapper = wrapper; + } + return this._recursiveWrapper; + }; + CatchScheduler.prototype.schedulePeriodicWithState = function(state, period, action) { + var self = this, + failed = false, + d = new SingleAssignmentDisposable(); + d.setDisposable(this._scheduler.schedulePeriodicWithState(state, period, function(state1) { + if (failed) { + return null; + } + try { + return action(state1); + } catch (e) { + failed = true; + if (!self._handler(e)) { + throw e; + } + d.dispose(); + return null; + } + })); + return d; + }; + return CatchScheduler; + }(Scheduler)); + var Notification = Rx.Notification = (function() { + function Notification(kind, value, exception, accept, acceptObservable, toString) { + this.kind = kind; + this.value = value; + this.exception = exception; + this._accept = accept; + this._acceptObservable = acceptObservable; + this.toString = toString; + } + Notification.prototype.accept = function(observerOrOnNext, onError, onCompleted) { + return observerOrOnNext && typeof observerOrOnNext === 'object' ? this._acceptObservable(observerOrOnNext) : this._accept(observerOrOnNext, onError, onCompleted); + }; + Notification.prototype.toObservable = function(scheduler) { + var self = this; + isScheduler(scheduler) || (scheduler = immediateScheduler); + return new AnonymousObservable(function(observer) { + return scheduler.scheduleWithState(self, function(_, notification) { + notification._acceptObservable(observer); + notification.kind === 'N' && observer.onCompleted(); + }); + }); + }; + return Notification; + })(); + var notificationCreateOnNext = Notification.createOnNext = (function() { + function _accept(onNext) { + return onNext(this.value); + } + function _acceptObservable(observer) { + return observer.onNext(this.value); + } + function toString() { + return 'OnNext(' + this.value + ')'; + } + return function(value) { + return new Notification('N', value, null, _accept, _acceptObservable, toString); + }; + }()); + var notificationCreateOnError = Notification.createOnError = (function() { + function _accept(onNext, onError) { + return onError(this.exception); + } + function _acceptObservable(observer) { + return observer.onError(this.exception); + } + function toString() { + return 'OnError(' + this.exception + ')'; + } + return function(e) { + return new Notification('E', null, e, _accept, _acceptObservable, toString); + }; + }()); + var notificationCreateOnCompleted = Notification.createOnCompleted = (function() { + function _accept(onNext, onError, onCompleted) { + return onCompleted(); + } + function _acceptObservable(observer) { + return observer.onCompleted(); + } + function toString() { + return 'OnCompleted()'; + } + return function() { + return new Notification('C', null, null, _accept, _acceptObservable, toString); + }; + }()); + var Enumerator = Rx.internals.Enumerator = function(next) { + this._next = next; + }; + Enumerator.prototype.next = function() { + return this._next(); + }; + Enumerator.prototype[$iterator$] = function() { + return this; + }; + var Enumerable = Rx.internals.Enumerable = function(iterator) { + this._iterator = iterator; + }; + Enumerable.prototype[$iterator$] = function() { + return this._iterator(); + }; + Enumerable.prototype.concat = function() { + var sources = this; + return new AnonymousObservable(function(o) { + var e = sources[$iterator$](); + var isDisposed, + subscription = new SerialDisposable(); + var cancelable = immediateScheduler.scheduleRecursive(function(self) { + if (isDisposed) { + return ; + } + try { + var currentItem = e.next(); + } catch (ex) { + return o.onError(ex); + } + if (currentItem.done) { + return o.onCompleted(); + } + var currentValue = currentItem.value; + isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); + var d = new SingleAssignmentDisposable(); + subscription.setDisposable(d); + d.setDisposable(currentValue.subscribe(function(x) { + o.onNext(x); + }, function(err) { + o.onError(err); + }, self)); + }); + return new CompositeDisposable(subscription, cancelable, disposableCreate(function() { + isDisposed = true; + })); + }); + }; + Enumerable.prototype.catchError = function() { + var sources = this; + return new AnonymousObservable(function(o) { + var e = sources[$iterator$](); + var isDisposed, + subscription = new SerialDisposable(); + var cancelable = immediateScheduler.scheduleRecursiveWithState(null, function(lastException, self) { + if (isDisposed) { + return ; + } + try { + var currentItem = e.next(); + } catch (ex) { + return observer.onError(ex); + } + if (currentItem.done) { + if (lastException !== null) { + o.onError(lastException); + } else { + o.onCompleted(); + } + return ; + } + var currentValue = currentItem.value; + isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); + var d = new SingleAssignmentDisposable(); + subscription.setDisposable(d); + d.setDisposable(currentValue.subscribe(function(x) { + o.onNext(x); + }, self, function() { + o.onCompleted(); + })); + }); + return new CompositeDisposable(subscription, cancelable, disposableCreate(function() { + isDisposed = true; + })); + }); + }; + Enumerable.prototype.catchErrorWhen = function(notificationHandler) { + var sources = this; + return new AnonymousObservable(function(o) { + var exceptions = new Subject(), + notifier = new Subject(), + handled = notificationHandler(exceptions), + notificationDisposable = handled.subscribe(notifier); + var e = sources[$iterator$](); + var isDisposed, + lastException, + subscription = new SerialDisposable(); + var cancelable = immediateScheduler.scheduleRecursive(function(self) { + if (isDisposed) { + return ; + } + try { + var currentItem = e.next(); + } catch (ex) { + return o.onError(ex); + } + if (currentItem.done) { + if (lastException) { + o.onError(lastException); + } else { + o.onCompleted(); + } + return ; + } + var currentValue = currentItem.value; + isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); + var outer = new SingleAssignmentDisposable(); + var inner = new SingleAssignmentDisposable(); + subscription.setDisposable(new CompositeDisposable(inner, outer)); + outer.setDisposable(currentValue.subscribe(function(x) { + o.onNext(x); + }, function(exn) { + inner.setDisposable(notifier.subscribe(self, function(ex) { + o.onError(ex); + }, function() { + o.onCompleted(); + })); + exceptions.onNext(exn); + }, function() { + o.onCompleted(); + })); + }); + return new CompositeDisposable(notificationDisposable, subscription, cancelable, disposableCreate(function() { + isDisposed = true; + })); + }); + }; + var enumerableRepeat = Enumerable.repeat = function(value, repeatCount) { + if (repeatCount == null) { + repeatCount = -1; + } + return new Enumerable(function() { + var left = repeatCount; + return new Enumerator(function() { + if (left === 0) { + return doneEnumerator; + } + if (left > 0) { + left--; + } + return { + done: false, + value: value + }; + }); + }); + }; + var enumerableOf = Enumerable.of = function(source, selector, thisArg) { + if (selector) { + var selectorFn = bindCallback(selector, thisArg, 3); + } + return new Enumerable(function() { + var index = -1; + return new Enumerator(function() { + return ++index < source.length ? { + done: false, + value: !selector ? source[index] : selectorFn(source[index], index, source) + } : doneEnumerator; + }); + }); + }; + var Observer = Rx.Observer = function() {}; + Observer.prototype.toNotifier = function() { + var observer = this; + return function(n) { + return n.accept(observer); + }; + }; + Observer.prototype.asObserver = function() { + return new AnonymousObserver(this.onNext.bind(this), this.onError.bind(this), this.onCompleted.bind(this)); + }; + Observer.prototype.checked = function() { + return new CheckedObserver(this); + }; + var observerCreate = Observer.create = function(onNext, onError, onCompleted) { + onNext || (onNext = noop); + onError || (onError = defaultError); + onCompleted || (onCompleted = noop); + return new AnonymousObserver(onNext, onError, onCompleted); + }; + Observer.fromNotifier = function(handler, thisArg) { + return new AnonymousObserver(function(x) { + return handler.call(thisArg, notificationCreateOnNext(x)); + }, function(e) { + return handler.call(thisArg, notificationCreateOnError(e)); + }, function() { + return handler.call(thisArg, notificationCreateOnCompleted()); + }); + }; + Observer.prototype.notifyOn = function(scheduler) { + return new ObserveOnObserver(scheduler, this); + }; + Observer.prototype.makeSafe = function(disposable) { + return new AnonymousSafeObserver(this._onNext, this._onError, this._onCompleted, disposable); + }; + var AbstractObserver = Rx.internals.AbstractObserver = (function(__super__) { + inherits(AbstractObserver, __super__); + function AbstractObserver() { + this.isStopped = false; + __super__.call(this); + } + AbstractObserver.prototype.next = notImplemented; + AbstractObserver.prototype.error = notImplemented; + AbstractObserver.prototype.completed = notImplemented; + AbstractObserver.prototype.onNext = function(value) { + if (!this.isStopped) { + this.next(value); + } + }; + AbstractObserver.prototype.onError = function(error) { + if (!this.isStopped) { + this.isStopped = true; + this.error(error); + } + }; + AbstractObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + this.isStopped = true; + this.completed(); + } + }; + AbstractObserver.prototype.dispose = function() { + this.isStopped = true; + }; + AbstractObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.error(e); + return true; + } + return false; + }; + return AbstractObserver; + }(Observer)); + var AnonymousObserver = Rx.AnonymousObserver = (function(__super__) { + inherits(AnonymousObserver, __super__); + function AnonymousObserver(onNext, onError, onCompleted) { + __super__.call(this); + this._onNext = onNext; + this._onError = onError; + this._onCompleted = onCompleted; + } + AnonymousObserver.prototype.next = function(value) { + this._onNext(value); + }; + AnonymousObserver.prototype.error = function(error) { + this._onError(error); + }; + AnonymousObserver.prototype.completed = function() { + this._onCompleted(); + }; + return AnonymousObserver; + }(AbstractObserver)); + var CheckedObserver = (function(__super__) { + inherits(CheckedObserver, __super__); + function CheckedObserver(observer) { + __super__.call(this); + this._observer = observer; + this._state = 0; + } + var CheckedObserverPrototype = CheckedObserver.prototype; + CheckedObserverPrototype.onNext = function(value) { + this.checkAccess(); + var res = tryCatch(this._observer.onNext).call(this._observer, value); + this._state = 0; + res === errorObj && thrower(res.e); + }; + CheckedObserverPrototype.onError = function(err) { + this.checkAccess(); + var res = tryCatch(this._observer.onError).call(this._observer, err); + this._state = 2; + res === errorObj && thrower(res.e); + }; + CheckedObserverPrototype.onCompleted = function() { + this.checkAccess(); + var res = tryCatch(this._observer.onCompleted).call(this._observer); + this._state = 2; + res === errorObj && thrower(res.e); + }; + CheckedObserverPrototype.checkAccess = function() { + if (this._state === 1) { + throw new Error('Re-entrancy detected'); + } + if (this._state === 2) { + throw new Error('Observer completed'); + } + if (this._state === 0) { + this._state = 1; + } + }; + return CheckedObserver; + }(Observer)); + var ScheduledObserver = Rx.internals.ScheduledObserver = (function(__super__) { + inherits(ScheduledObserver, __super__); + function ScheduledObserver(scheduler, observer) { + __super__.call(this); + this.scheduler = scheduler; + this.observer = observer; + this.isAcquired = false; + this.hasFaulted = false; + this.queue = []; + this.disposable = new SerialDisposable(); + } + ScheduledObserver.prototype.next = function(value) { + var self = this; + this.queue.push(function() { + self.observer.onNext(value); + }); + }; + ScheduledObserver.prototype.error = function(e) { + var self = this; + this.queue.push(function() { + self.observer.onError(e); + }); + }; + ScheduledObserver.prototype.completed = function() { + var self = this; + this.queue.push(function() { + self.observer.onCompleted(); + }); + }; + ScheduledObserver.prototype.ensureActive = function() { + var isOwner = false, + parent = this; + if (!this.hasFaulted && this.queue.length > 0) { + isOwner = !this.isAcquired; + this.isAcquired = true; + } + if (isOwner) { + this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(self) { + var work; + if (parent.queue.length > 0) { + work = parent.queue.shift(); + } else { + parent.isAcquired = false; + return ; + } + try { + work(); + } catch (ex) { + parent.queue = []; + parent.hasFaulted = true; + throw ex; + } + self(); + })); + } + }; + ScheduledObserver.prototype.dispose = function() { + __super__.prototype.dispose.call(this); + this.disposable.dispose(); + }; + return ScheduledObserver; + }(AbstractObserver)); + var ObserveOnObserver = (function(__super__) { + inherits(ObserveOnObserver, __super__); + function ObserveOnObserver(scheduler, observer, cancel) { + __super__.call(this, scheduler, observer); + this._cancel = cancel; + } + ObserveOnObserver.prototype.next = function(value) { + __super__.prototype.next.call(this, value); + this.ensureActive(); + }; + ObserveOnObserver.prototype.error = function(e) { + __super__.prototype.error.call(this, e); + this.ensureActive(); + }; + ObserveOnObserver.prototype.completed = function() { + __super__.prototype.completed.call(this); + this.ensureActive(); + }; + ObserveOnObserver.prototype.dispose = function() { + __super__.prototype.dispose.call(this); + this._cancel && this._cancel.dispose(); + this._cancel = null; + }; + return ObserveOnObserver; + })(ScheduledObserver); + var observableProto; + var Observable = Rx.Observable = (function() { + function Observable(subscribe) { + if (Rx.config.longStackSupport && hasStacks) { + try { + throw new Error(); + } catch (e) { + this.stack = e.stack.substring(e.stack.indexOf("\n") + 1); + } + var self = this; + this._subscribe = function(observer) { + var oldOnError = observer.onError.bind(observer); + observer.onError = function(err) { + makeStackTraceLong(err, self); + oldOnError(err); + }; + return subscribe.call(self, observer); + }; + } else { + this._subscribe = subscribe; + } + } + observableProto = Observable.prototype; + observableProto.subscribe = observableProto.forEach = function(observerOrOnNext, onError, onCompleted) { + return this._subscribe(typeof observerOrOnNext === 'object' ? observerOrOnNext : observerCreate(observerOrOnNext, onError, onCompleted)); + }; + observableProto.subscribeOnNext = function(onNext, thisArg) { + return this._subscribe(observerCreate(typeof thisArg !== 'undefined' ? function(x) { + onNext.call(thisArg, x); + } : onNext)); + }; + observableProto.subscribeOnError = function(onError, thisArg) { + return this._subscribe(observerCreate(null, typeof thisArg !== 'undefined' ? function(e) { + onError.call(thisArg, e); + } : onError)); + }; + observableProto.subscribeOnCompleted = function(onCompleted, thisArg) { + return this._subscribe(observerCreate(null, null, typeof thisArg !== 'undefined' ? function() { + onCompleted.call(thisArg); + } : onCompleted)); + }; + return Observable; + })(); + var ObservableBase = Rx.ObservableBase = (function(__super__) { + inherits(ObservableBase, __super__); + function fixSubscriber(subscriber) { + return subscriber && isFunction(subscriber.dispose) ? subscriber : isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty; + } + function setDisposable(s, state) { + var ado = state[0], + self = state[1]; + var sub = tryCatch(self.subscribeCore).call(self, ado); + if (sub === errorObj) { + if (!ado.fail(errorObj.e)) { + return thrower(errorObj.e); + } + } + ado.setDisposable(fixSubscriber(sub)); + } + function subscribe(observer) { + var ado = new AutoDetachObserver(observer), + state = [ado, this]; + if (currentThreadScheduler.scheduleRequired()) { + currentThreadScheduler.scheduleWithState(state, setDisposable); + } else { + setDisposable(null, state); + } + return ado; + } + function ObservableBase() { + __super__.call(this, subscribe); + } + ObservableBase.prototype.subscribeCore = notImplemented; + return ObservableBase; + }(Observable)); + observableProto.observeOn = function(scheduler) { + var source = this; + return new AnonymousObservable(function(observer) { + return source.subscribe(new ObserveOnObserver(scheduler, observer)); + }, source); + }; + observableProto.subscribeOn = function(scheduler) { + var source = this; + return new AnonymousObservable(function(observer) { + var m = new SingleAssignmentDisposable(), + d = new SerialDisposable(); + d.setDisposable(m); + m.setDisposable(scheduler.schedule(function() { + d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(observer))); + })); + return d; + }, source); + }; + var observableFromPromise = Observable.fromPromise = function(promise) { + return observableDefer(function() { + var subject = new Rx.AsyncSubject(); + promise.then(function(value) { + subject.onNext(value); + subject.onCompleted(); + }, subject.onError.bind(subject)); + return subject; + }); + }; + observableProto.toPromise = function(promiseCtor) { + promiseCtor || (promiseCtor = Rx.config.Promise); + if (!promiseCtor) { + throw new NotSupportedError('Promise type not provided nor in Rx.config.Promise'); + } + var source = this; + return new promiseCtor(function(resolve, reject) { + var value, + hasValue = false; + source.subscribe(function(v) { + value = v; + hasValue = true; + }, reject, function() { + hasValue && resolve(value); + }); + }); + }; + var ToArrayObservable = (function(__super__) { + inherits(ToArrayObservable, __super__); + function ToArrayObservable(source) { + this.source = source; + __super__.call(this); + } + ToArrayObservable.prototype.subscribeCore = function(observer) { + return this.source.subscribe(new ToArrayObserver(observer)); + }; + return ToArrayObservable; + }(ObservableBase)); + function ToArrayObserver(observer) { + this.observer = observer; + this.a = []; + this.isStopped = false; + } + ToArrayObserver.prototype.onNext = function(x) { + if (!this.isStopped) { + this.a.push(x); + } + }; + ToArrayObserver.prototype.onError = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onError(e); + } + }; + ToArrayObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onNext(this.a); + this.observer.onCompleted(); + } + }; + ToArrayObserver.prototype.dispose = function() { + this.isStopped = true; + }; + ToArrayObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onError(e); + return true; + } + return false; + }; + observableProto.toArray = function() { + return new ToArrayObservable(this); + }; + Observable.create = Observable.createWithDisposable = function(subscribe, parent) { + return new AnonymousObservable(subscribe, parent); + }; + var observableDefer = Observable.defer = function(observableFactory) { + return new AnonymousObservable(function(observer) { + var result; + try { + result = observableFactory(); + } catch (e) { + return observableThrow(e).subscribe(observer); + } + isPromise(result) && (result = observableFromPromise(result)); + return result.subscribe(observer); + }); + }; + var observableEmpty = Observable.empty = function(scheduler) { + isScheduler(scheduler) || (scheduler = immediateScheduler); + return new AnonymousObservable(function(observer) { + return scheduler.scheduleWithState(null, function() { + observer.onCompleted(); + }); + }); + }; + var FromObservable = (function(__super__) { + inherits(FromObservable, __super__); + function FromObservable(iterable, mapper, scheduler) { + this.iterable = iterable; + this.mapper = mapper; + this.scheduler = scheduler; + __super__.call(this); + } + FromObservable.prototype.subscribeCore = function(observer) { + var sink = new FromSink(observer, this); + return sink.run(); + }; + return FromObservable; + }(ObservableBase)); + var FromSink = (function() { + function FromSink(observer, parent) { + this.observer = observer; + this.parent = parent; + } + FromSink.prototype.run = function() { + var list = Object(this.parent.iterable), + it = getIterable(list), + observer = this.observer, + mapper = this.parent.mapper; + function loopRecursive(i, recurse) { + try { + var next = it.next(); + } catch (e) { + return observer.onError(e); + } + if (next.done) { + return observer.onCompleted(); + } + var result = next.value; + if (mapper) { + try { + result = mapper(result, i); + } catch (e) { + return observer.onError(e); + } + } + observer.onNext(result); + recurse(i + 1); + } + return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive); + }; + return FromSink; + }()); + var maxSafeInteger = Math.pow(2, 53) - 1; + function StringIterable(str) { + this._s = s; + } + StringIterable.prototype[$iterator$] = function() { + return new StringIterator(this._s); + }; + function StringIterator(str) { + this._s = s; + this._l = s.length; + this._i = 0; + } + StringIterator.prototype[$iterator$] = function() { + return this; + }; + StringIterator.prototype.next = function() { + return this._i < this._l ? { + done: false, + value: this._s.charAt(this._i++) + } : doneEnumerator; + }; + function ArrayIterable(a) { + this._a = a; + } + ArrayIterable.prototype[$iterator$] = function() { + return new ArrayIterator(this._a); + }; + function ArrayIterator(a) { + this._a = a; + this._l = toLength(a); + this._i = 0; + } + ArrayIterator.prototype[$iterator$] = function() { + return this; + }; + ArrayIterator.prototype.next = function() { + return this._i < this._l ? { + done: false, + value: this._a[this._i++] + } : doneEnumerator; + }; + function numberIsFinite(value) { + return typeof value === 'number' && root.isFinite(value); + } + function isNan(n) { + return n !== n; + } + function getIterable(o) { + var i = o[$iterator$], + it; + if (!i && typeof o === 'string') { + it = new StringIterable(o); + return it[$iterator$](); + } + if (!i && o.length !== undefined) { + it = new ArrayIterable(o); + return it[$iterator$](); + } + if (!i) { + throw new TypeError('Object is not iterable'); + } + return o[$iterator$](); + } + function sign(value) { + var number = +value; + if (number === 0) { + return number; + } + if (isNaN(number)) { + return number; + } + return number < 0 ? -1 : 1; + } + function toLength(o) { + var len = +o.length; + if (isNaN(len)) { + return 0; + } + if (len === 0 || !numberIsFinite(len)) { + return len; + } + len = sign(len) * Math.floor(Math.abs(len)); + if (len <= 0) { + return 0; + } + if (len > maxSafeInteger) { + return maxSafeInteger; + } + return len; + } + var observableFrom = Observable.from = function(iterable, mapFn, thisArg, scheduler) { + if (iterable == null) { + throw new Error('iterable cannot be null.'); + } + if (mapFn && !isFunction(mapFn)) { + throw new Error('mapFn when provided must be a function'); + } + if (mapFn) { + var mapper = bindCallback(mapFn, thisArg, 2); + } + isScheduler(scheduler) || (scheduler = currentThreadScheduler); + return new FromObservable(iterable, mapper, scheduler); + }; + var FromArrayObservable = (function(__super__) { + inherits(FromArrayObservable, __super__); + function FromArrayObservable(args, scheduler) { + this.args = args; + this.scheduler = scheduler; + __super__.call(this); + } + FromArrayObservable.prototype.subscribeCore = function(observer) { + var sink = new FromArraySink(observer, this); + return sink.run(); + }; + return FromArrayObservable; + }(ObservableBase)); + function FromArraySink(observer, parent) { + this.observer = observer; + this.parent = parent; + } + FromArraySink.prototype.run = function() { + var observer = this.observer, + args = this.parent.args, + len = args.length; + function loopRecursive(i, recurse) { + if (i < len) { + observer.onNext(args[i]); + recurse(i + 1); + } else { + observer.onCompleted(); + } + } + return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive); + }; + var observableFromArray = Observable.fromArray = function(array, scheduler) { + isScheduler(scheduler) || (scheduler = currentThreadScheduler); + return new FromArrayObservable(array, scheduler); + }; + Observable.generate = function(initialState, condition, iterate, resultSelector, scheduler) { + isScheduler(scheduler) || (scheduler = currentThreadScheduler); + return new AnonymousObservable(function(o) { + var first = true; + return scheduler.scheduleRecursiveWithState(initialState, function(state, self) { + var hasResult, + result; + try { + if (first) { + first = false; + } else { + state = iterate(state); + } + hasResult = condition(state); + hasResult && (result = resultSelector(state)); + } catch (e) { + return o.onError(e); + } + if (hasResult) { + o.onNext(result); + self(state); + } else { + o.onCompleted(); + } + }); + }); + }; + var observableNever = Observable.never = function() { + return new AnonymousObservable(function() { + return disposableEmpty; + }); + }; + function observableOf(scheduler, array) { + isScheduler(scheduler) || (scheduler = currentThreadScheduler); + return new FromArrayObservable(array, scheduler); + } + Observable.of = function() { + var len = arguments.length, + args = new Array(len); + for (var i = 0; i < len; i++) { + args[i] = arguments[i]; + } + return new FromArrayObservable(args, currentThreadScheduler); + }; + Observable.ofWithScheduler = function(scheduler) { + var len = arguments.length, + args = new Array(len - 1); + for (var i = 1; i < len; i++) { + args[i - 1] = arguments[i]; + } + return new FromArrayObservable(args, scheduler); + }; + Observable.pairs = function(obj, scheduler) { + scheduler || (scheduler = Rx.Scheduler.currentThread); + return new AnonymousObservable(function(observer) { + var keys = Object.keys(obj), + len = keys.length; + return scheduler.scheduleRecursiveWithState(0, function(idx, self) { + if (idx < len) { + var key = keys[idx]; + observer.onNext([key, obj[key]]); + self(idx + 1); + } else { + observer.onCompleted(); + } + }); + }); + }; + var RangeObservable = (function(__super__) { + inherits(RangeObservable, __super__); + function RangeObservable(start, count, scheduler) { + this.start = start; + this.count = count; + this.scheduler = scheduler; + __super__.call(this); + } + RangeObservable.prototype.subscribeCore = function(observer) { + var sink = new RangeSink(observer, this); + return sink.run(); + }; + return RangeObservable; + }(ObservableBase)); + var RangeSink = (function() { + function RangeSink(observer, parent) { + this.observer = observer; + this.parent = parent; + } + RangeSink.prototype.run = function() { + var start = this.parent.start, + count = this.parent.count, + observer = this.observer; + function loopRecursive(i, recurse) { + if (i < count) { + observer.onNext(start + i); + recurse(i + 1); + } else { + observer.onCompleted(); + } + } + return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive); + }; + return RangeSink; + }()); + Observable.range = function(start, count, scheduler) { + isScheduler(scheduler) || (scheduler = currentThreadScheduler); + return new RangeObservable(start, count, scheduler); + }; + Observable.repeat = function(value, repeatCount, scheduler) { + isScheduler(scheduler) || (scheduler = currentThreadScheduler); + return observableReturn(value, scheduler).repeat(repeatCount == null ? -1 : repeatCount); + }; + var observableReturn = Observable['return'] = Observable.just = Observable.returnValue = function(value, scheduler) { + isScheduler(scheduler) || (scheduler = immediateScheduler); + return new AnonymousObservable(function(o) { + return scheduler.scheduleWithState(value, function(_, v) { + o.onNext(v); + o.onCompleted(); + }); + }); + }; + var observableThrow = Observable['throw'] = Observable.throwError = function(error, scheduler) { + isScheduler(scheduler) || (scheduler = immediateScheduler); + return new AnonymousObservable(function(observer) { + return scheduler.schedule(function() { + observer.onError(error); + }); + }); + }; + Observable.throwException = function() { + return Observable.throwError.apply(null, arguments); + }; + Observable.using = function(resourceFactory, observableFactory) { + return new AnonymousObservable(function(observer) { + var disposable = disposableEmpty, + resource, + source; + try { + resource = resourceFactory(); + resource && (disposable = resource); + source = observableFactory(resource); + } catch (exception) { + return new CompositeDisposable(observableThrow(exception).subscribe(observer), disposable); + } + return new CompositeDisposable(source.subscribe(observer), disposable); + }); + }; + observableProto.amb = function(rightSource) { + var leftSource = this; + return new AnonymousObservable(function(observer) { + var choice, + leftChoice = 'L', + rightChoice = 'R', + leftSubscription = new SingleAssignmentDisposable(), + rightSubscription = new SingleAssignmentDisposable(); + isPromise(rightSource) && (rightSource = observableFromPromise(rightSource)); + function choiceL() { + if (!choice) { + choice = leftChoice; + rightSubscription.dispose(); + } + } + function choiceR() { + if (!choice) { + choice = rightChoice; + leftSubscription.dispose(); + } + } + leftSubscription.setDisposable(leftSource.subscribe(function(left) { + choiceL(); + if (choice === leftChoice) { + observer.onNext(left); + } + }, function(err) { + choiceL(); + if (choice === leftChoice) { + observer.onError(err); + } + }, function() { + choiceL(); + if (choice === leftChoice) { + observer.onCompleted(); + } + })); + rightSubscription.setDisposable(rightSource.subscribe(function(right) { + choiceR(); + if (choice === rightChoice) { + observer.onNext(right); + } + }, function(err) { + choiceR(); + if (choice === rightChoice) { + observer.onError(err); + } + }, function() { + choiceR(); + if (choice === rightChoice) { + observer.onCompleted(); + } + })); + return new CompositeDisposable(leftSubscription, rightSubscription); + }); + }; + Observable.amb = function() { + var acc = observableNever(), + items = []; + if (Array.isArray(arguments[0])) { + items = arguments[0]; + } else { + for (var i = 0, + len = arguments.length; i < len; i++) { + items.push(arguments[i]); + } + } + function func(previous, current) { + return previous.amb(current); + } + for (var i = 0, + len = items.length; i < len; i++) { + acc = func(acc, items[i]); + } + return acc; + }; + function observableCatchHandler(source, handler) { + return new AnonymousObservable(function(o) { + var d1 = new SingleAssignmentDisposable(), + subscription = new SerialDisposable(); + subscription.setDisposable(d1); + d1.setDisposable(source.subscribe(function(x) { + o.onNext(x); + }, function(e) { + try { + var result = handler(e); + } catch (ex) { + return o.onError(ex); + } + isPromise(result) && (result = observableFromPromise(result)); + var d = new SingleAssignmentDisposable(); + subscription.setDisposable(d); + d.setDisposable(result.subscribe(o)); + }, function(x) { + o.onCompleted(x); + })); + return subscription; + }, source); + } + observableProto['catch'] = observableProto.catchError = observableProto.catchException = function(handlerOrSecond) { + return typeof handlerOrSecond === 'function' ? observableCatchHandler(this, handlerOrSecond) : observableCatch([this, handlerOrSecond]); + }; + var observableCatch = Observable.catchError = Observable['catch'] = Observable.catchException = function() { + var items = []; + if (Array.isArray(arguments[0])) { + items = arguments[0]; + } else { + for (var i = 0, + len = arguments.length; i < len; i++) { + items.push(arguments[i]); + } + } + return enumerableOf(items).catchError(); + }; + observableProto.combineLatest = function() { + var len = arguments.length, + args = new Array(len); + for (var i = 0; i < len; i++) { + args[i] = arguments[i]; + } + if (Array.isArray(args[0])) { + args[0].unshift(this); + } else { + args.unshift(this); + } + return combineLatest.apply(this, args); + }; + var combineLatest = Observable.combineLatest = function() { + var len = arguments.length, + args = new Array(len); + for (var i = 0; i < len; i++) { + args[i] = arguments[i]; + } + var resultSelector = args.pop(); + Array.isArray(args[0]) && (args = args[0]); + return new AnonymousObservable(function(o) { + var n = args.length, + falseFactory = function() { + return false; + }, + hasValue = arrayInitialize(n, falseFactory), + hasValueAll = false, + isDone = arrayInitialize(n, falseFactory), + values = new Array(n); + function next(i) { + hasValue[i] = true; + if (hasValueAll || (hasValueAll = hasValue.every(identity))) { + try { + var res = resultSelector.apply(null, values); + } catch (e) { + return o.onError(e); + } + o.onNext(res); + } else if (isDone.filter(function(x, j) { + return j !== i; + }).every(identity)) { + o.onCompleted(); + } + } + function done(i) { + isDone[i] = true; + isDone.every(identity) && o.onCompleted(); + } + var subscriptions = new Array(n); + for (var idx = 0; idx < n; idx++) { + (function(i) { + var source = args[i], + sad = new SingleAssignmentDisposable(); + isPromise(source) && (source = observableFromPromise(source)); + sad.setDisposable(source.subscribe(function(x) { + values[i] = x; + next(i); + }, function(e) { + o.onError(e); + }, function() { + done(i); + })); + subscriptions[i] = sad; + }(idx)); + } + return new CompositeDisposable(subscriptions); + }, this); + }; + observableProto.concat = function() { + for (var args = [], + i = 0, + len = arguments.length; i < len; i++) { + args.push(arguments[i]); + } + args.unshift(this); + return observableConcat.apply(null, args); + }; + var observableConcat = Observable.concat = function() { + var args; + if (Array.isArray(arguments[0])) { + args = arguments[0]; + } else { + args = new Array(arguments.length); + for (var i = 0, + len = arguments.length; i < len; i++) { + args[i] = arguments[i]; + } + } + return enumerableOf(args).concat(); + }; + observableProto.concatAll = observableProto.concatObservable = function() { + return this.merge(1); + }; + var MergeObservable = (function(__super__) { + inherits(MergeObservable, __super__); + function MergeObservable(source, maxConcurrent) { + this.source = source; + this.maxConcurrent = maxConcurrent; + __super__.call(this); + } + MergeObservable.prototype.subscribeCore = function(observer) { + var g = new CompositeDisposable(); + g.add(this.source.subscribe(new MergeObserver(observer, this.maxConcurrent, g))); + return g; + }; + return MergeObservable; + }(ObservableBase)); + var MergeObserver = (function() { + function MergeObserver(o, max, g) { + this.o = o; + this.max = max; + this.g = g; + this.done = false; + this.q = []; + this.activeCount = 0; + this.isStopped = false; + } + MergeObserver.prototype.handleSubscribe = function(xs) { + var sad = new SingleAssignmentDisposable(); + this.g.add(sad); + isPromise(xs) && (xs = observableFromPromise(xs)); + sad.setDisposable(xs.subscribe(new InnerObserver(this, sad))); + }; + MergeObserver.prototype.onNext = function(innerSource) { + if (this.isStopped) { + return ; + } + if (this.activeCount < this.max) { + this.activeCount++; + this.handleSubscribe(innerSource); + } else { + this.q.push(innerSource); + } + }; + MergeObserver.prototype.onError = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.o.onError(e); + } + }; + MergeObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + this.isStopped = true; + this.done = true; + this.activeCount === 0 && this.o.onCompleted(); + } + }; + MergeObserver.prototype.dispose = function() { + this.isStopped = true; + }; + MergeObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.o.onError(e); + return true; + } + return false; + }; + function InnerObserver(parent, sad) { + this.parent = parent; + this.sad = sad; + this.isStopped = false; + } + InnerObserver.prototype.onNext = function(x) { + if (!this.isStopped) { + this.parent.o.onNext(x); + } + }; + InnerObserver.prototype.onError = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.parent.o.onError(e); + } + }; + InnerObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + this.isStopped = true; + var parent = this.parent; + parent.g.remove(this.sad); + if (parent.q.length > 0) { + parent.handleSubscribe(parent.q.shift()); + } else { + parent.activeCount--; + parent.done && parent.activeCount === 0 && parent.o.onCompleted(); + } + } + }; + InnerObserver.prototype.dispose = function() { + this.isStopped = true; + }; + InnerObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.parent.o.onError(e); + return true; + } + return false; + }; + return MergeObserver; + }()); + observableProto.merge = function(maxConcurrentOrOther) { + return typeof maxConcurrentOrOther !== 'number' ? observableMerge(this, maxConcurrentOrOther) : new MergeObservable(this, maxConcurrentOrOther); + }; + var observableMerge = Observable.merge = function() { + var scheduler, + sources = [], + i, + len = arguments.length; + if (!arguments[0]) { + scheduler = immediateScheduler; + for (i = 1; i < len; i++) { + sources.push(arguments[i]); + } + } else if (isScheduler(arguments[0])) { + scheduler = arguments[0]; + for (i = 1; i < len; i++) { + sources.push(arguments[i]); + } + } else { + scheduler = immediateScheduler; + for (i = 0; i < len; i++) { + sources.push(arguments[i]); + } + } + if (Array.isArray(sources[0])) { + sources = sources[0]; + } + return observableOf(scheduler, sources).mergeAll(); + }; + var CompositeError = Rx.CompositeError = function(errors) { + this.name = "NotImplementedError"; + this.innerErrors = errors; + this.message = 'This contains multiple errors. Check the innerErrors'; + Error.call(this); + }; + CompositeError.prototype = Error.prototype; + Observable.mergeDelayError = function() { + var args; + if (Array.isArray(arguments[0])) { + args = arguments[0]; + } else { + var len = arguments.length; + args = new Array(len); + for (var i = 0; i < len; i++) { + args[i] = arguments[i]; + } + } + var source = observableOf(null, args); + return new AnonymousObservable(function(o) { + var group = new CompositeDisposable(), + m = new SingleAssignmentDisposable(), + isStopped = false, + errors = []; + function setCompletion() { + if (errors.length === 0) { + o.onCompleted(); + } else if (errors.length === 1) { + o.onError(errors[0]); + } else { + o.onError(new CompositeError(errors)); + } + } + group.add(m); + m.setDisposable(source.subscribe(function(innerSource) { + var innerSubscription = new SingleAssignmentDisposable(); + group.add(innerSubscription); + isPromise(innerSource) && (innerSource = observableFromPromise(innerSource)); + innerSubscription.setDisposable(innerSource.subscribe(function(x) { + o.onNext(x); + }, function(e) { + errors.push(e); + group.remove(innerSubscription); + isStopped && group.length === 1 && setCompletion(); + }, function() { + group.remove(innerSubscription); + isStopped && group.length === 1 && setCompletion(); + })); + }, function(e) { + errors.push(e); + isStopped = true; + group.length === 1 && setCompletion(); + }, function() { + isStopped = true; + group.length === 1 && setCompletion(); + })); + return group; + }); + }; + var MergeAllObservable = (function(__super__) { + inherits(MergeAllObservable, __super__); + function MergeAllObservable(source) { + this.source = source; + __super__.call(this); + } + MergeAllObservable.prototype.subscribeCore = function(observer) { + var g = new CompositeDisposable(), + m = new SingleAssignmentDisposable(); + g.add(m); + m.setDisposable(this.source.subscribe(new MergeAllObserver(observer, g))); + return g; + }; + return MergeAllObservable; + }(ObservableBase)); + var MergeAllObserver = (function() { + function MergeAllObserver(o, g) { + this.o = o; + this.g = g; + this.isStopped = false; + this.done = false; + } + MergeAllObserver.prototype.onNext = function(innerSource) { + if (this.isStopped) { + return ; + } + var sad = new SingleAssignmentDisposable(); + this.g.add(sad); + isPromise(innerSource) && (innerSource = observableFromPromise(innerSource)); + sad.setDisposable(innerSource.subscribe(new InnerObserver(this, this.g, sad))); + }; + MergeAllObserver.prototype.onError = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.o.onError(e); + } + }; + MergeAllObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + this.isStopped = true; + this.done = true; + this.g.length === 1 && this.o.onCompleted(); + } + }; + MergeAllObserver.prototype.dispose = function() { + this.isStopped = true; + }; + MergeAllObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.o.onError(e); + return true; + } + return false; + }; + function InnerObserver(parent, g, sad) { + this.parent = parent; + this.g = g; + this.sad = sad; + this.isStopped = false; + } + InnerObserver.prototype.onNext = function(x) { + if (!this.isStopped) { + this.parent.o.onNext(x); + } + }; + InnerObserver.prototype.onError = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.parent.o.onError(e); + } + }; + InnerObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + var parent = this.parent; + this.isStopped = true; + parent.g.remove(this.sad); + parent.done && parent.g.length === 1 && parent.o.onCompleted(); + } + }; + InnerObserver.prototype.dispose = function() { + this.isStopped = true; + }; + InnerObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.parent.o.onError(e); + return true; + } + return false; + }; + return MergeAllObserver; + }()); + observableProto.mergeAll = observableProto.mergeObservable = function() { + return new MergeAllObservable(this); + }; + observableProto.onErrorResumeNext = function(second) { + if (!second) { + throw new Error('Second observable is required'); + } + return onErrorResumeNext([this, second]); + }; + var onErrorResumeNext = Observable.onErrorResumeNext = function() { + var sources = []; + if (Array.isArray(arguments[0])) { + sources = arguments[0]; + } else { + for (var i = 0, + len = arguments.length; i < len; i++) { + sources.push(arguments[i]); + } + } + return new AnonymousObservable(function(observer) { + var pos = 0, + subscription = new SerialDisposable(), + cancelable = immediateScheduler.scheduleRecursive(function(self) { + var current, + d; + if (pos < sources.length) { + current = sources[pos++]; + isPromise(current) && (current = observableFromPromise(current)); + d = new SingleAssignmentDisposable(); + subscription.setDisposable(d); + d.setDisposable(current.subscribe(observer.onNext.bind(observer), self, self)); + } else { + observer.onCompleted(); + } + }); + return new CompositeDisposable(subscription, cancelable); + }); + }; + observableProto.skipUntil = function(other) { + var source = this; + return new AnonymousObservable(function(o) { + var isOpen = false; + var disposables = new CompositeDisposable(source.subscribe(function(left) { + isOpen && o.onNext(left); + }, function(e) { + o.onError(e); + }, function() { + isOpen && o.onCompleted(); + })); + isPromise(other) && (other = observableFromPromise(other)); + var rightSubscription = new SingleAssignmentDisposable(); + disposables.add(rightSubscription); + rightSubscription.setDisposable(other.subscribe(function() { + isOpen = true; + rightSubscription.dispose(); + }, function(e) { + o.onError(e); + }, function() { + rightSubscription.dispose(); + })); + return disposables; + }, source); + }; + observableProto['switch'] = observableProto.switchLatest = function() { + var sources = this; + return new AnonymousObservable(function(observer) { + var hasLatest = false, + innerSubscription = new SerialDisposable(), + isStopped = false, + latest = 0, + subscription = sources.subscribe(function(innerSource) { + var d = new SingleAssignmentDisposable(), + id = ++latest; + hasLatest = true; + innerSubscription.setDisposable(d); + isPromise(innerSource) && (innerSource = observableFromPromise(innerSource)); + d.setDisposable(innerSource.subscribe(function(x) { + latest === id && observer.onNext(x); + }, function(e) { + latest === id && observer.onError(e); + }, function() { + if (latest === id) { + hasLatest = false; + isStopped && observer.onCompleted(); + } + })); + }, function(e) { + observer.onError(e); + }, function() { + isStopped = true; + !hasLatest && observer.onCompleted(); + }); + return new CompositeDisposable(subscription, innerSubscription); + }, sources); + }; + observableProto.takeUntil = function(other) { + var source = this; + return new AnonymousObservable(function(o) { + isPromise(other) && (other = observableFromPromise(other)); + return new CompositeDisposable(source.subscribe(o), other.subscribe(function() { + o.onCompleted(); + }, function(e) { + o.onError(e); + }, noop)); + }, source); + }; + observableProto.withLatestFrom = function() { + var len = arguments.length, + args = new Array(len); + for (var i = 0; i < len; i++) { + args[i] = arguments[i]; + } + var resultSelector = args.pop(), + source = this; + if (typeof source === 'undefined') { + throw new Error('Source observable not found for withLatestFrom().'); + } + if (typeof resultSelector !== 'function') { + throw new Error('withLatestFrom() expects a resultSelector function.'); + } + if (Array.isArray(args[0])) { + args = args[0]; + } + return new AnonymousObservable(function(observer) { + var falseFactory = function() { + return false; + }, + n = args.length, + hasValue = arrayInitialize(n, falseFactory), + hasValueAll = false, + values = new Array(n); + var subscriptions = new Array(n + 1); + for (var idx = 0; idx < n; idx++) { + (function(i) { + var other = args[i], + sad = new SingleAssignmentDisposable(); + isPromise(other) && (other = observableFromPromise(other)); + sad.setDisposable(other.subscribe(function(x) { + values[i] = x; + hasValue[i] = true; + hasValueAll = hasValue.every(identity); + }, observer.onError.bind(observer), function() {})); + subscriptions[i] = sad; + }(idx)); + } + var sad = new SingleAssignmentDisposable(); + sad.setDisposable(source.subscribe(function(x) { + var res; + var allValues = [x].concat(values); + if (!hasValueAll) + return ; + try { + res = resultSelector.apply(null, allValues); + } catch (ex) { + observer.onError(ex); + return ; + } + observer.onNext(res); + }, observer.onError.bind(observer), function() { + observer.onCompleted(); + })); + subscriptions[n] = sad; + return new CompositeDisposable(subscriptions); + }, this); + }; + function zipArray(second, resultSelector) { + var first = this; + return new AnonymousObservable(function(observer) { + var index = 0, + len = second.length; + return first.subscribe(function(left) { + if (index < len) { + var right = second[index++], + result; + try { + result = resultSelector(left, right); + } catch (e) { + return observer.onError(e); + } + observer.onNext(result); + } else { + observer.onCompleted(); + } + }, function(e) { + observer.onError(e); + }, function() { + observer.onCompleted(); + }); + }, first); + } + function falseFactory() { + return false; + } + function emptyArrayFactory() { + return []; + } + observableProto.zip = function() { + if (Array.isArray(arguments[0])) { + return zipArray.apply(this, arguments); + } + var len = arguments.length, + args = new Array(len); + for (var i = 0; i < len; i++) { + args[i] = arguments[i]; + } + var parent = this, + resultSelector = args.pop(); + args.unshift(parent); + return new AnonymousObservable(function(observer) { + var n = args.length, + queues = arrayInitialize(n, emptyArrayFactory), + isDone = arrayInitialize(n, falseFactory); + function next(i) { + var res, + queuedValues; + if (queues.every(function(x) { + return x.length > 0; + })) { + try { + queuedValues = queues.map(function(x) { + return x.shift(); + }); + res = resultSelector.apply(parent, queuedValues); + } catch (ex) { + observer.onError(ex); + return ; + } + observer.onNext(res); + } else if (isDone.filter(function(x, j) { + return j !== i; + }).every(identity)) { + observer.onCompleted(); + } + } + ; + function done(i) { + isDone[i] = true; + if (isDone.every(function(x) { + return x; + })) { + observer.onCompleted(); + } + } + var subscriptions = new Array(n); + for (var idx = 0; idx < n; idx++) { + (function(i) { + var source = args[i], + sad = new SingleAssignmentDisposable(); + isPromise(source) && (source = observableFromPromise(source)); + sad.setDisposable(source.subscribe(function(x) { + queues[i].push(x); + next(i); + }, function(e) { + observer.onError(e); + }, function() { + done(i); + })); + subscriptions[i] = sad; + })(idx); + } + return new CompositeDisposable(subscriptions); + }, parent); + }; + Observable.zip = function() { + var len = arguments.length, + args = new Array(len); + for (var i = 0; i < len; i++) { + args[i] = arguments[i]; + } + var first = args.shift(); + return first.zip.apply(first, args); + }; + Observable.zipArray = function() { + var sources; + if (Array.isArray(arguments[0])) { + sources = arguments[0]; + } else { + var len = arguments.length; + sources = new Array(len); + for (var i = 0; i < len; i++) { + sources[i] = arguments[i]; + } + } + return new AnonymousObservable(function(observer) { + var n = sources.length, + queues = arrayInitialize(n, function() { + return []; + }), + isDone = arrayInitialize(n, function() { + return false; + }); + function next(i) { + if (queues.every(function(x) { + return x.length > 0; + })) { + var res = queues.map(function(x) { + return x.shift(); + }); + observer.onNext(res); + } else if (isDone.filter(function(x, j) { + return j !== i; + }).every(identity)) { + observer.onCompleted(); + return ; + } + } + ; + function done(i) { + isDone[i] = true; + if (isDone.every(identity)) { + observer.onCompleted(); + return ; + } + } + var subscriptions = new Array(n); + for (var idx = 0; idx < n; idx++) { + (function(i) { + subscriptions[i] = new SingleAssignmentDisposable(); + subscriptions[i].setDisposable(sources[i].subscribe(function(x) { + queues[i].push(x); + next(i); + }, function(e) { + observer.onError(e); + }, function() { + done(i); + })); + })(idx); + } + return new CompositeDisposable(subscriptions); + }); + }; + observableProto.asObservable = function() { + var source = this; + return new AnonymousObservable(function(o) { + return source.subscribe(o); + }, this); + }; + observableProto.bufferWithCount = function(count, skip) { + if (typeof skip !== 'number') { + skip = count; + } + return this.windowWithCount(count, skip).selectMany(function(x) { + return x.toArray(); + }).where(function(x) { + return x.length > 0; + }); + }; + observableProto.dematerialize = function() { + var source = this; + return new AnonymousObservable(function(o) { + return source.subscribe(function(x) { + return x.accept(o); + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, this); + }; + observableProto.distinctUntilChanged = function(keySelector, comparer) { + var source = this; + comparer || (comparer = defaultComparer); + return new AnonymousObservable(function(o) { + var hasCurrentKey = false, + currentKey; + return source.subscribe(function(value) { + var key = value; + if (keySelector) { + try { + key = keySelector(value); + } catch (e) { + o.onError(e); + return ; + } + } + if (hasCurrentKey) { + try { + var comparerEquals = comparer(currentKey, key); + } catch (e) { + o.onError(e); + return ; + } + } + if (!hasCurrentKey || !comparerEquals) { + hasCurrentKey = true; + currentKey = key; + o.onNext(value); + } + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, this); + }; + observableProto['do'] = observableProto.tap = observableProto.doAction = function(observerOrOnNext, onError, onCompleted) { + var source = this; + return new AnonymousObservable(function(observer) { + var tapObserver = !observerOrOnNext || isFunction(observerOrOnNext) ? observerCreate(observerOrOnNext || noop, onError || noop, onCompleted || noop) : observerOrOnNext; + return source.subscribe(function(x) { + try { + tapObserver.onNext(x); + } catch (e) { + observer.onError(e); + } + observer.onNext(x); + }, function(err) { + try { + tapObserver.onError(err); + } catch (e) { + observer.onError(e); + } + observer.onError(err); + }, function() { + try { + tapObserver.onCompleted(); + } catch (e) { + observer.onError(e); + } + observer.onCompleted(); + }); + }, this); + }; + observableProto.doOnNext = observableProto.tapOnNext = function(onNext, thisArg) { + return this.tap(typeof thisArg !== 'undefined' ? function(x) { + onNext.call(thisArg, x); + } : onNext); + }; + observableProto.doOnError = observableProto.tapOnError = function(onError, thisArg) { + return this.tap(noop, typeof thisArg !== 'undefined' ? function(e) { + onError.call(thisArg, e); + } : onError); + }; + observableProto.doOnCompleted = observableProto.tapOnCompleted = function(onCompleted, thisArg) { + return this.tap(noop, null, typeof thisArg !== 'undefined' ? function() { + onCompleted.call(thisArg); + } : onCompleted); + }; + observableProto['finally'] = observableProto.ensure = function(action) { + var source = this; + return new AnonymousObservable(function(observer) { + var subscription; + try { + subscription = source.subscribe(observer); + } catch (e) { + action(); + throw e; + } + return disposableCreate(function() { + try { + subscription.dispose(); + } catch (e) { + throw e; + } finally { + action(); + } + }); + }, this); + }; + observableProto.finallyAction = function(action) { + return this.ensure(action); + }; + observableProto.ignoreElements = function() { + var source = this; + return new AnonymousObservable(function(o) { + return source.subscribe(noop, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, source); + }; + observableProto.materialize = function() { + var source = this; + return new AnonymousObservable(function(observer) { + return source.subscribe(function(value) { + observer.onNext(notificationCreateOnNext(value)); + }, function(e) { + observer.onNext(notificationCreateOnError(e)); + observer.onCompleted(); + }, function() { + observer.onNext(notificationCreateOnCompleted()); + observer.onCompleted(); + }); + }, source); + }; + observableProto.repeat = function(repeatCount) { + return enumerableRepeat(this, repeatCount).concat(); + }; + observableProto.retry = function(retryCount) { + return enumerableRepeat(this, retryCount).catchError(); + }; + observableProto.retryWhen = function(notifier) { + return enumerableRepeat(this).catchErrorWhen(notifier); + }; + observableProto.scan = function() { + var hasSeed = false, + seed, + accumulator, + source = this; + if (arguments.length === 2) { + hasSeed = true; + seed = arguments[0]; + accumulator = arguments[1]; + } else { + accumulator = arguments[0]; + } + return new AnonymousObservable(function(o) { + var hasAccumulation, + accumulation, + hasValue; + return source.subscribe(function(x) { + !hasValue && (hasValue = true); + try { + if (hasAccumulation) { + accumulation = accumulator(accumulation, x); + } else { + accumulation = hasSeed ? accumulator(seed, x) : x; + hasAccumulation = true; + } + } catch (e) { + o.onError(e); + return ; + } + o.onNext(accumulation); + }, function(e) { + o.onError(e); + }, function() { + !hasValue && hasSeed && o.onNext(seed); + o.onCompleted(); + }); + }, source); + }; + observableProto.skipLast = function(count) { + if (count < 0) { + throw new ArgumentOutOfRangeError(); + } + var source = this; + return new AnonymousObservable(function(o) { + var q = []; + return source.subscribe(function(x) { + q.push(x); + q.length > count && o.onNext(q.shift()); + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, source); + }; + observableProto.startWith = function() { + var values, + scheduler, + start = 0; + if (!!arguments.length && isScheduler(arguments[0])) { + scheduler = arguments[0]; + start = 1; + } else { + scheduler = immediateScheduler; + } + for (var args = [], + i = start, + len = arguments.length; i < len; i++) { + args.push(arguments[i]); + } + return enumerableOf([observableFromArray(args, scheduler), this]).concat(); + }; + observableProto.takeLast = function(count) { + if (count < 0) { + throw new ArgumentOutOfRangeError(); + } + var source = this; + return new AnonymousObservable(function(o) { + var q = []; + return source.subscribe(function(x) { + q.push(x); + q.length > count && q.shift(); + }, function(e) { + o.onError(e); + }, function() { + while (q.length > 0) { + o.onNext(q.shift()); + } + o.onCompleted(); + }); + }, source); + }; + observableProto.takeLastBuffer = function(count) { + var source = this; + return new AnonymousObservable(function(o) { + var q = []; + return source.subscribe(function(x) { + q.push(x); + q.length > count && q.shift(); + }, function(e) { + o.onError(e); + }, function() { + o.onNext(q); + o.onCompleted(); + }); + }, source); + }; + observableProto.windowWithCount = function(count, skip) { + var source = this; + +count || (count = 0); + Math.abs(count) === Infinity && (count = 0); + if (count <= 0) { + throw new ArgumentOutOfRangeError(); + } + skip == null && (skip = count); + +skip || (skip = 0); + Math.abs(skip) === Infinity && (skip = 0); + if (skip <= 0) { + throw new ArgumentOutOfRangeError(); + } + return new AnonymousObservable(function(observer) { + var m = new SingleAssignmentDisposable(), + refCountDisposable = new RefCountDisposable(m), + n = 0, + q = []; + function createWindow() { + var s = new Subject(); + q.push(s); + observer.onNext(addRef(s, refCountDisposable)); + } + createWindow(); + m.setDisposable(source.subscribe(function(x) { + for (var i = 0, + len = q.length; i < len; i++) { + q[i].onNext(x); + } + var c = n - count + 1; + c >= 0 && c % skip === 0 && q.shift().onCompleted(); + ++n % skip === 0 && createWindow(); + }, function(e) { + while (q.length > 0) { + q.shift().onError(e); + } + observer.onError(e); + }, function() { + while (q.length > 0) { + q.shift().onCompleted(); + } + observer.onCompleted(); + })); + return refCountDisposable; + }, source); + }; + function concatMap(source, selector, thisArg) { + var selectorFunc = bindCallback(selector, thisArg, 3); + return source.map(function(x, i) { + var result = selectorFunc(x, i, source); + isPromise(result) && (result = observableFromPromise(result)); + (isArrayLike(result) || isIterable(result)) && (result = observableFrom(result)); + return result; + }).concatAll(); + } + observableProto.selectConcat = observableProto.concatMap = function(selector, resultSelector, thisArg) { + if (isFunction(selector) && isFunction(resultSelector)) { + return this.concatMap(function(x, i) { + var selectorResult = selector(x, i); + isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult)); + (isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult)); + return selectorResult.map(function(y, i2) { + return resultSelector(x, y, i, i2); + }); + }); + } + return isFunction(selector) ? concatMap(this, selector, thisArg) : concatMap(this, function() { + return selector; + }); + }; + observableProto.concatMapObserver = observableProto.selectConcatObserver = function(onNext, onError, onCompleted, thisArg) { + var source = this, + onNextFunc = bindCallback(onNext, thisArg, 2), + onErrorFunc = bindCallback(onError, thisArg, 1), + onCompletedFunc = bindCallback(onCompleted, thisArg, 0); + return new AnonymousObservable(function(observer) { + var index = 0; + return source.subscribe(function(x) { + var result; + try { + result = onNextFunc(x, index++); + } catch (e) { + observer.onError(e); + return ; + } + isPromise(result) && (result = observableFromPromise(result)); + observer.onNext(result); + }, function(err) { + var result; + try { + result = onErrorFunc(err); + } catch (e) { + observer.onError(e); + return ; + } + isPromise(result) && (result = observableFromPromise(result)); + observer.onNext(result); + observer.onCompleted(); + }, function() { + var result; + try { + result = onCompletedFunc(); + } catch (e) { + observer.onError(e); + return ; + } + isPromise(result) && (result = observableFromPromise(result)); + observer.onNext(result); + observer.onCompleted(); + }); + }, this).concatAll(); + }; + observableProto.defaultIfEmpty = function(defaultValue) { + var source = this; + defaultValue === undefined && (defaultValue = null); + return new AnonymousObservable(function(observer) { + var found = false; + return source.subscribe(function(x) { + found = true; + observer.onNext(x); + }, function(e) { + observer.onError(e); + }, function() { + !found && observer.onNext(defaultValue); + observer.onCompleted(); + }); + }, source); + }; + function arrayIndexOfComparer(array, item, comparer) { + for (var i = 0, + len = array.length; i < len; i++) { + if (comparer(array[i], item)) { + return i; + } + } + return -1; + } + function HashSet(comparer) { + this.comparer = comparer; + this.set = []; + } + HashSet.prototype.push = function(value) { + var retValue = arrayIndexOfComparer(this.set, value, this.comparer) === -1; + retValue && this.set.push(value); + return retValue; + }; + observableProto.distinct = function(keySelector, comparer) { + var source = this; + comparer || (comparer = defaultComparer); + return new AnonymousObservable(function(o) { + var hashSet = new HashSet(comparer); + return source.subscribe(function(x) { + var key = x; + if (keySelector) { + try { + key = keySelector(x); + } catch (e) { + o.onError(e); + return ; + } + } + hashSet.push(key) && o.onNext(x); + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, this); + }; + var MapObservable = (function(__super__) { + inherits(MapObservable, __super__); + function MapObservable(source, selector, thisArg) { + this.source = source; + this.selector = bindCallback(selector, thisArg, 3); + __super__.call(this); + } + MapObservable.prototype.internalMap = function(selector, thisArg) { + var self = this; + return new MapObservable(this.source, function(x, i, o) { + return selector.call(this, self.selector(x, i, o), i, o); + }, thisArg); + }; + MapObservable.prototype.subscribeCore = function(observer) { + return this.source.subscribe(new MapObserver(observer, this.selector, this)); + }; + return MapObservable; + }(ObservableBase)); + function MapObserver(observer, selector, source) { + this.observer = observer; + this.selector = selector; + this.source = source; + this.i = 0; + this.isStopped = false; + } + MapObserver.prototype.onNext = function(x) { + if (this.isStopped) { + return ; + } + var result = tryCatch(this.selector).call(this, x, this.i++, this.source); + if (result === errorObj) { + return this.observer.onError(result.e); + } + this.observer.onNext(result); + }; + MapObserver.prototype.onError = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onError(e); + } + }; + MapObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onCompleted(); + } + }; + MapObserver.prototype.dispose = function() { + this.isStopped = true; + }; + MapObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onError(e); + return true; + } + return false; + }; + observableProto.map = observableProto.select = function(selector, thisArg) { + var selectorFn = typeof selector === 'function' ? selector : function() { + return selector; + }; + return this instanceof MapObservable ? this.internalMap(selectorFn, thisArg) : new MapObservable(this, selectorFn, thisArg); + }; + observableProto.pluck = function() { + var args = arguments, + len = arguments.length; + if (len === 0) { + throw new Error('List of properties cannot be empty.'); + } + return this.map(function(x) { + var currentProp = x; + for (var i = 0; i < len; i++) { + var p = currentProp[args[i]]; + if (typeof p !== 'undefined') { + currentProp = p; + } else { + return undefined; + } + } + return currentProp; + }); + }; + observableProto.flatMapObserver = observableProto.selectManyObserver = function(onNext, onError, onCompleted, thisArg) { + var source = this; + return new AnonymousObservable(function(observer) { + var index = 0; + return source.subscribe(function(x) { + var result; + try { + result = onNext.call(thisArg, x, index++); + } catch (e) { + observer.onError(e); + return ; + } + isPromise(result) && (result = observableFromPromise(result)); + observer.onNext(result); + }, function(err) { + var result; + try { + result = onError.call(thisArg, err); + } catch (e) { + observer.onError(e); + return ; + } + isPromise(result) && (result = observableFromPromise(result)); + observer.onNext(result); + observer.onCompleted(); + }, function() { + var result; + try { + result = onCompleted.call(thisArg); + } catch (e) { + observer.onError(e); + return ; + } + isPromise(result) && (result = observableFromPromise(result)); + observer.onNext(result); + observer.onCompleted(); + }); + }, source).mergeAll(); + }; + function flatMap(source, selector, thisArg) { + var selectorFunc = bindCallback(selector, thisArg, 3); + return source.map(function(x, i) { + var result = selectorFunc(x, i, source); + isPromise(result) && (result = observableFromPromise(result)); + (isArrayLike(result) || isIterable(result)) && (result = observableFrom(result)); + return result; + }).mergeAll(); + } + observableProto.selectMany = observableProto.flatMap = function(selector, resultSelector, thisArg) { + if (isFunction(selector) && isFunction(resultSelector)) { + return this.flatMap(function(x, i) { + var selectorResult = selector(x, i); + isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult)); + (isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult)); + return selectorResult.map(function(y, i2) { + return resultSelector(x, y, i, i2); + }); + }, thisArg); + } + return isFunction(selector) ? flatMap(this, selector, thisArg) : flatMap(this, function() { + return selector; + }); + }; + observableProto.selectSwitch = observableProto.flatMapLatest = observableProto.switchMap = function(selector, thisArg) { + return this.select(selector, thisArg).switchLatest(); + }; + observableProto.skip = function(count) { + if (count < 0) { + throw new ArgumentOutOfRangeError(); + } + var source = this; + return new AnonymousObservable(function(o) { + var remaining = count; + return source.subscribe(function(x) { + if (remaining <= 0) { + o.onNext(x); + } else { + remaining--; + } + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, source); + }; + observableProto.skipWhile = function(predicate, thisArg) { + var source = this, + callback = bindCallback(predicate, thisArg, 3); + return new AnonymousObservable(function(o) { + var i = 0, + running = false; + return source.subscribe(function(x) { + if (!running) { + try { + running = !callback(x, i++, source); + } catch (e) { + o.onError(e); + return ; + } + } + running && o.onNext(x); + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, source); + }; + observableProto.take = function(count, scheduler) { + if (count < 0) { + throw new ArgumentOutOfRangeError(); + } + if (count === 0) { + return observableEmpty(scheduler); + } + var source = this; + return new AnonymousObservable(function(o) { + var remaining = count; + return source.subscribe(function(x) { + if (remaining-- > 0) { + o.onNext(x); + remaining === 0 && o.onCompleted(); + } + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, source); + }; + observableProto.takeWhile = function(predicate, thisArg) { + var source = this, + callback = bindCallback(predicate, thisArg, 3); + return new AnonymousObservable(function(o) { + var i = 0, + running = true; + return source.subscribe(function(x) { + if (running) { + try { + running = callback(x, i++, source); + } catch (e) { + o.onError(e); + return ; + } + if (running) { + o.onNext(x); + } else { + o.onCompleted(); + } + } + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, source); + }; + var FilterObservable = (function(__super__) { + inherits(FilterObservable, __super__); + function FilterObservable(source, predicate, thisArg) { + this.source = source; + this.predicate = bindCallback(predicate, thisArg, 3); + __super__.call(this); + } + FilterObservable.prototype.subscribeCore = function(observer) { + return this.source.subscribe(new FilterObserver(observer, this.predicate, this)); + }; + FilterObservable.prototype.internalFilter = function(predicate, thisArg) { + var self = this; + return new FilterObservable(this.source, function(x, i, o) { + return self.predicate(x, i, o) && predicate.call(this, x, i, o); + }, thisArg); + }; + return FilterObservable; + }(ObservableBase)); + function FilterObserver(observer, predicate, source) { + this.observer = observer; + this.predicate = predicate; + this.source = source; + this.i = 0; + this.isStopped = false; + } + FilterObserver.prototype.onNext = function(x) { + if (this.isStopped) { + return ; + } + var shouldYield = tryCatch(this.predicate).call(this, x, this.i++, this.source); + if (shouldYield === errorObj) { + return this.observer.onError(shouldYield.e); + } + shouldYield && this.observer.onNext(x); + }; + FilterObserver.prototype.onError = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onError(e); + } + }; + FilterObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onCompleted(); + } + }; + FilterObserver.prototype.dispose = function() { + this.isStopped = true; + }; + FilterObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onError(e); + return true; + } + return false; + }; + observableProto.filter = observableProto.where = function(predicate, thisArg) { + return this instanceof FilterObservable ? this.internalFilter(predicate, thisArg) : new FilterObservable(this, predicate, thisArg); + }; + observableProto.transduce = function(transducer) { + var source = this; + function transformForObserver(o) { + return { + '@@transducer/init': function() { + return o; + }, + '@@transducer/step': function(obs, input) { + return obs.onNext(input); + }, + '@@transducer/result': function(obs) { + return obs.onCompleted(); + } + }; + } + return new AnonymousObservable(function(o) { + var xform = transducer(transformForObserver(o)); + return source.subscribe(function(v) { + try { + xform['@@transducer/step'](o, v); + } catch (e) { + o.onError(e); + } + }, function(e) { + o.onError(e); + }, function() { + xform['@@transducer/result'](o); + }); + }, source); + }; + var AnonymousObservable = Rx.AnonymousObservable = (function(__super__) { + inherits(AnonymousObservable, __super__); + function fixSubscriber(subscriber) { + return subscriber && isFunction(subscriber.dispose) ? subscriber : isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty; + } + function setDisposable(s, state) { + var ado = state[0], + subscribe = state[1]; + var sub = tryCatch(subscribe)(ado); + if (sub === errorObj) { + if (!ado.fail(errorObj.e)) { + return thrower(errorObj.e); + } + } + ado.setDisposable(fixSubscriber(sub)); + } + function AnonymousObservable(subscribe, parent) { + this.source = parent; + function s(observer) { + var ado = new AutoDetachObserver(observer), + state = [ado, subscribe]; + if (currentThreadScheduler.scheduleRequired()) { + currentThreadScheduler.scheduleWithState(state, setDisposable); + } else { + setDisposable(null, state); + } + return ado; + } + __super__.call(this, s); + } + return AnonymousObservable; + }(Observable)); + var AutoDetachObserver = (function(__super__) { + inherits(AutoDetachObserver, __super__); + function AutoDetachObserver(observer) { + __super__.call(this); + this.observer = observer; + this.m = new SingleAssignmentDisposable(); + } + var AutoDetachObserverPrototype = AutoDetachObserver.prototype; + AutoDetachObserverPrototype.next = function(value) { + var result = tryCatch(this.observer.onNext).call(this.observer, value); + if (result === errorObj) { + this.dispose(); + thrower(result.e); + } + }; + AutoDetachObserverPrototype.error = function(err) { + var result = tryCatch(this.observer.onError).call(this.observer, err); + this.dispose(); + result === errorObj && thrower(result.e); + }; + AutoDetachObserverPrototype.completed = function() { + var result = tryCatch(this.observer.onCompleted).call(this.observer); + this.dispose(); + result === errorObj && thrower(result.e); + }; + AutoDetachObserverPrototype.setDisposable = function(value) { + this.m.setDisposable(value); + }; + AutoDetachObserverPrototype.getDisposable = function() { + return this.m.getDisposable(); + }; + AutoDetachObserverPrototype.dispose = function() { + __super__.prototype.dispose.call(this); + this.m.dispose(); + }; + return AutoDetachObserver; + }(AbstractObserver)); + var InnerSubscription = function(subject, observer) { + this.subject = subject; + this.observer = observer; + }; + InnerSubscription.prototype.dispose = function() { + if (!this.subject.isDisposed && this.observer !== null) { + var idx = this.subject.observers.indexOf(this.observer); + this.subject.observers.splice(idx, 1); + this.observer = null; + } + }; + var Subject = Rx.Subject = (function(__super__) { + function subscribe(observer) { + checkDisposed(this); + if (!this.isStopped) { + this.observers.push(observer); + return new InnerSubscription(this, observer); + } + if (this.hasError) { + observer.onError(this.error); + return disposableEmpty; + } + observer.onCompleted(); + return disposableEmpty; + } + inherits(Subject, __super__); + function Subject() { + __super__.call(this, subscribe); + this.isDisposed = false, this.isStopped = false, this.observers = []; + this.hasError = false; + } + addProperties(Subject.prototype, Observer.prototype, { + hasObservers: function() { + return this.observers.length > 0; + }, + onCompleted: function() { + checkDisposed(this); + if (!this.isStopped) { + this.isStopped = true; + for (var i = 0, + os = cloneArray(this.observers), + len = os.length; i < len; i++) { + os[i].onCompleted(); + } + this.observers.length = 0; + } + }, + onError: function(error) { + checkDisposed(this); + if (!this.isStopped) { + this.isStopped = true; + this.error = error; + this.hasError = true; + for (var i = 0, + os = cloneArray(this.observers), + len = os.length; i < len; i++) { + os[i].onError(error); + } + this.observers.length = 0; + } + }, + onNext: function(value) { + checkDisposed(this); + if (!this.isStopped) { + for (var i = 0, + os = cloneArray(this.observers), + len = os.length; i < len; i++) { + os[i].onNext(value); + } + } + }, + dispose: function() { + this.isDisposed = true; + this.observers = null; + } + }); + Subject.create = function(observer, observable) { + return new AnonymousSubject(observer, observable); + }; + return Subject; + }(Observable)); + var AsyncSubject = Rx.AsyncSubject = (function(__super__) { + function subscribe(observer) { + checkDisposed(this); + if (!this.isStopped) { + this.observers.push(observer); + return new InnerSubscription(this, observer); + } + if (this.hasError) { + observer.onError(this.error); + } else if (this.hasValue) { + observer.onNext(this.value); + observer.onCompleted(); + } else { + observer.onCompleted(); + } + return disposableEmpty; + } + inherits(AsyncSubject, __super__); + function AsyncSubject() { + __super__.call(this, subscribe); + this.isDisposed = false; + this.isStopped = false; + this.hasValue = false; + this.observers = []; + this.hasError = false; + } + addProperties(AsyncSubject.prototype, Observer, { + hasObservers: function() { + checkDisposed(this); + return this.observers.length > 0; + }, + onCompleted: function() { + var i, + len; + checkDisposed(this); + if (!this.isStopped) { + this.isStopped = true; + var os = cloneArray(this.observers), + len = os.length; + if (this.hasValue) { + for (i = 0; i < len; i++) { + var o = os[i]; + o.onNext(this.value); + o.onCompleted(); + } + } else { + for (i = 0; i < len; i++) { + os[i].onCompleted(); + } + } + this.observers.length = 0; + } + }, + onError: function(error) { + checkDisposed(this); + if (!this.isStopped) { + this.isStopped = true; + this.hasError = true; + this.error = error; + for (var i = 0, + os = cloneArray(this.observers), + len = os.length; i < len; i++) { + os[i].onError(error); + } + this.observers.length = 0; + } + }, + onNext: function(value) { + checkDisposed(this); + if (this.isStopped) { + return ; + } + this.value = value; + this.hasValue = true; + }, + dispose: function() { + this.isDisposed = true; + this.observers = null; + this.exception = null; + this.value = null; + } + }); + return AsyncSubject; + }(Observable)); + var AnonymousSubject = Rx.AnonymousSubject = (function(__super__) { + inherits(AnonymousSubject, __super__); + function subscribe(observer) { + return this.observable.subscribe(observer); + } + function AnonymousSubject(observer, observable) { + this.observer = observer; + this.observable = observable; + __super__.call(this, subscribe); + } + addProperties(AnonymousSubject.prototype, Observer.prototype, { + onCompleted: function() { + this.observer.onCompleted(); + }, + onError: function(error) { + this.observer.onError(error); + }, + onNext: function(value) { + this.observer.onNext(value); + } + }); + return AnonymousSubject; + }(Observable)); + if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { + root.Rx = Rx; + define(function() { + return Rx; + }); + } else if (freeExports && freeModule) { + if (moduleExports) { + (freeModule.exports = Rx).Rx = Rx; + } else { + freeExports.Rx = Rx; + } + } else { + root.Rx = Rx; + } + var rEndingLine = captureLine(); + }.call(this)); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/facade/lang", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/facade/lang"; + var _global, + Type, + isDart, + BaseException, + Math, + Date, + assertionsEnabled_, + StringWrapper, + StringJoiner, + NumberParseError, + NumberWrapper, + RegExp, + RegExpWrapper, + RegExpMatcherWrapper, + FunctionWrapper, + Json, + DateWrapper; + function getTypeNameForDebugging(type) { + return type['name']; + } + function makeTypeError(message) { + return new TypeError(message); + } + function assertionsEnabled() { + return assertionsEnabled_; + } + function ENUM_INDEX(value) { + return value; + } + function CONST_EXPR(expr) { + return expr; + } + function CONST() { + return (function(target) { + return target; + }); + } + function ABSTRACT() { + return (function(t) { + return t; + }); + } + function IMPLEMENTS(_) { + return (function(t) { + return t; + }); + } + function isPresent(obj) { + return obj !== undefined && obj !== null; + } + function isBlank(obj) { + return obj === undefined || obj === null; + } + function isString(obj) { + return typeof obj === "string"; + } + function isFunction(obj) { + return typeof obj === "function"; + } + function isType(obj) { + return isFunction(obj); + } + function isStringMap(obj) { + return typeof obj === 'object' && obj !== null; + } + function isPromise(obj) { + return obj instanceof _global.Promise; + } + function isArray(obj) { + return Array.isArray(obj); + } + function isNumber(obj) { + return typeof obj === 'number'; + } + function isDate(obj) { + return obj instanceof Date && !isNaN(obj.valueOf()); + } + function stringify(token) { + if (typeof token === 'string') { + return token; + } + if (token === undefined || token === null) { + return '' + token; + } + if (token.name) { + return token.name; + } + var res = token.toString(); + var newLineIndex = res.indexOf("\n"); + return (newLineIndex === -1) ? res : res.substring(0, newLineIndex); + } + function serializeEnum(val) { + return val; + } + function deserializeEnum(val, values) { + return val; + } + function looseIdentical(a, b) { + return a === b || typeof a === "number" && typeof b === "number" && isNaN(a) && isNaN(b); + } + function getMapKey(value) { + return value; + } + function normalizeBlank(obj) { + return isBlank(obj) ? null : obj; + } + function normalizeBool(obj) { + return isBlank(obj) ? false : obj; + } + function isJsObject(o) { + return o !== null && (typeof o === "function" || typeof o === "object"); + } + function print(obj) { + if (obj instanceof BaseException) { + console.log(obj.stack); + } else { + console.log(obj); + } + } + $__export("getTypeNameForDebugging", getTypeNameForDebugging); + $__export("makeTypeError", makeTypeError); + $__export("assertionsEnabled", assertionsEnabled); + $__export("ENUM_INDEX", ENUM_INDEX); + $__export("CONST_EXPR", CONST_EXPR); + $__export("CONST", CONST); + $__export("ABSTRACT", ABSTRACT); + $__export("IMPLEMENTS", IMPLEMENTS); + $__export("isPresent", isPresent); + $__export("isBlank", isBlank); + $__export("isString", isString); + $__export("isFunction", isFunction); + $__export("isType", isType); + $__export("isStringMap", isStringMap); + $__export("isPromise", isPromise); + $__export("isArray", isArray); + $__export("isNumber", isNumber); + $__export("isDate", isDate); + $__export("stringify", stringify); + $__export("serializeEnum", serializeEnum); + $__export("deserializeEnum", deserializeEnum); + $__export("looseIdentical", looseIdentical); + $__export("getMapKey", getMapKey); + $__export("normalizeBlank", normalizeBlank); + $__export("normalizeBool", normalizeBool); + $__export("isJsObject", isJsObject); + $__export("print", print); + return { + setters: [], + execute: function() { + _global = (typeof window === 'undefined' ? global : window); + $__export("global", _global); + Type = Function; + $__export("Type", Type); + isDart = false; + $__export("isDart", isDart); + BaseException = (function($__super) { + function BaseException(message, _originalException, _originalStack, _context) { + $traceurRuntime.superConstructor(BaseException).call(this, message); + this.message = message; + this._originalException = _originalException; + this._originalStack = _originalStack; + this._context = _context; + this.stack = (new Error(message)).stack; + } + return ($traceurRuntime.createClass)(BaseException, { + get originalException() { + return this._originalException; + }, + get originalStack() { + return this._originalStack; + }, + get context() { + return this._context; + }, + toString: function() { + return this.message; + } + }, {}, $__super); + }(Error)); + $__export("BaseException", BaseException); + Math = _global.Math; + $__export("Math", Math); + Date = _global.Date; + $__export("Date", Date); + assertionsEnabled_ = typeof _global['assert'] !== 'undefined'; + _global.assert = function assert(condition) { + if (assertionsEnabled_) { + _global['assert'].call(condition); + } + }; + StringWrapper = (function() { + function StringWrapper() {} + return ($traceurRuntime.createClass)(StringWrapper, {}, { + fromCharCode: function(code) { + return String.fromCharCode(code); + }, + charCodeAt: function(s, index) { + return s.charCodeAt(index); + }, + split: function(s, regExp) { + return s.split(regExp); + }, + equals: function(s, s2) { + return s === s2; + }, + replace: function(s, from, replace) { + return s.replace(from, replace); + }, + replaceAll: function(s, from, replace) { + return s.replace(from, replace); + }, + toUpperCase: function(s) { + return s.toUpperCase(); + }, + toLowerCase: function(s) { + return s.toLowerCase(); + }, + startsWith: function(s, start) { + return s.startsWith(start); + }, + substring: function(s, start) { + var end = arguments[2] !== (void 0) ? arguments[2] : null; + return s.substring(start, end === null ? undefined : end); + }, + replaceAllMapped: function(s, from, cb) { + return s.replace(from, function() { + for (var matches = [], + $__1 = 0; $__1 < arguments.length; $__1++) + matches[$__1] = arguments[$__1]; + matches.splice(-2, 2); + return cb(matches); + }); + }, + contains: function(s, substr) { + return s.indexOf(substr) != -1; + }, + compare: function(a, b) { + if (a < b) { + return -1; + } else if (a > b) { + return 1; + } else { + return 0; + } + } + }); + }()); + $__export("StringWrapper", StringWrapper); + StringJoiner = (function() { + function StringJoiner() { + var parts = arguments[0] !== (void 0) ? arguments[0] : []; + this.parts = parts; + } + return ($traceurRuntime.createClass)(StringJoiner, { + add: function(part) { + this.parts.push(part); + }, + toString: function() { + return this.parts.join(""); + } + }, {}); + }()); + $__export("StringJoiner", StringJoiner); + NumberParseError = (function($__super) { + function NumberParseError(message) { + $traceurRuntime.superConstructor(NumberParseError).call(this); + this.message = message; + } + return ($traceurRuntime.createClass)(NumberParseError, {toString: function() { + return this.message; + }}, {}, $__super); + }(BaseException)); + $__export("NumberParseError", NumberParseError); + NumberWrapper = (function() { + function NumberWrapper() {} + return ($traceurRuntime.createClass)(NumberWrapper, {}, { + toFixed: function(n, fractionDigits) { + return n.toFixed(fractionDigits); + }, + equal: function(a, b) { + return a === b; + }, + parseIntAutoRadix: function(text) { + var result = parseInt(text); + if (isNaN(result)) { + throw new NumberParseError("Invalid integer literal when parsing " + text); + } + return result; + }, + parseInt: function(text, radix) { + if (radix == 10) { + if (/^(\-|\+)?[0-9]+$/.test(text)) { + return parseInt(text, radix); + } + } else if (radix == 16) { + if (/^(\-|\+)?[0-9ABCDEFabcdef]+$/.test(text)) { + return parseInt(text, radix); + } + } else { + var result = parseInt(text, radix); + if (!isNaN(result)) { + return result; + } + } + throw new NumberParseError("Invalid integer literal when parsing " + text + " in base " + radix); + }, + parseFloat: function(text) { + return parseFloat(text); + }, + get NaN() { + return NaN; + }, + isNaN: function(value) { + return isNaN(value); + }, + isInteger: function(value) { + return Number.isInteger(value); + } + }); + }()); + $__export("NumberWrapper", NumberWrapper); + RegExp = _global.RegExp; + $__export("RegExp", RegExp); + RegExpWrapper = (function() { + function RegExpWrapper() {} + return ($traceurRuntime.createClass)(RegExpWrapper, {}, { + create: function(regExpStr) { + var flags = arguments[1] !== (void 0) ? arguments[1] : ''; + flags = flags.replace(/g/g, ''); + return new _global.RegExp(regExpStr, flags + 'g'); + }, + firstMatch: function(regExp, input) { + regExp.lastIndex = 0; + return regExp.exec(input); + }, + test: function(regExp, input) { + return regExp.test(input); + }, + matcher: function(regExp, input) { + regExp.lastIndex = 0; + return { + re: regExp, + input: input + }; + } + }); + }()); + $__export("RegExpWrapper", RegExpWrapper); + RegExpMatcherWrapper = (function() { + function RegExpMatcherWrapper() {} + return ($traceurRuntime.createClass)(RegExpMatcherWrapper, {}, {next: function(matcher) { + return matcher.re.exec(matcher.input); + }}); + }()); + $__export("RegExpMatcherWrapper", RegExpMatcherWrapper); + FunctionWrapper = (function() { + function FunctionWrapper() {} + return ($traceurRuntime.createClass)(FunctionWrapper, {}, {apply: function(fn, posArgs) { + return fn.apply(null, posArgs); + }}); + }()); + $__export("FunctionWrapper", FunctionWrapper); + Json = (function() { + function Json() {} + return ($traceurRuntime.createClass)(Json, {}, { + parse: function(s) { + return _global.JSON.parse(s); + }, + stringify: function(data) { + return _global.JSON.stringify(data, null, 2); + } + }); + }()); + $__export("Json", Json); + DateWrapper = (function() { + function DateWrapper() {} + return ($traceurRuntime.createClass)(DateWrapper, {}, { + create: function(year) { + var month = arguments[1] !== (void 0) ? arguments[1] : 1; + var day = arguments[2] !== (void 0) ? arguments[2] : 1; + var hour = arguments[3] !== (void 0) ? arguments[3] : 0; + var minutes = arguments[4] !== (void 0) ? arguments[4] : 0; + var seconds = arguments[5] !== (void 0) ? arguments[5] : 0; + var milliseconds = arguments[6] !== (void 0) ? arguments[6] : 0; + return new Date(year, month - 1, day, hour, minutes, seconds, milliseconds); + }, + fromMillis: function(ms) { + return new Date(ms); + }, + toMillis: function(date) { + return date.getTime(); + }, + now: function() { + return new Date(); + }, + toJson: function(date) { + return date.toJSON(); + } + }); + }()); + $__export("DateWrapper", DateWrapper); + } + }; +}); + +System.register("angular2/src/util/decorators", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/util/decorators"; + var global, + isFunction, + stringify, + Reflect; + function extractAnnotation(annotation) { + if (isFunction(annotation) && annotation.hasOwnProperty('annotation')) { + annotation = annotation.annotation; + } + return annotation; + } + function applyParams(fnOrArray, key) { + if (fnOrArray === Object || fnOrArray === String || fnOrArray === Function || fnOrArray === Number || fnOrArray === Array) { + throw new Error(("Can not use native " + stringify(fnOrArray) + " as constructor")); + } + if (isFunction(fnOrArray)) { + return fnOrArray; + } else if (fnOrArray instanceof Array) { + var annotations = fnOrArray; + var fn = fnOrArray[fnOrArray.length - 1]; + if (!isFunction(fn)) { + throw new Error(("Last position of Class method array must be Function in key " + key + " was '" + stringify(fn) + "'")); + } + var annoLength = annotations.length - 1; + if (annoLength != fn.length) { + throw new Error(("Number of annotations (" + annoLength + ") does not match number of arguments (" + fn.length + ") in the function: " + stringify(fn))); + } + var paramsAnnotations = []; + for (var i = 0, + ii = annotations.length - 1; i < ii; i++) { + var paramAnnotations = []; + paramsAnnotations.push(paramAnnotations); + var annotation = annotations[i]; + if (annotation instanceof Array) { + for (var j = 0; j < annotation.length; j++) { + paramAnnotations.push(extractAnnotation(annotation[j])); + } + } else if (isFunction(annotation)) { + paramAnnotations.push(extractAnnotation(annotation)); + } else { + paramAnnotations.push(annotation); + } + } + Reflect.defineMetadata('parameters', paramsAnnotations, fn); + return fn; + } else { + throw new Error(("Only Function or Array is supported in Class definition for key '" + key + "' is '" + stringify(fnOrArray) + "'")); + } + } + function Class(clsDef) { + var constructor = applyParams(clsDef.hasOwnProperty('constructor') ? clsDef.constructor : undefined, 'constructor'); + var proto = constructor.prototype; + if (clsDef.hasOwnProperty('extends')) { + if (isFunction(clsDef.extends)) { + constructor.prototype = proto = Object.create(clsDef.extends.prototype); + } else { + throw new Error(("Class definition 'extends' property must be a constructor function was: " + stringify(clsDef.extends))); + } + } + for (var key in clsDef) { + if (key != 'extends' && key != 'prototype' && clsDef.hasOwnProperty(key)) { + proto[key] = applyParams(clsDef[key], key); + } + } + if (this && this.annotations instanceof Array) { + Reflect.defineMetadata('annotations', this.annotations, constructor); + } + return constructor; + } + function makeDecorator(annotationCls) { + var chainFn = arguments[1] !== (void 0) ? arguments[1] : null; + function DecoratorFactory(objOrType) { + var annotationInstance = new annotationCls(objOrType); + if (this instanceof annotationCls) { + return annotationInstance; + } else { + var chainAnnotation = isFunction(this) && this.annotations instanceof Array ? this.annotations : []; + chainAnnotation.push(annotationInstance); + var TypeDecorator = function TypeDecorator(cls) { + var annotations = Reflect.getMetadata('annotations', cls); + annotations = annotations || []; + annotations.push(annotationInstance); + Reflect.defineMetadata('annotations', annotations, cls); + return cls; + }; + TypeDecorator.annotations = chainAnnotation; + TypeDecorator.Class = Class; + if (chainFn) + chainFn(TypeDecorator); + return TypeDecorator; + } + } + DecoratorFactory.prototype = Object.create(annotationCls.prototype); + return DecoratorFactory; + } + function makeParamDecorator(annotationCls) { + function ParamDecoratorFactory() { + for (var args = [], + $__0 = 0; $__0 < arguments.length; $__0++) + args[$__0] = arguments[$__0]; + var annotationInstance = Object.create(annotationCls.prototype); + annotationCls.apply(annotationInstance, args); + if (this instanceof annotationCls) { + return annotationInstance; + } else { + ParamDecorator.annotation = annotationInstance; + return ParamDecorator; + } + function ParamDecorator(cls, unusedKey, index) { + var parameters = Reflect.getMetadata('parameters', cls); + parameters = parameters || []; + while (parameters.length <= index) { + parameters.push(null); + } + parameters[index] = parameters[index] || []; + var annotationsForParam = parameters[index]; + annotationsForParam.push(annotationInstance); + Reflect.defineMetadata('parameters', parameters, cls); + return cls; + } + } + ParamDecoratorFactory.prototype = Object.create(annotationCls.prototype); + return ParamDecoratorFactory; + } + $__export("Class", Class); + $__export("makeDecorator", makeDecorator); + $__export("makeParamDecorator", makeParamDecorator); + return { + setters: [function($__m) { + global = $__m.global; + isFunction = $__m.isFunction; + stringify = $__m.stringify; + }], + execute: function() { + Reflect = global.Reflect; + if (!(Reflect && Reflect.getMetadata)) { + throw 'reflect-metadata shim is required when using class decorators'; + } + } + }; +}); + +System.register("angular2/src/di/forward_ref", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/forward_ref"; + var stringify, + isFunction; + function forwardRef(forwardRefFn) { + forwardRefFn.__forward_ref__ = forwardRef; + forwardRefFn.toString = function() { + return stringify(this()); + }; + return forwardRefFn; + } + function resolveForwardRef(type) { + if (isFunction(type) && type.hasOwnProperty('__forward_ref__') && type.__forward_ref__ === forwardRef) { + return type(); + } else { + return type; + } + } + $__export("forwardRef", forwardRef); + $__export("resolveForwardRef", resolveForwardRef); + return { + setters: [function($__m) { + stringify = $__m.stringify; + isFunction = $__m.isFunction; + }], + execute: function() { + } + }; +}); + +System.register("angular2/src/facade/collection", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/facade/collection"; + var isJsObject, + global, + isPresent, + isArray, + List, + Map, + Set, + StringMap, + createMapFromPairs, + createMapFromMap, + _clearValues, + MapWrapper, + StringMapWrapper, + ListWrapper, + createSetFromList, + SetWrapper; + function isListLikeIterable(obj) { + if (!isJsObject(obj)) + return false; + return isArray(obj) || (!(obj instanceof Map) && Symbol.iterator in obj); + } + function iterateListLike(obj, fn) { + if (isArray(obj)) { + for (var i = 0; i < obj.length; i++) { + fn(obj[i]); + } + } else { + var iterator = obj[Symbol.iterator](); + var item; + while (!((item = iterator.next()).done)) { + fn(item.value); + } + } + } + $__export("isListLikeIterable", isListLikeIterable); + $__export("iterateListLike", iterateListLike); + return { + setters: [function($__m) { + isJsObject = $__m.isJsObject; + global = $__m.global; + isPresent = $__m.isPresent; + isArray = $__m.isArray; + }], + execute: function() { + List = global.Array; + $__export("List", List); + Map = global.Map; + $__export("Map", Map); + Set = global.Set; + $__export("Set", Set); + StringMap = global.Object; + $__export("StringMap", StringMap); + createMapFromPairs = (function() { + try { + if (new Map([1, 2]).size === 2) { + return function createMapFromPairs(pairs) { + return new Map(pairs); + }; + } + } catch (e) {} + return function createMapAndPopulateFromPairs(pairs) { + var map = new Map(); + for (var i = 0; i < pairs.length; i++) { + var pair = pairs[i]; + map.set(pair[0], pair[1]); + } + return map; + }; + })(); + createMapFromMap = (function() { + try { + if (new Map(new Map())) { + return function createMapFromMap(m) { + return new Map(m); + }; + } + } catch (e) {} + return function createMapAndPopulateFromMap(m) { + var map = new Map(); + m.forEach((function(v, k) { + map.set(k, v); + })); + return map; + }; + })(); + _clearValues = (function() { + if ((new Map()).keys().next) { + return function _clearValues(m) { + var keyIterator = m.keys(); + var k; + while (!((k = keyIterator.next()).done)) { + m.set(k.value, null); + } + }; + } else { + return function _clearValuesWithForeEach(m) { + m.forEach((function(v, k) { + m.set(k, null); + })); + }; + } + })(); + MapWrapper = (function() { + function MapWrapper() {} + return ($traceurRuntime.createClass)(MapWrapper, {}, { + clone: function(m) { + return createMapFromMap(m); + }, + createFromStringMap: function(stringMap) { + var result = new Map(); + for (var prop in stringMap) { + result.set(prop, stringMap[prop]); + } + return result; + }, + toStringMap: function(m) { + var r = {}; + m.forEach((function(v, k) { + return r[k] = v; + })); + return r; + }, + createFromPairs: function(pairs) { + return createMapFromPairs(pairs); + }, + forEach: function(m, fn) { + m.forEach(fn); + }, + get: function(map, key) { + return map.get(key); + }, + size: function(m) { + return m.size; + }, + delete: function(m, k) { + m.delete(k); + }, + clearValues: function(m) { + _clearValues(m); + }, + iterable: function(m) { + return m; + }, + keys: function(m) { + return Array.from(m.keys()); + }, + values: function(m) { + return Array.from(m.values()); + } + }); + }()); + $__export("MapWrapper", MapWrapper); + StringMapWrapper = (function() { + function StringMapWrapper() {} + return ($traceurRuntime.createClass)(StringMapWrapper, {}, { + create: function() { + return {}; + }, + contains: function(map, key) { + return map.hasOwnProperty(key); + }, + get: function(map, key) { + return map.hasOwnProperty(key) ? map[key] : undefined; + }, + set: function(map, key, value) { + map[key] = value; + }, + keys: function(map) { + return Object.keys(map); + }, + isEmpty: function(map) { + for (var prop in map) { + return false; + } + return true; + }, + delete: function(map, key) { + delete map[key]; + }, + forEach: function(map, callback) { + for (var prop in map) { + if (map.hasOwnProperty(prop)) { + callback(map[prop], prop); + } + } + }, + merge: function(m1, m2) { + var m = {}; + for (var attr in m1) { + if (m1.hasOwnProperty(attr)) { + m[attr] = m1[attr]; + } + } + for (var attr in m2) { + if (m2.hasOwnProperty(attr)) { + m[attr] = m2[attr]; + } + } + return m; + }, + equals: function(m1, m2) { + var k1 = Object.keys(m1); + var k2 = Object.keys(m2); + if (k1.length != k2.length) { + return false; + } + var key; + for (var i = 0; i < k1.length; i++) { + key = k1[i]; + if (m1[key] !== m2[key]) { + return false; + } + } + return true; + } + }); + }()); + $__export("StringMapWrapper", StringMapWrapper); + ListWrapper = (function() { + function ListWrapper() {} + return ($traceurRuntime.createClass)(ListWrapper, {}, { + createFixedSize: function(size) { + return new List(size); + }, + createGrowableSize: function(size) { + return new List(size); + }, + get: function(m, k) { + return m[k]; + }, + set: function(m, k, v) { + m[k] = v; + }, + clone: function(array) { + return array.slice(0); + }, + map: function(array, fn) { + return array.map(fn); + }, + forEach: function(array, fn) { + for (var i = 0; i < array.length; i++) { + fn(array[i]); + } + }, + first: function(array) { + if (!array) + return null; + return array[0]; + }, + last: function(array) { + if (!array || array.length == 0) + return null; + return array[array.length - 1]; + }, + find: function(list, pred) { + for (var i = 0; i < list.length; ++i) { + if (pred(list[i])) + return list[i]; + } + return null; + }, + indexOf: function(array, value) { + var startIndex = arguments[2] !== (void 0) ? arguments[2] : 0; + return array.indexOf(value, startIndex); + }, + reduce: function(list, fn, init) { + return list.reduce(fn, init); + }, + filter: function(array, pred) { + return array.filter(pred); + }, + any: function(list, pred) { + for (var i = 0; i < list.length; ++i) { + if (pred(list[i])) + return true; + } + return false; + }, + contains: function(list, el) { + return list.indexOf(el) !== -1; + }, + reversed: function(array) { + var a = ListWrapper.clone(array); + return a.reverse(); + }, + concat: function(a, b) { + return a.concat(b); + }, + insert: function(list, index, value) { + list.splice(index, 0, value); + }, + removeAt: function(list, index) { + var res = list[index]; + list.splice(index, 1); + return res; + }, + removeAll: function(list, items) { + for (var i = 0; i < items.length; ++i) { + var index = list.indexOf(items[i]); + list.splice(index, 1); + } + }, + removeLast: function(list) { + return list.pop(); + }, + remove: function(list, el) { + var index = list.indexOf(el); + if (index > -1) { + list.splice(index, 1); + return true; + } + return false; + }, + clear: function(list) { + list.splice(0, list.length); + }, + join: function(list, s) { + return list.join(s); + }, + isEmpty: function(list) { + return list.length == 0; + }, + fill: function(list, value) { + var start = arguments[2] !== (void 0) ? arguments[2] : 0; + var end = arguments[3] !== (void 0) ? arguments[3] : null; + list.fill(value, start, end === null ? undefined : end); + }, + equals: function(a, b) { + if (a.length != b.length) + return false; + for (var i = 0; i < a.length; ++i) { + if (a[i] !== b[i]) + return false; + } + return true; + }, + slice: function(l) { + var from = arguments[1] !== (void 0) ? arguments[1] : 0; + var to = arguments[2] !== (void 0) ? arguments[2] : null; + return l.slice(from, to === null ? undefined : to); + }, + splice: function(l, from, length) { + return l.splice(from, length); + }, + sort: function(l, compareFn) { + if (isPresent(compareFn)) { + l.sort(compareFn); + } else { + l.sort(); + } + }, + toString: function(l) { + return l.toString(); + }, + toJSON: function(l) { + return JSON.stringify(l); + } + }); + }()); + $__export("ListWrapper", ListWrapper); + createSetFromList = (function() { + var test = new Set([1, 2, 3]); + if (test.size === 3) { + return function createSetFromList(lst) { + return new Set(lst); + }; + } else { + return function createSetAndPopulateFromList(lst) { + var res = new Set(lst); + if (res.size !== lst.length) { + for (var i = 0; i < lst.length; i++) { + res.add(lst[i]); + } + } + return res; + }; + } + })(); + SetWrapper = (function() { + function SetWrapper() {} + return ($traceurRuntime.createClass)(SetWrapper, {}, { + createFromList: function(lst) { + return createSetFromList(lst); + }, + has: function(s, key) { + return s.has(key); + }, + delete: function(m, k) { + m.delete(k); + } + }); + }()); + $__export("SetWrapper", SetWrapper); + } + }; +}); + +System.register("angular2/src/reflection/reflector", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/reflection/reflector"; + var isPresent, + Map, + StringMapWrapper, + ReflectionInfo, + Reflector; + function _mergeMaps(target, config) { + StringMapWrapper.forEach(config, (function(v, k) { + return target.set(k, v); + })); + } + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + Map = $__m.Map; + StringMapWrapper = $__m.StringMapWrapper; + }], + execute: function() { + ReflectionInfo = (function() { + function ReflectionInfo(annotations, parameters, factory, interfaces) { + this._annotations = annotations; + this._parameters = parameters; + this._factory = factory; + this._interfaces = interfaces; + } + return ($traceurRuntime.createClass)(ReflectionInfo, {}, {}); + }()); + $__export("ReflectionInfo", ReflectionInfo); + Reflector = (function() { + function Reflector(reflectionCapabilities) { + this._injectableInfo = new Map(); + this._getters = new Map(); + this._setters = new Map(); + this._methods = new Map(); + this.reflectionCapabilities = reflectionCapabilities; + } + return ($traceurRuntime.createClass)(Reflector, { + isReflectionEnabled: function() { + return this.reflectionCapabilities.isReflectionEnabled(); + }, + registerFunction: function(func, funcInfo) { + this._injectableInfo.set(func, funcInfo); + }, + registerType: function(type, typeInfo) { + this._injectableInfo.set(type, typeInfo); + }, + registerGetters: function(getters) { + _mergeMaps(this._getters, getters); + }, + registerSetters: function(setters) { + _mergeMaps(this._setters, setters); + }, + registerMethods: function(methods) { + _mergeMaps(this._methods, methods); + }, + factory: function(type) { + if (this._containsReflectionInfo(type)) { + var res = this._injectableInfo.get(type)._factory; + return isPresent(res) ? res : null; + } else { + return this.reflectionCapabilities.factory(type); + } + }, + parameters: function(typeOrFunc) { + if (this._injectableInfo.has(typeOrFunc)) { + var res = this._injectableInfo.get(typeOrFunc)._parameters; + return isPresent(res) ? res : []; + } else { + return this.reflectionCapabilities.parameters(typeOrFunc); + } + }, + annotations: function(typeOrFunc) { + if (this._injectableInfo.has(typeOrFunc)) { + var res = this._injectableInfo.get(typeOrFunc)._annotations; + return isPresent(res) ? res : []; + } else { + return this.reflectionCapabilities.annotations(typeOrFunc); + } + }, + interfaces: function(type) { + if (this._injectableInfo.has(type)) { + var res = this._injectableInfo.get(type)._interfaces; + return isPresent(res) ? res : []; + } else { + return this.reflectionCapabilities.interfaces(type); + } + }, + getter: function(name) { + if (this._getters.has(name)) { + return this._getters.get(name); + } else { + return this.reflectionCapabilities.getter(name); + } + }, + setter: function(name) { + if (this._setters.has(name)) { + return this._setters.get(name); + } else { + return this.reflectionCapabilities.setter(name); + } + }, + method: function(name) { + if (this._methods.has(name)) { + return this._methods.get(name); + } else { + return this.reflectionCapabilities.method(name); + } + }, + _containsReflectionInfo: function(typeOrFunc) { + return this._injectableInfo.has(typeOrFunc); + } + }, {}); + }()); + $__export("Reflector", Reflector); + } + }; +}); + +System.register("angular2/src/reflection/reflection_capabilities", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/reflection/reflection_capabilities"; + var isPresent, + isFunction, + global, + stringify, + BaseException, + ListWrapper, + ReflectionCapabilities; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + isFunction = $__m.isFunction; + global = $__m.global; + stringify = $__m.stringify; + BaseException = $__m.BaseException; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }], + execute: function() { + ReflectionCapabilities = (function() { + function ReflectionCapabilities(reflect) { + this._reflect = isPresent(reflect) ? reflect : global.Reflect; + } + return ($traceurRuntime.createClass)(ReflectionCapabilities, { + isReflectionEnabled: function() { + return true; + }, + factory: function(t) { + switch (t.length) { + case 0: + return (function() { + return new t(); + }); + case 1: + return (function(a1) { + return new t(a1); + }); + case 2: + return (function(a1, a2) { + return new t(a1, a2); + }); + case 3: + return (function(a1, a2, a3) { + return new t(a1, a2, a3); + }); + case 4: + return (function(a1, a2, a3, a4) { + return new t(a1, a2, a3, a4); + }); + case 5: + return (function(a1, a2, a3, a4, a5) { + return new t(a1, a2, a3, a4, a5); + }); + case 6: + return (function(a1, a2, a3, a4, a5, a6) { + return new t(a1, a2, a3, a4, a5, a6); + }); + case 7: + return (function(a1, a2, a3, a4, a5, a6, a7) { + return new t(a1, a2, a3, a4, a5, a6, a7); + }); + case 8: + return (function(a1, a2, a3, a4, a5, a6, a7, a8) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8); + }); + case 9: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9); + }); + case 10: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + }); + case 11: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + }); + case 12: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + }); + case 13: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + }); + case 14: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + }); + case 15: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + }); + case 16: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + }); + case 17: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); + }); + case 18: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); + }); + case 19: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); + }); + case 20: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + }); + } + ; + throw new Error(("Cannot create a factory for '" + stringify(t) + "' because its constructor has more than 20 arguments")); + }, + _zipTypesAndAnnotaions: function(paramTypes, paramAnnotations) { + var result; + if (typeof paramTypes === 'undefined') { + result = ListWrapper.createFixedSize(paramAnnotations.length); + } else { + result = ListWrapper.createFixedSize(paramTypes.length); + } + for (var i = 0; i < result.length; i++) { + if (typeof paramTypes === 'undefined') { + result[i] = []; + } else if (paramTypes[i] != Object) { + result[i] = [paramTypes[i]]; + } else { + result[i] = []; + } + if (isPresent(paramAnnotations) && isPresent(paramAnnotations[i])) { + result[i] = result[i].concat(paramAnnotations[i]); + } + } + return result; + }, + parameters: function(typeOfFunc) { + if (isPresent(typeOfFunc.parameters)) { + return typeOfFunc.parameters; + } + if (isPresent(this._reflect) && isPresent(this._reflect.getMetadata)) { + var paramAnnotations = this._reflect.getMetadata('parameters', typeOfFunc); + var paramTypes = this._reflect.getMetadata('design:paramtypes', typeOfFunc); + if (isPresent(paramTypes) || isPresent(paramAnnotations)) { + return this._zipTypesAndAnnotaions(paramTypes, paramAnnotations); + } + } + return ListWrapper.createFixedSize(typeOfFunc.length); + }, + annotations: function(typeOfFunc) { + if (isPresent(typeOfFunc.annotations)) { + var annotations = typeOfFunc.annotations; + if (isFunction(annotations) && annotations.annotations) { + annotations = annotations.annotations; + } + return annotations; + } + if (isPresent(this._reflect) && isPresent(this._reflect.getMetadata)) { + var annotations = this._reflect.getMetadata('annotations', typeOfFunc); + if (isPresent(annotations)) + return annotations; + } + return []; + }, + interfaces: function(type) { + throw new BaseException("JavaScript does not support interfaces"); + }, + getter: function(name) { + return new Function('o', 'return o.' + name + ';'); + }, + setter: function(name) { + return new Function('o', 'v', 'return o.' + name + ' = v;'); + }, + method: function(name) { + var functionBody = ("if (!o." + name + ") throw new Error('\"" + name + "\" is undefined');\n return o." + name + ".apply(o, args);"); + return new Function('o', 'args', functionBody); + } + }, {}); + }()); + $__export("ReflectionCapabilities", ReflectionCapabilities); + } + }; +}); + +System.register("angular2/src/di/type_literal", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/type_literal"; + var TypeLiteral; + return { + setters: [], + execute: function() { + TypeLiteral = (function() { + function TypeLiteral() {} + return ($traceurRuntime.createClass)(TypeLiteral, {get type() { + throw new Error("Type literals are only supported in Dart"); + }}, {}); + }()); + $__export("TypeLiteral", TypeLiteral); + } + }; +}); + +System.register("angular2/src/di/exceptions", ["angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/exceptions"; + var ListWrapper, + stringify, + BaseException, + isBlank, + AbstractBindingError, + NoBindingError, + CyclicDependencyError, + InstantiationError, + InvalidBindingError, + NoAnnotationError, + OutOfBoundsError; + function findFirstClosedCycle(keys) { + var res = []; + for (var i = 0; i < keys.length; ++i) { + if (ListWrapper.contains(res, keys[i])) { + res.push(keys[i]); + return res; + } else { + res.push(keys[i]); + } + } + return res; + } + function constructResolvingPath(keys) { + if (keys.length > 1) { + var reversed = findFirstClosedCycle(ListWrapper.reversed(keys)); + var tokenStrs = ListWrapper.map(reversed, (function(k) { + return stringify(k.token); + })); + return " (" + tokenStrs.join(' -> ') + ")"; + } else { + return ""; + } + } + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + stringify = $__m.stringify; + BaseException = $__m.BaseException; + isBlank = $__m.isBlank; + }], + execute: function() { + AbstractBindingError = (function($__super) { + function AbstractBindingError(injector, key, constructResolvingMessage, originalException, originalStack) { + $traceurRuntime.superConstructor(AbstractBindingError).call(this, "DI Exception", originalException, originalStack, null); + this.keys = [key]; + this.injectors = [injector]; + this.constructResolvingMessage = constructResolvingMessage; + this.message = this.constructResolvingMessage(this.keys); + } + return ($traceurRuntime.createClass)(AbstractBindingError, { + addKey: function(injector, key) { + this.injectors.push(injector); + this.keys.push(key); + this.message = this.constructResolvingMessage(this.keys); + }, + get context() { + return this.injectors[this.injectors.length - 1].debugContext(); + }, + toString: function() { + return this.message; + } + }, {}, $__super); + }(BaseException)); + $__export("AbstractBindingError", AbstractBindingError); + NoBindingError = (function($__super) { + function NoBindingError(injector, key) { + $traceurRuntime.superConstructor(NoBindingError).call(this, injector, key, function(keys) { + var first = stringify(ListWrapper.first(keys).token); + return ("No provider for " + first + "!" + constructResolvingPath(keys)); + }); + } + return ($traceurRuntime.createClass)(NoBindingError, {}, {}, $__super); + }(AbstractBindingError)); + $__export("NoBindingError", NoBindingError); + CyclicDependencyError = (function($__super) { + function CyclicDependencyError(injector, key) { + $traceurRuntime.superConstructor(CyclicDependencyError).call(this, injector, key, function(keys) { + return ("Cannot instantiate cyclic dependency!" + constructResolvingPath(keys)); + }); + } + return ($traceurRuntime.createClass)(CyclicDependencyError, {}, {}, $__super); + }(AbstractBindingError)); + $__export("CyclicDependencyError", CyclicDependencyError); + InstantiationError = (function($__super) { + function InstantiationError(injector, originalException, originalStack, key) { + $traceurRuntime.superConstructor(InstantiationError).call(this, injector, key, function(keys) { + var first = stringify(ListWrapper.first(keys).token); + return ("Error during instantiation of " + first + "!" + constructResolvingPath(keys) + "."); + }, originalException, originalStack); + this.causeKey = key; + } + return ($traceurRuntime.createClass)(InstantiationError, {}, {}, $__super); + }(AbstractBindingError)); + $__export("InstantiationError", InstantiationError); + InvalidBindingError = (function($__super) { + function InvalidBindingError(binding) { + $traceurRuntime.superConstructor(InvalidBindingError).call(this); + this.message = "Invalid binding - only instances of Binding and Type are allowed, got: " + binding.toString(); + } + return ($traceurRuntime.createClass)(InvalidBindingError, {toString: function() { + return this.message; + }}, {}, $__super); + }(BaseException)); + $__export("InvalidBindingError", InvalidBindingError); + NoAnnotationError = (function($__super) { + function NoAnnotationError(typeOrFunc, params) { + $traceurRuntime.superConstructor(NoAnnotationError).call(this); + var signature = []; + for (var i = 0, + ii = params.length; i < ii; i++) { + var parameter = params[i]; + if (isBlank(parameter) || parameter.length == 0) { + signature.push('?'); + } else { + signature.push(ListWrapper.map(parameter, stringify).join(' ')); + } + } + this.message = "Cannot resolve all parameters for " + stringify(typeOrFunc) + "(" + signature.join(', ') + "). " + 'Make sure they all have valid type or annotations.'; + } + return ($traceurRuntime.createClass)(NoAnnotationError, {toString: function() { + return this.message; + }}, {}, $__super); + }(BaseException)); + $__export("NoAnnotationError", NoAnnotationError); + OutOfBoundsError = (function($__super) { + function OutOfBoundsError(index) { + $traceurRuntime.superConstructor(OutOfBoundsError).call(this); + this.message = ("Index " + index + " is out-of-bounds."); + } + return ($traceurRuntime.createClass)(OutOfBoundsError, {toString: function() { + return this.message; + }}, {}, $__super); + }(BaseException)); + $__export("OutOfBoundsError", OutOfBoundsError); + } + }; +}); + +System.register("angular2/src/di/opaque_token", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/opaque_token"; + var __decorate, + __metadata, + CONST, + OpaqueToken; + return { + setters: [function($__m) { + CONST = $__m.CONST; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + OpaqueToken = (($traceurRuntime.createClass)(function(desc) { + this._desc = 'Token(' + desc + ')'; + }, {toString: function() { + return this._desc; + }}, {})); + $__export("OpaqueToken", OpaqueToken); + $__export("OpaqueToken", OpaqueToken = __decorate([CONST(), __metadata('design:paramtypes', [String])], OpaqueToken)); + } + }; +}); + +System.register("angular2/src/dom/dom_adapter", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/dom/dom_adapter"; + var BaseException, + isBlank, + DOM, + DomAdapter; + function setRootDomAdapter(adapter) { + if (isBlank(DOM)) { + $__export("DOM", DOM = adapter); + } + } + function _abstract() { + return new BaseException('This method is abstract'); + } + $__export("setRootDomAdapter", setRootDomAdapter); + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + isBlank = $__m.isBlank; + }], + execute: function() { + $__export("DOM", DOM); + DomAdapter = (function() { + function DomAdapter() {} + return ($traceurRuntime.createClass)(DomAdapter, { + hasProperty: function(element, name) { + throw _abstract(); + }, + setProperty: function(el, name, value) { + throw _abstract(); + }, + getProperty: function(el, name) { + throw _abstract(); + }, + invoke: function(el, methodName, args) { + throw _abstract(); + }, + logError: function(error) { + throw _abstract(); + }, + log: function(error) { + throw _abstract(); + }, + logGroup: function(error) { + throw _abstract(); + }, + logGroupEnd: function() { + throw _abstract(); + }, + get attrToPropMap() { + throw _abstract(); + }, + parse: function(templateHtml) { + throw _abstract(); + }, + query: function(selector) { + throw _abstract(); + }, + querySelector: function(el, selector) { + throw _abstract(); + }, + querySelectorAll: function(el, selector) { + throw _abstract(); + }, + on: function(el, evt, listener) { + throw _abstract(); + }, + onAndCancel: function(el, evt, listener) { + throw _abstract(); + }, + dispatchEvent: function(el, evt) { + throw _abstract(); + }, + createMouseEvent: function(eventType) { + throw _abstract(); + }, + createEvent: function(eventType) { + throw _abstract(); + }, + preventDefault: function(evt) { + throw _abstract(); + }, + getInnerHTML: function(el) { + throw _abstract(); + }, + getOuterHTML: function(el) { + throw _abstract(); + }, + nodeName: function(node) { + throw _abstract(); + }, + nodeValue: function(node) { + throw _abstract(); + }, + type: function(node) { + throw _abstract(); + }, + content: function(node) { + throw _abstract(); + }, + firstChild: function(el) { + throw _abstract(); + }, + nextSibling: function(el) { + throw _abstract(); + }, + parentElement: function(el) { + throw _abstract(); + }, + childNodes: function(el) { + throw _abstract(); + }, + childNodesAsList: function(el) { + throw _abstract(); + }, + clearNodes: function(el) { + throw _abstract(); + }, + appendChild: function(el, node) { + throw _abstract(); + }, + removeChild: function(el, node) { + throw _abstract(); + }, + replaceChild: function(el, newNode, oldNode) { + throw _abstract(); + }, + remove: function(el) { + throw _abstract(); + }, + insertBefore: function(el, node) { + throw _abstract(); + }, + insertAllBefore: function(el, nodes) { + throw _abstract(); + }, + insertAfter: function(el, node) { + throw _abstract(); + }, + setInnerHTML: function(el, value) { + throw _abstract(); + }, + getText: function(el) { + throw _abstract(); + }, + setText: function(el, value) { + throw _abstract(); + }, + getValue: function(el) { + throw _abstract(); + }, + setValue: function(el, value) { + throw _abstract(); + }, + getChecked: function(el) { + throw _abstract(); + }, + setChecked: function(el, value) { + throw _abstract(); + }, + createTemplate: function(html) { + throw _abstract(); + }, + createElement: function(tagName) { + var doc = arguments[1] !== (void 0) ? arguments[1] : null; + throw _abstract(); + }, + createTextNode: function(text) { + var doc = arguments[1] !== (void 0) ? arguments[1] : null; + throw _abstract(); + }, + createScriptTag: function(attrName, attrValue) { + var doc = arguments[2] !== (void 0) ? arguments[2] : null; + throw _abstract(); + }, + createStyleElement: function(css) { + var doc = arguments[1] !== (void 0) ? arguments[1] : null; + throw _abstract(); + }, + createShadowRoot: function(el) { + throw _abstract(); + }, + getShadowRoot: function(el) { + throw _abstract(); + }, + getHost: function(el) { + throw _abstract(); + }, + getDistributedNodes: function(el) { + throw _abstract(); + }, + clone: function(node) { + throw _abstract(); + }, + getElementsByClassName: function(element, name) { + throw _abstract(); + }, + getElementsByTagName: function(element, name) { + throw _abstract(); + }, + classList: function(element) { + throw _abstract(); + }, + addClass: function(element, classname) { + throw _abstract(); + }, + removeClass: function(element, classname) { + throw _abstract(); + }, + hasClass: function(element, classname) { + throw _abstract(); + }, + setStyle: function(element, stylename, stylevalue) { + throw _abstract(); + }, + removeStyle: function(element, stylename) { + throw _abstract(); + }, + getStyle: function(element, stylename) { + throw _abstract(); + }, + tagName: function(element) { + throw _abstract(); + }, + attributeMap: function(element) { + throw _abstract(); + }, + hasAttribute: function(element, attribute) { + throw _abstract(); + }, + getAttribute: function(element, attribute) { + throw _abstract(); + }, + setAttribute: function(element, name, value) { + throw _abstract(); + }, + removeAttribute: function(element, attribute) { + throw _abstract(); + }, + templateAwareRoot: function(el) { + throw _abstract(); + }, + createHtmlDocument: function() { + throw _abstract(); + }, + defaultDoc: function() { + throw _abstract(); + }, + getBoundingClientRect: function(el) { + throw _abstract(); + }, + getTitle: function() { + throw _abstract(); + }, + setTitle: function(newTitle) { + throw _abstract(); + }, + elementMatches: function(n, selector) { + throw _abstract(); + }, + isTemplateElement: function(el) { + throw _abstract(); + }, + isTextNode: function(node) { + throw _abstract(); + }, + isCommentNode: function(node) { + throw _abstract(); + }, + isElementNode: function(node) { + throw _abstract(); + }, + hasShadowRoot: function(node) { + throw _abstract(); + }, + isShadowRoot: function(node) { + throw _abstract(); + }, + importIntoDoc: function(node) { + throw _abstract(); + }, + isPageRule: function(rule) { + throw _abstract(); + }, + isStyleRule: function(rule) { + throw _abstract(); + }, + isMediaRule: function(rule) { + throw _abstract(); + }, + isKeyframesRule: function(rule) { + throw _abstract(); + }, + getHref: function(element) { + throw _abstract(); + }, + getEventKey: function(event) { + throw _abstract(); + }, + resolveAndSetHref: function(element, baseUrl, href) { + throw _abstract(); + }, + cssToRules: function(css) { + throw _abstract(); + }, + supportsDOMEvents: function() { + throw _abstract(); + }, + supportsNativeShadowDOM: function() { + throw _abstract(); + }, + getGlobalEventTarget: function(target) { + throw _abstract(); + }, + getHistory: function() { + throw _abstract(); + }, + getLocation: function() { + throw _abstract(); + }, + getBaseHref: function() { + throw _abstract(); + }, + getUserAgent: function() { + throw _abstract(); + }, + setData: function(element, name, value) { + throw _abstract(); + }, + getData: function(element, name) { + throw _abstract(); + }, + setGlobalVar: function(name, value) { + throw _abstract(); + } + }, {}); + }()); + $__export("DomAdapter", DomAdapter); + } + }; +}); + +System.register("angular2/src/dom/generic_browser_adapter", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/dom/dom_adapter"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/dom/generic_browser_adapter"; + var ListWrapper, + isPresent, + isFunction, + DomAdapter, + GenericBrowserDomAdapter; + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + isFunction = $__m.isFunction; + }, function($__m) { + DomAdapter = $__m.DomAdapter; + }], + execute: function() { + GenericBrowserDomAdapter = (function($__super) { + function GenericBrowserDomAdapter() { + $traceurRuntime.superConstructor(GenericBrowserDomAdapter).apply(this, arguments); + } + return ($traceurRuntime.createClass)(GenericBrowserDomAdapter, { + getDistributedNodes: function(el) { + return el.getDistributedNodes(); + }, + resolveAndSetHref: function(el, baseUrl, href) { + el.href = href == null ? baseUrl : baseUrl + '/../' + href; + }, + cssToRules: function(css) { + var style = this.createStyleElement(css); + this.appendChild(this.defaultDoc().head, style); + var rules = []; + if (isPresent(style.sheet)) { + try { + var rawRules = style.sheet.cssRules; + rules = ListWrapper.createFixedSize(rawRules.length); + for (var i = 0; i < rawRules.length; i++) { + rules[i] = rawRules[i]; + } + } catch (e) {} + } else {} + this.remove(style); + return rules; + }, + supportsDOMEvents: function() { + return true; + }, + supportsNativeShadowDOM: function() { + return isFunction(this.defaultDoc().body.createShadowRoot); + } + }, {}, $__super); + }(DomAdapter)); + $__export("GenericBrowserDomAdapter", GenericBrowserDomAdapter); + } + }; +}); + +System.register("angular2/src/change_detection/constants", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/constants"; + var CHECK_ONCE, + CHECKED, + CHECK_ALWAYS, + DETACHED, + ON_PUSH, + DEFAULT; + return { + setters: [], + execute: function() { + CHECK_ONCE = "CHECK_ONCE"; + $__export("CHECK_ONCE", CHECK_ONCE); + CHECKED = "CHECKED"; + $__export("CHECKED", CHECKED); + CHECK_ALWAYS = "ALWAYS_CHECK"; + $__export("CHECK_ALWAYS", CHECK_ALWAYS); + DETACHED = "DETACHED"; + $__export("DETACHED", DETACHED); + ON_PUSH = "ON_PUSH"; + $__export("ON_PUSH", ON_PUSH); + DEFAULT = "DEFAULT"; + $__export("DEFAULT", DEFAULT); + } + }; +}); + +System.register("angular2/src/change_detection/exceptions", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/exceptions"; + var BaseException, + ExpressionChangedAfterItHasBeenCheckedException, + ChangeDetectionError, + DehydratedException; + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + }], + execute: function() { + ExpressionChangedAfterItHasBeenCheckedException = (function($__super) { + function ExpressionChangedAfterItHasBeenCheckedException(proto, change, context) { + $traceurRuntime.superConstructor(ExpressionChangedAfterItHasBeenCheckedException).call(this, ("Expression '" + proto.expressionAsString + "' has changed after it was checked. ") + ("Previous value: '" + change.previousValue + "'. Current value: '" + change.currentValue + "'")); + } + return ($traceurRuntime.createClass)(ExpressionChangedAfterItHasBeenCheckedException, {}, {}, $__super); + }(BaseException)); + $__export("ExpressionChangedAfterItHasBeenCheckedException", ExpressionChangedAfterItHasBeenCheckedException); + ChangeDetectionError = (function($__super) { + function ChangeDetectionError(proto, originalException, originalStack, context) { + $traceurRuntime.superConstructor(ChangeDetectionError).call(this, (originalException + " in [" + proto.expressionAsString + "]"), originalException, originalStack, context); + this.location = proto.expressionAsString; + } + return ($traceurRuntime.createClass)(ChangeDetectionError, {}, {}, $__super); + }(BaseException)); + $__export("ChangeDetectionError", ChangeDetectionError); + DehydratedException = (function($__super) { + function DehydratedException() { + $traceurRuntime.superConstructor(DehydratedException).call(this, 'Attempt to detect changes on a dehydrated detector.'); + } + return ($traceurRuntime.createClass)(DehydratedException, {}, {}, $__super); + }(BaseException)); + $__export("DehydratedException", DehydratedException); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/pipe", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/pipe"; + var __decorate, + __metadata, + BaseException, + CONST, + WrappedValue, + _wrappedValues, + _wrappedIndex, + BasePipe; + function _abstract() { + throw new BaseException('This method is abstract'); + } + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + CONST = $__m.CONST; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + WrappedValue = (function() { + function WrappedValue(wrapped) { + this.wrapped = wrapped; + } + return ($traceurRuntime.createClass)(WrappedValue, {}, {wrap: function(value) { + var w = _wrappedValues[_wrappedIndex++ % 5]; + w.wrapped = value; + return w; + }}); + }()); + $__export("WrappedValue", WrappedValue); + _wrappedValues = [new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null)]; + _wrappedIndex = 0; + BasePipe = (($traceurRuntime.createClass)(function() {}, { + supports: function(obj) { + return true; + }, + onDestroy: function() {}, + transform: function(value, args) { + return _abstract(); + } + }, {})); + $__export("BasePipe", BasePipe); + $__export("BasePipe", BasePipe = __decorate([CONST(), __metadata('design:paramtypes', [])], BasePipe)); + } + }; +}); + +System.register("angular2/src/change_detection/proto_record", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/proto_record"; + var RecordType, + ProtoRecord; + return { + setters: [], + execute: function() { + $__export("RecordType", RecordType); + (function(RecordType) { + RecordType[RecordType["SELF"] = 0] = "SELF"; + RecordType[RecordType["CONST"] = 1] = "CONST"; + RecordType[RecordType["PRIMITIVE_OP"] = 2] = "PRIMITIVE_OP"; + RecordType[RecordType["PROPERTY"] = 3] = "PROPERTY"; + RecordType[RecordType["LOCAL"] = 4] = "LOCAL"; + RecordType[RecordType["INVOKE_METHOD"] = 5] = "INVOKE_METHOD"; + RecordType[RecordType["INVOKE_CLOSURE"] = 6] = "INVOKE_CLOSURE"; + RecordType[RecordType["KEYED_ACCESS"] = 7] = "KEYED_ACCESS"; + RecordType[RecordType["PIPE"] = 8] = "PIPE"; + RecordType[RecordType["INTERPOLATE"] = 9] = "INTERPOLATE"; + RecordType[RecordType["SAFE_PROPERTY"] = 10] = "SAFE_PROPERTY"; + RecordType[RecordType["SAFE_INVOKE_METHOD"] = 11] = "SAFE_INVOKE_METHOD"; + RecordType[RecordType["DIRECTIVE_LIFECYCLE"] = 12] = "DIRECTIVE_LIFECYCLE"; + })(RecordType || ($__export("RecordType", RecordType = {}))); + ProtoRecord = (function() { + function ProtoRecord(mode, name, funcOrValue, args, fixedArgs, contextIndex, directiveIndex, selfIndex, bindingRecord, expressionAsString, lastInBinding, lastInDirective) { + this.mode = mode; + this.name = name; + this.funcOrValue = funcOrValue; + this.args = args; + this.fixedArgs = fixedArgs; + this.contextIndex = contextIndex; + this.directiveIndex = directiveIndex; + this.selfIndex = selfIndex; + this.bindingRecord = bindingRecord; + this.expressionAsString = expressionAsString; + this.lastInBinding = lastInBinding; + this.lastInDirective = lastInDirective; + } + return ($traceurRuntime.createClass)(ProtoRecord, { + isPureFunction: function() { + return this.mode === RecordType.INTERPOLATE || this.mode === RecordType.PRIMITIVE_OP; + }, + isPipeRecord: function() { + return this.mode === RecordType.PIPE; + }, + isLifeCycleRecord: function() { + return this.mode === RecordType.DIRECTIVE_LIFECYCLE; + } + }, {}); + }()); + $__export("ProtoRecord", ProtoRecord); + } + }; +}); + +System.register("angular2/src/change_detection/codegen_name_util", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/codegen_name_util"; + var RegExpWrapper, + StringWrapper, + ListWrapper, + _CONTEXT_IDX, + _whiteSpaceRegExp, + CodegenNameUtil; + function sanitizeName(s) { + return StringWrapper.replaceAll(s, _whiteSpaceRegExp, ''); + } + $__export("sanitizeName", sanitizeName); + return { + setters: [function($__m) { + RegExpWrapper = $__m.RegExpWrapper; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }], + execute: function() { + _CONTEXT_IDX = 0; + _whiteSpaceRegExp = RegExpWrapper.create("\\W", "g"); + CodegenNameUtil = (function() { + function CodegenNameUtil(records, directiveRecords, fieldPrefix, utilName) { + this.records = records; + this.directiveRecords = directiveRecords; + this.fieldPrefix = fieldPrefix; + this.utilName = utilName; + this._sanitizedNames = ListWrapper.createFixedSize(this.records.length + 1); + this._sanitizedNames[_CONTEXT_IDX] = 'context'; + for (var i = 0, + iLen = this.records.length; i < iLen; ++i) { + this._sanitizedNames[i + 1] = sanitizeName(("" + this.records[i].name + i)); + } + } + return ($traceurRuntime.createClass)(CodegenNameUtil, { + getContextName: function() { + return this.getFieldName(_CONTEXT_IDX); + }, + getLocalName: function(idx) { + return this._sanitizedNames[idx]; + }, + getChangeName: function(idx) { + return ("c_" + this._sanitizedNames[idx]); + }, + genInitLocals: function() { + var declarations = []; + var assignments = []; + for (var i = 0, + iLen = this.getFieldCount(); i < iLen; ++i) { + var changeName = this.getChangeName(i); + declarations.push((this.getLocalName(i) + "," + changeName)); + assignments.push(changeName); + } + return ("var " + ListWrapper.join(declarations, ',') + ";") + (ListWrapper.join(assignments, '=') + " = false;"); + }, + getFieldCount: function() { + return this._sanitizedNames.length; + }, + getFieldName: function(idx) { + return ("" + this.fieldPrefix + this._sanitizedNames[idx]); + }, + getAllFieldNames: function() { + var fieldList = []; + for (var k = 0, + kLen = this.getFieldCount(); k < kLen; ++k) { + fieldList.push(this.getFieldName(k)); + } + for (var i = 0, + iLen = this.records.length; i < iLen; ++i) { + var rec = this.records[i]; + if (rec.isPipeRecord()) { + fieldList.push(this.getPipeName(rec.selfIndex)); + } + } + for (var j = 0, + jLen = this.directiveRecords.length; j < jLen; ++j) { + var dRec = this.directiveRecords[j]; + fieldList.push(this.getDirectiveName(dRec.directiveIndex)); + if (dRec.isOnPushChangeDetection()) { + fieldList.push(this.getDetectorName(dRec.directiveIndex)); + } + } + return fieldList; + }, + genDeclareFields: function() { + var fields = this.getAllFieldNames(); + ListWrapper.removeAt(fields, _CONTEXT_IDX); + return ListWrapper.isEmpty(fields) ? '' : ("var " + ListWrapper.join(fields, ', ') + ";"); + }, + genDehydrateFields: function() { + var fields = this.getAllFieldNames(); + ListWrapper.removeAt(fields, _CONTEXT_IDX); + if (!ListWrapper.isEmpty(fields)) { + fields.push((this.utilName + ".uninitialized;")); + } + return (this.getContextName() + " = null; " + ListWrapper.join(fields, ' = ')); + }, + genPipeOnDestroy: function() { + var $__0 = this; + return ListWrapper.join(ListWrapper.map(ListWrapper.filter(this.records, (function(r) { + return r.isPipeRecord(); + })), (function(r) { + return ($__0.getPipeName(r.selfIndex) + ".onDestroy();"); + })), '\n'); + }, + getPipeName: function(idx) { + return ("" + this.fieldPrefix + this._sanitizedNames[idx] + "_pipe"); + }, + getAllDirectiveNames: function() { + var $__0 = this; + return ListWrapper.map(this.directiveRecords, (function(d) { + return $__0.getDirectiveName(d.directiveIndex); + })); + }, + getDirectiveName: function(d) { + return (this.fieldPrefix + "directive_" + d.name); + }, + getAllDetectorNames: function() { + var $__0 = this; + return ListWrapper.map(ListWrapper.filter(this.directiveRecords, (function(r) { + return r.isOnPushChangeDetection(); + })), (function(d) { + return $__0.getDetectorName(d.directiveIndex); + })); + }, + getDetectorName: function(d) { + return (this.fieldPrefix + "detector_" + d.name); + } + }, {}); + }()); + $__export("CodegenNameUtil", CodegenNameUtil); + } + }; +}); + +System.register("angular2/src/change_detection/coalesce", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/proto_record"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/coalesce"; + var isPresent, + isBlank, + looseIdentical, + ListWrapper, + Map, + RecordType, + ProtoRecord; + function coalesce(records) { + var res = []; + var indexMap = new Map(); + for (var i = 0; i < records.length; ++i) { + var r = records[i]; + var record = _replaceIndices(r, res.length + 1, indexMap); + var matchingRecord = _findMatching(record, res); + if (isPresent(matchingRecord) && record.lastInBinding) { + res.push(_selfRecord(record, matchingRecord.selfIndex, res.length + 1)); + indexMap.set(r.selfIndex, matchingRecord.selfIndex); + } else if (isPresent(matchingRecord) && !record.lastInBinding) { + indexMap.set(r.selfIndex, matchingRecord.selfIndex); + } else { + res.push(record); + indexMap.set(r.selfIndex, record.selfIndex); + } + } + return res; + } + function _selfRecord(r, contextIndex, selfIndex) { + return new ProtoRecord(RecordType.SELF, "self", null, [], r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.expressionAsString, r.lastInBinding, r.lastInDirective); + } + function _findMatching(r, rs) { + return ListWrapper.find(rs, (function(rr) { + return rr.mode !== RecordType.DIRECTIVE_LIFECYCLE && _sameDirIndex(rr, r) && rr.mode === r.mode && looseIdentical(rr.funcOrValue, r.funcOrValue) && rr.contextIndex === r.contextIndex && looseIdentical(rr.name, r.name) && ListWrapper.equals(rr.args, r.args); + })); + } + function _sameDirIndex(a, b) { + var di1 = isBlank(a.directiveIndex) ? null : a.directiveIndex.directiveIndex; + var ei1 = isBlank(a.directiveIndex) ? null : a.directiveIndex.elementIndex; + var di2 = isBlank(b.directiveIndex) ? null : b.directiveIndex.directiveIndex; + var ei2 = isBlank(b.directiveIndex) ? null : b.directiveIndex.elementIndex; + return di1 === di2 && ei1 === ei2; + } + function _replaceIndices(r, selfIndex, indexMap) { + var args = ListWrapper.map(r.args, (function(a) { + return _map(indexMap, a); + })); + var contextIndex = _map(indexMap, r.contextIndex); + return new ProtoRecord(r.mode, r.name, r.funcOrValue, args, r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.expressionAsString, r.lastInBinding, r.lastInDirective); + } + function _map(indexMap, value) { + var r = indexMap.get(value); + return isPresent(r) ? r : value; + } + $__export("coalesce", coalesce); + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + looseIdentical = $__m.looseIdentical; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + Map = $__m.Map; + }, function($__m) { + RecordType = $__m.RecordType; + ProtoRecord = $__m.ProtoRecord; + }], + execute: function() { + } + }; +}); + +System.register("angular2/src/change_detection/parser/ast", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/parser/ast"; + var isBlank, + isPresent, + FunctionWrapper, + BaseException, + ListWrapper, + StringMapWrapper, + AST, + EmptyExpr, + ImplicitReceiver, + Chain, + Conditional, + If, + AccessMember, + SafeAccessMember, + KeyedAccess, + BindingPipe, + LiteralPrimitive, + LiteralArray, + LiteralMap, + Interpolation, + Binary, + PrefixNot, + Assignment, + MethodCall, + SafeMethodCall, + FunctionCall, + ASTWithSource, + TemplateBinding, + AstTransformer, + _evalListCache; + function evalList(context, locals, exps) { + var length = exps.length; + if (length > 10) { + throw new BaseException("Cannot have more than 10 argument"); + } + var result = _evalListCache[length]; + for (var i = 0; i < length; i++) { + result[i] = exps[i].eval(context, locals); + } + return result; + } + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + FunctionWrapper = $__m.FunctionWrapper; + BaseException = $__m.BaseException; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }], + execute: function() { + AST = (function() { + function AST() {} + return ($traceurRuntime.createClass)(AST, { + eval: function(context, locals) { + throw new BaseException("Not supported"); + }, + get isAssignable() { + return false; + }, + assign: function(context, locals, value) { + throw new BaseException("Not supported"); + }, + visit: function(visitor) { + return null; + }, + toString: function() { + return "AST"; + } + }, {}); + }()); + $__export("AST", AST); + EmptyExpr = (function($__super) { + function EmptyExpr() { + $traceurRuntime.superConstructor(EmptyExpr).apply(this, arguments); + } + return ($traceurRuntime.createClass)(EmptyExpr, { + eval: function(context, locals) { + return null; + }, + visit: function(visitor) {} + }, {}, $__super); + }(AST)); + $__export("EmptyExpr", EmptyExpr); + ImplicitReceiver = (function($__super) { + function ImplicitReceiver() { + $traceurRuntime.superConstructor(ImplicitReceiver).apply(this, arguments); + } + return ($traceurRuntime.createClass)(ImplicitReceiver, { + eval: function(context, locals) { + return context; + }, + visit: function(visitor) { + return visitor.visitImplicitReceiver(this); + } + }, {}, $__super); + }(AST)); + $__export("ImplicitReceiver", ImplicitReceiver); + Chain = (function($__super) { + function Chain(expressions) { + $traceurRuntime.superConstructor(Chain).call(this); + this.expressions = expressions; + } + return ($traceurRuntime.createClass)(Chain, { + eval: function(context, locals) { + var result; + for (var i = 0; i < this.expressions.length; i++) { + var last = this.expressions[i].eval(context, locals); + if (isPresent(last)) + result = last; + } + return result; + }, + visit: function(visitor) { + return visitor.visitChain(this); + } + }, {}, $__super); + }(AST)); + $__export("Chain", Chain); + Conditional = (function($__super) { + function Conditional(condition, trueExp, falseExp) { + $traceurRuntime.superConstructor(Conditional).call(this); + this.condition = condition; + this.trueExp = trueExp; + this.falseExp = falseExp; + } + return ($traceurRuntime.createClass)(Conditional, { + eval: function(context, locals) { + if (this.condition.eval(context, locals)) { + return this.trueExp.eval(context, locals); + } else { + return this.falseExp.eval(context, locals); + } + }, + visit: function(visitor) { + return visitor.visitConditional(this); + } + }, {}, $__super); + }(AST)); + $__export("Conditional", Conditional); + If = (function($__super) { + function If(condition, trueExp, falseExp) { + $traceurRuntime.superConstructor(If).call(this); + this.condition = condition; + this.trueExp = trueExp; + this.falseExp = falseExp; + } + return ($traceurRuntime.createClass)(If, { + eval: function(context, locals) { + if (this.condition.eval(context, locals)) { + this.trueExp.eval(context, locals); + } else if (isPresent(this.falseExp)) { + this.falseExp.eval(context, locals); + } + }, + visit: function(visitor) { + return visitor.visitIf(this); + } + }, {}, $__super); + }(AST)); + $__export("If", If); + AccessMember = (function($__super) { + function AccessMember(receiver, name, getter, setter) { + $traceurRuntime.superConstructor(AccessMember).call(this); + this.receiver = receiver; + this.name = name; + this.getter = getter; + this.setter = setter; + } + return ($traceurRuntime.createClass)(AccessMember, { + eval: function(context, locals) { + if (this.receiver instanceof ImplicitReceiver && isPresent(locals) && locals.contains(this.name)) { + return locals.get(this.name); + } else { + var evaluatedReceiver = this.receiver.eval(context, locals); + return this.getter(evaluatedReceiver); + } + }, + get isAssignable() { + return true; + }, + assign: function(context, locals, value) { + var evaluatedContext = this.receiver.eval(context, locals); + if (this.receiver instanceof ImplicitReceiver && isPresent(locals) && locals.contains(this.name)) { + throw new BaseException(("Cannot reassign a variable binding " + this.name)); + } else { + return this.setter(evaluatedContext, value); + } + }, + visit: function(visitor) { + return visitor.visitAccessMember(this); + } + }, {}, $__super); + }(AST)); + $__export("AccessMember", AccessMember); + SafeAccessMember = (function($__super) { + function SafeAccessMember(receiver, name, getter, setter) { + $traceurRuntime.superConstructor(SafeAccessMember).call(this); + this.receiver = receiver; + this.name = name; + this.getter = getter; + this.setter = setter; + } + return ($traceurRuntime.createClass)(SafeAccessMember, { + eval: function(context, locals) { + var evaluatedReceiver = this.receiver.eval(context, locals); + return isBlank(evaluatedReceiver) ? null : this.getter(evaluatedReceiver); + }, + visit: function(visitor) { + return visitor.visitSafeAccessMember(this); + } + }, {}, $__super); + }(AST)); + $__export("SafeAccessMember", SafeAccessMember); + KeyedAccess = (function($__super) { + function KeyedAccess(obj, key) { + $traceurRuntime.superConstructor(KeyedAccess).call(this); + this.obj = obj; + this.key = key; + } + return ($traceurRuntime.createClass)(KeyedAccess, { + eval: function(context, locals) { + var obj = this.obj.eval(context, locals); + var key = this.key.eval(context, locals); + return obj[key]; + }, + get isAssignable() { + return true; + }, + assign: function(context, locals, value) { + var obj = this.obj.eval(context, locals); + var key = this.key.eval(context, locals); + obj[key] = value; + return value; + }, + visit: function(visitor) { + return visitor.visitKeyedAccess(this); + } + }, {}, $__super); + }(AST)); + $__export("KeyedAccess", KeyedAccess); + BindingPipe = (function($__super) { + function BindingPipe(exp, name, args) { + $traceurRuntime.superConstructor(BindingPipe).call(this); + this.exp = exp; + this.name = name; + this.args = args; + } + return ($traceurRuntime.createClass)(BindingPipe, {visit: function(visitor) { + return visitor.visitPipe(this); + }}, {}, $__super); + }(AST)); + $__export("BindingPipe", BindingPipe); + LiteralPrimitive = (function($__super) { + function LiteralPrimitive(value) { + $traceurRuntime.superConstructor(LiteralPrimitive).call(this); + this.value = value; + } + return ($traceurRuntime.createClass)(LiteralPrimitive, { + eval: function(context, locals) { + return this.value; + }, + visit: function(visitor) { + return visitor.visitLiteralPrimitive(this); + } + }, {}, $__super); + }(AST)); + $__export("LiteralPrimitive", LiteralPrimitive); + LiteralArray = (function($__super) { + function LiteralArray(expressions) { + $traceurRuntime.superConstructor(LiteralArray).call(this); + this.expressions = expressions; + } + return ($traceurRuntime.createClass)(LiteralArray, { + eval: function(context, locals) { + return ListWrapper.map(this.expressions, (function(e) { + return e.eval(context, locals); + })); + }, + visit: function(visitor) { + return visitor.visitLiteralArray(this); + } + }, {}, $__super); + }(AST)); + $__export("LiteralArray", LiteralArray); + LiteralMap = (function($__super) { + function LiteralMap(keys, values) { + $traceurRuntime.superConstructor(LiteralMap).call(this); + this.keys = keys; + this.values = values; + } + return ($traceurRuntime.createClass)(LiteralMap, { + eval: function(context, locals) { + var res = StringMapWrapper.create(); + for (var i = 0; i < this.keys.length; ++i) { + StringMapWrapper.set(res, this.keys[i], this.values[i].eval(context, locals)); + } + return res; + }, + visit: function(visitor) { + return visitor.visitLiteralMap(this); + } + }, {}, $__super); + }(AST)); + $__export("LiteralMap", LiteralMap); + Interpolation = (function($__super) { + function Interpolation(strings, expressions) { + $traceurRuntime.superConstructor(Interpolation).call(this); + this.strings = strings; + this.expressions = expressions; + } + return ($traceurRuntime.createClass)(Interpolation, { + eval: function(context, locals) { + throw new BaseException("evaluating an Interpolation is not supported"); + }, + visit: function(visitor) { + visitor.visitInterpolation(this); + } + }, {}, $__super); + }(AST)); + $__export("Interpolation", Interpolation); + Binary = (function($__super) { + function Binary(operation, left, right) { + $traceurRuntime.superConstructor(Binary).call(this); + this.operation = operation; + this.left = left; + this.right = right; + } + return ($traceurRuntime.createClass)(Binary, { + eval: function(context, locals) { + var left = this.left.eval(context, locals); + switch (this.operation) { + case '&&': + return left && this.right.eval(context, locals); + case '||': + return left || this.right.eval(context, locals); + } + var right = this.right.eval(context, locals); + switch (this.operation) { + case '+': + return left + right; + case '-': + return left - right; + case '*': + return left * right; + case '/': + return left / right; + case '%': + return left % right; + case '==': + return left == right; + case '!=': + return left != right; + case '===': + return left === right; + case '!==': + return left !== right; + case '<': + return left < right; + case '>': + return left > right; + case '<=': + return left <= right; + case '>=': + return left >= right; + case '^': + return left ^ right; + case '&': + return left & right; + } + throw 'Internal error [$operation] not handled'; + }, + visit: function(visitor) { + return visitor.visitBinary(this); + } + }, {}, $__super); + }(AST)); + $__export("Binary", Binary); + PrefixNot = (function($__super) { + function PrefixNot(expression) { + $traceurRuntime.superConstructor(PrefixNot).call(this); + this.expression = expression; + } + return ($traceurRuntime.createClass)(PrefixNot, { + eval: function(context, locals) { + return !this.expression.eval(context, locals); + }, + visit: function(visitor) { + return visitor.visitPrefixNot(this); + } + }, {}, $__super); + }(AST)); + $__export("PrefixNot", PrefixNot); + Assignment = (function($__super) { + function Assignment(target, value) { + $traceurRuntime.superConstructor(Assignment).call(this); + this.target = target; + this.value = value; + } + return ($traceurRuntime.createClass)(Assignment, { + eval: function(context, locals) { + return this.target.assign(context, locals, this.value.eval(context, locals)); + }, + visit: function(visitor) { + return visitor.visitAssignment(this); + } + }, {}, $__super); + }(AST)); + $__export("Assignment", Assignment); + MethodCall = (function($__super) { + function MethodCall(receiver, name, fn, args) { + $traceurRuntime.superConstructor(MethodCall).call(this); + this.receiver = receiver; + this.name = name; + this.fn = fn; + this.args = args; + } + return ($traceurRuntime.createClass)(MethodCall, { + eval: function(context, locals) { + var evaluatedArgs = evalList(context, locals, this.args); + if (this.receiver instanceof ImplicitReceiver && isPresent(locals) && locals.contains(this.name)) { + var fn = locals.get(this.name); + return FunctionWrapper.apply(fn, evaluatedArgs); + } else { + var evaluatedReceiver = this.receiver.eval(context, locals); + return this.fn(evaluatedReceiver, evaluatedArgs); + } + }, + visit: function(visitor) { + return visitor.visitMethodCall(this); + } + }, {}, $__super); + }(AST)); + $__export("MethodCall", MethodCall); + SafeMethodCall = (function($__super) { + function SafeMethodCall(receiver, name, fn, args) { + $traceurRuntime.superConstructor(SafeMethodCall).call(this); + this.receiver = receiver; + this.name = name; + this.fn = fn; + this.args = args; + } + return ($traceurRuntime.createClass)(SafeMethodCall, { + eval: function(context, locals) { + var evaluatedReceiver = this.receiver.eval(context, locals); + if (isBlank(evaluatedReceiver)) + return null; + var evaluatedArgs = evalList(context, locals, this.args); + return this.fn(evaluatedReceiver, evaluatedArgs); + }, + visit: function(visitor) { + return visitor.visitSafeMethodCall(this); + } + }, {}, $__super); + }(AST)); + $__export("SafeMethodCall", SafeMethodCall); + FunctionCall = (function($__super) { + function FunctionCall(target, args) { + $traceurRuntime.superConstructor(FunctionCall).call(this); + this.target = target; + this.args = args; + } + return ($traceurRuntime.createClass)(FunctionCall, { + eval: function(context, locals) { + var obj = this.target.eval(context, locals); + if (!(obj instanceof Function)) { + throw new BaseException((obj + " is not a function")); + } + return FunctionWrapper.apply(obj, evalList(context, locals, this.args)); + }, + visit: function(visitor) { + return visitor.visitFunctionCall(this); + } + }, {}, $__super); + }(AST)); + $__export("FunctionCall", FunctionCall); + ASTWithSource = (function($__super) { + function ASTWithSource(ast, source, location) { + $traceurRuntime.superConstructor(ASTWithSource).call(this); + this.ast = ast; + this.source = source; + this.location = location; + } + return ($traceurRuntime.createClass)(ASTWithSource, { + eval: function(context, locals) { + return this.ast.eval(context, locals); + }, + get isAssignable() { + return this.ast.isAssignable; + }, + assign: function(context, locals, value) { + return this.ast.assign(context, locals, value); + }, + visit: function(visitor) { + return this.ast.visit(visitor); + }, + toString: function() { + return (this.source + " in " + this.location); + } + }, {}, $__super); + }(AST)); + $__export("ASTWithSource", ASTWithSource); + TemplateBinding = (function() { + function TemplateBinding(key, keyIsVar, name, expression) { + this.key = key; + this.keyIsVar = keyIsVar; + this.name = name; + this.expression = expression; + } + return ($traceurRuntime.createClass)(TemplateBinding, {}, {}); + }()); + $__export("TemplateBinding", TemplateBinding); + AstTransformer = (function() { + function AstTransformer() {} + return ($traceurRuntime.createClass)(AstTransformer, { + visitImplicitReceiver: function(ast) { + return ast; + }, + visitInterpolation: function(ast) { + return new Interpolation(ast.strings, this.visitAll(ast.expressions)); + }, + visitLiteralPrimitive: function(ast) { + return new LiteralPrimitive(ast.value); + }, + visitAccessMember: function(ast) { + return new AccessMember(ast.receiver.visit(this), ast.name, ast.getter, ast.setter); + }, + visitSafeAccessMember: function(ast) { + return new SafeAccessMember(ast.receiver.visit(this), ast.name, ast.getter, ast.setter); + }, + visitMethodCall: function(ast) { + return new MethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args)); + }, + visitSafeMethodCall: function(ast) { + return new SafeMethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args)); + }, + visitFunctionCall: function(ast) { + return new FunctionCall(ast.target.visit(this), this.visitAll(ast.args)); + }, + visitLiteralArray: function(ast) { + return new LiteralArray(this.visitAll(ast.expressions)); + }, + visitLiteralMap: function(ast) { + return new LiteralMap(ast.keys, this.visitAll(ast.values)); + }, + visitBinary: function(ast) { + return new Binary(ast.operation, ast.left.visit(this), ast.right.visit(this)); + }, + visitPrefixNot: function(ast) { + return new PrefixNot(ast.expression.visit(this)); + }, + visitConditional: function(ast) { + return new Conditional(ast.condition.visit(this), ast.trueExp.visit(this), ast.falseExp.visit(this)); + }, + visitPipe: function(ast) { + return new BindingPipe(ast.exp.visit(this), ast.name, this.visitAll(ast.args)); + }, + visitKeyedAccess: function(ast) { + return new KeyedAccess(ast.obj.visit(this), ast.key.visit(this)); + }, + visitAll: function(asts) { + var res = ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }, + visitChain: function(ast) { + return new Chain(this.visitAll(ast.expressions)); + }, + visitAssignment: function(ast) { + return new Assignment(ast.target.visit(this), ast.value.visit(this)); + }, + visitIf: function(ast) { + var falseExp = isPresent(ast.falseExp) ? ast.falseExp.visit(this) : null; + return new If(ast.condition.visit(this), ast.trueExp.visit(this), falseExp); + } + }, {}); + }()); + $__export("AstTransformer", AstTransformer); + _evalListCache = [[], [0], [0, 0], [0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]; + } + }; +}); + +System.register("angular2/src/change_detection/dynamic_change_detector", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/abstract_change_detector", "angular2/src/change_detection/change_detection_util", "angular2/src/change_detection/proto_record"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/dynamic_change_detector"; + var isPresent, + isBlank, + BaseException, + FunctionWrapper, + ListWrapper, + AbstractChangeDetector, + ChangeDetectionUtil, + RecordType, + DynamicChangeDetector; + function isSame(a, b) { + if (a === b) + return true; + if (a instanceof String && b instanceof String && a == b) + return true; + if ((a !== a) && (b !== b)) + return true; + return false; + } + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + FunctionWrapper = $__m.FunctionWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + AbstractChangeDetector = $__m.AbstractChangeDetector; + }, function($__m) { + ChangeDetectionUtil = $__m.ChangeDetectionUtil; + }, function($__m) { + RecordType = $__m.RecordType; + }], + execute: function() { + DynamicChangeDetector = (function($__super) { + function DynamicChangeDetector(id, changeControlStrategy, dispatcher, protos, directiveRecords) { + $traceurRuntime.superConstructor(DynamicChangeDetector).call(this, id, dispatcher); + this.changeControlStrategy = changeControlStrategy; + this.protos = protos; + this.directiveRecords = directiveRecords; + this.locals = null; + this.directives = null; + this.alreadyChecked = false; + this.pipes = null; + this.values = ListWrapper.createFixedSize(protos.length + 1); + this.localPipes = ListWrapper.createFixedSize(protos.length + 1); + this.prevContexts = ListWrapper.createFixedSize(protos.length + 1); + this.changes = ListWrapper.createFixedSize(protos.length + 1); + this.values[0] = null; + ListWrapper.fill(this.values, ChangeDetectionUtil.uninitialized, 1); + ListWrapper.fill(this.localPipes, null); + ListWrapper.fill(this.prevContexts, ChangeDetectionUtil.uninitialized); + ListWrapper.fill(this.changes, false); + } + return ($traceurRuntime.createClass)(DynamicChangeDetector, { + hydrate: function(context, locals, directives, pipes) { + this.mode = ChangeDetectionUtil.changeDetectionMode(this.changeControlStrategy); + this.values[0] = context; + this.locals = locals; + this.directives = directives; + this.alreadyChecked = false; + this.pipes = pipes; + }, + dehydrate: function() { + this._destroyPipes(); + this.values[0] = null; + ListWrapper.fill(this.values, ChangeDetectionUtil.uninitialized, 1); + ListWrapper.fill(this.changes, false); + ListWrapper.fill(this.localPipes, null); + ListWrapper.fill(this.prevContexts, ChangeDetectionUtil.uninitialized); + this.locals = null; + this.pipes = null; + }, + _destroyPipes: function() { + for (var i = 0; i < this.localPipes.length; ++i) { + if (isPresent(this.localPipes[i])) { + this.localPipes[i].onDestroy(); + } + } + }, + hydrated: function() { + return this.values[0] !== null; + }, + checkNoChanges: function() { + this.runDetectChanges(true); + }, + detectChangesInRecords: function(throwOnChange) { + if (!this.hydrated()) { + ChangeDetectionUtil.throwDehydrated(); + } + var protos = this.protos; + var changes = null; + var isChanged = false; + for (var i = 0; i < protos.length; ++i) { + var proto = protos[i]; + var bindingRecord = proto.bindingRecord; + var directiveRecord = bindingRecord.directiveRecord; + if (proto.isLifeCycleRecord()) { + if (proto.name === "onCheck" && !throwOnChange) { + this._getDirectiveFor(directiveRecord.directiveIndex).onCheck(); + } else if (proto.name === "onInit" && !throwOnChange && !this.alreadyChecked) { + this._getDirectiveFor(directiveRecord.directiveIndex).onInit(); + } else if (proto.name === "onChange" && isPresent(changes) && !throwOnChange) { + this._getDirectiveFor(directiveRecord.directiveIndex).onChange(changes); + } + } else { + var change = this._check(proto, throwOnChange); + if (isPresent(change)) { + this._updateDirectiveOrElement(change, bindingRecord); + isChanged = true; + changes = this._addChange(bindingRecord, change, changes); + } + } + if (proto.lastInDirective) { + changes = null; + if (isChanged && bindingRecord.isOnPushChangeDetection()) { + this._getDetectorFor(directiveRecord.directiveIndex).markAsCheckOnce(); + } + isChanged = false; + } + } + this.alreadyChecked = true; + }, + callOnAllChangesDone: function() { + this.dispatcher.notifyOnAllChangesDone(); + var dirs = this.directiveRecords; + for (var i = dirs.length - 1; i >= 0; --i) { + var dir = dirs[i]; + if (dir.callOnAllChangesDone) { + this._getDirectiveFor(dir.directiveIndex).onAllChangesDone(); + } + } + }, + _updateDirectiveOrElement: function(change, bindingRecord) { + if (isBlank(bindingRecord.directiveRecord)) { + this.dispatcher.notifyOnBinding(bindingRecord, change.currentValue); + } else { + var directiveIndex = bindingRecord.directiveRecord.directiveIndex; + bindingRecord.setter(this._getDirectiveFor(directiveIndex), change.currentValue); + } + }, + _addChange: function(bindingRecord, change, changes) { + if (bindingRecord.callOnChange()) { + return ChangeDetectionUtil.addChange(changes, bindingRecord.propertyName, change); + } else { + return changes; + } + }, + _getDirectiveFor: function(directiveIndex) { + return this.directives.getDirectiveFor(directiveIndex); + }, + _getDetectorFor: function(directiveIndex) { + return this.directives.getDetectorFor(directiveIndex); + }, + _check: function(proto, throwOnChange) { + try { + if (proto.isPipeRecord()) { + return this._pipeCheck(proto, throwOnChange); + } else { + return this._referenceCheck(proto, throwOnChange); + } + } catch (e) { + this.throwError(proto, e, e.stack); + } + }, + _referenceCheck: function(proto, throwOnChange) { + if (this._pureFuncAndArgsDidNotChange(proto)) { + this._setChanged(proto, false); + return null; + } + var prevValue = this._readSelf(proto); + var currValue = this._calculateCurrValue(proto); + if (!isSame(prevValue, currValue)) { + if (proto.lastInBinding) { + var change = ChangeDetectionUtil.simpleChange(prevValue, currValue); + if (throwOnChange) + ChangeDetectionUtil.throwOnChange(proto, change); + this._writeSelf(proto, currValue); + this._setChanged(proto, true); + return change; + } else { + this._writeSelf(proto, currValue); + this._setChanged(proto, true); + return null; + } + } else { + this._setChanged(proto, false); + return null; + } + }, + _calculateCurrValue: function(proto) { + switch (proto.mode) { + case RecordType.SELF: + return this._readContext(proto); + case RecordType.CONST: + return proto.funcOrValue; + case RecordType.PROPERTY: + var context = this._readContext(proto); + return proto.funcOrValue(context); + case RecordType.SAFE_PROPERTY: + var context = this._readContext(proto); + return isBlank(context) ? null : proto.funcOrValue(context); + case RecordType.LOCAL: + return this.locals.get(proto.name); + case RecordType.INVOKE_METHOD: + var context = this._readContext(proto); + var args = this._readArgs(proto); + return proto.funcOrValue(context, args); + case RecordType.SAFE_INVOKE_METHOD: + var context = this._readContext(proto); + if (isBlank(context)) { + return null; + } + var args = this._readArgs(proto); + return proto.funcOrValue(context, args); + case RecordType.KEYED_ACCESS: + var arg = this._readArgs(proto)[0]; + return this._readContext(proto)[arg]; + case RecordType.INVOKE_CLOSURE: + return FunctionWrapper.apply(this._readContext(proto), this._readArgs(proto)); + case RecordType.INTERPOLATE: + case RecordType.PRIMITIVE_OP: + return FunctionWrapper.apply(proto.funcOrValue, this._readArgs(proto)); + default: + throw new BaseException(("Unknown operation " + proto.mode)); + } + }, + _pipeCheck: function(proto, throwOnChange) { + var context = this._readContext(proto); + var args = this._readArgs(proto); + var pipe = this._pipeFor(proto, context); + var prevValue = this._readSelf(proto); + var currValue = pipe.transform(context, args); + if (!isSame(prevValue, currValue)) { + currValue = ChangeDetectionUtil.unwrapValue(currValue); + if (proto.lastInBinding) { + var change = ChangeDetectionUtil.simpleChange(prevValue, currValue); + if (throwOnChange) + ChangeDetectionUtil.throwOnChange(proto, change); + this._writeSelf(proto, currValue); + this._setChanged(proto, true); + return change; + } else { + this._writeSelf(proto, currValue); + this._setChanged(proto, true); + return null; + } + } else { + this._setChanged(proto, false); + return null; + } + }, + _pipeFor: function(proto, context) { + var storedPipe = this._readPipe(proto); + if (isPresent(storedPipe) && storedPipe.supports(context)) { + return storedPipe; + } + if (isPresent(storedPipe)) { + storedPipe.onDestroy(); + } + var pipe = this.pipes.get(proto.name, context, this.ref); + this._writePipe(proto, pipe); + return pipe; + }, + _readContext: function(proto) { + if (proto.contextIndex == -1) { + return this._getDirectiveFor(proto.directiveIndex); + } else { + return this.values[proto.contextIndex]; + } + return this.values[proto.contextIndex]; + }, + _readSelf: function(proto) { + return this.values[proto.selfIndex]; + }, + _writeSelf: function(proto, value) { + this.values[proto.selfIndex] = value; + }, + _readPipe: function(proto) { + return this.localPipes[proto.selfIndex]; + }, + _writePipe: function(proto, value) { + this.localPipes[proto.selfIndex] = value; + }, + _setChanged: function(proto, value) { + this.changes[proto.selfIndex] = value; + }, + _pureFuncAndArgsDidNotChange: function(proto) { + return proto.isPureFunction() && !this._argsChanged(proto); + }, + _argsChanged: function(proto) { + var args = proto.args; + for (var i = 0; i < args.length; ++i) { + if (this.changes[args[i]]) { + return true; + } + } + return false; + }, + _readArgs: function(proto) { + var res = ListWrapper.createFixedSize(proto.args.length); + var args = proto.args; + for (var i = 0; i < args.length; ++i) { + res[i] = this.values[args[i]]; + } + return res; + } + }, {}, $__super); + }(AbstractChangeDetector)); + $__export("DynamicChangeDetector", DynamicChangeDetector); + } + }; +}); + +System.register("angular2/src/change_detection/directive_record", ["angular2/src/change_detection/constants", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/directive_record"; + var ON_PUSH, + StringWrapper, + normalizeBool, + DirectiveIndex, + DirectiveRecord; + return { + setters: [function($__m) { + ON_PUSH = $__m.ON_PUSH; + }, function($__m) { + StringWrapper = $__m.StringWrapper; + normalizeBool = $__m.normalizeBool; + }], + execute: function() { + DirectiveIndex = (function() { + function DirectiveIndex(elementIndex, directiveIndex) { + this.elementIndex = elementIndex; + this.directiveIndex = directiveIndex; + } + return ($traceurRuntime.createClass)(DirectiveIndex, {get name() { + return (this.elementIndex + "_" + this.directiveIndex); + }}, {}); + }()); + $__export("DirectiveIndex", DirectiveIndex); + DirectiveRecord = (function() { + function DirectiveRecord() { + var $__1 = arguments[0] !== (void 0) ? arguments[0] : {}, + directiveIndex = $__1.directiveIndex, + callOnAllChangesDone = $__1.callOnAllChangesDone, + callOnChange = $__1.callOnChange, + callOnCheck = $__1.callOnCheck, + callOnInit = $__1.callOnInit, + changeDetection = $__1.changeDetection; + this.directiveIndex = directiveIndex; + this.callOnAllChangesDone = normalizeBool(callOnAllChangesDone); + this.callOnChange = normalizeBool(callOnChange); + this.callOnCheck = normalizeBool(callOnCheck); + this.callOnInit = normalizeBool(callOnInit); + this.changeDetection = changeDetection; + } + return ($traceurRuntime.createClass)(DirectiveRecord, {isOnPushChangeDetection: function() { + return StringWrapper.equals(this.changeDetection, ON_PUSH); + }}, {}); + }()); + $__export("DirectiveRecord", DirectiveRecord); + } + }; +}); + +System.register("angular2/src/change_detection/pregen_proto_change_detector", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pregen_proto_change_detector"; + var BaseException, + PregenProtoChangeDetector; + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + }], + execute: function() { + $__export("PregenProtoChangeDetectorFactory", Function); + PregenProtoChangeDetector = (function() { + function PregenProtoChangeDetector() {} + return ($traceurRuntime.createClass)(PregenProtoChangeDetector, {instantiate: function(dispatcher) { + throw new BaseException('Pregen change detection not supported in Js'); + }}, {isSupported: function() { + return false; + }}); + }()); + $__export("PregenProtoChangeDetector", PregenProtoChangeDetector); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/pipes", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/pipes"; + var __decorate, + __metadata, + ListWrapper, + StringMapWrapper, + isBlank, + isPresent, + BaseException, + CONST, + Injectable, + UnboundedMetadata, + OptionalMetadata, + Binding, + Pipes; + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + CONST = $__m.CONST; + }, function($__m) { + Injectable = $__m.Injectable; + UnboundedMetadata = $__m.UnboundedMetadata; + OptionalMetadata = $__m.OptionalMetadata; + Binding = $__m.Binding; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Pipes = (($traceurRuntime.createClass)(function(config) { + this.config = config; + }, { + get: function(type, obj, cdRef, existingPipe) { + if (isPresent(existingPipe) && existingPipe.supports(obj)) + return existingPipe; + if (isPresent(existingPipe)) + existingPipe.onDestroy(); + var factories = this._getListOfFactories(type, obj); + var factory = this._getMatchingFactory(factories, type, obj); + return factory.create(cdRef); + }, + _getListOfFactories: function(type, obj) { + var listOfFactories = this.config[type]; + if (isBlank(listOfFactories)) { + throw new BaseException(("Cannot find '" + type + "' pipe supporting object '" + obj + "'")); + } + return listOfFactories; + }, + _getMatchingFactory: function(listOfFactories, type, obj) { + var matchingFactory = ListWrapper.find(listOfFactories, (function(pipeFactory) { + return pipeFactory.supports(obj); + })); + if (isBlank(matchingFactory)) { + throw new BaseException(("Cannot find '" + type + "' pipe supporting object '" + obj + "'")); + } + return matchingFactory; + } + }, { + extend: function(config) { + return new Binding(Pipes, { + toFactory: (function(pipes) { + if (isBlank(pipes)) { + throw new BaseException('Cannot extend Pipes without a parent injector'); + } + return Pipes.create(config, pipes); + }), + deps: [[Pipes, new UnboundedMetadata(), new OptionalMetadata()]] + }); + }, + create: function(config) { + var pipes = arguments[1] !== (void 0) ? arguments[1] : null; + if (isPresent(pipes)) { + StringMapWrapper.forEach(pipes.config, (function(v, k) { + if (StringMapWrapper.contains(config, k)) { + var configFactories = config[k]; + config[k] = configFactories.concat(v); + } else { + config[k] = ListWrapper.clone(v); + } + })); + } + return new Pipes(config); + } + })); + $__export("Pipes", Pipes); + $__export("Pipes", Pipes = __decorate([Injectable(), CONST(), __metadata('design:paramtypes', [Object])], Pipes)); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/iterable_changes", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/iterable_changes"; + var __decorate, + __metadata, + CONST, + isListLikeIterable, + iterateListLike, + MapWrapper, + isBlank, + isPresent, + stringify, + getMapKey, + looseIdentical, + isArray, + WrappedValue, + BasePipe, + IterableChangesFactory, + IterableChanges, + CollectionChangeRecord, + _DuplicateItemRecordList, + _DuplicateMap; + return { + setters: [function($__m) { + CONST = $__m.CONST; + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + stringify = $__m.stringify; + getMapKey = $__m.getMapKey; + looseIdentical = $__m.looseIdentical; + isArray = $__m.isArray; + }, function($__m) { + isListLikeIterable = $__m.isListLikeIterable; + iterateListLike = $__m.iterateListLike; + MapWrapper = $__m.MapWrapper; + }, function($__m) { + WrappedValue = $__m.WrappedValue; + BasePipe = $__m.BasePipe; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + IterableChangesFactory = (($traceurRuntime.createClass)(function() {}, { + supports: function(obj) { + return IterableChanges.supportsObj(obj); + }, + create: function(cdRef) { + return new IterableChanges(); + } + }, {})); + $__export("IterableChangesFactory", IterableChangesFactory); + $__export("IterableChangesFactory", IterableChangesFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], IterableChangesFactory)); + IterableChanges = (function($__super) { + function IterableChanges() { + $traceurRuntime.superConstructor(IterableChanges).call(this); + this._collection = null; + this._length = null; + this._linkedRecords = null; + this._unlinkedRecords = null; + this._previousItHead = null; + this._itHead = null; + this._itTail = null; + this._additionsHead = null; + this._additionsTail = null; + this._movesHead = null; + this._movesTail = null; + this._removalsHead = null; + this._removalsTail = null; + } + return ($traceurRuntime.createClass)(IterableChanges, { + supports: function(obj) { + return IterableChanges.supportsObj(obj); + }, + get collection() { + return this._collection; + }, + get length() { + return this._length; + }, + forEachItem: function(fn) { + var record; + for (record = this._itHead; record !== null; record = record._next) { + fn(record); + } + }, + forEachPreviousItem: function(fn) { + var record; + for (record = this._previousItHead; record !== null; record = record._nextPrevious) { + fn(record); + } + }, + forEachAddedItem: function(fn) { + var record; + for (record = this._additionsHead; record !== null; record = record._nextAdded) { + fn(record); + } + }, + forEachMovedItem: function(fn) { + var record; + for (record = this._movesHead; record !== null; record = record._nextMoved) { + fn(record); + } + }, + forEachRemovedItem: function(fn) { + var record; + for (record = this._removalsHead; record !== null; record = record._nextRemoved) { + fn(record); + } + }, + transform: function(collection) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + if (this.check(collection)) { + return WrappedValue.wrap(this); + } else { + return null; + } + }, + check: function(collection) { + var $__0 = this; + this._reset(); + var record = this._itHead; + var mayBeDirty = false; + var index; + var item; + if (isArray(collection)) { + var list = collection; + this._length = collection.length; + for (index = 0; index < this._length; index++) { + item = list[index]; + if (record === null || !looseIdentical(record.item, item)) { + record = this._mismatch(record, item, index); + mayBeDirty = true; + } else if (mayBeDirty) { + record = this._verifyReinsertion(record, item, index); + } + record = record._next; + } + } else { + index = 0; + iterateListLike(collection, (function(item) { + if (record === null || !looseIdentical(record.item, item)) { + record = $__0._mismatch(record, item, index); + mayBeDirty = true; + } else if (mayBeDirty) { + record = $__0._verifyReinsertion(record, item, index); + } + record = record._next; + index++; + })); + this._length = index; + } + this._truncate(record); + this._collection = collection; + return this.isDirty; + }, + get isDirty() { + return this._additionsHead !== null || this._movesHead !== null || this._removalsHead !== null; + }, + _reset: function() { + if (this.isDirty) { + var record; + var nextRecord; + for (record = this._previousItHead = this._itHead; record !== null; record = record._next) { + record._nextPrevious = record._next; + } + for (record = this._additionsHead; record !== null; record = record._nextAdded) { + record.previousIndex = record.currentIndex; + } + this._additionsHead = this._additionsTail = null; + for (record = this._movesHead; record !== null; record = nextRecord) { + record.previousIndex = record.currentIndex; + nextRecord = record._nextMoved; + } + this._movesHead = this._movesTail = null; + this._removalsHead = this._removalsTail = null; + } + }, + _mismatch: function(record, item, index) { + var previousRecord; + if (record === null) { + previousRecord = this._itTail; + } else { + previousRecord = record._prev; + this._remove(record); + } + record = this._linkedRecords === null ? null : this._linkedRecords.get(item, index); + if (record !== null) { + this._moveAfter(record, previousRecord, index); + } else { + record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(item); + if (record !== null) { + this._reinsertAfter(record, previousRecord, index); + } else { + record = this._addAfter(new CollectionChangeRecord(item), previousRecord, index); + } + } + return record; + }, + _verifyReinsertion: function(record, item, index) { + var reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(item); + if (reinsertRecord !== null) { + record = this._reinsertAfter(reinsertRecord, record._prev, index); + } else if (record.currentIndex != index) { + record.currentIndex = index; + this._addToMoves(record, index); + } + return record; + }, + _truncate: function(record) { + while (record !== null) { + var nextRecord = record._next; + this._addToRemovals(this._unlink(record)); + record = nextRecord; + } + if (this._unlinkedRecords !== null) { + this._unlinkedRecords.clear(); + } + if (this._additionsTail !== null) { + this._additionsTail._nextAdded = null; + } + if (this._movesTail !== null) { + this._movesTail._nextMoved = null; + } + if (this._itTail !== null) { + this._itTail._next = null; + } + if (this._removalsTail !== null) { + this._removalsTail._nextRemoved = null; + } + }, + _reinsertAfter: function(record, prevRecord, index) { + if (this._unlinkedRecords !== null) { + this._unlinkedRecords.remove(record); + } + var prev = record._prevRemoved; + var next = record._nextRemoved; + if (prev === null) { + this._removalsHead = next; + } else { + prev._nextRemoved = next; + } + if (next === null) { + this._removalsTail = prev; + } else { + next._prevRemoved = prev; + } + this._insertAfter(record, prevRecord, index); + this._addToMoves(record, index); + return record; + }, + _moveAfter: function(record, prevRecord, index) { + this._unlink(record); + this._insertAfter(record, prevRecord, index); + this._addToMoves(record, index); + return record; + }, + _addAfter: function(record, prevRecord, index) { + this._insertAfter(record, prevRecord, index); + if (this._additionsTail === null) { + this._additionsTail = this._additionsHead = record; + } else { + this._additionsTail = this._additionsTail._nextAdded = record; + } + return record; + }, + _insertAfter: function(record, prevRecord, index) { + var next = prevRecord === null ? this._itHead : prevRecord._next; + record._next = next; + record._prev = prevRecord; + if (next === null) { + this._itTail = record; + } else { + next._prev = record; + } + if (prevRecord === null) { + this._itHead = record; + } else { + prevRecord._next = record; + } + if (this._linkedRecords === null) { + this._linkedRecords = new _DuplicateMap(); + } + this._linkedRecords.put(record); + record.currentIndex = index; + return record; + }, + _remove: function(record) { + return this._addToRemovals(this._unlink(record)); + }, + _unlink: function(record) { + if (this._linkedRecords !== null) { + this._linkedRecords.remove(record); + } + var prev = record._prev; + var next = record._next; + if (prev === null) { + this._itHead = next; + } else { + prev._next = next; + } + if (next === null) { + this._itTail = prev; + } else { + next._prev = prev; + } + return record; + }, + _addToMoves: function(record, toIndex) { + if (record.previousIndex === toIndex) { + return record; + } + if (this._movesTail === null) { + this._movesTail = this._movesHead = record; + } else { + this._movesTail = this._movesTail._nextMoved = record; + } + return record; + }, + _addToRemovals: function(record) { + if (this._unlinkedRecords === null) { + this._unlinkedRecords = new _DuplicateMap(); + } + this._unlinkedRecords.put(record); + record.currentIndex = null; + record._nextRemoved = null; + if (this._removalsTail === null) { + this._removalsTail = this._removalsHead = record; + record._prevRemoved = null; + } else { + record._prevRemoved = this._removalsTail; + this._removalsTail = this._removalsTail._nextRemoved = record; + } + return record; + }, + toString: function() { + var record; + var list = []; + for (record = this._itHead; record !== null; record = record._next) { + list.push(record); + } + var previous = []; + for (record = this._previousItHead; record !== null; record = record._nextPrevious) { + previous.push(record); + } + var additions = []; + for (record = this._additionsHead; record !== null; record = record._nextAdded) { + additions.push(record); + } + var moves = []; + for (record = this._movesHead; record !== null; record = record._nextMoved) { + moves.push(record); + } + var removals = []; + for (record = this._removalsHead; record !== null; record = record._nextRemoved) { + removals.push(record); + } + return "collection: " + list.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" + "additions: " + additions.join(', ') + "\n" + "moves: " + moves.join(', ') + "\n" + "removals: " + removals.join(', ') + "\n"; + } + }, {supportsObj: function(obj) { + return isListLikeIterable(obj); + }}, $__super); + }(BasePipe)); + $__export("IterableChanges", IterableChanges); + CollectionChangeRecord = (function() { + function CollectionChangeRecord(item) { + this.item = item; + this.currentIndex = null; + this.previousIndex = null; + this._nextPrevious = null; + this._prev = null; + this._next = null; + this._prevDup = null; + this._nextDup = null; + this._prevRemoved = null; + this._nextRemoved = null; + this._nextAdded = null; + this._nextMoved = null; + } + return ($traceurRuntime.createClass)(CollectionChangeRecord, {toString: function() { + return this.previousIndex === this.currentIndex ? stringify(this.item) : stringify(this.item) + '[' + stringify(this.previousIndex) + '->' + stringify(this.currentIndex) + ']'; + }}, {}); + }()); + $__export("CollectionChangeRecord", CollectionChangeRecord); + _DuplicateItemRecordList = (function() { + function _DuplicateItemRecordList() { + this._head = null; + this._tail = null; + } + return ($traceurRuntime.createClass)(_DuplicateItemRecordList, { + add: function(record) { + if (this._head === null) { + this._head = this._tail = record; + record._nextDup = null; + record._prevDup = null; + } else { + this._tail._nextDup = record; + record._prevDup = this._tail; + record._nextDup = null; + this._tail = record; + } + }, + get: function(item, afterIndex) { + var record; + for (record = this._head; record !== null; record = record._nextDup) { + if ((afterIndex === null || afterIndex < record.currentIndex) && looseIdentical(record.item, item)) { + return record; + } + } + return null; + }, + remove: function(record) { + var prev = record._prevDup; + var next = record._nextDup; + if (prev === null) { + this._head = next; + } else { + prev._nextDup = next; + } + if (next === null) { + this._tail = prev; + } else { + next._prevDup = prev; + } + return this._head === null; + } + }, {}); + }()); + _DuplicateMap = (function() { + function _DuplicateMap() { + this.map = new Map(); + } + return ($traceurRuntime.createClass)(_DuplicateMap, { + put: function(record) { + var key = getMapKey(record.item); + var duplicates = this.map.get(key); + if (!isPresent(duplicates)) { + duplicates = new _DuplicateItemRecordList(); + this.map.set(key, duplicates); + } + duplicates.add(record); + }, + get: function(value) { + var afterIndex = arguments[1] !== (void 0) ? arguments[1] : null; + var key = getMapKey(value); + var recordList = this.map.get(key); + return isBlank(recordList) ? null : recordList.get(value, afterIndex); + }, + remove: function(record) { + var key = getMapKey(record.item); + var recordList = this.map.get(key); + if (recordList.remove(record)) { + MapWrapper.delete(this.map, key); + } + return record; + }, + get isEmpty() { + return MapWrapper.size(this.map) === 0; + }, + clear: function() { + this.map.clear(); + }, + toString: function() { + return '_DuplicateMap(' + stringify(this.map) + ')'; + } + }, {}); + }()); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/keyvalue_changes", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/keyvalue_changes"; + var __decorate, + __metadata, + MapWrapper, + StringMapWrapper, + stringify, + looseIdentical, + isJsObject, + CONST, + WrappedValue, + BasePipe, + KeyValueChangesFactory, + KeyValueChanges, + KVChangeRecord; + return { + setters: [function($__m) { + MapWrapper = $__m.MapWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + stringify = $__m.stringify; + looseIdentical = $__m.looseIdentical; + isJsObject = $__m.isJsObject; + CONST = $__m.CONST; + }, function($__m) { + WrappedValue = $__m.WrappedValue; + BasePipe = $__m.BasePipe; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + KeyValueChangesFactory = (($traceurRuntime.createClass)(function() {}, { + supports: function(obj) { + return KeyValueChanges.supportsObj(obj); + }, + create: function(cdRef) { + return new KeyValueChanges(); + } + }, {})); + $__export("KeyValueChangesFactory", KeyValueChangesFactory); + $__export("KeyValueChangesFactory", KeyValueChangesFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], KeyValueChangesFactory)); + KeyValueChanges = (function($__super) { + function KeyValueChanges() { + var $__4; + for (var args = [], + $__3 = 0; $__3 < arguments.length; $__3++) + args[$__3] = arguments[$__3]; + ($__4 = $traceurRuntime.superConstructor(KeyValueChanges)).call.apply($__4, $traceurRuntime.spread([this], args)); + this._records = new Map(); + this._mapHead = null; + this._previousMapHead = null; + this._changesHead = null; + this._changesTail = null; + this._additionsHead = null; + this._additionsTail = null; + this._removalsHead = null; + this._removalsTail = null; + } + return ($traceurRuntime.createClass)(KeyValueChanges, { + supports: function(obj) { + return KeyValueChanges.supportsObj(obj); + }, + transform: function(map) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + if (this.check(map)) { + return WrappedValue.wrap(this); + } else { + return null; + } + }, + get isDirty() { + return this._additionsHead !== null || this._changesHead !== null || this._removalsHead !== null; + }, + forEachItem: function(fn) { + var record; + for (record = this._mapHead; record !== null; record = record._next) { + fn(record); + } + }, + forEachPreviousItem: function(fn) { + var record; + for (record = this._previousMapHead; record !== null; record = record._nextPrevious) { + fn(record); + } + }, + forEachChangedItem: function(fn) { + var record; + for (record = this._changesHead; record !== null; record = record._nextChanged) { + fn(record); + } + }, + forEachAddedItem: function(fn) { + var record; + for (record = this._additionsHead; record !== null; record = record._nextAdded) { + fn(record); + } + }, + forEachRemovedItem: function(fn) { + var record; + for (record = this._removalsHead; record !== null; record = record._nextRemoved) { + fn(record); + } + }, + check: function(map) { + var $__0 = this; + this._reset(); + var records = this._records; + var oldSeqRecord = this._mapHead; + var lastOldSeqRecord = null; + var lastNewSeqRecord = null; + var seqChanged = false; + this._forEach(map, (function(value, key) { + var newSeqRecord; + if (oldSeqRecord !== null && key === oldSeqRecord.key) { + newSeqRecord = oldSeqRecord; + if (!looseIdentical(value, oldSeqRecord.currentValue)) { + oldSeqRecord.previousValue = oldSeqRecord.currentValue; + oldSeqRecord.currentValue = value; + $__0._addToChanges(oldSeqRecord); + } + } else { + seqChanged = true; + if (oldSeqRecord !== null) { + oldSeqRecord._next = null; + $__0._removeFromSeq(lastOldSeqRecord, oldSeqRecord); + $__0._addToRemovals(oldSeqRecord); + } + if (records.has(key)) { + newSeqRecord = records.get(key); + } else { + newSeqRecord = new KVChangeRecord(key); + records.set(key, newSeqRecord); + newSeqRecord.currentValue = value; + $__0._addToAdditions(newSeqRecord); + } + } + if (seqChanged) { + if ($__0._isInRemovals(newSeqRecord)) { + $__0._removeFromRemovals(newSeqRecord); + } + if (lastNewSeqRecord == null) { + $__0._mapHead = newSeqRecord; + } else { + lastNewSeqRecord._next = newSeqRecord; + } + } + lastOldSeqRecord = oldSeqRecord; + lastNewSeqRecord = newSeqRecord; + oldSeqRecord = oldSeqRecord === null ? null : oldSeqRecord._next; + })); + this._truncate(lastOldSeqRecord, oldSeqRecord); + return this.isDirty; + }, + _reset: function() { + if (this.isDirty) { + var record; + for (record = this._previousMapHead = this._mapHead; record !== null; record = record._next) { + record._nextPrevious = record._next; + } + for (record = this._changesHead; record !== null; record = record._nextChanged) { + record.previousValue = record.currentValue; + } + for (record = this._additionsHead; record != null; record = record._nextAdded) { + record.previousValue = record.currentValue; + } + this._changesHead = this._changesTail = null; + this._additionsHead = this._additionsTail = null; + this._removalsHead = this._removalsTail = null; + } + }, + _truncate: function(lastRecord, record) { + while (record !== null) { + if (lastRecord === null) { + this._mapHead = null; + } else { + lastRecord._next = null; + } + var nextRecord = record._next; + this._addToRemovals(record); + lastRecord = record; + record = nextRecord; + } + for (var rec = this._removalsHead; rec !== null; rec = rec._nextRemoved) { + rec.previousValue = rec.currentValue; + rec.currentValue = null; + MapWrapper.delete(this._records, rec.key); + } + }, + _isInRemovals: function(record) { + return record === this._removalsHead || record._nextRemoved !== null || record._prevRemoved !== null; + }, + _addToRemovals: function(record) { + if (this._removalsHead === null) { + this._removalsHead = this._removalsTail = record; + } else { + this._removalsTail._nextRemoved = record; + record._prevRemoved = this._removalsTail; + this._removalsTail = record; + } + }, + _removeFromSeq: function(prev, record) { + var next = record._next; + if (prev === null) { + this._mapHead = next; + } else { + prev._next = next; + } + }, + _removeFromRemovals: function(record) { + var prev = record._prevRemoved; + var next = record._nextRemoved; + if (prev === null) { + this._removalsHead = next; + } else { + prev._nextRemoved = next; + } + if (next === null) { + this._removalsTail = prev; + } else { + next._prevRemoved = prev; + } + record._prevRemoved = record._nextRemoved = null; + }, + _addToAdditions: function(record) { + if (this._additionsHead === null) { + this._additionsHead = this._additionsTail = record; + } else { + this._additionsTail._nextAdded = record; + this._additionsTail = record; + } + }, + _addToChanges: function(record) { + if (this._changesHead === null) { + this._changesHead = this._changesTail = record; + } else { + this._changesTail._nextChanged = record; + this._changesTail = record; + } + }, + toString: function() { + var items = []; + var previous = []; + var changes = []; + var additions = []; + var removals = []; + var record; + for (record = this._mapHead; record !== null; record = record._next) { + items.push(stringify(record)); + } + for (record = this._previousMapHead; record !== null; record = record._nextPrevious) { + previous.push(stringify(record)); + } + for (record = this._changesHead; record !== null; record = record._nextChanged) { + changes.push(stringify(record)); + } + for (record = this._additionsHead; record !== null; record = record._nextAdded) { + additions.push(stringify(record)); + } + for (record = this._removalsHead; record !== null; record = record._nextRemoved) { + removals.push(stringify(record)); + } + return "map: " + items.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" + "additions: " + additions.join(', ') + "\n" + "changes: " + changes.join(', ') + "\n" + "removals: " + removals.join(', ') + "\n"; + }, + _forEach: function(obj, fn) { + if (obj instanceof Map) { + MapWrapper.forEach(obj, fn); + } else { + StringMapWrapper.forEach(obj, fn); + } + } + }, {supportsObj: function(obj) { + return obj instanceof Map || isJsObject(obj); + }}, $__super); + }(BasePipe)); + $__export("KeyValueChanges", KeyValueChanges); + KVChangeRecord = (function() { + function KVChangeRecord(key) { + this.key = key; + this.previousValue = null; + this.currentValue = null; + this._nextPrevious = null; + this._next = null; + this._nextAdded = null; + this._nextRemoved = null; + this._prevRemoved = null; + this._nextChanged = null; + } + return ($traceurRuntime.createClass)(KVChangeRecord, {toString: function() { + return looseIdentical(this.previousValue, this.currentValue) ? stringify(this.key) : (stringify(this.key) + '[' + stringify(this.previousValue) + '->' + stringify(this.currentValue) + ']'); + }}, {}); + }()); + $__export("KVChangeRecord", KVChangeRecord); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/observable_pipe", ["angular2/src/facade/async", "angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/observable_pipe"; + var __decorate, + __metadata, + ObservableWrapper, + isBlank, + isPresent, + CONST, + WrappedValue, + ObservablePipe, + ObservablePipeFactory; + return { + setters: [function($__m) { + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + CONST = $__m.CONST; + }, function($__m) { + WrappedValue = $__m.WrappedValue; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + ObservablePipe = (function() { + function ObservablePipe(_ref) { + this._ref = _ref; + this._latestValue = null; + this._latestReturnedValue = null; + this._subscription = null; + this._observable = null; + } + return ($traceurRuntime.createClass)(ObservablePipe, { + supports: function(obs) { + return ObservableWrapper.isObservable(obs); + }, + onDestroy: function() { + if (isPresent(this._subscription)) { + this._dispose(); + } + }, + transform: function(obs) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + if (isBlank(this._subscription)) { + this._subscribe(obs); + return null; + } + if (obs !== this._observable) { + this._dispose(); + return this.transform(obs); + } + if (this._latestValue === this._latestReturnedValue) { + return this._latestReturnedValue; + } else { + this._latestReturnedValue = this._latestValue; + return WrappedValue.wrap(this._latestValue); + } + }, + _subscribe: function(obs) { + var $__0 = this; + this._observable = obs; + this._subscription = ObservableWrapper.subscribe(obs, (function(value) { + return $__0._updateLatestValue(value); + }), (function(e) { + throw e; + })); + }, + _dispose: function() { + ObservableWrapper.dispose(this._subscription); + this._latestValue = null; + this._latestReturnedValue = null; + this._subscription = null; + this._observable = null; + }, + _updateLatestValue: function(value) { + this._latestValue = value; + this._ref.requestCheck(); + } + }, {}); + }()); + $__export("ObservablePipe", ObservablePipe); + ObservablePipeFactory = (($traceurRuntime.createClass)(function() {}, { + supports: function(obs) { + return ObservableWrapper.isObservable(obs); + }, + create: function(cdRef) { + return new ObservablePipe(cdRef); + } + }, {})); + $__export("ObservablePipeFactory", ObservablePipeFactory); + $__export("ObservablePipeFactory", ObservablePipeFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], ObservablePipeFactory)); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/promise_pipe", ["angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/promise_pipe"; + var __decorate, + __metadata, + isBlank, + isPresent, + isPromise, + CONST, + WrappedValue, + PromisePipe, + PromisePipeFactory; + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + isPromise = $__m.isPromise; + CONST = $__m.CONST; + }, function($__m) { + WrappedValue = $__m.WrappedValue; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + PromisePipe = (function() { + function PromisePipe(_ref) { + this._ref = _ref; + this._latestValue = null; + this._latestReturnedValue = null; + } + return ($traceurRuntime.createClass)(PromisePipe, { + supports: function(promise) { + return isPromise(promise); + }, + onDestroy: function() { + if (isPresent(this._sourcePromise)) { + this._latestValue = null; + this._latestReturnedValue = null; + this._sourcePromise = null; + } + }, + transform: function(promise) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + var $__0 = this; + if (isBlank(this._sourcePromise)) { + this._sourcePromise = promise; + promise.then((function(val) { + if ($__0._sourcePromise === promise) { + $__0._updateLatestValue(val); + } + })); + return null; + } + if (promise !== this._sourcePromise) { + this._sourcePromise = null; + return this.transform(promise); + } + if (this._latestValue === this._latestReturnedValue) { + return this._latestReturnedValue; + } else { + this._latestReturnedValue = this._latestValue; + return WrappedValue.wrap(this._latestValue); + } + }, + _updateLatestValue: function(value) { + this._latestValue = value; + this._ref.requestCheck(); + } + }, {}); + }()); + $__export("PromisePipe", PromisePipe); + PromisePipeFactory = (($traceurRuntime.createClass)(function() {}, { + supports: function(promise) { + return isPromise(promise); + }, + create: function(cdRef) { + return new PromisePipe(cdRef); + } + }, {})); + $__export("PromisePipeFactory", PromisePipeFactory); + $__export("PromisePipeFactory", PromisePipeFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], PromisePipeFactory)); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/uppercase_pipe", ["angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/uppercase_pipe"; + var __decorate, + __metadata, + isString, + StringWrapper, + CONST, + BasePipe, + UpperCasePipe; + return { + setters: [function($__m) { + isString = $__m.isString; + StringWrapper = $__m.StringWrapper; + CONST = $__m.CONST; + }, function($__m) { + BasePipe = $__m.BasePipe; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + UpperCasePipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, { + supports: function(str) { + return isString(str); + }, + transform: function(value) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + return StringWrapper.toUpperCase(value); + }, + create: function(cdRef) { + return this; + } + }, {}, $__super); + }(BasePipe)); + $__export("UpperCasePipe", UpperCasePipe); + $__export("UpperCasePipe", UpperCasePipe = __decorate([CONST(), __metadata('design:paramtypes', [])], UpperCasePipe)); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/lowercase_pipe", ["angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/lowercase_pipe"; + var __decorate, + __metadata, + isString, + StringWrapper, + CONST, + BasePipe, + LowerCasePipe; + return { + setters: [function($__m) { + isString = $__m.isString; + StringWrapper = $__m.StringWrapper; + CONST = $__m.CONST; + }, function($__m) { + BasePipe = $__m.BasePipe; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + LowerCasePipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, { + supports: function(str) { + return isString(str); + }, + transform: function(value) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + return StringWrapper.toLowerCase(value); + }, + create: function(cdRef) { + return this; + } + }, {}, $__super); + }(BasePipe)); + $__export("LowerCasePipe", LowerCasePipe); + $__export("LowerCasePipe", LowerCasePipe = __decorate([CONST(), __metadata('design:paramtypes', [])], LowerCasePipe)); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/json_pipe", ["angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/json_pipe"; + var __decorate, + __metadata, + Json, + CONST, + BasePipe, + JsonPipe; + return { + setters: [function($__m) { + Json = $__m.Json; + CONST = $__m.CONST; + }, function($__m) { + BasePipe = $__m.BasePipe; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + JsonPipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, { + transform: function(value) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + return Json.stringify(value); + }, + create: function(cdRef) { + return this; + } + }, {}, $__super); + }(BasePipe)); + $__export("JsonPipe", JsonPipe); + $__export("JsonPipe", JsonPipe = __decorate([CONST(), __metadata('design:paramtypes', [])], JsonPipe)); + } + }; +}); + +System.register("angular2/src/facade/math", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/facade/math"; + var global, + Math, + NaN; + return { + setters: [function($__m) { + global = $__m.global; + }], + execute: function() { + Math = global.Math; + $__export("Math", Math); + NaN = typeof NaN; + $__export("NaN", NaN); + } + }; +}); + +System.register("angular2/src/facade/intl", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/facade/intl"; + var NumberFormatStyle, + NumberFormatter, + dateFormatterCache, + DateFormatter; + function digitCondition(len) { + return len == 2 ? '2-digit' : 'numeric'; + } + function nameCondition(len) { + return len < 4 ? 'short' : 'long'; + } + function extractComponents(pattern) { + var ret = {}; + var i = 0, + j; + while (i < pattern.length) { + j = i; + while (j < pattern.length && pattern[j] == pattern[i]) + j++; + var len = j - i; + switch (pattern[i]) { + case 'G': + ret.era = nameCondition(len); + break; + case 'y': + ret.year = digitCondition(len); + break; + case 'M': + if (len >= 3) + ret.month = nameCondition(len); + else + ret.month = digitCondition(len); + break; + case 'd': + ret.day = digitCondition(len); + break; + case 'E': + ret.weekday = nameCondition(len); + break; + case 'j': + ret.hour = digitCondition(len); + break; + case 'h': + ret.hour = digitCondition(len); + ret.hour12 = true; + break; + case 'H': + ret.hour = digitCondition(len); + ret.hour12 = false; + break; + case 'm': + ret.minute = digitCondition(len); + break; + case 's': + ret.second = digitCondition(len); + break; + case 'z': + ret.timeZoneName = 'long'; + break; + case 'Z': + ret.timeZoneName = 'short'; + break; + } + i = j; + } + return ret; + } + return { + setters: [], + execute: function() { + $__export("NumberFormatStyle", NumberFormatStyle); + (function(NumberFormatStyle) { + NumberFormatStyle[NumberFormatStyle["DECIMAL"] = 0] = "DECIMAL"; + NumberFormatStyle[NumberFormatStyle["PERCENT"] = 1] = "PERCENT"; + NumberFormatStyle[NumberFormatStyle["CURRENCY"] = 2] = "CURRENCY"; + })(NumberFormatStyle || ($__export("NumberFormatStyle", NumberFormatStyle = {}))); + NumberFormatter = (function() { + function NumberFormatter() {} + return ($traceurRuntime.createClass)(NumberFormatter, {}, {format: function(number, locale, style) { + var $__2, + $__3, + $__4, + $__5; + var $__1 = arguments[3] !== (void 0) ? arguments[3] : {}, + minimumIntegerDigits = ($__2 = $__1.minimumIntegerDigits) === void 0 ? 1 : $__2, + minimumFractionDigits = ($__3 = $__1.minimumFractionDigits) === void 0 ? 0 : $__3, + maximumFractionDigits = ($__4 = $__1.maximumFractionDigits) === void 0 ? 3 : $__4, + currency = $__1.currency, + currencyAsSymbol = ($__5 = $__1.currencyAsSymbol) === void 0 ? false : $__5; + var intlOptions = { + minimumIntegerDigits: minimumIntegerDigits, + minimumFractionDigits: minimumFractionDigits, + maximumFractionDigits: maximumFractionDigits + }; + intlOptions.style = NumberFormatStyle[style].toLowerCase(); + if (style == NumberFormatStyle.CURRENCY) { + intlOptions.currency = currency; + intlOptions.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code'; + } + return new Intl.NumberFormat(locale, intlOptions).format(number); + }}); + }()); + $__export("NumberFormatter", NumberFormatter); + dateFormatterCache = new Map(); + DateFormatter = (function() { + function DateFormatter() {} + return ($traceurRuntime.createClass)(DateFormatter, {}, {format: function(date, locale, pattern) { + var key = locale + pattern; + if (dateFormatterCache.has(key)) { + return dateFormatterCache.get(key).format(date); + } + var formatter = new Intl.DateTimeFormat(locale, extractComponents(pattern)); + dateFormatterCache.set(key, formatter); + return formatter.format(date); + }}); + }()); + $__export("DateFormatter", DateFormatter); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/number_pipe", ["angular2/src/facade/lang", "angular2/src/facade/intl", "angular2/src/facade/collection", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/number_pipe"; + var __decorate, + __metadata, + isNumber, + isPresent, + isBlank, + NumberWrapper, + RegExpWrapper, + BaseException, + CONST, + NumberFormatter, + NumberFormatStyle, + ListWrapper, + BasePipe, + defaultLocale, + _re, + NumberPipe, + DecimalPipe, + PercentPipe, + CurrencyPipe; + return { + setters: [function($__m) { + isNumber = $__m.isNumber; + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + NumberWrapper = $__m.NumberWrapper; + RegExpWrapper = $__m.RegExpWrapper; + BaseException = $__m.BaseException; + CONST = $__m.CONST; + }, function($__m) { + NumberFormatter = $__m.NumberFormatter; + NumberFormatStyle = $__m.NumberFormatStyle; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + BasePipe = $__m.BasePipe; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + defaultLocale = 'en-US'; + _re = RegExpWrapper.create('^(\\d+)?\\.((\\d+)(\\-(\\d+))?)?$'); + NumberPipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, { + supports: function(obj) { + return isNumber(obj); + }, + create: function(cdRef) { + return this; + } + }, {_format: function(value, style, digits) { + var currency = arguments[3] !== (void 0) ? arguments[3] : null; + var currencyAsSymbol = arguments[4] !== (void 0) ? arguments[4] : false; + var minInt = 1, + minFraction = 0, + maxFraction = 3; + if (isPresent(digits)) { + var parts = RegExpWrapper.firstMatch(_re, digits); + if (isBlank(parts)) { + throw new BaseException((digits + " is not a valid digit info for number pipes")); + } + if (isPresent(parts[1])) { + minInt = NumberWrapper.parseIntAutoRadix(parts[1]); + } + if (isPresent(parts[3])) { + minFraction = NumberWrapper.parseIntAutoRadix(parts[3]); + } + if (isPresent(parts[5])) { + maxFraction = NumberWrapper.parseIntAutoRadix(parts[5]); + } + } + return NumberFormatter.format(value, defaultLocale, style, { + minimumIntegerDigits: minInt, + minimumFractionDigits: minFraction, + maximumFractionDigits: maxFraction, + currency: currency, + currencyAsSymbol: currencyAsSymbol + }); + }}, $__super); + }(BasePipe)); + $__export("NumberPipe", NumberPipe); + $__export("NumberPipe", NumberPipe = __decorate([CONST(), __metadata('design:paramtypes', [])], NumberPipe)); + DecimalPipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, {transform: function(value, args) { + var digits = ListWrapper.first(args); + return NumberPipe._format(value, NumberFormatStyle.DECIMAL, digits); + }}, {}, $__super); + }(NumberPipe)); + $__export("DecimalPipe", DecimalPipe); + $__export("DecimalPipe", DecimalPipe = __decorate([CONST(), __metadata('design:paramtypes', [])], DecimalPipe)); + PercentPipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, {transform: function(value, args) { + var digits = ListWrapper.first(args); + return NumberPipe._format(value, NumberFormatStyle.PERCENT, digits); + }}, {}, $__super); + }(NumberPipe)); + $__export("PercentPipe", PercentPipe); + $__export("PercentPipe", PercentPipe = __decorate([CONST(), __metadata('design:paramtypes', [])], PercentPipe)); + CurrencyPipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, {transform: function(value, args) { + var currencyCode = isPresent(args) && args.length > 0 ? args[0] : 'USD'; + var symbolDisplay = isPresent(args) && args.length > 1 ? args[1] : false; + var digits = isPresent(args) && args.length > 2 ? args[2] : null; + return NumberPipe._format(value, NumberFormatStyle.CURRENCY, digits, currencyCode, symbolDisplay); + }}, {}, $__super); + }(NumberPipe)); + $__export("CurrencyPipe", CurrencyPipe); + $__export("CurrencyPipe", CurrencyPipe = __decorate([CONST(), __metadata('design:paramtypes', [])], CurrencyPipe)); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/null_pipe", ["angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/null_pipe"; + var __decorate, + __metadata, + isBlank, + CONST, + BasePipe, + WrappedValue, + NullPipeFactory, + NullPipe; + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + CONST = $__m.CONST; + }, function($__m) { + BasePipe = $__m.BasePipe; + WrappedValue = $__m.WrappedValue; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + NullPipeFactory = (($traceurRuntime.createClass)(function() {}, { + supports: function(obj) { + return NullPipe.supportsObj(obj); + }, + create: function(cdRef) { + return new NullPipe(); + } + }, {})); + $__export("NullPipeFactory", NullPipeFactory); + $__export("NullPipeFactory", NullPipeFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], NullPipeFactory)); + NullPipe = (function($__super) { + function NullPipe() { + var $__3; + for (var args = [], + $__2 = 0; $__2 < arguments.length; $__2++) + args[$__2] = arguments[$__2]; + ($__3 = $traceurRuntime.superConstructor(NullPipe)).call.apply($__3, $traceurRuntime.spread([this], args)); + this.called = false; + } + return ($traceurRuntime.createClass)(NullPipe, { + supports: function(obj) { + return NullPipe.supportsObj(obj); + }, + transform: function(value) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + if (!this.called) { + this.called = true; + return WrappedValue.wrap(null); + } else { + return null; + } + } + }, {supportsObj: function(obj) { + return isBlank(obj); + }}, $__super); + }(BasePipe)); + $__export("NullPipe", NullPipe); + } + }; +}); + +System.register("angular2/src/change_detection/interfaces", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/interfaces"; + var __decorate, + __metadata, + CONST, + ChangeDetection, + ChangeDetectorDefinition; + return { + setters: [function($__m) { + CONST = $__m.CONST; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + ChangeDetection = (($traceurRuntime.createClass)(function() {}, {createProtoChangeDetector: function(definition) { + return null; + }}, {})); + $__export("ChangeDetection", ChangeDetection); + $__export("ChangeDetection", ChangeDetection = __decorate([CONST(), __metadata('design:paramtypes', [])], ChangeDetection)); + ChangeDetectorDefinition = (function() { + function ChangeDetectorDefinition(id, strategy, variableNames, bindingRecords, directiveRecords, generateCheckNoChanges) { + this.id = id; + this.strategy = strategy; + this.variableNames = variableNames; + this.bindingRecords = bindingRecords; + this.directiveRecords = directiveRecords; + this.generateCheckNoChanges = generateCheckNoChanges; + } + return ($traceurRuntime.createClass)(ChangeDetectorDefinition, {}, {}); + }()); + $__export("ChangeDetectorDefinition", ChangeDetectorDefinition); + } + }; +}); + +System.register("angular2/src/change_detection/parser/lexer", ["angular2/src/di/decorators", "angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/parser/lexer"; + var __decorate, + __metadata, + Injectable, + SetWrapper, + NumberWrapper, + StringJoiner, + StringWrapper, + BaseException, + isPresent, + TokenType, + Lexer, + Token, + EOF, + $EOF, + $TAB, + $LF, + $VTAB, + $FF, + $CR, + $SPACE, + $BANG, + $DQ, + $HASH, + $$, + $PERCENT, + $AMPERSAND, + $SQ, + $LPAREN, + $RPAREN, + $STAR, + $PLUS, + $COMMA, + $MINUS, + $PERIOD, + $SLASH, + $COLON, + $SEMICOLON, + $LT, + $EQ, + $GT, + $QUESTION, + $0, + $9, + $A, + $E, + $Z, + $LBRACKET, + $BACKSLASH, + $RBRACKET, + $CARET, + $_, + $a, + $e, + $f, + $n, + $r, + $t, + $u, + $v, + $z, + $LBRACE, + $BAR, + $RBRACE, + $NBSP, + ScannerError, + _Scanner, + OPERATORS, + KEYWORDS; + function newCharacterToken(index, code) { + return new Token(index, TokenType.CHARACTER, code, StringWrapper.fromCharCode(code)); + } + function newIdentifierToken(index, text) { + return new Token(index, TokenType.IDENTIFIER, 0, text); + } + function newKeywordToken(index, text) { + return new Token(index, TokenType.KEYWORD, 0, text); + } + function newOperatorToken(index, text) { + return new Token(index, TokenType.OPERATOR, 0, text); + } + function newStringToken(index, text) { + return new Token(index, TokenType.STRING, 0, text); + } + function newNumberToken(index, n) { + return new Token(index, TokenType.NUMBER, n, ""); + } + function isWhitespace(code) { + return (code >= $TAB && code <= $SPACE) || (code == $NBSP); + } + function isIdentifierStart(code) { + return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || (code == $_) || (code == $$); + } + function isIdentifierPart(code) { + return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || ($0 <= code && code <= $9) || (code == $_) || (code == $$); + } + function isDigit(code) { + return $0 <= code && code <= $9; + } + function isExponentStart(code) { + return code == $e || code == $E; + } + function isExponentSign(code) { + return code == $MINUS || code == $PLUS; + } + function unescape(code) { + switch (code) { + case $n: + return $LF; + case $f: + return $FF; + case $r: + return $CR; + case $t: + return $TAB; + case $v: + return $VTAB; + default: + return code; + } + } + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + SetWrapper = $__m.SetWrapper; + }, function($__m) { + NumberWrapper = $__m.NumberWrapper; + StringJoiner = $__m.StringJoiner; + StringWrapper = $__m.StringWrapper; + BaseException = $__m.BaseException; + isPresent = $__m.isPresent; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + $__export("TokenType", TokenType); + (function(TokenType) { + TokenType[TokenType["CHARACTER"] = 0] = "CHARACTER"; + TokenType[TokenType["IDENTIFIER"] = 1] = "IDENTIFIER"; + TokenType[TokenType["KEYWORD"] = 2] = "KEYWORD"; + TokenType[TokenType["STRING"] = 3] = "STRING"; + TokenType[TokenType["OPERATOR"] = 4] = "OPERATOR"; + TokenType[TokenType["NUMBER"] = 5] = "NUMBER"; + })(TokenType || ($__export("TokenType", TokenType = {}))); + Lexer = (($traceurRuntime.createClass)(function() {}, {tokenize: function(text) { + var scanner = new _Scanner(text); + var tokens = []; + var token = scanner.scanToken(); + while (token != null) { + tokens.push(token); + token = scanner.scanToken(); + } + return tokens; + }}, {})); + $__export("Lexer", Lexer); + $__export("Lexer", Lexer = __decorate([Injectable(), __metadata('design:paramtypes', [])], Lexer)); + Token = (function() { + function Token(index, type, numValue, strValue) { + this.index = index; + this.type = type; + this.numValue = numValue; + this.strValue = strValue; + } + return ($traceurRuntime.createClass)(Token, { + isCharacter: function(code) { + return (this.type == TokenType.CHARACTER && this.numValue == code); + }, + isNumber: function() { + return (this.type == TokenType.NUMBER); + }, + isString: function() { + return (this.type == TokenType.STRING); + }, + isOperator: function(operater) { + return (this.type == TokenType.OPERATOR && this.strValue == operater); + }, + isIdentifier: function() { + return (this.type == TokenType.IDENTIFIER); + }, + isKeyword: function() { + return (this.type == TokenType.KEYWORD); + }, + isKeywordVar: function() { + return (this.type == TokenType.KEYWORD && this.strValue == "var"); + }, + isKeywordNull: function() { + return (this.type == TokenType.KEYWORD && this.strValue == "null"); + }, + isKeywordUndefined: function() { + return (this.type == TokenType.KEYWORD && this.strValue == "undefined"); + }, + isKeywordTrue: function() { + return (this.type == TokenType.KEYWORD && this.strValue == "true"); + }, + isKeywordIf: function() { + return (this.type == TokenType.KEYWORD && this.strValue == "if"); + }, + isKeywordElse: function() { + return (this.type == TokenType.KEYWORD && this.strValue == "else"); + }, + isKeywordFalse: function() { + return (this.type == TokenType.KEYWORD && this.strValue == "false"); + }, + toNumber: function() { + return (this.type == TokenType.NUMBER) ? this.numValue : -1; + }, + toString: function() { + switch (this.type) { + case TokenType.CHARACTER: + case TokenType.STRING: + case TokenType.IDENTIFIER: + case TokenType.KEYWORD: + return this.strValue; + case TokenType.NUMBER: + return this.numValue.toString(); + default: + return null; + } + } + }, {}); + }()); + $__export("Token", Token); + EOF = new Token(-1, TokenType.CHARACTER, 0, ""); + $__export("EOF", EOF); + $EOF = 0; + $__export("$EOF", $EOF); + $TAB = 9; + $__export("$TAB", $TAB); + $LF = 10; + $__export("$LF", $LF); + $VTAB = 11; + $__export("$VTAB", $VTAB); + $FF = 12; + $__export("$FF", $FF); + $CR = 13; + $__export("$CR", $CR); + $SPACE = 32; + $__export("$SPACE", $SPACE); + $BANG = 33; + $__export("$BANG", $BANG); + $DQ = 34; + $__export("$DQ", $DQ); + $HASH = 35; + $__export("$HASH", $HASH); + $$ = 36; + $__export("$$", $$); + $PERCENT = 37; + $__export("$PERCENT", $PERCENT); + $AMPERSAND = 38; + $__export("$AMPERSAND", $AMPERSAND); + $SQ = 39; + $__export("$SQ", $SQ); + $LPAREN = 40; + $__export("$LPAREN", $LPAREN); + $RPAREN = 41; + $__export("$RPAREN", $RPAREN); + $STAR = 42; + $__export("$STAR", $STAR); + $PLUS = 43; + $__export("$PLUS", $PLUS); + $COMMA = 44; + $__export("$COMMA", $COMMA); + $MINUS = 45; + $__export("$MINUS", $MINUS); + $PERIOD = 46; + $__export("$PERIOD", $PERIOD); + $SLASH = 47; + $__export("$SLASH", $SLASH); + $COLON = 58; + $__export("$COLON", $COLON); + $SEMICOLON = 59; + $__export("$SEMICOLON", $SEMICOLON); + $LT = 60; + $__export("$LT", $LT); + $EQ = 61; + $__export("$EQ", $EQ); + $GT = 62; + $__export("$GT", $GT); + $QUESTION = 63; + $__export("$QUESTION", $QUESTION); + $0 = 48; + $9 = 57; + $A = 65, $E = 69, $Z = 90; + $LBRACKET = 91; + $__export("$LBRACKET", $LBRACKET); + $BACKSLASH = 92; + $__export("$BACKSLASH", $BACKSLASH); + $RBRACKET = 93; + $__export("$RBRACKET", $RBRACKET); + $CARET = 94; + $_ = 95; + $a = 97, $e = 101, $f = 102, $n = 110, $r = 114, $t = 116, $u = 117, $v = 118, $z = 122; + $LBRACE = 123; + $__export("$LBRACE", $LBRACE); + $BAR = 124; + $__export("$BAR", $BAR); + $RBRACE = 125; + $__export("$RBRACE", $RBRACE); + $NBSP = 160; + ScannerError = (function($__super) { + function ScannerError(message) { + $traceurRuntime.superConstructor(ScannerError).call(this); + this.message = message; + } + return ($traceurRuntime.createClass)(ScannerError, {toString: function() { + return this.message; + }}, {}, $__super); + }(BaseException)); + $__export("ScannerError", ScannerError); + _Scanner = (function() { + function _Scanner(input) { + this.input = input; + this.peek = 0; + this.index = -1; + this.length = input.length; + this.advance(); + } + return ($traceurRuntime.createClass)(_Scanner, { + advance: function() { + this.peek = ++this.index >= this.length ? $EOF : StringWrapper.charCodeAt(this.input, this.index); + }, + scanToken: function() { + var input = this.input, + length = this.length, + peek = this.peek, + index = this.index; + while (peek <= $SPACE) { + if (++index >= length) { + peek = $EOF; + break; + } else { + peek = StringWrapper.charCodeAt(input, index); + } + } + this.peek = peek; + this.index = index; + if (index >= length) { + return null; + } + if (isIdentifierStart(peek)) + return this.scanIdentifier(); + if (isDigit(peek)) + return this.scanNumber(index); + var start = index; + switch (peek) { + case $PERIOD: + this.advance(); + return isDigit(this.peek) ? this.scanNumber(start) : newCharacterToken(start, $PERIOD); + case $LPAREN: + case $RPAREN: + case $LBRACE: + case $RBRACE: + case $LBRACKET: + case $RBRACKET: + case $COMMA: + case $COLON: + case $SEMICOLON: + return this.scanCharacter(start, peek); + case $SQ: + case $DQ: + return this.scanString(); + case $HASH: + case $PLUS: + case $MINUS: + case $STAR: + case $SLASH: + case $PERCENT: + case $CARET: + return this.scanOperator(start, StringWrapper.fromCharCode(peek)); + case $QUESTION: + return this.scanComplexOperator(start, '?', $PERIOD, '.'); + case $LT: + case $GT: + return this.scanComplexOperator(start, StringWrapper.fromCharCode(peek), $EQ, '='); + case $BANG: + case $EQ: + return this.scanComplexOperator(start, StringWrapper.fromCharCode(peek), $EQ, '=', $EQ, '='); + case $AMPERSAND: + return this.scanComplexOperator(start, '&', $AMPERSAND, '&'); + case $BAR: + return this.scanComplexOperator(start, '|', $BAR, '|'); + case $NBSP: + while (isWhitespace(this.peek)) + this.advance(); + return this.scanToken(); + } + this.error(("Unexpected character [" + StringWrapper.fromCharCode(peek) + "]"), 0); + return null; + }, + scanCharacter: function(start, code) { + assert(this.peek == code); + this.advance(); + return newCharacterToken(start, code); + }, + scanOperator: function(start, str) { + assert(this.peek == StringWrapper.charCodeAt(str, 0)); + assert(SetWrapper.has(OPERATORS, str)); + this.advance(); + return newOperatorToken(start, str); + }, + scanComplexOperator: function(start, one, twoCode, two, threeCode, three) { + assert(this.peek == StringWrapper.charCodeAt(one, 0)); + this.advance(); + var str = one; + if (this.peek == twoCode) { + this.advance(); + str += two; + } + if (isPresent(threeCode) && this.peek == threeCode) { + this.advance(); + str += three; + } + assert(SetWrapper.has(OPERATORS, str)); + return newOperatorToken(start, str); + }, + scanIdentifier: function() { + assert(isIdentifierStart(this.peek)); + var start = this.index; + this.advance(); + while (isIdentifierPart(this.peek)) + this.advance(); + var str = this.input.substring(start, this.index); + if (SetWrapper.has(KEYWORDS, str)) { + return newKeywordToken(start, str); + } else { + return newIdentifierToken(start, str); + } + }, + scanNumber: function(start) { + assert(isDigit(this.peek)); + var simple = (this.index === start); + this.advance(); + while (true) { + if (isDigit(this.peek)) {} else if (this.peek == $PERIOD) { + simple = false; + } else if (isExponentStart(this.peek)) { + this.advance(); + if (isExponentSign(this.peek)) + this.advance(); + if (!isDigit(this.peek)) + this.error('Invalid exponent', -1); + simple = false; + } else { + break; + } + this.advance(); + } + var str = this.input.substring(start, this.index); + var value = simple ? NumberWrapper.parseIntAutoRadix(str) : NumberWrapper.parseFloat(str); + return newNumberToken(start, value); + }, + scanString: function() { + assert(this.peek == $SQ || this.peek == $DQ); + var start = this.index; + var quote = this.peek; + this.advance(); + var buffer; + var marker = this.index; + var input = this.input; + while (this.peek != quote) { + if (this.peek == $BACKSLASH) { + if (buffer == null) + buffer = new StringJoiner(); + buffer.add(input.substring(marker, this.index)); + this.advance(); + var unescapedCode = void 0; + if (this.peek == $u) { + var hex = input.substring(this.index + 1, this.index + 5); + try { + unescapedCode = NumberWrapper.parseInt(hex, 16); + } catch (e) { + this.error(("Invalid unicode escape [\\u" + hex + "]"), 0); + } + for (var i = 0; i < 5; i++) { + this.advance(); + } + } else { + unescapedCode = unescape(this.peek); + this.advance(); + } + buffer.add(StringWrapper.fromCharCode(unescapedCode)); + marker = this.index; + } else if (this.peek == $EOF) { + this.error('Unterminated quote', 0); + } else { + this.advance(); + } + } + var last = input.substring(marker, this.index); + this.advance(); + var unescaped = last; + if (buffer != null) { + buffer.add(last); + unescaped = buffer.toString(); + } + return newStringToken(start, unescaped); + }, + error: function(message, offset) { + var position = this.index + offset; + throw new ScannerError(("Lexer Error: " + message + " at column " + position + " in expression [" + this.input + "]")); + } + }, {}); + }()); + OPERATORS = SetWrapper.createFromList(['+', '-', '*', '/', '%', '^', '=', '==', '!=', '===', '!==', '<', '>', '<=', '>=', '&&', '||', '&', '|', '!', '?', '#', '?.']); + KEYWORDS = SetWrapper.createFromList(['var', 'null', 'undefined', 'true', 'false', 'if', 'else']); + } + }; +}); + +System.register("angular2/src/change_detection/parser/parser", ["angular2/src/di/decorators", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/parser/lexer", "angular2/src/reflection/reflection", "angular2/src/change_detection/parser/ast"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/parser/parser"; + var __decorate, + __metadata, + Injectable, + isBlank, + isPresent, + BaseException, + StringWrapper, + ListWrapper, + Lexer, + EOF, + $PERIOD, + $COLON, + $SEMICOLON, + $LBRACKET, + $RBRACKET, + $COMMA, + $LBRACE, + $RBRACE, + $LPAREN, + $RPAREN, + reflector, + Reflector, + EmptyExpr, + ImplicitReceiver, + AccessMember, + SafeAccessMember, + LiteralPrimitive, + Binary, + PrefixNot, + Conditional, + If, + BindingPipe, + Assignment, + Chain, + KeyedAccess, + LiteralArray, + LiteralMap, + Interpolation, + MethodCall, + SafeMethodCall, + FunctionCall, + TemplateBinding, + ASTWithSource, + _implicitReceiver, + INTERPOLATION_REGEXP, + Parser, + _ParseAST, + SimpleExpressionChecker; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + Lexer = $__m.Lexer; + EOF = $__m.EOF; + $PERIOD = $__m.$PERIOD; + $COLON = $__m.$COLON; + $SEMICOLON = $__m.$SEMICOLON; + $LBRACKET = $__m.$LBRACKET; + $RBRACKET = $__m.$RBRACKET; + $COMMA = $__m.$COMMA; + $LBRACE = $__m.$LBRACE; + $RBRACE = $__m.$RBRACE; + $LPAREN = $__m.$LPAREN; + $RPAREN = $__m.$RPAREN; + }, function($__m) { + reflector = $__m.reflector; + Reflector = $__m.Reflector; + }, function($__m) { + EmptyExpr = $__m.EmptyExpr; + ImplicitReceiver = $__m.ImplicitReceiver; + AccessMember = $__m.AccessMember; + SafeAccessMember = $__m.SafeAccessMember; + LiteralPrimitive = $__m.LiteralPrimitive; + Binary = $__m.Binary; + PrefixNot = $__m.PrefixNot; + Conditional = $__m.Conditional; + If = $__m.If; + BindingPipe = $__m.BindingPipe; + Assignment = $__m.Assignment; + Chain = $__m.Chain; + KeyedAccess = $__m.KeyedAccess; + LiteralArray = $__m.LiteralArray; + LiteralMap = $__m.LiteralMap; + Interpolation = $__m.Interpolation; + MethodCall = $__m.MethodCall; + SafeMethodCall = $__m.SafeMethodCall; + FunctionCall = $__m.FunctionCall; + TemplateBinding = $__m.TemplateBinding; + ASTWithSource = $__m.ASTWithSource; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + _implicitReceiver = new ImplicitReceiver(); + INTERPOLATION_REGEXP = /\{\{(.*?)\}\}/g; + Parser = (($traceurRuntime.createClass)(function(_lexer) { + var providedReflector = arguments[1] !== (void 0) ? arguments[1] : null; + this._lexer = _lexer; + this._reflector = isPresent(providedReflector) ? providedReflector : reflector; + }, { + parseAction: function(input, location) { + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, true).parseChain(); + return new ASTWithSource(ast, input, location); + }, + parseBinding: function(input, location) { + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); + return new ASTWithSource(ast, input, location); + }, + parseSimpleBinding: function(input, location) { + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseSimpleBinding(); + return new ASTWithSource(ast, input, location); + }, + parseTemplateBindings: function(input, location) { + var tokens = this._lexer.tokenize(input); + return new _ParseAST(input, location, tokens, this._reflector, false).parseTemplateBindings(); + }, + parseInterpolation: function(input, location) { + var parts = StringWrapper.split(input, INTERPOLATION_REGEXP); + if (parts.length <= 1) { + return null; + } + var strings = []; + var expressions = []; + for (var i = 0; i < parts.length; i++) { + var part = parts[i]; + if (i % 2 === 0) { + strings.push(part); + } else { + var tokens = this._lexer.tokenize(part); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); + expressions.push(ast); + } + } + return new ASTWithSource(new Interpolation(strings, expressions), input, location); + }, + wrapLiteralPrimitive: function(input, location) { + return new ASTWithSource(new LiteralPrimitive(input), input, location); + } + }, {})); + $__export("Parser", Parser); + $__export("Parser", Parser = __decorate([Injectable(), __metadata('design:paramtypes', [Lexer, Reflector])], Parser)); + _ParseAST = (function() { + function _ParseAST(input, location, tokens, reflector, parseAction) { + this.input = input; + this.location = location; + this.tokens = tokens; + this.reflector = reflector; + this.parseAction = parseAction; + this.index = 0; + } + return ($traceurRuntime.createClass)(_ParseAST, { + peek: function(offset) { + var i = this.index + offset; + return i < this.tokens.length ? this.tokens[i] : EOF; + }, + get next() { + return this.peek(0); + }, + get inputIndex() { + return (this.index < this.tokens.length) ? this.next.index : this.input.length; + }, + advance: function() { + this.index++; + }, + optionalCharacter: function(code) { + if (this.next.isCharacter(code)) { + this.advance(); + return true; + } else { + return false; + } + }, + optionalKeywordVar: function() { + if (this.peekKeywordVar()) { + this.advance(); + return true; + } else { + return false; + } + }, + peekKeywordVar: function() { + return this.next.isKeywordVar() || this.next.isOperator('#'); + }, + expectCharacter: function(code) { + if (this.optionalCharacter(code)) + return ; + this.error(("Missing expected " + StringWrapper.fromCharCode(code))); + }, + optionalOperator: function(op) { + if (this.next.isOperator(op)) { + this.advance(); + return true; + } else { + return false; + } + }, + expectOperator: function(operator) { + if (this.optionalOperator(operator)) + return ; + this.error(("Missing expected operator " + operator)); + }, + expectIdentifierOrKeyword: function() { + var n = this.next; + if (!n.isIdentifier() && !n.isKeyword()) { + this.error(("Unexpected token " + n + ", expected identifier or keyword")); + } + this.advance(); + return n.toString(); + }, + expectIdentifierOrKeywordOrString: function() { + var n = this.next; + if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) { + this.error(("Unexpected token " + n + ", expected identifier, keyword, or string")); + } + this.advance(); + return n.toString(); + }, + parseChain: function() { + var exprs = []; + while (this.index < this.tokens.length) { + var expr = this.parsePipe(); + exprs.push(expr); + if (this.optionalCharacter($SEMICOLON)) { + if (!this.parseAction) { + this.error("Binding expression cannot contain chained expression"); + } + while (this.optionalCharacter($SEMICOLON)) {} + } else if (this.index < this.tokens.length) { + this.error(("Unexpected token '" + this.next + "'")); + } + } + if (exprs.length == 0) + return new EmptyExpr(); + if (exprs.length == 1) + return exprs[0]; + return new Chain(exprs); + }, + parseSimpleBinding: function() { + var ast = this.parseChain(); + if (!SimpleExpressionChecker.check(ast)) { + this.error("Simple binding expression can only contain field access and constants'"); + } + return ast; + }, + parsePipe: function() { + var result = this.parseExpression(); + if (this.optionalOperator("|")) { + if (this.parseAction) { + this.error("Cannot have a pipe in an action expression"); + } + do { + var name = this.expectIdentifierOrKeyword(); + var args = []; + while (this.optionalCharacter($COLON)) { + args.push(this.parsePipe()); + } + result = new BindingPipe(result, name, args); + } while (this.optionalOperator("|")); + } + return result; + }, + parseExpression: function() { + var start = this.inputIndex; + var result = this.parseConditional(); + while (this.next.isOperator('=')) { + if (!result.isAssignable) { + var end = this.inputIndex; + var expression = this.input.substring(start, end); + this.error(("Expression " + expression + " is not assignable")); + } + if (!this.parseAction) { + this.error("Binding expression cannot contain assignments"); + } + this.expectOperator('='); + result = new Assignment(result, this.parseConditional()); + } + return result; + }, + parseConditional: function() { + var start = this.inputIndex; + var result = this.parseLogicalOr(); + if (this.optionalOperator('?')) { + var yes = this.parsePipe(); + if (!this.optionalCharacter($COLON)) { + var end = this.inputIndex; + var expression = this.input.substring(start, end); + this.error(("Conditional expression " + expression + " requires all 3 expressions")); + } + var no = this.parsePipe(); + return new Conditional(result, yes, no); + } else { + return result; + } + }, + parseLogicalOr: function() { + var result = this.parseLogicalAnd(); + while (this.optionalOperator('||')) { + result = new Binary('||', result, this.parseLogicalAnd()); + } + return result; + }, + parseLogicalAnd: function() { + var result = this.parseEquality(); + while (this.optionalOperator('&&')) { + result = new Binary('&&', result, this.parseEquality()); + } + return result; + }, + parseEquality: function() { + var result = this.parseRelational(); + while (true) { + if (this.optionalOperator('==')) { + result = new Binary('==', result, this.parseRelational()); + } else if (this.optionalOperator('===')) { + result = new Binary('===', result, this.parseRelational()); + } else if (this.optionalOperator('!=')) { + result = new Binary('!=', result, this.parseRelational()); + } else if (this.optionalOperator('!==')) { + result = new Binary('!==', result, this.parseRelational()); + } else { + return result; + } + } + }, + parseRelational: function() { + var result = this.parseAdditive(); + while (true) { + if (this.optionalOperator('<')) { + result = new Binary('<', result, this.parseAdditive()); + } else if (this.optionalOperator('>')) { + result = new Binary('>', result, this.parseAdditive()); + } else if (this.optionalOperator('<=')) { + result = new Binary('<=', result, this.parseAdditive()); + } else if (this.optionalOperator('>=')) { + result = new Binary('>=', result, this.parseAdditive()); + } else { + return result; + } + } + }, + parseAdditive: function() { + var result = this.parseMultiplicative(); + while (true) { + if (this.optionalOperator('+')) { + result = new Binary('+', result, this.parseMultiplicative()); + } else if (this.optionalOperator('-')) { + result = new Binary('-', result, this.parseMultiplicative()); + } else { + return result; + } + } + }, + parseMultiplicative: function() { + var result = this.parsePrefix(); + while (true) { + if (this.optionalOperator('*')) { + result = new Binary('*', result, this.parsePrefix()); + } else if (this.optionalOperator('%')) { + result = new Binary('%', result, this.parsePrefix()); + } else if (this.optionalOperator('/')) { + result = new Binary('/', result, this.parsePrefix()); + } else { + return result; + } + } + }, + parsePrefix: function() { + if (this.optionalOperator('+')) { + return this.parsePrefix(); + } else if (this.optionalOperator('-')) { + return new Binary('-', new LiteralPrimitive(0), this.parsePrefix()); + } else if (this.optionalOperator('!')) { + return new PrefixNot(this.parsePrefix()); + } else { + return this.parseCallChain(); + } + }, + parseCallChain: function() { + var result = this.parsePrimary(); + while (true) { + if (this.optionalCharacter($PERIOD)) { + result = this.parseAccessMemberOrMethodCall(result, false); + } else if (this.optionalOperator('?.')) { + result = this.parseAccessMemberOrMethodCall(result, true); + } else if (this.optionalCharacter($LBRACKET)) { + var key = this.parsePipe(); + this.expectCharacter($RBRACKET); + result = new KeyedAccess(result, key); + } else if (this.optionalCharacter($LPAREN)) { + var args = this.parseCallArguments(); + this.expectCharacter($RPAREN); + result = new FunctionCall(result, args); + } else { + return result; + } + } + }, + parsePrimary: function() { + if (this.optionalCharacter($LPAREN)) { + var result = this.parsePipe(); + this.expectCharacter($RPAREN); + return result; + } else if (this.next.isKeywordNull() || this.next.isKeywordUndefined()) { + this.advance(); + return new LiteralPrimitive(null); + } else if (this.next.isKeywordTrue()) { + this.advance(); + return new LiteralPrimitive(true); + } else if (this.next.isKeywordFalse()) { + this.advance(); + return new LiteralPrimitive(false); + } else if (this.parseAction && this.next.isKeywordIf()) { + this.advance(); + this.expectCharacter($LPAREN); + var condition = this.parseExpression(); + this.expectCharacter($RPAREN); + var ifExp = this.parseExpressionOrBlock(); + var elseExp; + if (this.next.isKeywordElse()) { + this.advance(); + elseExp = this.parseExpressionOrBlock(); + } + return new If(condition, ifExp, elseExp); + } else if (this.optionalCharacter($LBRACKET)) { + var elements = this.parseExpressionList($RBRACKET); + this.expectCharacter($RBRACKET); + return new LiteralArray(elements); + } else if (this.next.isCharacter($LBRACE)) { + return this.parseLiteralMap(); + } else if (this.next.isIdentifier()) { + return this.parseAccessMemberOrMethodCall(_implicitReceiver, false); + } else if (this.next.isNumber()) { + var value = this.next.toNumber(); + this.advance(); + return new LiteralPrimitive(value); + } else if (this.next.isString()) { + var literalValue = this.next.toString(); + this.advance(); + return new LiteralPrimitive(literalValue); + } else if (this.index >= this.tokens.length) { + this.error(("Unexpected end of expression: " + this.input)); + } else { + this.error(("Unexpected token " + this.next)); + } + throw new BaseException("Fell through all cases in parsePrimary"); + }, + parseExpressionList: function(terminator) { + var result = []; + if (!this.next.isCharacter(terminator)) { + do { + result.push(this.parsePipe()); + } while (this.optionalCharacter($COMMA)); + } + return result; + }, + parseLiteralMap: function() { + var keys = []; + var values = []; + this.expectCharacter($LBRACE); + if (!this.optionalCharacter($RBRACE)) { + do { + var key = this.expectIdentifierOrKeywordOrString(); + keys.push(key); + this.expectCharacter($COLON); + values.push(this.parsePipe()); + } while (this.optionalCharacter($COMMA)); + this.expectCharacter($RBRACE); + } + return new LiteralMap(keys, values); + }, + parseAccessMemberOrMethodCall: function(receiver) { + var isSafe = arguments[1] !== (void 0) ? arguments[1] : false; + var id = this.expectIdentifierOrKeyword(); + if (this.optionalCharacter($LPAREN)) { + var args = this.parseCallArguments(); + this.expectCharacter($RPAREN); + var fn = this.reflector.method(id); + return isSafe ? new SafeMethodCall(receiver, id, fn, args) : new MethodCall(receiver, id, fn, args); + } else { + var getter = this.reflector.getter(id); + var setter = this.reflector.setter(id); + return isSafe ? new SafeAccessMember(receiver, id, getter, setter) : new AccessMember(receiver, id, getter, setter); + } + }, + parseCallArguments: function() { + if (this.next.isCharacter($RPAREN)) + return []; + var positionals = []; + do { + positionals.push(this.parsePipe()); + } while (this.optionalCharacter($COMMA)); + return positionals; + }, + parseExpressionOrBlock: function() { + if (this.optionalCharacter($LBRACE)) { + var block = this.parseBlockContent(); + this.expectCharacter($RBRACE); + return block; + } + return this.parseExpression(); + }, + parseBlockContent: function() { + if (!this.parseAction) { + this.error("Binding expression cannot contain chained expression"); + } + var exprs = []; + while (this.index < this.tokens.length && !this.next.isCharacter($RBRACE)) { + var expr = this.parseExpression(); + exprs.push(expr); + if (this.optionalCharacter($SEMICOLON)) { + while (this.optionalCharacter($SEMICOLON)) {} + } + } + if (exprs.length == 0) + return new EmptyExpr(); + if (exprs.length == 1) + return exprs[0]; + return new Chain(exprs); + }, + expectTemplateBindingKey: function() { + var result = ''; + var operatorFound = false; + do { + result += this.expectIdentifierOrKeywordOrString(); + operatorFound = this.optionalOperator('-'); + if (operatorFound) { + result += '-'; + } + } while (operatorFound); + return result.toString(); + }, + parseTemplateBindings: function() { + var bindings = []; + var prefix = null; + while (this.index < this.tokens.length) { + var keyIsVar = this.optionalKeywordVar(); + var key = this.expectTemplateBindingKey(); + if (!keyIsVar) { + if (prefix == null) { + prefix = key; + } else { + key = prefix + '-' + key; + } + } + this.optionalCharacter($COLON); + var name = null; + var expression = null; + if (keyIsVar) { + if (this.optionalOperator("=")) { + name = this.expectTemplateBindingKey(); + } else { + name = '\$implicit'; + } + } else if (this.next !== EOF && !this.peekKeywordVar()) { + var start = this.inputIndex; + var ast = this.parsePipe(); + var source = this.input.substring(start, this.inputIndex); + expression = new ASTWithSource(ast, source, this.location); + } + bindings.push(new TemplateBinding(key, keyIsVar, name, expression)); + if (!this.optionalCharacter($SEMICOLON)) { + this.optionalCharacter($COMMA); + } + } + return bindings; + }, + error: function(message) { + var index = arguments[1] !== (void 0) ? arguments[1] : null; + if (isBlank(index)) + index = this.index; + var location = (index < this.tokens.length) ? ("at column " + (this.tokens[index].index + 1) + " in") : "at the end of the expression"; + throw new BaseException(("Parser Error: " + message + " " + location + " [" + this.input + "] in " + this.location)); + } + }, {}); + }()); + $__export("_ParseAST", _ParseAST); + SimpleExpressionChecker = (function() { + function SimpleExpressionChecker() { + this.simple = true; + } + return ($traceurRuntime.createClass)(SimpleExpressionChecker, { + visitImplicitReceiver: function(ast) {}, + visitInterpolation: function(ast) { + this.simple = false; + }, + visitLiteralPrimitive: function(ast) {}, + visitAccessMember: function(ast) {}, + visitSafeAccessMember: function(ast) { + this.simple = false; + }, + visitMethodCall: function(ast) { + this.simple = false; + }, + visitSafeMethodCall: function(ast) { + this.simple = false; + }, + visitFunctionCall: function(ast) { + this.simple = false; + }, + visitLiteralArray: function(ast) { + this.visitAll(ast.expressions); + }, + visitLiteralMap: function(ast) { + this.visitAll(ast.values); + }, + visitBinary: function(ast) { + this.simple = false; + }, + visitPrefixNot: function(ast) { + this.simple = false; + }, + visitConditional: function(ast) { + this.simple = false; + }, + visitPipe: function(ast) { + this.simple = false; + }, + visitKeyedAccess: function(ast) { + this.simple = false; + }, + visitAll: function(asts) { + var res = ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }, + visitChain: function(ast) { + this.simple = false; + }, + visitAssignment: function(ast) { + this.simple = false; + }, + visitIf: function(ast) { + this.simple = false; + } + }, {check: function(ast) { + var s = new SimpleExpressionChecker(); + ast.visit(s); + return s.simple; + }}); + }()); + } + }; +}); + +System.register("angular2/src/change_detection/parser/locals", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/parser/locals"; + var isPresent, + BaseException, + MapWrapper, + Locals; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + }, function($__m) { + MapWrapper = $__m.MapWrapper; + }], + execute: function() { + Locals = (function() { + function Locals(parent, current) { + this.parent = parent; + this.current = current; + } + return ($traceurRuntime.createClass)(Locals, { + contains: function(name) { + if (this.current.has(name)) { + return true; + } + if (isPresent(this.parent)) { + return this.parent.contains(name); + } + return false; + }, + get: function(name) { + if (this.current.has(name)) { + return this.current.get(name); + } + if (isPresent(this.parent)) { + return this.parent.get(name); + } + throw new BaseException(("Cannot find '" + name + "'")); + }, + set: function(name, value) { + if (this.current.has(name)) { + this.current.set(name, value); + } else { + throw new BaseException(("Setting of new keys post-construction is not supported. Key: " + name + ".")); + } + }, + clearValues: function() { + MapWrapper.clearValues(this.current); + } + }, {}); + }()); + $__export("Locals", Locals); + } + }; +}); + +System.register("angular2/src/change_detection/binding_record", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/binding_record"; + var isPresent, + DIRECTIVE, + DIRECTIVE_LIFECYCLE, + ELEMENT_PROPERTY, + ELEMENT_ATTRIBUTE, + ELEMENT_CLASS, + ELEMENT_STYLE, + TEXT_NODE, + BindingRecord; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }], + execute: function() { + DIRECTIVE = "directive"; + DIRECTIVE_LIFECYCLE = "directiveLifecycle"; + ELEMENT_PROPERTY = "elementProperty"; + ELEMENT_ATTRIBUTE = "elementAttribute"; + ELEMENT_CLASS = "elementClass"; + ELEMENT_STYLE = "elementStyle"; + TEXT_NODE = "textNode"; + BindingRecord = (function() { + function BindingRecord(mode, implicitReceiver, ast, elementIndex, propertyName, propertyUnit, setter, lifecycleEvent, directiveRecord) { + this.mode = mode; + this.implicitReceiver = implicitReceiver; + this.ast = ast; + this.elementIndex = elementIndex; + this.propertyName = propertyName; + this.propertyUnit = propertyUnit; + this.setter = setter; + this.lifecycleEvent = lifecycleEvent; + this.directiveRecord = directiveRecord; + } + return ($traceurRuntime.createClass)(BindingRecord, { + callOnChange: function() { + return isPresent(this.directiveRecord) && this.directiveRecord.callOnChange; + }, + isOnPushChangeDetection: function() { + return isPresent(this.directiveRecord) && this.directiveRecord.isOnPushChangeDetection(); + }, + isDirective: function() { + return this.mode === DIRECTIVE; + }, + isDirectiveLifecycle: function() { + return this.mode === DIRECTIVE_LIFECYCLE; + }, + isElementProperty: function() { + return this.mode === ELEMENT_PROPERTY; + }, + isElementAttribute: function() { + return this.mode === ELEMENT_ATTRIBUTE; + }, + isElementClass: function() { + return this.mode === ELEMENT_CLASS; + }, + isElementStyle: function() { + return this.mode === ELEMENT_STYLE; + }, + isTextNode: function() { + return this.mode === TEXT_NODE; + } + }, { + createForDirective: function(ast, propertyName, setter, directiveRecord) { + return new BindingRecord(DIRECTIVE, 0, ast, 0, propertyName, null, setter, null, directiveRecord); + }, + createDirectiveOnCheck: function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, 0, null, 0, null, null, null, "onCheck", directiveRecord); + }, + createDirectiveOnInit: function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, 0, null, 0, null, null, null, "onInit", directiveRecord); + }, + createDirectiveOnChange: function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, 0, null, 0, null, null, null, "onChange", directiveRecord); + }, + createForElementProperty: function(ast, elementIndex, propertyName) { + return new BindingRecord(ELEMENT_PROPERTY, 0, ast, elementIndex, propertyName, null, null, null, null); + }, + createForElementAttribute: function(ast, elementIndex, attributeName) { + return new BindingRecord(ELEMENT_ATTRIBUTE, 0, ast, elementIndex, attributeName, null, null, null, null); + }, + createForElementClass: function(ast, elementIndex, className) { + return new BindingRecord(ELEMENT_CLASS, 0, ast, elementIndex, className, null, null, null, null); + }, + createForElementStyle: function(ast, elementIndex, styleName, unit) { + return new BindingRecord(ELEMENT_STYLE, 0, ast, elementIndex, styleName, unit, null, null, null); + }, + createForHostProperty: function(directiveIndex, ast, propertyName) { + return new BindingRecord(ELEMENT_PROPERTY, directiveIndex, ast, directiveIndex.elementIndex, propertyName, null, null, null, null); + }, + createForHostAttribute: function(directiveIndex, ast, attributeName) { + return new BindingRecord(ELEMENT_ATTRIBUTE, directiveIndex, ast, directiveIndex.elementIndex, attributeName, null, null, null, null); + }, + createForHostClass: function(directiveIndex, ast, className) { + return new BindingRecord(ELEMENT_CLASS, directiveIndex, ast, directiveIndex.elementIndex, className, null, null, null, null); + }, + createForHostStyle: function(directiveIndex, ast, styleName, unit) { + return new BindingRecord(ELEMENT_STYLE, directiveIndex, ast, directiveIndex.elementIndex, styleName, unit, null, null, null); + }, + createForTextNode: function(ast, elementIndex) { + return new BindingRecord(TEXT_NODE, 0, ast, elementIndex, null, null, null, null, null); + } + }); + }()); + $__export("BindingRecord", BindingRecord); + } + }; +}); + +System.register("angular2/src/core/compiler/element_binder", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/element_binder"; + var isBlank, + isPresent, + BaseException, + ElementBinder; + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + }], + execute: function() { + ElementBinder = (function() { + function ElementBinder(index, parent, distanceToParent, protoElementInjector, componentDirective) { + this.index = index; + this.parent = parent; + this.distanceToParent = distanceToParent; + this.protoElementInjector = protoElementInjector; + this.componentDirective = componentDirective; + this.nestedProtoView = null; + this.hostListeners = null; + if (isBlank(index)) { + throw new BaseException('null index not allowed.'); + } + } + return ($traceurRuntime.createClass)(ElementBinder, { + hasStaticComponent: function() { + return isPresent(this.componentDirective) && isPresent(this.nestedProtoView); + }, + hasEmbeddedProtoView: function() { + return !isPresent(this.componentDirective) && isPresent(this.nestedProtoView); + } + }, {}); + }()); + $__export("ElementBinder", ElementBinder); + } + }; +}); + +System.register("angular2/src/core/compiler/view_ref", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view_ref"; + var isPresent, + ViewRef, + ProtoViewRef; + function internalView(viewRef) { + return viewRef._view; + } + function internalProtoView(protoViewRef) { + return isPresent(protoViewRef) ? protoViewRef._protoView : null; + } + $__export("internalView", internalView); + $__export("internalProtoView", internalProtoView); + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }], + execute: function() { + ViewRef = (function() { + function ViewRef(_view) { + this._view = _view; + } + return ($traceurRuntime.createClass)(ViewRef, { + get render() { + return this._view.render; + }, + get renderFragment() { + return this._view.renderFragment; + }, + setLocal: function(contextName, value) { + this._view.setLocal(contextName, value); + } + }, {}); + }()); + $__export("ViewRef", ViewRef); + ProtoViewRef = (function() { + function ProtoViewRef(_protoView) { + this._protoView = _protoView; + } + return ($traceurRuntime.createClass)(ProtoViewRef, {}, {}); + }()); + $__export("ProtoViewRef", ProtoViewRef); + } + }; +}); + +System.register("angular2/src/core/annotations_impl/di", ["angular2/src/facade/lang", "angular2/src/di/metadata", "angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/annotations_impl/di"; + var __decorate, + __metadata, + CONST, + stringify, + StringWrapper, + isString, + DependencyMetadata, + resolveForwardRef, + Attribute, + Query, + ViewQuery; + return { + setters: [function($__m) { + CONST = $__m.CONST; + stringify = $__m.stringify; + StringWrapper = $__m.StringWrapper; + isString = $__m.isString; + }, function($__m) { + DependencyMetadata = $__m.DependencyMetadata; + }, function($__m) { + resolveForwardRef = $__m.resolveForwardRef; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Attribute = (function($__super) { + function $__0(attributeName) { + $traceurRuntime.superConstructor($__0).call(this); + this.attributeName = attributeName; + } + return ($traceurRuntime.createClass)($__0, { + get token() { + return this; + }, + toString: function() { + return ("@Attribute(" + stringify(this.attributeName) + ")"); + } + }, {}, $__super); + }(DependencyMetadata)); + $__export("Attribute", Attribute); + $__export("Attribute", Attribute = __decorate([CONST(), __metadata('design:paramtypes', [String])], Attribute)); + Query = (function($__super) { + function $__0(_selector) { + var $__3; + var $__2 = arguments[1] !== (void 0) ? arguments[1] : {}, + descendants = ($__3 = $__2.descendants) === void 0 ? false : $__3; + $traceurRuntime.superConstructor($__0).call(this); + this._selector = _selector; + this.descendants = descendants; + } + return ($traceurRuntime.createClass)($__0, { + get isViewQuery() { + return false; + }, + get selector() { + return resolveForwardRef(this._selector); + }, + get isVarBindingQuery() { + return isString(this.selector); + }, + get varBindings() { + return StringWrapper.split(this.selector, new RegExp(",")); + }, + toString: function() { + return ("@Query(" + stringify(this.selector) + ")"); + } + }, {}, $__super); + }(DependencyMetadata)); + $__export("Query", Query); + $__export("Query", Query = __decorate([CONST(), __metadata('design:paramtypes', [Object, Object])], Query)); + ViewQuery = (function($__super) { + function $__0(_selector) { + var $__3; + var $__2 = arguments[1] !== (void 0) ? arguments[1] : {}, + descendants = ($__3 = $__2.descendants) === void 0 ? false : $__3; + $traceurRuntime.superConstructor($__0).call(this, _selector, {descendants: descendants}); + } + return ($traceurRuntime.createClass)($__0, { + get isViewQuery() { + return true; + }, + toString: function() { + return ("@ViewQuery(" + stringify(this.selector) + ")"); + } + }, {}, $__super); + }(Query)); + $__export("ViewQuery", ViewQuery); + $__export("ViewQuery", ViewQuery = __decorate([CONST(), __metadata('design:paramtypes', [Object, Object])], ViewQuery)); + } + }; +}); + +System.register("angular2/src/render/api", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/api"; + var isPresent, + isBlank, + RegExpWrapper, + Map, + MapWrapper, + EventBinding, + PropertyBindingType, + ElementPropertyBinding, + ElementBinder, + DirectiveBinder, + ViewType, + ProtoViewDto, + DirectiveMetadata, + RenderProtoViewRef, + RenderFragmentRef, + RenderViewRef, + ViewEncapsulation, + ViewDefinition, + RenderProtoViewMergeMapping, + RenderCompiler, + RenderViewWithFragments, + Renderer; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + RegExpWrapper = $__m.RegExpWrapper; + }, function($__m) { + Map = $__m.Map; + MapWrapper = $__m.MapWrapper; + }], + execute: function() { + EventBinding = (function() { + function EventBinding(fullName, source) { + this.fullName = fullName; + this.source = source; + } + return ($traceurRuntime.createClass)(EventBinding, {}, {}); + }()); + $__export("EventBinding", EventBinding); + $__export("PropertyBindingType", PropertyBindingType); + (function(PropertyBindingType) { + PropertyBindingType[PropertyBindingType["PROPERTY"] = 0] = "PROPERTY"; + PropertyBindingType[PropertyBindingType["ATTRIBUTE"] = 1] = "ATTRIBUTE"; + PropertyBindingType[PropertyBindingType["CLASS"] = 2] = "CLASS"; + PropertyBindingType[PropertyBindingType["STYLE"] = 3] = "STYLE"; + })(PropertyBindingType || ($__export("PropertyBindingType", PropertyBindingType = {}))); + ElementPropertyBinding = (function() { + function ElementPropertyBinding(type, astWithSource, property) { + var unit = arguments[3] !== (void 0) ? arguments[3] : null; + this.type = type; + this.astWithSource = astWithSource; + this.property = property; + this.unit = unit; + } + return ($traceurRuntime.createClass)(ElementPropertyBinding, {}, {}); + }()); + $__export("ElementPropertyBinding", ElementPropertyBinding); + ElementBinder = (function() { + function ElementBinder() { + var $__1 = arguments[0] !== (void 0) ? arguments[0] : {}, + index = $__1.index, + parentIndex = $__1.parentIndex, + distanceToParent = $__1.distanceToParent, + directives = $__1.directives, + nestedProtoView = $__1.nestedProtoView, + propertyBindings = $__1.propertyBindings, + variableBindings = $__1.variableBindings, + eventBindings = $__1.eventBindings, + readAttributes = $__1.readAttributes; + this.index = index; + this.parentIndex = parentIndex; + this.distanceToParent = distanceToParent; + this.directives = directives; + this.nestedProtoView = nestedProtoView; + this.propertyBindings = propertyBindings; + this.variableBindings = variableBindings; + this.eventBindings = eventBindings; + this.readAttributes = readAttributes; + } + return ($traceurRuntime.createClass)(ElementBinder, {}, {}); + }()); + $__export("ElementBinder", ElementBinder); + DirectiveBinder = (function() { + function DirectiveBinder($__1) { + var $__2 = $__1, + directiveIndex = $__2.directiveIndex, + propertyBindings = $__2.propertyBindings, + eventBindings = $__2.eventBindings, + hostPropertyBindings = $__2.hostPropertyBindings; + this.directiveIndex = directiveIndex; + this.propertyBindings = propertyBindings; + this.eventBindings = eventBindings; + this.hostPropertyBindings = hostPropertyBindings; + } + return ($traceurRuntime.createClass)(DirectiveBinder, {}, {}); + }()); + $__export("DirectiveBinder", DirectiveBinder); + $__export("ViewType", ViewType); + (function(ViewType) { + ViewType[ViewType["HOST"] = 0] = "HOST"; + ViewType[ViewType["COMPONENT"] = 1] = "COMPONENT"; + ViewType[ViewType["EMBEDDED"] = 2] = "EMBEDDED"; + })(ViewType || ($__export("ViewType", ViewType = {}))); + ProtoViewDto = (function() { + function ProtoViewDto($__1) { + var $__2 = $__1, + render = $__2.render, + elementBinders = $__2.elementBinders, + variableBindings = $__2.variableBindings, + type = $__2.type, + textBindings = $__2.textBindings, + transitiveNgContentCount = $__2.transitiveNgContentCount; + this.render = render; + this.elementBinders = elementBinders; + this.variableBindings = variableBindings; + this.type = type; + this.textBindings = textBindings; + this.transitiveNgContentCount = transitiveNgContentCount; + } + return ($traceurRuntime.createClass)(ProtoViewDto, {}, {}); + }()); + $__export("ProtoViewDto", ProtoViewDto); + DirectiveMetadata = (function() { + function DirectiveMetadata($__1) { + var $__2 = $__1, + id = $__2.id, + selector = $__2.selector, + compileChildren = $__2.compileChildren, + events = $__2.events, + hostListeners = $__2.hostListeners, + hostProperties = $__2.hostProperties, + hostAttributes = $__2.hostAttributes, + hostActions = $__2.hostActions, + properties = $__2.properties, + readAttributes = $__2.readAttributes, + type = $__2.type, + callOnDestroy = $__2.callOnDestroy, + callOnChange = $__2.callOnChange, + callOnCheck = $__2.callOnCheck, + callOnInit = $__2.callOnInit, + callOnAllChangesDone = $__2.callOnAllChangesDone, + changeDetection = $__2.changeDetection, + exportAs = $__2.exportAs; + this.id = id; + this.selector = selector; + this.compileChildren = isPresent(compileChildren) ? compileChildren : true; + this.events = events; + this.hostListeners = hostListeners; + this.hostAttributes = hostAttributes; + this.hostProperties = hostProperties; + this.hostActions = hostActions; + this.properties = properties; + this.readAttributes = readAttributes; + this.type = type; + this.callOnDestroy = callOnDestroy; + this.callOnChange = callOnChange; + this.callOnCheck = callOnCheck; + this.callOnInit = callOnInit; + this.callOnAllChangesDone = callOnAllChangesDone; + this.changeDetection = changeDetection; + this.exportAs = exportAs; + } + return ($traceurRuntime.createClass)(DirectiveMetadata, {}, { + get DIRECTIVE_TYPE() { + return 0; + }, + get COMPONENT_TYPE() { + return 1; + }, + create: function($__1) { + var $__2 = $__1, + id = $__2.id, + selector = $__2.selector, + compileChildren = $__2.compileChildren, + events = $__2.events, + host = $__2.host, + properties = $__2.properties, + readAttributes = $__2.readAttributes, + type = $__2.type, + callOnDestroy = $__2.callOnDestroy, + callOnChange = $__2.callOnChange, + callOnCheck = $__2.callOnCheck, + callOnInit = $__2.callOnInit, + callOnAllChangesDone = $__2.callOnAllChangesDone, + changeDetection = $__2.changeDetection, + exportAs = $__2.exportAs; + var hostListeners = new Map(); + var hostProperties = new Map(); + var hostAttributes = new Map(); + var hostActions = new Map(); + if (isPresent(host)) { + MapWrapper.forEach(host, (function(value, key) { + var matches = RegExpWrapper.firstMatch(DirectiveMetadata._hostRegExp, key); + if (isBlank(matches)) { + hostAttributes.set(key, value); + } else if (isPresent(matches[1])) { + hostProperties.set(matches[1], value); + } else if (isPresent(matches[2])) { + hostListeners.set(matches[2], value); + } else if (isPresent(matches[3])) { + hostActions.set(matches[3], value); + } + })); + } + return new DirectiveMetadata({ + id: id, + selector: selector, + compileChildren: compileChildren, + events: events, + hostListeners: hostListeners, + hostProperties: hostProperties, + hostAttributes: hostAttributes, + hostActions: hostActions, + properties: properties, + readAttributes: readAttributes, + type: type, + callOnDestroy: callOnDestroy, + callOnChange: callOnChange, + callOnCheck: callOnCheck, + callOnInit: callOnInit, + callOnAllChangesDone: callOnAllChangesDone, + changeDetection: changeDetection, + exportAs: exportAs + }); + } + }); + }()); + $__export("DirectiveMetadata", DirectiveMetadata); + DirectiveMetadata._hostRegExp = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\))|(?:@(.+)))$/g; + RenderProtoViewRef = (function() { + function RenderProtoViewRef() {} + return ($traceurRuntime.createClass)(RenderProtoViewRef, {}, {}); + }()); + $__export("RenderProtoViewRef", RenderProtoViewRef); + RenderFragmentRef = (function() { + function RenderFragmentRef() {} + return ($traceurRuntime.createClass)(RenderFragmentRef, {}, {}); + }()); + $__export("RenderFragmentRef", RenderFragmentRef); + RenderViewRef = (function() { + function RenderViewRef() {} + return ($traceurRuntime.createClass)(RenderViewRef, {}, {}); + }()); + $__export("RenderViewRef", RenderViewRef); + $__export("ViewEncapsulation", ViewEncapsulation); + (function(ViewEncapsulation) { + ViewEncapsulation[ViewEncapsulation["EMULATED"] = 0] = "EMULATED"; + ViewEncapsulation[ViewEncapsulation["NATIVE"] = 1] = "NATIVE"; + ViewEncapsulation[ViewEncapsulation["NONE"] = 2] = "NONE"; + })(ViewEncapsulation || ($__export("ViewEncapsulation", ViewEncapsulation = {}))); + ViewDefinition = (function() { + function ViewDefinition() { + var $__1 = arguments[0] !== (void 0) ? arguments[0] : {}, + componentId = $__1.componentId, + templateAbsUrl = $__1.templateAbsUrl, + template = $__1.template, + styleAbsUrls = $__1.styleAbsUrls, + styles = $__1.styles, + directives = $__1.directives, + encapsulation = $__1.encapsulation; + this.componentId = componentId; + this.templateAbsUrl = templateAbsUrl; + this.template = template; + this.styleAbsUrls = styleAbsUrls; + this.styles = styles; + this.directives = directives; + this.encapsulation = isPresent(encapsulation) ? encapsulation : ViewEncapsulation.EMULATED; + } + return ($traceurRuntime.createClass)(ViewDefinition, {}, {}); + }()); + $__export("ViewDefinition", ViewDefinition); + RenderProtoViewMergeMapping = (function() { + function RenderProtoViewMergeMapping(mergedProtoViewRef, fragmentCount, mappedElementIndices, mappedElementCount, mappedTextIndices, hostElementIndicesByViewIndex, nestedViewCountByViewIndex) { + this.mergedProtoViewRef = mergedProtoViewRef; + this.fragmentCount = fragmentCount; + this.mappedElementIndices = mappedElementIndices; + this.mappedElementCount = mappedElementCount; + this.mappedTextIndices = mappedTextIndices; + this.hostElementIndicesByViewIndex = hostElementIndicesByViewIndex; + this.nestedViewCountByViewIndex = nestedViewCountByViewIndex; + } + return ($traceurRuntime.createClass)(RenderProtoViewMergeMapping, {}, {}); + }()); + $__export("RenderProtoViewMergeMapping", RenderProtoViewMergeMapping); + RenderCompiler = (function() { + function RenderCompiler() {} + return ($traceurRuntime.createClass)(RenderCompiler, { + compileHost: function(directiveMetadata) { + return null; + }, + compile: function(view) { + return null; + }, + mergeProtoViewsRecursively: function(protoViewRefs) { + return null; + } + }, {}); + }()); + $__export("RenderCompiler", RenderCompiler); + RenderViewWithFragments = (function() { + function RenderViewWithFragments(viewRef, fragmentRefs) { + this.viewRef = viewRef; + this.fragmentRefs = fragmentRefs; + } + return ($traceurRuntime.createClass)(RenderViewWithFragments, {}, {}); + }()); + $__export("RenderViewWithFragments", RenderViewWithFragments); + Renderer = (function() { + function Renderer() {} + return ($traceurRuntime.createClass)(Renderer, { + createRootHostView: function(hostProtoViewRef, fragmentCount, hostElementSelector) { + return null; + }, + createView: function(protoViewRef, fragmentCount) { + return null; + }, + destroyView: function(viewRef) {}, + attachFragmentAfterFragment: function(previousFragmentRef, fragmentRef) {}, + attachFragmentAfterElement: function(elementRef, fragmentRef) {}, + detachFragment: function(fragmentRef) {}, + hydrateView: function(viewRef) {}, + dehydrateView: function(viewRef) {}, + getNativeElementSync: function(location) { + return null; + }, + setElementProperty: function(location, propertyName, propertyValue) {}, + setElementAttribute: function(location, attributeName, attributeValue) {}, + setElementClass: function(location, className, isAdd) {}, + setElementStyle: function(location, styleName, styleValue) {}, + invokeElementMethod: function(location, methodName, args) {}, + setText: function(viewRef, textNodeIndex, text) {}, + setEventDispatcher: function(viewRef, dispatcher) {} + }, {}); + }()); + $__export("Renderer", Renderer); + } + }; +}); + +System.register("angular2/src/core/compiler/element_ref", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/element_ref"; + var BaseException, + ElementRef; + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + }], + execute: function() { + ElementRef = (function() { + function ElementRef(parentView, boundElementIndex, renderBoundElementIndex, _renderer) { + this._renderer = _renderer; + this.parentView = parentView; + this.boundElementIndex = boundElementIndex; + this.renderBoundElementIndex = renderBoundElementIndex; + } + return ($traceurRuntime.createClass)(ElementRef, { + get renderView() { + return this.parentView.render; + }, + set renderView(viewRef) { + throw new BaseException('Abstract setter'); + }, + get nativeElement() { + return this._renderer.getNativeElementSync(this); + } + }, {}); + }()); + $__export("ElementRef", ElementRef); + } + }; +}); + +System.register("angular2/src/core/compiler/template_ref", ["angular2/src/core/compiler/view_ref"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/template_ref"; + var internalView, + TemplateRef; + return { + setters: [function($__m) { + internalView = $__m.internalView; + }], + execute: function() { + TemplateRef = (function() { + function TemplateRef(elementRef) { + this.elementRef = elementRef; + } + return ($traceurRuntime.createClass)(TemplateRef, { + _getProtoView: function() { + var parentView = internalView(this.elementRef.parentView); + return parentView.proto.elementBinders[this.elementRef.boundElementIndex - parentView.elementOffset].nestedProtoView; + }, + get protoViewRef() { + return this._getProtoView().ref; + }, + hasLocal: function(name) { + return this._getProtoView().protoLocals.has(name); + } + }, {}); + }()); + $__export("TemplateRef", TemplateRef); + } + }; +}); + +System.register("angular2/src/core/compiler/view_pool", ["angular2/di", "angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view_pool"; + var __decorate, + __metadata, + __param, + Inject, + Injectable, + OpaqueToken, + ListWrapper, + Map, + isPresent, + isBlank, + CONST_EXPR, + APP_VIEW_POOL_CAPACITY, + AppViewPool; + return { + setters: [function($__m) { + Inject = $__m.Inject; + Injectable = $__m.Injectable; + OpaqueToken = $__m.OpaqueToken; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + Map = $__m.Map; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + CONST_EXPR = $__m.CONST_EXPR; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + APP_VIEW_POOL_CAPACITY = CONST_EXPR(new OpaqueToken('AppViewPool.viewPoolCapacity')); + $__export("APP_VIEW_POOL_CAPACITY", APP_VIEW_POOL_CAPACITY); + AppViewPool = (($traceurRuntime.createClass)(function(poolCapacityPerProtoView) { + this._pooledViewsPerProtoView = new Map(); + this._poolCapacityPerProtoView = poolCapacityPerProtoView; + }, { + getView: function(protoView) { + var pooledViews = this._pooledViewsPerProtoView.get(protoView); + if (isPresent(pooledViews) && pooledViews.length > 0) { + return ListWrapper.removeLast(pooledViews); + } + return null; + }, + returnView: function(view) { + var protoView = view.proto; + var pooledViews = this._pooledViewsPerProtoView.get(protoView); + if (isBlank(pooledViews)) { + pooledViews = []; + this._pooledViewsPerProtoView.set(protoView, pooledViews); + } + var haveRemainingCapacity = pooledViews.length < this._poolCapacityPerProtoView; + if (haveRemainingCapacity) { + pooledViews.push(view); + } + return haveRemainingCapacity; + } + }, {})); + $__export("AppViewPool", AppViewPool); + $__export("AppViewPool", AppViewPool = __decorate([Injectable(), __param(0, Inject(APP_VIEW_POOL_CAPACITY)), __metadata('design:paramtypes', [Object])], AppViewPool)); + } + }; +}); + +System.register("angular2/src/core/compiler/view_listener", ["angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view_listener"; + var __decorate, + __metadata, + Injectable, + AppViewListener; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + AppViewListener = (($traceurRuntime.createClass)(function() {}, { + viewCreated: function(view) {}, + viewDestroyed: function(view) {} + }, {})); + $__export("AppViewListener", AppViewListener); + $__export("AppViewListener", AppViewListener = __decorate([Injectable(), __metadata('design:paramtypes', [])], AppViewListener)); + } + }; +}); + +System.register("angular2/src/core/compiler/view_container_ref", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/core/compiler/view_ref"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view_container_ref"; + var ListWrapper, + isPresent, + internalView, + ViewContainerRef; + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + internalView = $__m.internalView; + }], + execute: function() { + ViewContainerRef = (function() { + function ViewContainerRef(viewManager, element) { + this.viewManager = viewManager; + this.element = element; + } + return ($traceurRuntime.createClass)(ViewContainerRef, { + _getViews: function() { + var vc = internalView(this.element.parentView).viewContainers[this.element.boundElementIndex]; + return isPresent(vc) ? vc.views : []; + }, + clear: function() { + for (var i = this.length - 1; i >= 0; i--) { + this.remove(i); + } + }, + get: function(index) { + return this._getViews()[index].ref; + }, + get length() { + return this._getViews().length; + }, + createEmbeddedView: function(templateRef) { + var atIndex = arguments[1] !== (void 0) ? arguments[1] : -1; + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.createEmbeddedViewInContainer(this.element, atIndex, templateRef); + }, + createHostView: function() { + var protoViewRef = arguments[0] !== (void 0) ? arguments[0] : null; + var atIndex = arguments[1] !== (void 0) ? arguments[1] : -1; + var dynamicallyCreatedBindings = arguments[2] !== (void 0) ? arguments[2] : null; + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.createHostViewInContainer(this.element, atIndex, protoViewRef, dynamicallyCreatedBindings); + }, + insert: function(viewRef) { + var atIndex = arguments[1] !== (void 0) ? arguments[1] : -1; + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.attachViewInContainer(this.element, atIndex, viewRef); + }, + indexOf: function(viewRef) { + return ListWrapper.indexOf(this._getViews(), internalView(viewRef)); + }, + remove: function() { + var atIndex = arguments[0] !== (void 0) ? arguments[0] : -1; + if (atIndex == -1) + atIndex = this.length - 1; + this.viewManager.destroyViewInContainer(this.element, atIndex); + }, + detach: function() { + var atIndex = arguments[0] !== (void 0) ? arguments[0] : -1; + if (atIndex == -1) + atIndex = this.length - 1; + return this.viewManager.detachViewInContainer(this.element, atIndex); + } + }, {}); + }()); + $__export("ViewContainerRef", ViewContainerRef); + } + }; +}); + +System.register("angular2/src/core/compiler/directive_lifecycle_reflector", ["angular2/src/facade/lang", "angular2/src/core/annotations_impl/annotations"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/directive_lifecycle_reflector"; + var Type, + isPresent, + LifecycleEvent; + function hasLifecycleHook(e, type, annotation) { + if (isPresent(annotation.lifecycle)) { + return annotation.lifecycle.indexOf(e) !== -1; + } else { + if (!(type instanceof Type)) + return false; + var proto = type.prototype; + switch (e) { + case LifecycleEvent.onAllChangesDone: + return !!proto.onAllChangesDone; + case LifecycleEvent.onChange: + return !!proto.onChange; + case LifecycleEvent.onCheck: + return !!proto.onCheck; + case LifecycleEvent.onDestroy: + return !!proto.onDestroy; + case LifecycleEvent.onInit: + return !!proto.onInit; + default: + return false; + } + } + } + $__export("hasLifecycleHook", hasLifecycleHook); + return { + setters: [function($__m) { + Type = $__m.Type; + isPresent = $__m.isPresent; + }, function($__m) { + LifecycleEvent = $__m.LifecycleEvent; + }], + execute: function() { + } + }; +}); + +System.register("angular2/src/core/compiler/query_list", ["angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/query_list"; + var ListWrapper, + QueryList; + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + }], + execute: function() { + QueryList = (function() { + var $__1; + function QueryList() { + this._results = []; + this._callbacks = []; + this._dirty = false; + } + return ($traceurRuntime.createClass)(QueryList, ($__1 = {}, Object.defineProperty($__1, "reset", { + value: function(newList) { + this._results = newList; + this._dirty = true; + }, + configurable: true, + enumerable: true, + writable: true + }), Object.defineProperty($__1, "add", { + value: function(obj) { + this._results.push(obj); + this._dirty = true; + }, + configurable: true, + enumerable: true, + writable: true + }), Object.defineProperty($__1, "fireCallbacks", { + value: function() { + if (this._dirty) { + ListWrapper.forEach(this._callbacks, (function(c) { + return c(); + })); + this._dirty = false; + } + }, + configurable: true, + enumerable: true, + writable: true + }), Object.defineProperty($__1, "onChange", { + value: function(callback) { + this._callbacks.push(callback); + }, + configurable: true, + enumerable: true, + writable: true + }), Object.defineProperty($__1, "removeCallback", { + value: function(callback) { + ListWrapper.remove(this._callbacks, callback); + }, + configurable: true, + enumerable: true, + writable: true + }), Object.defineProperty($__1, "length", { + get: function() { + return this._results.length; + }, + configurable: true, + enumerable: true + }), Object.defineProperty($__1, "first", { + get: function() { + return ListWrapper.first(this._results); + }, + configurable: true, + enumerable: true + }), Object.defineProperty($__1, "last", { + get: function() { + return ListWrapper.last(this._results); + }, + configurable: true, + enumerable: true + }), Object.defineProperty($__1, "map", { + value: function(fn) { + return this._results.map(fn); + }, + configurable: true, + enumerable: true, + writable: true + }), Object.defineProperty($__1, Symbol.iterator, { + value: function() { + return this._results[Symbol.iterator](); + }, + configurable: true, + enumerable: true, + writable: true + }), $__1), {}); + }()); + $__export("QueryList", QueryList); + } + }; +}); + +System.register("angular2/src/core/annotations_impl/view", ["angular2/src/facade/lang", "angular2/src/render/api"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/annotations_impl/view"; + var __decorate, + __metadata, + CONST, + View; + return { + setters: [function($__m) { + CONST = $__m.CONST; + }, function($__m) { + $__export("ViewEncapsulation", $__m.ViewEncapsulation); + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + View = (($traceurRuntime.createClass)(function() { + var $__2 = arguments[0] !== (void 0) ? arguments[0] : {}, + templateUrl = $__2.templateUrl, + template = $__2.template, + directives = $__2.directives, + encapsulation = $__2.encapsulation, + styles = $__2.styles, + styleUrls = $__2.styleUrls; + this.templateUrl = templateUrl; + this.template = template; + this.styleUrls = styleUrls; + this.styles = styles; + this.directives = directives; + this.encapsulation = encapsulation; + }, {}, {})); + $__export("View", View); + $__export("View", View = __decorate([CONST(), __metadata('design:paramtypes', [Object])], View)); + } + }; +}); + +System.register("angular2/src/core/compiler/component_url_mapper", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/component_url_mapper"; + var __decorate, + __metadata, + Injectable, + isPresent, + Map, + ComponentUrlMapper, + RuntimeComponentUrlMapper; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + Map = $__m.Map; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + ComponentUrlMapper = (($traceurRuntime.createClass)(function() {}, {getUrl: function(component) { + return './'; + }}, {})); + $__export("ComponentUrlMapper", ComponentUrlMapper); + $__export("ComponentUrlMapper", ComponentUrlMapper = __decorate([Injectable(), __metadata('design:paramtypes', [])], ComponentUrlMapper)); + RuntimeComponentUrlMapper = (function($__super) { + function RuntimeComponentUrlMapper() { + $traceurRuntime.superConstructor(RuntimeComponentUrlMapper).call(this); + this._componentUrls = new Map(); + } + return ($traceurRuntime.createClass)(RuntimeComponentUrlMapper, { + setComponentUrl: function(component, url) { + this._componentUrls.set(component, url); + }, + getUrl: function(component) { + var url = this._componentUrls.get(component); + if (isPresent(url)) + return url; + return $traceurRuntime.superGet(this, RuntimeComponentUrlMapper.prototype, "getUrl").call(this, component); + } + }, {}, $__super); + }(ComponentUrlMapper)); + $__export("RuntimeComponentUrlMapper", RuntimeComponentUrlMapper); + } + }; +}); + +System.register("angular2/src/core/compiler/proto_view_factory", ["angular2/di", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/reflection/reflection", "angular2/src/change_detection/change_detection", "angular2/src/render/api", "angular2/src/core/compiler/view", "angular2/src/core/compiler/element_injector"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/proto_view_factory"; + var __decorate, + __metadata, + Injectable, + ListWrapper, + MapWrapper, + isPresent, + isBlank, + BaseException, + assertionsEnabled, + reflector, + ChangeDetection, + DirectiveIndex, + BindingRecord, + DirectiveRecord, + DEFAULT, + ChangeDetectorDefinition, + renderApi, + AppProtoView, + ProtoElementInjector, + BindingRecordsCreator, + ProtoViewFactory, + RenderProtoViewWithIndex, + ParentProtoElementInjectorWithDistance; + function getChangeDetectorDefinitions(hostComponentMetadata, rootRenderProtoView, allRenderDirectiveMetadata) { + var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); + var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); + return _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata); + } + function _collectNestedProtoViews(renderProtoView) { + var parentIndex = arguments[1] !== (void 0) ? arguments[1] : null; + var boundElementIndex = arguments[2] !== (void 0) ? arguments[2] : null; + var result = arguments[3] !== (void 0) ? arguments[3] : null; + if (isBlank(result)) { + result = []; + } + result.push(new RenderProtoViewWithIndex(renderProtoView, result.length, parentIndex, boundElementIndex)); + var currentIndex = result.length - 1; + var childBoundElementIndex = 0; + ListWrapper.forEach(renderProtoView.elementBinders, (function(elementBinder) { + if (isPresent(elementBinder.nestedProtoView)) { + _collectNestedProtoViews(elementBinder.nestedProtoView, currentIndex, childBoundElementIndex, result); + } + childBoundElementIndex++; + })); + return result; + } + function _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata) { + return ListWrapper.map(nestedPvsWithIndex, (function(pvWithIndex) { + var elementBinders = pvWithIndex.renderProtoView.elementBinders; + var bindingRecordsCreator = new BindingRecordsCreator(); + var bindingRecords = bindingRecordsCreator.getBindingRecords(pvWithIndex.renderProtoView.textBindings, elementBinders, allRenderDirectiveMetadata); + var directiveRecords = bindingRecordsCreator.getDirectiveRecords(elementBinders, allRenderDirectiveMetadata); + var strategyName = DEFAULT; + var typeString; + if (pvWithIndex.renderProtoView.type === renderApi.ViewType.COMPONENT) { + strategyName = hostComponentMetadata.changeDetection; + typeString = 'comp'; + } else if (pvWithIndex.renderProtoView.type === renderApi.ViewType.HOST) { + typeString = 'host'; + } else { + typeString = 'embedded'; + } + var id = (hostComponentMetadata.id + "_" + typeString + "_" + pvWithIndex.index); + var variableNames = nestedPvVariableNames[pvWithIndex.index]; + return new ChangeDetectorDefinition(id, strategyName, variableNames, bindingRecords, directiveRecords, assertionsEnabled()); + })); + } + function _createAppProtoView(renderProtoView, protoChangeDetector, variableBindings, allDirectives) { + var elementBinders = renderProtoView.elementBinders; + var protoView = new AppProtoView(renderProtoView.type, renderProtoView.transitiveNgContentCount > 0, renderProtoView.render, protoChangeDetector, variableBindings, createVariableLocations(elementBinders), renderProtoView.textBindings.length); + _createElementBinders(protoView, elementBinders, allDirectives); + _bindDirectiveEvents(protoView, elementBinders); + return protoView; + } + function _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex) { + return ListWrapper.map(nestedPvsWithIndex, (function(pvWithIndex) { + return _createVariableBindings(pvWithIndex.renderProtoView); + })); + } + function _createVariableBindings(renderProtoView) { + var variableBindings = new Map(); + MapWrapper.forEach(renderProtoView.variableBindings, (function(mappedName, varName) { + variableBindings.set(varName, mappedName); + })); + return variableBindings; + } + function _collectNestedProtoViewsVariableNames(nestedPvsWithIndex) { + var nestedPvVariableNames = ListWrapper.createFixedSize(nestedPvsWithIndex.length); + ListWrapper.forEach(nestedPvsWithIndex, (function(pvWithIndex) { + var parentVariableNames = isPresent(pvWithIndex.parentIndex) ? nestedPvVariableNames[pvWithIndex.parentIndex] : null; + nestedPvVariableNames[pvWithIndex.index] = _createVariableNames(parentVariableNames, pvWithIndex.renderProtoView); + })); + return nestedPvVariableNames; + } + function _createVariableNames(parentVariableNames, renderProtoView) { + var res = isBlank(parentVariableNames) ? [] : ListWrapper.clone(parentVariableNames); + MapWrapper.forEach(renderProtoView.variableBindings, (function(mappedName, varName) { + res.push(mappedName); + })); + ListWrapper.forEach(renderProtoView.elementBinders, (function(binder) { + MapWrapper.forEach(binder.variableBindings, (function(mappedName, varName) { + res.push(mappedName); + })); + })); + return res; + } + function createVariableLocations(elementBinders) { + var variableLocations = new Map(); + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + MapWrapper.forEach(binder.variableBindings, (function(mappedName, varName) { + variableLocations.set(mappedName, i); + })); + } + return variableLocations; + } + function _createElementBinders(protoView, elementBinders, allDirectiveBindings) { + for (var i = 0; i < elementBinders.length; i++) { + var renderElementBinder = elementBinders[i]; + var dirs = elementBinders[i].directives; + var parentPeiWithDistance = _findParentProtoElementInjectorWithDistance(i, protoView.elementBinders, elementBinders); + var directiveBindings = ListWrapper.map(dirs, (function(dir) { + return allDirectiveBindings[dir.directiveIndex]; + })); + var componentDirectiveBinding = null; + if (directiveBindings.length > 0) { + if (directiveBindings[0].metadata.type === renderApi.DirectiveMetadata.COMPONENT_TYPE) { + componentDirectiveBinding = directiveBindings[0]; + } + } + var protoElementInjector = _createProtoElementInjector(i, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings); + _createElementBinder(protoView, i, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings); + } + } + function _findParentProtoElementInjectorWithDistance(binderIndex, elementBinders, renderElementBinders) { + var distance = 0; + do { + var renderElementBinder = renderElementBinders[binderIndex]; + binderIndex = renderElementBinder.parentIndex; + if (binderIndex !== -1) { + distance += renderElementBinder.distanceToParent; + var elementBinder = elementBinders[binderIndex]; + if (isPresent(elementBinder.protoElementInjector)) { + return new ParentProtoElementInjectorWithDistance(elementBinder.protoElementInjector, distance); + } + } + } while (binderIndex !== -1); + return new ParentProtoElementInjectorWithDistance(null, 0); + } + function _createProtoElementInjector(binderIndex, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings) { + var protoElementInjector = null; + var hasVariables = MapWrapper.size(renderElementBinder.variableBindings) > 0; + if (directiveBindings.length > 0 || hasVariables) { + var directiveVariableBindings = createDirectiveVariableBindings(renderElementBinder, directiveBindings); + protoElementInjector = ProtoElementInjector.create(parentPeiWithDistance.protoElementInjector, binderIndex, directiveBindings, isPresent(componentDirectiveBinding), parentPeiWithDistance.distance, directiveVariableBindings); + protoElementInjector.attributes = renderElementBinder.readAttributes; + } + return protoElementInjector; + } + function _createElementBinder(protoView, boundElementIndex, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings) { + var parent = null; + if (renderElementBinder.parentIndex !== -1) { + parent = protoView.elementBinders[renderElementBinder.parentIndex]; + } + var elBinder = protoView.bindElement(parent, renderElementBinder.distanceToParent, protoElementInjector, componentDirectiveBinding); + protoView.bindEvent(renderElementBinder.eventBindings, boundElementIndex, -1); + MapWrapper.forEach(renderElementBinder.variableBindings, (function(mappedName, varName) { + protoView.protoLocals.set(mappedName, null); + })); + return elBinder; + } + function createDirectiveVariableBindings(renderElementBinder, directiveBindings) { + var directiveVariableBindings = new Map(); + MapWrapper.forEach(renderElementBinder.variableBindings, (function(templateName, exportAs) { + var dirIndex = _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs); + directiveVariableBindings.set(templateName, dirIndex); + })); + return directiveVariableBindings; + } + function _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs) { + var matchedDirectiveIndex = null; + var matchedDirective; + for (var i = 0; i < directiveBindings.length; ++i) { + var directive = directiveBindings[i]; + if (_directiveExportAs(directive) == exportAs) { + if (isPresent(matchedDirective)) { + throw new BaseException(("More than one directive have exportAs = '" + exportAs + "'. Directives: [" + matchedDirective.displayName + ", " + directive.displayName + "]")); + } + matchedDirectiveIndex = i; + matchedDirective = directive; + } + } + if (isBlank(matchedDirective) && exportAs !== "$implicit") { + throw new BaseException(("Cannot find directive with exportAs = '" + exportAs + "'")); + } + return matchedDirectiveIndex; + } + function _directiveExportAs(directive) { + var directiveExportAs = directive.metadata.exportAs; + if (isBlank(directiveExportAs) && directive.metadata.type === renderApi.DirectiveMetadata.COMPONENT_TYPE) { + return "$implicit"; + } else { + return directiveExportAs; + } + } + function _bindDirectiveEvents(protoView, elementBinders) { + for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; ++boundElementIndex) { + var dirs = elementBinders[boundElementIndex].directives; + for (var i = 0; i < dirs.length; i++) { + var directiveBinder = dirs[i]; + protoView.bindEvent(directiveBinder.eventBindings, boundElementIndex, i); + } + } + } + $__export("getChangeDetectorDefinitions", getChangeDetectorDefinitions); + $__export("createVariableLocations", createVariableLocations); + $__export("createDirectiveVariableBindings", createDirectiveVariableBindings); + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + MapWrapper = $__m.MapWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + assertionsEnabled = $__m.assertionsEnabled; + }, function($__m) { + reflector = $__m.reflector; + }, function($__m) { + ChangeDetection = $__m.ChangeDetection; + DirectiveIndex = $__m.DirectiveIndex; + BindingRecord = $__m.BindingRecord; + DirectiveRecord = $__m.DirectiveRecord; + DEFAULT = $__m.DEFAULT; + ChangeDetectorDefinition = $__m.ChangeDetectorDefinition; + }, function($__m) { + renderApi = $__m; + }, function($__m) { + AppProtoView = $__m.AppProtoView; + }, function($__m) { + ProtoElementInjector = $__m.ProtoElementInjector; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + BindingRecordsCreator = (function() { + function BindingRecordsCreator() { + this._directiveRecordsMap = new Map(); + } + return ($traceurRuntime.createClass)(BindingRecordsCreator, { + getBindingRecords: function(textBindings, elementBinders, allDirectiveMetadatas) { + var bindings = []; + this._createTextNodeRecords(bindings, textBindings); + for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; boundElementIndex++) { + var renderElementBinder = elementBinders[boundElementIndex]; + this._createElementPropertyRecords(bindings, boundElementIndex, renderElementBinder); + this._createDirectiveRecords(bindings, boundElementIndex, renderElementBinder.directives, allDirectiveMetadatas); + } + return bindings; + }, + getDirectiveRecords: function(elementBinders, allDirectiveMetadatas) { + var directiveRecords = []; + for (var elementIndex = 0; elementIndex < elementBinders.length; ++elementIndex) { + var dirs = elementBinders[elementIndex].directives; + for (var dirIndex = 0; dirIndex < dirs.length; ++dirIndex) { + directiveRecords.push(this._getDirectiveRecord(elementIndex, dirIndex, allDirectiveMetadatas[dirs[dirIndex].directiveIndex])); + } + } + return directiveRecords; + }, + _createTextNodeRecords: function(bindings, textBindings) { + for (var i = 0; i < textBindings.length; i++) { + bindings.push(BindingRecord.createForTextNode(textBindings[i], i)); + } + }, + _createElementPropertyRecords: function(bindings, boundElementIndex, renderElementBinder) { + ListWrapper.forEach(renderElementBinder.propertyBindings, (function(binding) { + if (binding.type === renderApi.PropertyBindingType.PROPERTY) { + bindings.push(BindingRecord.createForElementProperty(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === renderApi.PropertyBindingType.ATTRIBUTE) { + bindings.push(BindingRecord.createForElementAttribute(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === renderApi.PropertyBindingType.CLASS) { + bindings.push(BindingRecord.createForElementClass(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === renderApi.PropertyBindingType.STYLE) { + bindings.push(BindingRecord.createForElementStyle(binding.astWithSource, boundElementIndex, binding.property, binding.unit)); + } + })); + }, + _createDirectiveRecords: function(bindings, boundElementIndex, directiveBinders, allDirectiveMetadatas) { + for (var i = 0; i < directiveBinders.length; i++) { + var directiveBinder = directiveBinders[i]; + var directiveMetadata = allDirectiveMetadatas[directiveBinder.directiveIndex]; + var directiveRecord = this._getDirectiveRecord(boundElementIndex, i, directiveMetadata); + MapWrapper.forEach(directiveBinder.propertyBindings, (function(astWithSource, propertyName) { + var setter = reflector.setter(propertyName); + bindings.push(BindingRecord.createForDirective(astWithSource, propertyName, setter, directiveRecord)); + })); + if (directiveRecord.callOnChange) { + bindings.push(BindingRecord.createDirectiveOnChange(directiveRecord)); + } + if (directiveRecord.callOnInit) { + bindings.push(BindingRecord.createDirectiveOnInit(directiveRecord)); + } + if (directiveRecord.callOnCheck) { + bindings.push(BindingRecord.createDirectiveOnCheck(directiveRecord)); + } + } + for (var i = 0; i < directiveBinders.length; i++) { + var directiveBinder = directiveBinders[i]; + ListWrapper.forEach(directiveBinder.hostPropertyBindings, (function(binding) { + var dirIndex = new DirectiveIndex(boundElementIndex, i); + if (binding.type === renderApi.PropertyBindingType.PROPERTY) { + bindings.push(BindingRecord.createForHostProperty(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === renderApi.PropertyBindingType.ATTRIBUTE) { + bindings.push(BindingRecord.createForHostAttribute(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === renderApi.PropertyBindingType.CLASS) { + bindings.push(BindingRecord.createForHostClass(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === renderApi.PropertyBindingType.STYLE) { + bindings.push(BindingRecord.createForHostStyle(dirIndex, binding.astWithSource, binding.property, binding.unit)); + } + })); + } + }, + _getDirectiveRecord: function(boundElementIndex, directiveIndex, directiveMetadata) { + var id = boundElementIndex * 100 + directiveIndex; + if (!this._directiveRecordsMap.has(id)) { + this._directiveRecordsMap.set(id, new DirectiveRecord({ + directiveIndex: new DirectiveIndex(boundElementIndex, directiveIndex), + callOnAllChangesDone: directiveMetadata.callOnAllChangesDone, + callOnChange: directiveMetadata.callOnChange, + callOnCheck: directiveMetadata.callOnCheck, + callOnInit: directiveMetadata.callOnInit, + changeDetection: directiveMetadata.changeDetection + })); + } + return this._directiveRecordsMap.get(id); + } + }, {}); + }()); + ProtoViewFactory = (($traceurRuntime.createClass)(function(_changeDetection) { + this._changeDetection = _changeDetection; + }, {createAppProtoViews: function(hostComponentBinding, rootRenderProtoView, allDirectives) { + var $__0 = this; + var allRenderDirectiveMetadata = ListWrapper.map(allDirectives, (function(directiveBinding) { + return directiveBinding.metadata; + })); + var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); + var nestedPvVariableBindings = _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex); + var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); + var changeDetectorDefs = _getChangeDetectorDefinitions(hostComponentBinding.metadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata); + var protoChangeDetectors = ListWrapper.map(changeDetectorDefs, (function(changeDetectorDef) { + return $__0._changeDetection.createProtoChangeDetector(changeDetectorDef); + })); + var appProtoViews = ListWrapper.createFixedSize(nestedPvsWithIndex.length); + ListWrapper.forEach(nestedPvsWithIndex, (function(pvWithIndex) { + var appProtoView = _createAppProtoView(pvWithIndex.renderProtoView, protoChangeDetectors[pvWithIndex.index], nestedPvVariableBindings[pvWithIndex.index], allDirectives); + if (isPresent(pvWithIndex.parentIndex)) { + var parentView = appProtoViews[pvWithIndex.parentIndex]; + parentView.elementBinders[pvWithIndex.boundElementIndex].nestedProtoView = appProtoView; + } + appProtoViews[pvWithIndex.index] = appProtoView; + })); + return appProtoViews; + }}, {})); + $__export("ProtoViewFactory", ProtoViewFactory); + $__export("ProtoViewFactory", ProtoViewFactory = __decorate([Injectable(), __metadata('design:paramtypes', [ChangeDetection])], ProtoViewFactory)); + RenderProtoViewWithIndex = (function() { + function RenderProtoViewWithIndex(renderProtoView, index, parentIndex, boundElementIndex) { + this.renderProtoView = renderProtoView; + this.index = index; + this.parentIndex = parentIndex; + this.boundElementIndex = boundElementIndex; + } + return ($traceurRuntime.createClass)(RenderProtoViewWithIndex, {}, {}); + }()); + ParentProtoElementInjectorWithDistance = (function() { + function ParentProtoElementInjectorWithDistance(protoElementInjector, distance) { + this.protoElementInjector = protoElementInjector; + this.distance = distance; + } + return ($traceurRuntime.createClass)(ParentProtoElementInjectorWithDistance, {}, {}); + }()); + } + }; +}); + +System.register("angular2/src/services/url_resolver", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/services/url_resolver"; + var __decorate, + __metadata, + Injectable, + isPresent, + isBlank, + RegExpWrapper, + ListWrapper, + UrlResolver, + _splitRe, + _ComponentIndex; + function _buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) { + var out = []; + if (isPresent(opt_scheme)) { + out.push(opt_scheme + ':'); + } + if (isPresent(opt_domain)) { + out.push('//'); + if (isPresent(opt_userInfo)) { + out.push(opt_userInfo + '@'); + } + out.push(opt_domain); + if (isPresent(opt_port)) { + out.push(':' + opt_port); + } + } + if (isPresent(opt_path)) { + out.push(opt_path); + } + if (isPresent(opt_queryData)) { + out.push('?' + opt_queryData); + } + if (isPresent(opt_fragment)) { + out.push('#' + opt_fragment); + } + return out.join(''); + } + function _split(uri) { + return RegExpWrapper.firstMatch(_splitRe, uri); + } + function _removeDotSegments(path) { + if (path == '/') + return '/'; + var leadingSlash = path[0] == '/' ? '/' : ''; + var trailingSlash = path[path.length - 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 > 0) { + ListWrapper.removeAt(out, out.length - 1); + } else { + up++; + } + break; + default: + out.push(segment); + } + } + if (leadingSlash == '') { + while (up-- > 0) { + ListWrapper.insert(out, 0, '..'); + } + if (out.length === 0) + out.push('.'); + } + return leadingSlash + out.join('/') + trailingSlash; + } + function _joinAndCanonicalizePath(parts) { + var path = parts[_ComponentIndex.PATH]; + path = isBlank(path) ? '' : _removeDotSegments(path); + parts[_ComponentIndex.PATH] = path; + return _buildFromEncodedParts(parts[_ComponentIndex.SCHEME], parts[_ComponentIndex.USER_INFO], parts[_ComponentIndex.DOMAIN], parts[_ComponentIndex.PORT], path, parts[_ComponentIndex.QUERY_DATA], parts[_ComponentIndex.FRAGMENT]); + } + function _resolveUrl(base, url) { + var parts = _split(url); + var baseParts = _split(base); + if (isPresent(parts[_ComponentIndex.SCHEME])) { + return _joinAndCanonicalizePath(parts); + } else { + parts[_ComponentIndex.SCHEME] = baseParts[_ComponentIndex.SCHEME]; + } + for (var i = _ComponentIndex.SCHEME; i <= _ComponentIndex.PORT; i++) { + if (isBlank(parts[i])) { + parts[i] = baseParts[i]; + } + } + if (parts[_ComponentIndex.PATH][0] == '/') { + return _joinAndCanonicalizePath(parts); + } + var path = baseParts[_ComponentIndex.PATH]; + if (isBlank(path)) + path = '/'; + var index = path.lastIndexOf('/'); + path = path.substring(0, index + 1) + parts[_ComponentIndex.PATH]; + parts[_ComponentIndex.PATH] = path; + return _joinAndCanonicalizePath(parts); + } + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + RegExpWrapper = $__m.RegExpWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + UrlResolver = (($traceurRuntime.createClass)(function() {}, {resolve: function(baseUrl, url) { + return _resolveUrl(baseUrl, url); + }}, {})); + $__export("UrlResolver", UrlResolver); + $__export("UrlResolver", UrlResolver = __decorate([Injectable(), __metadata('design:paramtypes', [])], UrlResolver)); + _splitRe = RegExpWrapper.create('^' + '(?:' + '([^:/?#.]+)' + ':)?' + '(?://' + '(?:([^/?#]*)@)?' + '([\\w\\d\\-\\u0100-\\uffff.%]*)' + '(?::([0-9]+))?' + ')?' + '([^?#]+)?' + '(?:\\?([^#]*))?' + '(?:#(.*))?' + '$'); + (function(_ComponentIndex) { + _ComponentIndex[_ComponentIndex["SCHEME"] = 1] = "SCHEME"; + _ComponentIndex[_ComponentIndex["USER_INFO"] = 2] = "USER_INFO"; + _ComponentIndex[_ComponentIndex["DOMAIN"] = 3] = "DOMAIN"; + _ComponentIndex[_ComponentIndex["PORT"] = 4] = "PORT"; + _ComponentIndex[_ComponentIndex["PATH"] = 5] = "PATH"; + _ComponentIndex[_ComponentIndex["QUERY_DATA"] = 6] = "QUERY_DATA"; + _ComponentIndex[_ComponentIndex["FRAGMENT"] = 7] = "FRAGMENT"; + })(_ComponentIndex || (_ComponentIndex = {})); + } + }; +}); + +System.register("angular2/src/services/app_root_url", ["angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/services/app_root_url"; + var __decorate, + __metadata, + Injectable, + AppRootUrl; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + AppRootUrl = (($traceurRuntime.createClass)(function(value) { + this._value = value; + }, { + get value() { + return this._value; + }, + set value(value) { + this._value = value; + } + }, {})); + $__export("AppRootUrl", AppRootUrl); + $__export("AppRootUrl", AppRootUrl = __decorate([Injectable(), __metadata('design:paramtypes', [String])], AppRootUrl)); + } + }; +}); + +System.register("angular2/src/core/exception_handler", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/exception_handler"; + var __decorate, + __metadata, + Injectable, + isPresent, + isBlank, + BaseException, + isListLikeIterable, + _ArrayLogger, + ExceptionHandler; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + isListLikeIterable = $__m.isListLikeIterable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + _ArrayLogger = (function() { + function _ArrayLogger() { + this.res = []; + } + return ($traceurRuntime.createClass)(_ArrayLogger, { + log: function(s) { + this.res.push(s); + }, + logGroup: function(s) { + this.res.push(s); + }, + logGroupEnd: function() {} + }, {}); + }()); + ExceptionHandler = (($traceurRuntime.createClass)(function(logger) { + var rethrowException = arguments[1] !== (void 0) ? arguments[1] : true; + this.logger = logger; + this.rethrowException = rethrowException; + }, { + call: function(exception) { + var stackTrace = arguments[1] !== (void 0) ? arguments[1] : null; + var reason = arguments[2] !== (void 0) ? arguments[2] : null; + var originalException = this._findOriginalException(exception); + var originalStack = this._findOriginalStack(exception); + var context = this._findContext(exception); + this.logger.logGroup(("EXCEPTION: " + exception)); + if (isPresent(stackTrace) && isBlank(originalStack)) { + this.logger.log("STACKTRACE:"); + this.logger.log(this._longStackTrace(stackTrace)); + } + if (isPresent(reason)) { + this.logger.log(("REASON: " + reason)); + } + if (isPresent(originalException)) { + this.logger.log(("ORIGINAL EXCEPTION: " + originalException)); + } + if (isPresent(originalStack)) { + this.logger.log("ORIGINAL STACKTRACE:"); + this.logger.log(this._longStackTrace(originalStack)); + } + if (isPresent(context)) { + this.logger.log("ERROR CONTEXT:"); + this.logger.log(context); + } + this.logger.logGroupEnd(); + if (this.rethrowException) + throw exception; + }, + _longStackTrace: function(stackTrace) { + return isListLikeIterable(stackTrace) ? stackTrace.join("\n\n-----async gap-----\n") : stackTrace.toString(); + }, + _findContext: function(exception) { + try { + if (!(exception instanceof BaseException)) + return null; + return isPresent(exception.context) ? exception.context : this._findContext(exception.originalException); + } catch (e) { + return null; + } + }, + _findOriginalException: function(exception) { + if (!(exception instanceof BaseException)) + return null; + var e = exception.originalException; + while (e instanceof BaseException && isPresent(e.originalException)) { + e = e.originalException; + } + return e; + }, + _findOriginalStack: function(exception) { + if (!(exception instanceof BaseException)) + return null; + var e = exception; + var stack = exception.originalStack; + while (e instanceof BaseException && isPresent(e.originalException)) { + e = e.originalException; + if (e instanceof BaseException && isPresent(e.originalException)) { + stack = e.originalStack; + } + } + return stack; + } + }, {exceptionToString: function(exception) { + var stackTrace = arguments[1] !== (void 0) ? arguments[1] : null; + var reason = arguments[2] !== (void 0) ? arguments[2] : null; + var l = new _ArrayLogger(); + var e = new ExceptionHandler(l, false); + e.call(exception, stackTrace, reason); + return l.res.join("\n"); + }})); + $__export("ExceptionHandler", ExceptionHandler); + $__export("ExceptionHandler", ExceptionHandler = __decorate([Injectable(), __metadata('design:paramtypes', [Object, Boolean])], ExceptionHandler)); + } + }; +}); + +System.register("angular2/src/render/xhr", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/xhr"; + var XHR; + return { + setters: [], + execute: function() { + XHR = (function() { + function XHR() {} + return ($traceurRuntime.createClass)(XHR, {get: function(url) { + return null; + }}, {}); + }()); + $__export("XHR", XHR); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/style_url_resolver", ["angular2/di", "angular2/src/facade/lang", "angular2/src/services/url_resolver"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/style_url_resolver"; + var __decorate, + __metadata, + Injectable, + StringWrapper, + UrlResolver, + StyleUrlResolver, + _cssUrlRe, + _cssImportRe, + _quoteRe; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + StringWrapper = $__m.StringWrapper; + }, function($__m) { + UrlResolver = $__m.UrlResolver; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + StyleUrlResolver = (($traceurRuntime.createClass)(function(_resolver) { + this._resolver = _resolver; + }, { + resolveUrls: function(cssText, baseUrl) { + cssText = this._replaceUrls(cssText, _cssUrlRe, baseUrl); + cssText = this._replaceUrls(cssText, _cssImportRe, baseUrl); + return cssText; + }, + _replaceUrls: function(cssText, re, baseUrl) { + var $__0 = this; + return StringWrapper.replaceAllMapped(cssText, re, (function(m) { + var pre = m[1]; + var url = StringWrapper.replaceAll(m[2], _quoteRe, ''); + var post = m[3]; + var resolvedUrl = $__0._resolver.resolve(baseUrl, url); + return pre + "'" + resolvedUrl + "'" + post; + })); + } + }, {})); + $__export("StyleUrlResolver", StyleUrlResolver); + $__export("StyleUrlResolver", StyleUrlResolver = __decorate([Injectable(), __metadata('design:paramtypes', [UrlResolver])], StyleUrlResolver)); + _cssUrlRe = /(url\()([^)]*)(\))/g; + _cssImportRe = /(@import[\s]+(?!url\())['"]([^'"]*)['"](.*;)/g; + _quoteRe = /['"]/g; + } + }; +}); + +System.register("angular2/src/core/zone/ng_zone", ["angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/zone/ng_zone"; + var ListWrapper, + StringMapWrapper, + normalizeBlank, + isPresent, + global, + NgZone; + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + normalizeBlank = $__m.normalizeBlank; + isPresent = $__m.isPresent; + global = $__m.global; + }], + execute: function() { + NgZone = (function() { + function NgZone($__3) { + var enableLongStackTrace = $__3.enableLongStackTrace; + this._inVmTurnDone = false; + this._pendingTimeouts = []; + this._onTurnStart = null; + this._onTurnDone = null; + this._onEventDone = null; + this._onErrorHandler = null; + this._pendingMicrotasks = 0; + this._hasExecutedCodeInInnerZone = false; + this._nestedRun = 0; + if (global.zone) { + this._disabled = false; + this._mountZone = global.zone; + this._innerZone = this._createInnerZone(this._mountZone, enableLongStackTrace); + } else { + this._disabled = true; + this._mountZone = null; + } + } + return ($traceurRuntime.createClass)(NgZone, { + overrideOnTurnStart: function(onTurnStartFn) { + this._onTurnStart = normalizeBlank(onTurnStartFn); + }, + overrideOnTurnDone: function(onTurnDoneFn) { + this._onTurnDone = normalizeBlank(onTurnDoneFn); + }, + overrideOnEventDone: function(onEventDoneFn, opt_waitForAsync) { + var $__0 = this; + var normalizedOnEventDone = normalizeBlank(onEventDoneFn); + if (opt_waitForAsync) { + this._onEventDone = (function() { + if (!$__0._pendingTimeouts.length) { + normalizedOnEventDone(); + } + }); + } else { + this._onEventDone = normalizedOnEventDone; + } + }, + overrideOnErrorHandler: function(errorHandlingFn) { + this._onErrorHandler = normalizeBlank(errorHandlingFn); + }, + run: function(fn) { + if (this._disabled) { + return fn(); + } else { + return this._innerZone.run(fn); + } + }, + runOutsideAngular: function(fn) { + if (this._disabled) { + return fn(); + } else { + return this._mountZone.run(fn); + } + }, + _createInnerZone: function(zone, enableLongStackTrace) { + var ngZone = this; + var errorHandling; + if (enableLongStackTrace) { + errorHandling = StringMapWrapper.merge(Zone.longStackTraceZone, {onError: function(e) { + ngZone._onError(this, e); + }}); + } else { + errorHandling = {onError: function(e) { + ngZone._onError(this, e); + }}; + } + return zone.fork(errorHandling).fork({ + '$run': function(parentRun) { + return function() { + try { + ngZone._nestedRun++; + if (!ngZone._hasExecutedCodeInInnerZone) { + ngZone._hasExecutedCodeInInnerZone = true; + if (ngZone._onTurnStart) { + parentRun.call(ngZone._innerZone, ngZone._onTurnStart); + } + } + return parentRun.apply(this, arguments); + } finally { + ngZone._nestedRun--; + if (ngZone._pendingMicrotasks == 0 && ngZone._nestedRun == 0 && !this._inVmTurnDone) { + if (ngZone._onTurnDone && ngZone._hasExecutedCodeInInnerZone) { + try { + this._inVmTurnDone = true; + parentRun.call(ngZone._innerZone, ngZone._onTurnDone); + if (ngZone._pendingMicrotasks === 0 && isPresent(ngZone._onEventDone)) { + ngZone.runOutsideAngular(ngZone._onEventDone); + } + } finally { + this._inVmTurnDone = false; + ngZone._hasExecutedCodeInInnerZone = false; + } + } + } + } + }; + }, + '$scheduleMicrotask': function(parentScheduleMicrotask) { + return function(fn) { + ngZone._pendingMicrotasks++; + var microtask = function() { + try { + fn(); + } finally { + ngZone._pendingMicrotasks--; + } + }; + parentScheduleMicrotask.call(this, microtask); + }; + }, + '$setTimeout': function(parentSetTimeout) { + return function(fn, delay) { + for (var args = [], + $__2 = 2; $__2 < arguments.length; $__2++) + args[$__2 - 2] = arguments[$__2]; + var id; + var cb = function() { + fn(); + ListWrapper.remove(ngZone._pendingTimeouts, id); + }; + id = parentSetTimeout(cb, delay, args); + ngZone._pendingTimeouts.push(id); + return id; + }; + }, + '$clearTimeout': function(parentClearTimeout) { + return function(id) { + parentClearTimeout(id); + ListWrapper.remove(ngZone._pendingTimeouts, id); + }; + }, + _innerZone: true + }); + }, + _onError: function(zone, e) { + if (isPresent(this._onErrorHandler)) { + var trace = [normalizeBlank(e.stack)]; + while (zone && zone.constructedAtException) { + trace.push(zone.constructedAtException.get()); + zone = zone.parent; + } + this._onErrorHandler(e, trace); + } else { + console.log('## _onError ##'); + console.log(e.stack); + throw e; + } + } + }, {}); + }()); + $__export("NgZone", NgZone); + } + }; +}); + +System.register("angular2/src/core/life_cycle/life_cycle", ["angular2/di", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/life_cycle/life_cycle"; + var __decorate, + __metadata, + Injectable, + isPresent, + BaseException, + LifeCycle; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + LifeCycle = (($traceurRuntime.createClass)(function() { + var changeDetector = arguments[0] !== (void 0) ? arguments[0] : null; + var enforceNoNewChanges = arguments[1] !== (void 0) ? arguments[1] : false; + this._runningTick = false; + this._changeDetector = changeDetector; + this._enforceNoNewChanges = enforceNoNewChanges; + }, { + registerWith: function(zone) { + var changeDetector = arguments[1] !== (void 0) ? arguments[1] : null; + var $__0 = this; + if (isPresent(changeDetector)) { + this._changeDetector = changeDetector; + } + zone.overrideOnTurnDone((function() { + return $__0.tick(); + })); + }, + tick: function() { + if (this._runningTick) { + throw new BaseException("LifeCycle.tick is called recursively"); + } + try { + this._runningTick = true; + this._changeDetector.detectChanges(); + if (this._enforceNoNewChanges) { + this._changeDetector.checkNoChanges(); + } + } finally { + this._runningTick = false; + } + } + }, {})); + $__export("LifeCycle", LifeCycle); + $__export("LifeCycle", LifeCycle = __decorate([Injectable(), __metadata('design:paramtypes', [Object, Boolean])], LifeCycle)); + } + }; +}); + +System.register("angular2/src/render/xhr_impl", ["angular2/di", "angular2/src/facade/async", "angular2/src/render/xhr"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/xhr_impl"; + var __decorate, + __metadata, + Injectable, + PromiseWrapper, + XHR, + XHRImpl; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }, function($__m) { + XHR = $__m.XHR; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + XHRImpl = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, {get: function(url) { + var completer = PromiseWrapper.completer(); + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, true); + xhr.responseType = 'text'; + xhr.onload = function() { + var response = ('response' in xhr) ? xhr.response : xhr.responseText; + var status = xhr.status === 1223 ? 204 : xhr.status; + if (status === 0) { + status = response ? 200 : 0; + } + if (200 <= status && status <= 300) { + completer.resolve(response); + } else { + completer.reject(("Failed to load " + url), null); + } + }; + xhr.onerror = function() { + completer.reject(("Failed to load " + url), null); + }; + xhr.send(); + return completer.promise; + }}, {}, $__super); + }(XHR)); + $__export("XHRImpl", XHRImpl); + $__export("XHRImpl", XHRImpl = __decorate([Injectable(), __metadata('design:paramtypes', [])], XHRImpl)); + } + }; +}); + +System.register("angular2/src/render/dom/events/event_manager", ["angular2/src/facade/lang", "angular2/src/dom/dom_adapter"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/events/event_manager"; + var BaseException, + StringWrapper, + DOM, + BUBBLE_SYMBOL, + EventManager, + EventManagerPlugin, + DomEventsPlugin; + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + DOM = $__m.DOM; + }], + execute: function() { + BUBBLE_SYMBOL = '^'; + EventManager = (function() { + function EventManager(_plugins, _zone) { + this._plugins = _plugins; + this._zone = _zone; + for (var i = 0; i < _plugins.length; i++) { + _plugins[i].manager = this; + } + } + return ($traceurRuntime.createClass)(EventManager, { + addEventListener: function(element, eventName, handler) { + var withoutBubbleSymbol = this._removeBubbleSymbol(eventName); + var plugin = this._findPluginFor(withoutBubbleSymbol); + plugin.addEventListener(element, withoutBubbleSymbol, handler, withoutBubbleSymbol != eventName); + }, + addGlobalEventListener: function(target, eventName, handler) { + var withoutBubbleSymbol = this._removeBubbleSymbol(eventName); + var plugin = this._findPluginFor(withoutBubbleSymbol); + return plugin.addGlobalEventListener(target, withoutBubbleSymbol, handler, withoutBubbleSymbol != eventName); + }, + getZone: function() { + return this._zone; + }, + _findPluginFor: function(eventName) { + var plugins = this._plugins; + for (var i = 0; i < plugins.length; i++) { + var plugin = plugins[i]; + if (plugin.supports(eventName)) { + return plugin; + } + } + throw new BaseException(("No event manager plugin found for event " + eventName)); + }, + _removeBubbleSymbol: function(eventName) { + return eventName[0] == BUBBLE_SYMBOL ? StringWrapper.substring(eventName, 1) : eventName; + } + }, {}); + }()); + $__export("EventManager", EventManager); + EventManagerPlugin = (function() { + function EventManagerPlugin() {} + return ($traceurRuntime.createClass)(EventManagerPlugin, { + supports: function(eventName) { + return false; + }, + addEventListener: function(element, eventName, handler, shouldSupportBubble) { + throw "not implemented"; + }, + addGlobalEventListener: function(element, eventName, handler, shouldSupportBubble) { + throw "not implemented"; + } + }, {}); + }()); + $__export("EventManagerPlugin", EventManagerPlugin); + DomEventsPlugin = (function($__super) { + function DomEventsPlugin() { + $traceurRuntime.superConstructor(DomEventsPlugin).apply(this, arguments); + } + return ($traceurRuntime.createClass)(DomEventsPlugin, { + supports: function(eventName) { + return true; + }, + addEventListener: function(element, eventName, handler, shouldSupportBubble) { + var outsideHandler = this._getOutsideHandler(shouldSupportBubble, element, handler, this.manager._zone); + this.manager._zone.runOutsideAngular((function() { + DOM.on(element, eventName, outsideHandler); + })); + }, + addGlobalEventListener: function(target, eventName, handler, shouldSupportBubble) { + var element = DOM.getGlobalEventTarget(target); + var outsideHandler = this._getOutsideHandler(shouldSupportBubble, element, handler, this.manager._zone); + return this.manager._zone.runOutsideAngular((function() { + return DOM.onAndCancel(element, eventName, outsideHandler); + })); + }, + _getOutsideHandler: function(shouldSupportBubble, element, handler, zone) { + return shouldSupportBubble ? DomEventsPlugin.bubbleCallback(element, handler, zone) : DomEventsPlugin.sameElementCallback(element, handler, zone); + } + }, { + sameElementCallback: function(element, handler, zone) { + return (function(event) { + if (event.target === element) { + zone.run((function() { + return handler(event); + })); + } + }); + }, + bubbleCallback: function(element, handler, zone) { + return (function(event) { + return zone.run((function() { + return handler(event); + })); + }); + } + }, $__super); + }(EventManagerPlugin)); + $__export("DomEventsPlugin", DomEventsPlugin); + } + }; +}); + +System.register("angular2/src/render/dom/events/key_events", ["angular2/src/dom/dom_adapter", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/render/dom/events/event_manager"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/events/key_events"; + var DOM, + isPresent, + StringWrapper, + StringMapWrapper, + ListWrapper, + EventManagerPlugin, + modifierKeys, + modifierKeyGetters, + KeyEventsPlugin; + return { + setters: [function($__m) { + DOM = $__m.DOM; + }, function($__m) { + isPresent = $__m.isPresent; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + ListWrapper = $__m.ListWrapper; + }, function($__m) { + EventManagerPlugin = $__m.EventManagerPlugin; + }], + execute: function() { + modifierKeys = ['alt', 'control', 'meta', 'shift']; + modifierKeyGetters = { + 'alt': (function(event) { + return event.altKey; + }), + 'control': (function(event) { + return event.ctrlKey; + }), + 'meta': (function(event) { + return event.metaKey; + }), + 'shift': (function(event) { + return event.shiftKey; + }) + }; + KeyEventsPlugin = (function($__super) { + function KeyEventsPlugin() { + $traceurRuntime.superConstructor(KeyEventsPlugin).call(this); + } + return ($traceurRuntime.createClass)(KeyEventsPlugin, { + supports: function(eventName) { + return isPresent(KeyEventsPlugin.parseEventName(eventName)); + }, + addEventListener: function(element, eventName, handler, shouldSupportBubble) { + var parsedEvent = KeyEventsPlugin.parseEventName(eventName); + var outsideHandler = KeyEventsPlugin.eventCallback(element, shouldSupportBubble, StringMapWrapper.get(parsedEvent, 'fullKey'), handler, this.manager.getZone()); + this.manager.getZone().runOutsideAngular((function() { + DOM.on(element, StringMapWrapper.get(parsedEvent, 'domEventName'), outsideHandler); + })); + } + }, { + parseEventName: function(eventName) { + var parts = eventName.toLowerCase().split('.'); + var domEventName = ListWrapper.removeAt(parts, 0); + if ((parts.length === 0) || !(StringWrapper.equals(domEventName, 'keydown') || StringWrapper.equals(domEventName, 'keyup'))) { + return null; + } + var key = KeyEventsPlugin._normalizeKey(ListWrapper.removeLast(parts)); + var fullKey = ''; + ListWrapper.forEach(modifierKeys, (function(modifierName) { + if (ListWrapper.contains(parts, modifierName)) { + ListWrapper.remove(parts, modifierName); + fullKey += modifierName + '.'; + } + })); + fullKey += key; + if (parts.length != 0 || key.length === 0) { + return null; + } + var result = StringMapWrapper.create(); + StringMapWrapper.set(result, 'domEventName', domEventName); + StringMapWrapper.set(result, 'fullKey', fullKey); + return result; + }, + getEventFullKey: function(event) { + var fullKey = ''; + var key = DOM.getEventKey(event); + key = key.toLowerCase(); + if (StringWrapper.equals(key, ' ')) { + key = 'space'; + } else if (StringWrapper.equals(key, '.')) { + key = 'dot'; + } + ListWrapper.forEach(modifierKeys, (function(modifierName) { + if (modifierName != key) { + var modifierGetter = StringMapWrapper.get(modifierKeyGetters, modifierName); + if (modifierGetter(event)) { + fullKey += modifierName + '.'; + } + } + })); + fullKey += key; + return fullKey; + }, + eventCallback: function(element, shouldSupportBubble, fullKey, handler, zone) { + return (function(event) { + var correctElement = shouldSupportBubble || event.target === element; + if (correctElement && StringWrapper.equals(KeyEventsPlugin.getEventFullKey(event), fullKey)) { + zone.run((function() { + return handler(event); + })); + } + }); + }, + _normalizeKey: function(keyName) { + switch (keyName) { + case 'esc': + return 'escape'; + default: + return keyName; + } + } + }, $__super); + }(EventManagerPlugin)); + $__export("KeyEventsPlugin", KeyEventsPlugin); + } + }; +}); + +System.register("angular2/src/render/dom/events/hammer_common", ["angular2/src/render/dom/events/event_manager", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/events/hammer_common"; + var EventManagerPlugin, + StringMapWrapper, + _eventNames, + HammerGesturesPluginCommon; + return { + setters: [function($__m) { + EventManagerPlugin = $__m.EventManagerPlugin; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + }], + execute: function() { + _eventNames = { + 'pan': true, + 'panstart': true, + 'panmove': true, + 'panend': true, + 'pancancel': true, + 'panleft': true, + 'panright': true, + 'panup': true, + 'pandown': true, + 'pinch': true, + 'pinchstart': true, + 'pinchmove': true, + 'pinchend': true, + 'pinchcancel': true, + 'pinchin': true, + 'pinchout': true, + 'press': true, + 'pressup': true, + 'rotate': true, + 'rotatestart': true, + 'rotatemove': true, + 'rotateend': true, + 'rotatecancel': true, + 'swipe': true, + 'swipeleft': true, + 'swiperight': true, + 'swipeup': true, + 'swipedown': true, + 'tap': true + }; + HammerGesturesPluginCommon = (function($__super) { + function HammerGesturesPluginCommon() { + $traceurRuntime.superConstructor(HammerGesturesPluginCommon).call(this); + } + return ($traceurRuntime.createClass)(HammerGesturesPluginCommon, {supports: function(eventName) { + eventName = eventName.toLowerCase(); + return StringMapWrapper.contains(_eventNames, eventName); + }}, {}, $__super); + }(EventManagerPlugin)); + $__export("HammerGesturesPluginCommon", HammerGesturesPluginCommon); + } + }; +}); + +System.register("angular2/src/services/anchor_based_app_root_url", ["angular2/src/services/app_root_url", "angular2/src/dom/dom_adapter", "angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/services/anchor_based_app_root_url"; + var __decorate, + __metadata, + AppRootUrl, + DOM, + Injectable, + AnchorBasedAppRootUrl; + return { + setters: [function($__m) { + AppRootUrl = $__m.AppRootUrl; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + Injectable = $__m.Injectable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + AnchorBasedAppRootUrl = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).call(this, ""); + var rootUrl; + var a = DOM.createElement('a'); + DOM.resolveAndSetHref(a, './', null); + rootUrl = DOM.getHref(a); + this.value = rootUrl; + } + return ($traceurRuntime.createClass)($__0, {}, {}, $__super); + }(AppRootUrl)); + $__export("AnchorBasedAppRootUrl", AnchorBasedAppRootUrl); + $__export("AnchorBasedAppRootUrl", AnchorBasedAppRootUrl = __decorate([Injectable(), __metadata('design:paramtypes', [])], AnchorBasedAppRootUrl)); + } + }; +}); + +System.register("angular2/src/core/compiler/dynamic_component_loader", ["angular2/di", "angular2/src/core/compiler/compiler", "angular2/src/core/compiler/view_manager"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/dynamic_component_loader"; + var __decorate, + __metadata, + Injectable, + Compiler, + AppViewManager, + ComponentRef, + DynamicComponentLoader; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + Compiler = $__m.Compiler; + }, function($__m) { + AppViewManager = $__m.AppViewManager; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + ComponentRef = (function() { + function ComponentRef(location, instance, _dispose) { + this._dispose = _dispose; + this.location = location; + this.instance = instance; + } + return ($traceurRuntime.createClass)(ComponentRef, { + get hostView() { + return this.location.parentView; + }, + dispose: function() { + this._dispose(); + } + }, {}); + }()); + $__export("ComponentRef", ComponentRef); + DynamicComponentLoader = (($traceurRuntime.createClass)(function(_compiler, _viewManager) { + this._compiler = _compiler; + this._viewManager = _viewManager; + }, { + loadAsRoot: function(typeOrBinding, overrideSelector, injector) { + var $__0 = this; + return this._compiler.compileInHost(typeOrBinding).then((function(hostProtoViewRef) { + var hostViewRef = $__0._viewManager.createRootHostView(hostProtoViewRef, overrideSelector, injector); + var newLocation = $__0._viewManager.getHostElement(hostViewRef); + var component = $__0._viewManager.getComponent(newLocation); + var dispose = (function() { + $__0._viewManager.destroyRootHostView(hostViewRef); + }); + return new ComponentRef(newLocation, component, dispose); + })); + }, + loadIntoLocation: function(typeOrBinding, hostLocation, anchorName) { + var bindings = arguments[3] !== (void 0) ? arguments[3] : null; + return this.loadNextToLocation(typeOrBinding, this._viewManager.getNamedElementInComponentView(hostLocation, anchorName), bindings); + }, + loadNextToLocation: function(typeOrBinding, location) { + var bindings = arguments[2] !== (void 0) ? arguments[2] : null; + var $__0 = this; + return this._compiler.compileInHost(typeOrBinding).then((function(hostProtoViewRef) { + var viewContainer = $__0._viewManager.getViewContainer(location); + var hostViewRef = viewContainer.createHostView(hostProtoViewRef, viewContainer.length, bindings); + var newLocation = $__0._viewManager.getHostElement(hostViewRef); + var component = $__0._viewManager.getComponent(newLocation); + var dispose = (function() { + var index = viewContainer.indexOf(hostViewRef); + if (index !== -1) { + viewContainer.remove(index); + } + }); + return new ComponentRef(newLocation, component, dispose); + })); + } + }, {})); + $__export("DynamicComponentLoader", DynamicComponentLoader); + $__export("DynamicComponentLoader", DynamicComponentLoader = __decorate([Injectable(), __metadata('design:paramtypes', [Compiler, AppViewManager])], DynamicComponentLoader)); + } + }; +}); + +System.register("angular2/src/core/testability/get_testability", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/testability/get_testability"; + var global, + PublicTestability, + GetTestability; + return { + setters: [function($__m) { + global = $__m.global; + }], + execute: function() { + PublicTestability = (function() { + function PublicTestability(testability) { + this._testability = testability; + } + return ($traceurRuntime.createClass)(PublicTestability, { + whenStable: function(callback) { + this._testability.whenStable(callback); + }, + findBindings: function(using, binding, exactMatch) { + return this._testability.findBindings(using, binding, exactMatch); + } + }, {}); + }()); + GetTestability = (function() { + function GetTestability() {} + return ($traceurRuntime.createClass)(GetTestability, {}, {addToWindow: function(registry) { + global.getAngularTestability = function(elem) { + var testability = registry.findTestabilityInTree(elem); + if (testability == null) { + throw new Error('Could not find testability for element.'); + } + return new PublicTestability(testability); + }; + }}); + }()); + $__export("GetTestability", GetTestability); + } + }; +}); + +System.register("angular2/src/render/dom/dom_tokens", ["angular2/di", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/dom_tokens"; + var OpaqueToken, + bind, + CONST_EXPR, + StringWrapper, + Math, + DOCUMENT_TOKEN, + DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES, + APP_ID_TOKEN, + APP_ID_RANDOM_BINDING; + function randomChar() { + return StringWrapper.fromCharCode(97 + Math.floor(Math.random() * 25)); + } + return { + setters: [function($__m) { + OpaqueToken = $__m.OpaqueToken; + bind = $__m.bind; + }, function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + StringWrapper = $__m.StringWrapper; + Math = $__m.Math; + }], + execute: function() { + DOCUMENT_TOKEN = CONST_EXPR(new OpaqueToken('DocumentToken')); + $__export("DOCUMENT_TOKEN", DOCUMENT_TOKEN); + DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES = CONST_EXPR(new OpaqueToken('DomReflectPropertiesAsAttributes')); + $__export("DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES", DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES); + APP_ID_TOKEN = CONST_EXPR(new OpaqueToken('AppId')); + $__export("APP_ID_TOKEN", APP_ID_TOKEN); + APP_ID_RANDOM_BINDING = bind(APP_ID_TOKEN).toFactory((function() { + return ("" + randomChar() + randomChar() + randomChar()); + }), []); + $__export("APP_ID_RANDOM_BINDING", APP_ID_RANDOM_BINDING); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/compile_element", ["angular2/src/facade/collection", "angular2/src/dom/dom_adapter", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/compile_element"; + var MapWrapper, + DOM, + isBlank, + isPresent, + StringJoiner, + assertionsEnabled, + CompileElement; + function getElementDescription(domElement) { + var buf = new StringJoiner(); + var atts = DOM.attributeMap(domElement); + buf.add("<"); + buf.add(DOM.tagName(domElement).toLowerCase()); + addDescriptionAttribute(buf, "id", atts.get("id")); + addDescriptionAttribute(buf, "class", atts.get("class")); + MapWrapper.forEach(atts, (function(attValue, attName) { + if (attName !== "id" && attName !== "class") { + addDescriptionAttribute(buf, attName, attValue); + } + })); + buf.add(">"); + return buf.toString(); + } + function addDescriptionAttribute(buffer, attName, attValue) { + if (isPresent(attValue)) { + if (attValue.length === 0) { + buffer.add(' ' + attName); + } else { + buffer.add(' ' + attName + '="' + attValue + '"'); + } + } + } + return { + setters: [function($__m) { + MapWrapper = $__m.MapWrapper; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + StringJoiner = $__m.StringJoiner; + assertionsEnabled = $__m.assertionsEnabled; + }], + execute: function() { + CompileElement = (function() { + function CompileElement(element) { + var compilationUnit = arguments[1] !== (void 0) ? arguments[1] : ''; + this.element = element; + this._attrs = null; + this._classList = null; + this.isViewRoot = false; + this.inheritedProtoView = null; + this.distanceToInheritedBinder = 0; + this.inheritedElementBinder = null; + this.compileChildren = true; + var tplDesc = assertionsEnabled() ? getElementDescription(element) : null; + if (compilationUnit !== '') { + this.elementDescription = compilationUnit; + if (isPresent(tplDesc)) + this.elementDescription += ": " + tplDesc; + } else { + this.elementDescription = tplDesc; + } + } + return ($traceurRuntime.createClass)(CompileElement, { + isBound: function() { + return isPresent(this.inheritedElementBinder) && this.distanceToInheritedBinder === 0; + }, + bindElement: function() { + if (!this.isBound()) { + var parentBinder = this.inheritedElementBinder; + this.inheritedElementBinder = this.inheritedProtoView.bindElement(this.element, this.elementDescription); + if (isPresent(parentBinder)) { + this.inheritedElementBinder.setParent(parentBinder, this.distanceToInheritedBinder); + } + this.distanceToInheritedBinder = 0; + } + return this.inheritedElementBinder; + }, + refreshAttrs: function() { + this._attrs = null; + }, + attrs: function() { + if (isBlank(this._attrs)) { + this._attrs = DOM.attributeMap(this.element); + } + return this._attrs; + }, + refreshClassList: function() { + this._classList = null; + }, + classList: function() { + if (isBlank(this._classList)) { + this._classList = []; + var elClassList = DOM.classList(this.element); + for (var i = 0; i < elClassList.length; i++) { + this._classList.push(elClassList[i]); + } + } + return this._classList; + } + }, {}); + }()); + $__export("CompileElement", CompileElement); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/compile_control", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/compile_control"; + var isBlank, + CompileControl; + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + }], + execute: function() { + CompileControl = (function() { + function CompileControl(_steps) { + this._steps = _steps; + this._currentStepIndex = 0; + this._parent = null; + this._results = null; + this._additionalChildren = null; + } + return ($traceurRuntime.createClass)(CompileControl, { + internalProcess: function(results, startStepIndex, parent, current) { + this._results = results; + var previousStepIndex = this._currentStepIndex; + var previousParent = this._parent; + this._ignoreCurrentElement = false; + for (var i = startStepIndex; i < this._steps.length && !this._ignoreCurrentElement; i++) { + var step = this._steps[i]; + this._parent = parent; + this._currentStepIndex = i; + step.processElement(parent, current, this); + parent = this._parent; + } + if (!this._ignoreCurrentElement) { + results.push(current); + } + this._currentStepIndex = previousStepIndex; + this._parent = previousParent; + var localAdditionalChildren = this._additionalChildren; + this._additionalChildren = null; + return localAdditionalChildren; + }, + addParent: function(newElement) { + this.internalProcess(this._results, this._currentStepIndex + 1, this._parent, newElement); + this._parent = newElement; + }, + addChild: function(element) { + if (isBlank(this._additionalChildren)) { + this._additionalChildren = []; + } + this._additionalChildren.push(element); + }, + ignoreCurrentElement: function() { + this._ignoreCurrentElement = true; + } + }, {}); + }()); + $__export("CompileControl", CompileControl); + } + }; +}); + +System.register("angular2/src/render/dom/view/proto_view", ["angular2/src/render/api", "angular2/src/dom/dom_adapter"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/view/proto_view"; + var RenderProtoViewRef, + DOM, + DomProtoViewRef, + DomProtoView; + function resolveInternalDomProtoView(protoViewRef) { + return protoViewRef._protoView; + } + $__export("resolveInternalDomProtoView", resolveInternalDomProtoView); + return { + setters: [function($__m) { + RenderProtoViewRef = $__m.RenderProtoViewRef; + }, function($__m) { + DOM = $__m.DOM; + }], + execute: function() { + DomProtoViewRef = (function($__super) { + function DomProtoViewRef(_protoView) { + $traceurRuntime.superConstructor(DomProtoViewRef).call(this); + this._protoView = _protoView; + } + return ($traceurRuntime.createClass)(DomProtoViewRef, {}, {}, $__super); + }(RenderProtoViewRef)); + $__export("DomProtoViewRef", DomProtoViewRef); + DomProtoView = (function() { + function DomProtoView(type, rootElement, encapsulation, elementBinders, hostAttributes, rootTextNodeIndices, boundTextNodeCount, fragmentsRootNodeCount, isSingleElementFragment) { + this.type = type; + this.rootElement = rootElement; + this.encapsulation = encapsulation; + this.elementBinders = elementBinders; + this.hostAttributes = hostAttributes; + this.rootTextNodeIndices = rootTextNodeIndices; + this.boundTextNodeCount = boundTextNodeCount; + this.fragmentsRootNodeCount = fragmentsRootNodeCount; + this.isSingleElementFragment = isSingleElementFragment; + } + return ($traceurRuntime.createClass)(DomProtoView, {}, {create: function(type, rootElement, viewEncapsulation, fragmentsRootNodeCount, rootTextNodeIndices, elementBinders, hostAttributes) { + var boundTextNodeCount = rootTextNodeIndices.length; + for (var i = 0; i < elementBinders.length; i++) { + boundTextNodeCount += elementBinders[i].textNodeIndices.length; + } + var isSingleElementFragment = fragmentsRootNodeCount.length === 1 && fragmentsRootNodeCount[0] === 1 && DOM.isElementNode(DOM.firstChild(DOM.content(rootElement))); + return new DomProtoView(type, rootElement, viewEncapsulation, elementBinders, hostAttributes, rootTextNodeIndices, boundTextNodeCount, fragmentsRootNodeCount, isSingleElementFragment); + }}); + }()); + $__export("DomProtoView", DomProtoView); + } + }; +}); + +System.register("angular2/src/render/dom/view/element_binder", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/view/element_binder"; + var isPresent, + DomElementBinder, + Event, + HostAction; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }], + execute: function() { + DomElementBinder = (function() { + function DomElementBinder() { + var $__1 = arguments[0] !== (void 0) ? arguments[0] : {}, + textNodeIndices = $__1.textNodeIndices, + hasNestedProtoView = $__1.hasNestedProtoView, + eventLocals = $__1.eventLocals, + localEvents = $__1.localEvents, + globalEvents = $__1.globalEvents, + hasNativeShadowRoot = $__1.hasNativeShadowRoot; + this.textNodeIndices = textNodeIndices; + this.hasNestedProtoView = hasNestedProtoView; + this.eventLocals = eventLocals; + this.localEvents = localEvents; + this.globalEvents = globalEvents; + this.hasNativeShadowRoot = isPresent(hasNativeShadowRoot) ? hasNativeShadowRoot : false; + } + return ($traceurRuntime.createClass)(DomElementBinder, {}, {}); + }()); + $__export("DomElementBinder", DomElementBinder); + Event = (function() { + function Event(name, target, fullName) { + this.name = name; + this.target = target; + this.fullName = fullName; + } + return ($traceurRuntime.createClass)(Event, {}, {}); + }()); + $__export("Event", Event); + HostAction = (function() { + function HostAction(actionName, actionExpression, expression) { + this.actionName = actionName; + this.actionExpression = actionExpression; + this.expression = expression; + } + return ($traceurRuntime.createClass)(HostAction, {}, {}); + }()); + $__export("HostAction", HostAction); + } + }; +}); + +System.register("angular2/src/render/dom/util", ["angular2/src/facade/lang", "angular2/src/dom/dom_adapter", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/util"; + var StringWrapper, + isPresent, + isBlank, + DOM, + ListWrapper, + NG_BINDING_CLASS_SELECTOR, + NG_BINDING_CLASS, + EVENT_TARGET_SEPARATOR, + NG_CONTENT_ELEMENT_NAME, + NG_SHADOW_ROOT_ELEMENT_NAME, + CAMEL_CASE_REGEXP, + DASH_CASE_REGEXP, + ClonedProtoView; + function camelCaseToDashCase(input) { + return StringWrapper.replaceAllMapped(input, CAMEL_CASE_REGEXP, (function(m) { + return '-' + m[1].toLowerCase(); + })); + } + function dashCaseToCamelCase(input) { + return StringWrapper.replaceAllMapped(input, DASH_CASE_REGEXP, (function(m) { + return m[1].toUpperCase(); + })); + } + function queryBoundElements(templateContent, isSingleElementChild) { + var result; + var dynamicElementList; + var elementIdx = 0; + if (isSingleElementChild) { + var rootElement = DOM.firstChild(templateContent); + var rootHasBinding = DOM.hasClass(rootElement, NG_BINDING_CLASS); + dynamicElementList = DOM.getElementsByClassName(rootElement, NG_BINDING_CLASS); + result = ListWrapper.createFixedSize(dynamicElementList.length + (rootHasBinding ? 1 : 0)); + if (rootHasBinding) { + result[elementIdx++] = rootElement; + } + } else { + dynamicElementList = DOM.querySelectorAll(templateContent, NG_BINDING_CLASS_SELECTOR); + result = ListWrapper.createFixedSize(dynamicElementList.length); + } + for (var i = 0; i < dynamicElementList.length; i++) { + result[elementIdx++] = dynamicElementList[i]; + } + return result; + } + function cloneAndQueryProtoView(pv, importIntoDocument) { + var templateContent = importIntoDocument ? DOM.importIntoDoc(DOM.content(pv.rootElement)) : DOM.clone(DOM.content(pv.rootElement)); + var boundElements = queryBoundElements(templateContent, pv.isSingleElementFragment); + var boundTextNodes = queryBoundTextNodes(templateContent, pv.rootTextNodeIndices, boundElements, pv.elementBinders, pv.boundTextNodeCount); + var fragments = queryFragments(templateContent, pv.fragmentsRootNodeCount); + return new ClonedProtoView(pv, fragments, boundElements, boundTextNodes); + } + function queryFragments(templateContent, fragmentsRootNodeCount) { + var fragments = ListWrapper.createGrowableSize(fragmentsRootNodeCount.length); + var childNode = DOM.firstChild(templateContent); + for (var fragmentIndex = 0; fragmentIndex < fragments.length; fragmentIndex++) { + var fragment = ListWrapper.createFixedSize(fragmentsRootNodeCount[fragmentIndex]); + fragments[fragmentIndex] = fragment; + for (var i = 0; i < fragment.length; i++) { + fragment[i] = childNode; + childNode = DOM.nextSibling(childNode); + } + } + return fragments; + } + function queryBoundTextNodes(templateContent, rootTextNodeIndices, boundElements, elementBinders, boundTextNodeCount) { + var boundTextNodes = ListWrapper.createFixedSize(boundTextNodeCount); + var textNodeIndex = 0; + if (rootTextNodeIndices.length > 0) { + var rootChildNodes = DOM.childNodes(templateContent); + for (var i = 0; i < rootTextNodeIndices.length; i++) { + boundTextNodes[textNodeIndex++] = rootChildNodes[rootTextNodeIndices[i]]; + } + } + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + var element = boundElements[i]; + if (binder.textNodeIndices.length > 0) { + var childNodes = DOM.childNodes(element); + for (var j = 0; j < binder.textNodeIndices.length; j++) { + boundTextNodes[textNodeIndex++] = childNodes[binder.textNodeIndices[j]]; + } + } + } + return boundTextNodes; + } + function isElementWithTag(node, elementName) { + return DOM.isElementNode(node) && DOM.tagName(node).toLowerCase() == elementName.toLowerCase(); + } + function queryBoundTextNodeIndices(parentNode, boundTextNodes, resultCallback) { + var childNodes = DOM.childNodes(parentNode); + for (var j = 0; j < childNodes.length; j++) { + var node = childNodes[j]; + if (boundTextNodes.has(node)) { + resultCallback(node, j, boundTextNodes.get(node)); + } + } + } + function prependAll(parentNode, nodes) { + var lastInsertedNode = null; + nodes.forEach((function(node) { + if (isBlank(lastInsertedNode)) { + var firstChild = DOM.firstChild(parentNode); + if (isPresent(firstChild)) { + DOM.insertBefore(firstChild, node); + } else { + DOM.appendChild(parentNode, node); + } + } else { + DOM.insertAfter(lastInsertedNode, node); + } + lastInsertedNode = node; + })); + } + $__export("camelCaseToDashCase", camelCaseToDashCase); + $__export("dashCaseToCamelCase", dashCaseToCamelCase); + $__export("queryBoundElements", queryBoundElements); + $__export("cloneAndQueryProtoView", cloneAndQueryProtoView); + $__export("isElementWithTag", isElementWithTag); + $__export("queryBoundTextNodeIndices", queryBoundTextNodeIndices); + $__export("prependAll", prependAll); + return { + setters: [function($__m) { + StringWrapper = $__m.StringWrapper; + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }], + execute: function() { + NG_BINDING_CLASS_SELECTOR = '.ng-binding'; + $__export("NG_BINDING_CLASS_SELECTOR", NG_BINDING_CLASS_SELECTOR); + NG_BINDING_CLASS = 'ng-binding'; + $__export("NG_BINDING_CLASS", NG_BINDING_CLASS); + EVENT_TARGET_SEPARATOR = ':'; + $__export("EVENT_TARGET_SEPARATOR", EVENT_TARGET_SEPARATOR); + NG_CONTENT_ELEMENT_NAME = 'ng-content'; + $__export("NG_CONTENT_ELEMENT_NAME", NG_CONTENT_ELEMENT_NAME); + NG_SHADOW_ROOT_ELEMENT_NAME = 'shadow-root'; + $__export("NG_SHADOW_ROOT_ELEMENT_NAME", NG_SHADOW_ROOT_ELEMENT_NAME); + CAMEL_CASE_REGEXP = /([A-Z])/g; + DASH_CASE_REGEXP = /-([a-z])/g; + ClonedProtoView = (function() { + function ClonedProtoView(original, fragments, boundElements, boundTextNodes) { + this.original = original; + this.fragments = fragments; + this.boundElements = boundElements; + this.boundTextNodes = boundTextNodes; + } + return ($traceurRuntime.createClass)(ClonedProtoView, {}, {}); + }()); + $__export("ClonedProtoView", ClonedProtoView); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/property_binding_parser", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/render/dom/util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/property_binding_parser"; + var isPresent, + RegExpWrapper, + StringWrapper, + MapWrapper, + dashCaseToCamelCase, + BIND_NAME_REGEXP, + PropertyBindingParser; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + RegExpWrapper = $__m.RegExpWrapper; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + MapWrapper = $__m.MapWrapper; + }, function($__m) { + dashCaseToCamelCase = $__m.dashCaseToCamelCase; + }], + execute: function() { + BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(var-|#)|(on-)|(bindon-))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/g; + PropertyBindingParser = (function() { + function PropertyBindingParser(_parser) { + this._parser = _parser; + } + return ($traceurRuntime.createClass)(PropertyBindingParser, { + processStyle: function(style) { + return style; + }, + processElement: function(parent, current, control) { + var $__0 = this; + var attrs = current.attrs(); + var newAttrs = new Map(); + MapWrapper.forEach(attrs, (function(attrValue, attrName) { + attrName = $__0._normalizeAttributeName(attrName); + var bindParts = RegExpWrapper.firstMatch(BIND_NAME_REGEXP, attrName); + if (isPresent(bindParts)) { + if (isPresent(bindParts[1])) { + $__0._bindProperty(bindParts[5], attrValue, current, newAttrs); + } else if (isPresent(bindParts[2])) { + var identifier = bindParts[5]; + var value = attrValue == '' ? '\$implicit' : attrValue; + $__0._bindVariable(identifier, value, current, newAttrs); + } else if (isPresent(bindParts[3])) { + $__0._bindEvent(bindParts[5], attrValue, current, newAttrs); + } else if (isPresent(bindParts[4])) { + $__0._bindProperty(bindParts[5], attrValue, current, newAttrs); + $__0._bindAssignmentEvent(bindParts[5], attrValue, current, newAttrs); + } else if (isPresent(bindParts[6])) { + $__0._bindProperty(bindParts[6], attrValue, current, newAttrs); + $__0._bindAssignmentEvent(bindParts[6], attrValue, current, newAttrs); + } else if (isPresent(bindParts[7])) { + $__0._bindProperty(bindParts[7], attrValue, current, newAttrs); + } else if (isPresent(bindParts[8])) { + $__0._bindEvent(bindParts[8], attrValue, current, newAttrs); + } + } else { + var expr = $__0._parser.parseInterpolation(attrValue, current.elementDescription); + if (isPresent(expr)) { + $__0._bindPropertyAst(attrName, expr, current, newAttrs); + } + } + })); + MapWrapper.forEach(newAttrs, (function(attrValue, attrName) { + attrs.set(attrName, attrValue); + })); + }, + _normalizeAttributeName: function(attrName) { + return StringWrapper.startsWith(attrName, 'data-') ? StringWrapper.substring(attrName, 5) : attrName; + }, + _bindVariable: function(identifier, value, current, newAttrs) { + current.bindElement().bindVariable(dashCaseToCamelCase(identifier), value); + newAttrs.set(identifier, value); + }, + _bindProperty: function(name, expression, current, newAttrs) { + this._bindPropertyAst(name, this._parser.parseBinding(expression, current.elementDescription), current, newAttrs); + }, + _bindPropertyAst: function(name, ast, current, newAttrs) { + var binder = current.bindElement(); + binder.bindProperty(dashCaseToCamelCase(name), ast); + newAttrs.set(name, ast.source); + }, + _bindAssignmentEvent: function(name, expression, current, newAttrs) { + this._bindEvent(name, (expression + "=$event"), current, newAttrs); + }, + _bindEvent: function(name, expression, current, newAttrs) { + current.bindElement().bindEvent(dashCaseToCamelCase(name), this._parser.parseAction(expression, current.elementDescription)); + } + }, {}); + }()); + $__export("PropertyBindingParser", PropertyBindingParser); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/text_interpolation_parser", ["angular2/src/facade/lang", "angular2/src/dom/dom_adapter"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/text_interpolation_parser"; + var isPresent, + DOM, + TextInterpolationParser; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + DOM = $__m.DOM; + }], + execute: function() { + TextInterpolationParser = (function() { + function TextInterpolationParser(_parser) { + this._parser = _parser; + } + return ($traceurRuntime.createClass)(TextInterpolationParser, { + processStyle: function(style) { + return style; + }, + processElement: function(parent, current, control) { + if (!current.compileChildren) { + return ; + } + var element = current.element; + var childNodes = DOM.childNodes(DOM.templateAwareRoot(element)); + for (var i = 0; i < childNodes.length; i++) { + var node = childNodes[i]; + if (DOM.isTextNode(node)) { + var textNode = node; + var text = DOM.nodeValue(textNode); + var expr = this._parser.parseInterpolation(text, current.elementDescription); + if (isPresent(expr)) { + DOM.setText(textNode, ' '); + if (current.element === current.inheritedProtoView.rootElement) { + current.inheritedProtoView.bindRootText(textNode, expr); + } else { + current.bindElement().bindText(textNode, expr); + } + } + } + } + } + }, {}); + }()); + $__export("TextInterpolationParser", TextInterpolationParser); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/selector", ["angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/selector"; + var Map, + ListWrapper, + isPresent, + isBlank, + RegExpWrapper, + RegExpMatcherWrapper, + StringWrapper, + BaseException, + _EMPTY_ATTR_VALUE, + _SELECTOR_REGEXP, + CssSelector, + SelectorMatcher, + SelectorListContext, + SelectorContext; + return { + setters: [function($__m) { + Map = $__m.Map; + ListWrapper = $__m.ListWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + RegExpWrapper = $__m.RegExpWrapper; + RegExpMatcherWrapper = $__m.RegExpMatcherWrapper; + StringWrapper = $__m.StringWrapper; + BaseException = $__m.BaseException; + }], + execute: function() { + _EMPTY_ATTR_VALUE = ''; + _SELECTOR_REGEXP = RegExpWrapper.create('(\\:not\\()|' + '([-\\w]+)|' + '(?:\\.([-\\w]+))|' + '(?:\\[([-\\w*]+)(?:=([^\\]]*))?\\])|' + '(\\))|' + '(\\s*,\\s*)'); + CssSelector = (function() { + function CssSelector() { + this.element = null; + this.classNames = []; + this.attrs = []; + this.notSelectors = []; + } + return ($traceurRuntime.createClass)(CssSelector, { + isElementSelector: function() { + return isPresent(this.element) && ListWrapper.isEmpty(this.classNames) && ListWrapper.isEmpty(this.attrs) && this.notSelectors.length === 0; + }, + setElement: function() { + var element = arguments[0] !== (void 0) ? arguments[0] : null; + if (isPresent(element)) { + element = element.toLowerCase(); + } + this.element = element; + }, + addAttribute: function(name) { + var value = arguments[1] !== (void 0) ? arguments[1] : _EMPTY_ATTR_VALUE; + this.attrs.push(name.toLowerCase()); + if (isPresent(value)) { + value = value.toLowerCase(); + } else { + value = _EMPTY_ATTR_VALUE; + } + this.attrs.push(value); + }, + addClassName: function(name) { + this.classNames.push(name.toLowerCase()); + }, + toString: function() { + var res = ''; + if (isPresent(this.element)) { + res += this.element; + } + if (isPresent(this.classNames)) { + for (var i = 0; i < this.classNames.length; i++) { + res += '.' + this.classNames[i]; + } + } + if (isPresent(this.attrs)) { + for (var i = 0; i < this.attrs.length; ) { + var attrName = this.attrs[i++]; + var attrValue = this.attrs[i++]; + res += '[' + attrName; + if (attrValue.length > 0) { + res += '=' + attrValue; + } + res += ']'; + } + } + ListWrapper.forEach(this.notSelectors, (function(notSelector) { + res += ":not(" + notSelector.toString() + ")"; + })); + return res; + } + }, {parse: function(selector) { + var results = []; + var _addResult = (function(res, cssSel) { + if (cssSel.notSelectors.length > 0 && isBlank(cssSel.element) && ListWrapper.isEmpty(cssSel.classNames) && ListWrapper.isEmpty(cssSel.attrs)) { + cssSel.element = "*"; + } + res.push(cssSel); + }); + var cssSelector = new CssSelector(); + var matcher = RegExpWrapper.matcher(_SELECTOR_REGEXP, selector); + var match; + var current = cssSelector; + var inNot = false; + while (isPresent(match = RegExpMatcherWrapper.next(matcher))) { + if (isPresent(match[1])) { + if (inNot) { + throw new BaseException('Nesting :not is not allowed in a selector'); + } + inNot = true; + current = new CssSelector(); + cssSelector.notSelectors.push(current); + } + if (isPresent(match[2])) { + current.setElement(match[2]); + } + if (isPresent(match[3])) { + current.addClassName(match[3]); + } + if (isPresent(match[4])) { + current.addAttribute(match[4], match[5]); + } + if (isPresent(match[6])) { + inNot = false; + current = cssSelector; + } + if (isPresent(match[7])) { + if (inNot) { + throw new BaseException('Multiple selectors in :not are not supported'); + } + _addResult(results, cssSelector); + cssSelector = current = new CssSelector(); + } + } + _addResult(results, cssSelector); + return results; + }}); + }()); + $__export("CssSelector", CssSelector); + SelectorMatcher = (function() { + function SelectorMatcher() { + this._elementMap = new Map(); + this._elementPartialMap = new Map(); + this._classMap = new Map(); + this._classPartialMap = new Map(); + this._attrValueMap = new Map(); + this._attrValuePartialMap = new Map(); + this._listContexts = []; + } + return ($traceurRuntime.createClass)(SelectorMatcher, { + addSelectables: function(cssSelectors, callbackCtxt) { + var listContext = null; + if (cssSelectors.length > 1) { + listContext = new SelectorListContext(cssSelectors); + this._listContexts.push(listContext); + } + for (var i = 0; i < cssSelectors.length; i++) { + this._addSelectable(cssSelectors[i], callbackCtxt, listContext); + } + }, + _addSelectable: function(cssSelector, callbackCtxt, listContext) { + var matcher = this; + var element = cssSelector.element; + var classNames = cssSelector.classNames; + var attrs = cssSelector.attrs; + var selectable = new SelectorContext(cssSelector, callbackCtxt, listContext); + if (isPresent(element)) { + var isTerminal = attrs.length === 0 && classNames.length === 0; + if (isTerminal) { + this._addTerminal(matcher._elementMap, element, selectable); + } else { + matcher = this._addPartial(matcher._elementPartialMap, element); + } + } + if (isPresent(classNames)) { + for (var index = 0; index < classNames.length; index++) { + var isTerminal = attrs.length === 0 && index === classNames.length - 1; + var className = classNames[index]; + if (isTerminal) { + this._addTerminal(matcher._classMap, className, selectable); + } else { + matcher = this._addPartial(matcher._classPartialMap, className); + } + } + } + if (isPresent(attrs)) { + for (var index = 0; index < attrs.length; ) { + var isTerminal = index === attrs.length - 2; + var attrName = attrs[index++]; + var attrValue = attrs[index++]; + if (isTerminal) { + var terminalMap = matcher._attrValueMap; + var terminalValuesMap = terminalMap.get(attrName); + if (isBlank(terminalValuesMap)) { + terminalValuesMap = new Map(); + terminalMap.set(attrName, terminalValuesMap); + } + this._addTerminal(terminalValuesMap, attrValue, selectable); + } else { + var parttialMap = matcher._attrValuePartialMap; + var partialValuesMap = parttialMap.get(attrName); + if (isBlank(partialValuesMap)) { + partialValuesMap = new Map(); + parttialMap.set(attrName, partialValuesMap); + } + matcher = this._addPartial(partialValuesMap, attrValue); + } + } + } + }, + _addTerminal: function(map, name, selectable) { + var terminalList = map.get(name); + if (isBlank(terminalList)) { + terminalList = []; + map.set(name, terminalList); + } + terminalList.push(selectable); + }, + _addPartial: function(map, name) { + var matcher = map.get(name); + if (isBlank(matcher)) { + matcher = new SelectorMatcher(); + map.set(name, matcher); + } + return matcher; + }, + match: function(cssSelector, matchedCallback) { + var result = false; + var element = cssSelector.element; + var classNames = cssSelector.classNames; + var attrs = cssSelector.attrs; + for (var i = 0; i < this._listContexts.length; i++) { + this._listContexts[i].alreadyMatched = false; + } + result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result; + result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) || result; + if (isPresent(classNames)) { + for (var index = 0; index < classNames.length; index++) { + var className = classNames[index]; + result = this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result; + result = this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) || result; + } + } + if (isPresent(attrs)) { + for (var index = 0; index < attrs.length; ) { + var attrName = attrs[index++]; + var attrValue = attrs[index++]; + var terminalValuesMap = this._attrValueMap.get(attrName); + if (!StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchTerminal(terminalValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result; + } + result = this._matchTerminal(terminalValuesMap, attrValue, cssSelector, matchedCallback) || result; + var partialValuesMap = this._attrValuePartialMap.get(attrName); + if (!StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchPartial(partialValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result; + } + result = this._matchPartial(partialValuesMap, attrValue, cssSelector, matchedCallback) || result; + } + } + return result; + }, + _matchTerminal: function(map, name, cssSelector, matchedCallback) { + if (isBlank(map) || isBlank(name)) { + return false; + } + var selectables = map.get(name); + var starSelectables = map.get("*"); + if (isPresent(starSelectables)) { + selectables = ListWrapper.concat(selectables, starSelectables); + } + if (isBlank(selectables)) { + return false; + } + var selectable; + var result = false; + for (var index = 0; index < selectables.length; index++) { + selectable = selectables[index]; + result = selectable.finalize(cssSelector, matchedCallback) || result; + } + return result; + }, + _matchPartial: function(map, name, cssSelector, matchedCallback) { + if (isBlank(map) || isBlank(name)) { + return false; + } + var nestedSelector = map.get(name); + if (isBlank(nestedSelector)) { + return false; + } + return nestedSelector.match(cssSelector, matchedCallback); + } + }, {createNotMatcher: function(notSelectors) { + var notMatcher = new SelectorMatcher(); + notMatcher.addSelectables(notSelectors, null); + return notMatcher; + }}); + }()); + $__export("SelectorMatcher", SelectorMatcher); + SelectorListContext = (function() { + function SelectorListContext(selectors) { + this.selectors = selectors; + this.alreadyMatched = false; + } + return ($traceurRuntime.createClass)(SelectorListContext, {}, {}); + }()); + $__export("SelectorListContext", SelectorListContext); + SelectorContext = (function() { + function SelectorContext(selector, cbContext, listContext) { + this.selector = selector; + this.cbContext = cbContext; + this.listContext = listContext; + this.notSelectors = selector.notSelectors; + } + return ($traceurRuntime.createClass)(SelectorContext, {finalize: function(cssSelector, callback) { + var result = true; + if (this.notSelectors.length > 0 && (isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + var notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors); + result = !notMatcher.match(cssSelector, null); + } + if (result && isPresent(callback) && (isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + if (isPresent(this.listContext)) { + this.listContext.alreadyMatched = true; + } + callback(this.selector, this.cbContext); + } + return result; + }}, {}); + }()); + $__export("SelectorContext", SelectorContext); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/view_splitter", ["angular2/src/facade/lang", "angular2/src/dom/dom_adapter", "angular2/src/facade/collection", "angular2/src/render/dom/compiler/compile_element", "angular2/src/render/dom/util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/view_splitter"; + var isPresent, + BaseException, + StringWrapper, + DOM, + MapWrapper, + CompileElement, + dashCaseToCamelCase, + ViewSplitter; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + MapWrapper = $__m.MapWrapper; + }, function($__m) { + CompileElement = $__m.CompileElement; + }, function($__m) { + dashCaseToCamelCase = $__m.dashCaseToCamelCase; + }], + execute: function() { + ViewSplitter = (function() { + function ViewSplitter(_parser) { + this._parser = _parser; + } + return ($traceurRuntime.createClass)(ViewSplitter, { + processStyle: function(style) { + return style; + }, + processElement: function(parent, current, control) { + var attrs = current.attrs(); + var templateBindings = attrs.get('template'); + var hasTemplateBinding = isPresent(templateBindings); + MapWrapper.forEach(attrs, (function(attrValue, attrName) { + if (StringWrapper.startsWith(attrName, '*')) { + var key = StringWrapper.substring(attrName, 1); + if (hasTemplateBinding) { + throw new BaseException("Only one template directive per element is allowed: " + (templateBindings + " and " + key + " cannot be used simultaneously ") + ("in " + current.elementDescription)); + } else { + templateBindings = (attrValue.length == 0) ? key : key + ' ' + attrValue; + hasTemplateBinding = true; + } + } + })); + if (isPresent(parent)) { + if (DOM.isTemplateElement(current.element)) { + if (!current.isViewRoot) { + var viewRoot = new CompileElement(DOM.createTemplate('')); + viewRoot.inheritedProtoView = current.bindElement().bindNestedProtoView(viewRoot.element); + viewRoot.elementDescription = current.elementDescription; + viewRoot.isViewRoot = true; + this._moveChildNodes(DOM.content(current.element), DOM.content(viewRoot.element)); + control.addChild(viewRoot); + } + } + if (hasTemplateBinding) { + var anchor = new CompileElement(DOM.createTemplate('')); + anchor.inheritedProtoView = current.inheritedProtoView; + anchor.inheritedElementBinder = current.inheritedElementBinder; + anchor.distanceToInheritedBinder = current.distanceToInheritedBinder; + anchor.elementDescription = current.elementDescription; + var viewRoot = new CompileElement(DOM.createTemplate('')); + viewRoot.inheritedProtoView = anchor.bindElement().bindNestedProtoView(viewRoot.element); + viewRoot.elementDescription = current.elementDescription; + viewRoot.isViewRoot = true; + current.inheritedProtoView = viewRoot.inheritedProtoView; + current.inheritedElementBinder = null; + current.distanceToInheritedBinder = 0; + this._parseTemplateBindings(templateBindings, anchor); + DOM.insertBefore(current.element, anchor.element); + control.addParent(anchor); + DOM.appendChild(DOM.content(viewRoot.element), current.element); + control.addParent(viewRoot); + } + } + }, + _moveChildNodes: function(source, target) { + var next = DOM.firstChild(source); + while (isPresent(next)) { + DOM.appendChild(target, next); + next = DOM.firstChild(source); + } + }, + _parseTemplateBindings: function(templateBindings, compileElement) { + var bindings = this._parser.parseTemplateBindings(templateBindings, compileElement.elementDescription); + for (var i = 0; i < bindings.length; i++) { + var binding = bindings[i]; + if (binding.keyIsVar) { + compileElement.bindElement().bindVariable(dashCaseToCamelCase(binding.key), binding.name); + compileElement.attrs().set(binding.key, binding.name); + } else if (isPresent(binding.expression)) { + compileElement.bindElement().bindProperty(dashCaseToCamelCase(binding.key), binding.expression); + compileElement.attrs().set(binding.key, binding.expression.source); + } else { + DOM.setAttribute(compileElement.element, binding.key, ''); + } + } + } + }, {}); + }()); + $__export("ViewSplitter", ViewSplitter); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/shadow_css", ["angular2/src/dom/dom_adapter", "angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/shadow_css"; + var DOM, + ListWrapper, + StringWrapper, + RegExpWrapper, + RegExpMatcherWrapper, + isPresent, + isBlank, + ShadowCss, + _cssContentNextSelectorRe, + _cssContentRuleRe, + _cssContentUnscopedRuleRe, + _polyfillHost, + _polyfillHostContext, + _parenSuffix, + _cssColonHostRe, + _cssColonHostContextRe, + _polyfillHostNoCombinator, + _shadowDOMSelectorsRe, + _selectorReSuffix, + _polyfillHostRe, + _colonHostRe, + _colonHostContextRe; + function _cssToRules(cssText) { + return DOM.cssToRules(cssText); + } + function _withCssRules(cssText, callback) { + if (isBlank(callback)) + return ; + var rules = _cssToRules(cssText); + callback(rules); + } + return { + setters: [function($__m) { + DOM = $__m.DOM; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + StringWrapper = $__m.StringWrapper; + RegExpWrapper = $__m.RegExpWrapper; + RegExpMatcherWrapper = $__m.RegExpMatcherWrapper; + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + }], + execute: function() { + ShadowCss = (function() { + function ShadowCss() { + this.strictStyling = true; + } + return ($traceurRuntime.createClass)(ShadowCss, { + shimStyle: function(style, selector) { + var hostSelector = arguments[2] !== (void 0) ? arguments[2] : ''; + var cssText = DOM.getText(style); + return this.shimCssText(cssText, selector, hostSelector); + }, + shimCssText: function(cssText, selector) { + var hostSelector = arguments[2] !== (void 0) ? arguments[2] : ''; + cssText = this._insertDirectives(cssText); + return this._scopeCssText(cssText, selector, hostSelector); + }, + _insertDirectives: function(cssText) { + cssText = this._insertPolyfillDirectivesInCssText(cssText); + return this._insertPolyfillRulesInCssText(cssText); + }, + _insertPolyfillDirectivesInCssText: function(cssText) { + return StringWrapper.replaceAllMapped(cssText, _cssContentNextSelectorRe, function(m) { + return m[1] + '{'; + }); + }, + _insertPolyfillRulesInCssText: function(cssText) { + return StringWrapper.replaceAllMapped(cssText, _cssContentRuleRe, function(m) { + var rule = m[0]; + rule = StringWrapper.replace(rule, m[1], ''); + rule = StringWrapper.replace(rule, m[2], ''); + return m[3] + rule; + }); + }, + _scopeCssText: function(cssText, scopeSelector, hostSelector) { + var $__0 = this; + var unscoped = this._extractUnscopedRulesFromCssText(cssText); + cssText = this._insertPolyfillHostInCssText(cssText); + cssText = this._convertColonHost(cssText); + cssText = this._convertColonHostContext(cssText); + cssText = this._convertShadowDOMSelectors(cssText); + if (isPresent(scopeSelector)) { + _withCssRules(cssText, (function(rules) { + cssText = $__0._scopeRules(rules, scopeSelector, hostSelector); + })); + } + cssText = cssText + '\n' + unscoped; + return cssText.trim(); + }, + _extractUnscopedRulesFromCssText: function(cssText) { + var r = '', + m; + var matcher = RegExpWrapper.matcher(_cssContentUnscopedRuleRe, cssText); + while (isPresent(m = RegExpMatcherWrapper.next(matcher))) { + var rule = m[0]; + rule = StringWrapper.replace(rule, m[2], ''); + rule = StringWrapper.replace(rule, m[1], m[3]); + r += rule + '\n\n'; + } + return r; + }, + _convertColonHost: function(cssText) { + return this._convertColonRule(cssText, _cssColonHostRe, this._colonHostPartReplacer); + }, + _convertColonHostContext: function(cssText) { + return this._convertColonRule(cssText, _cssColonHostContextRe, this._colonHostContextPartReplacer); + }, + _convertColonRule: function(cssText, regExp, partReplacer) { + return StringWrapper.replaceAllMapped(cssText, regExp, function(m) { + if (isPresent(m[2])) { + var parts = m[2].split(','), + r = []; + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + if (isBlank(p)) + break; + p = p.trim(); + r.push(partReplacer(_polyfillHostNoCombinator, p, m[3])); + } + return r.join(','); + } else { + return _polyfillHostNoCombinator + m[3]; + } + }); + }, + _colonHostContextPartReplacer: function(host, part, suffix) { + if (StringWrapper.contains(part, _polyfillHost)) { + return this._colonHostPartReplacer(host, part, suffix); + } else { + return host + part + suffix + ', ' + part + ' ' + host + suffix; + } + }, + _colonHostPartReplacer: function(host, part, suffix) { + return host + StringWrapper.replace(part, _polyfillHost, '') + suffix; + }, + _convertShadowDOMSelectors: function(cssText) { + for (var i = 0; i < _shadowDOMSelectorsRe.length; i++) { + cssText = StringWrapper.replaceAll(cssText, _shadowDOMSelectorsRe[i], ' '); + } + return cssText; + }, + _scopeRules: function(cssRules, scopeSelector, hostSelector) { + var cssText = ''; + if (isPresent(cssRules)) { + for (var i = 0; i < cssRules.length; i++) { + var rule = cssRules[i]; + if (DOM.isStyleRule(rule) || DOM.isPageRule(rule)) { + cssText += this._scopeSelector(rule.selectorText, scopeSelector, hostSelector, this.strictStyling) + ' {\n'; + cssText += this._propertiesFromRule(rule) + '\n}\n\n'; + } else if (DOM.isMediaRule(rule)) { + cssText += '@media ' + rule.media.mediaText + ' {\n'; + cssText += this._scopeRules(rule.cssRules, scopeSelector, hostSelector); + cssText += '\n}\n\n'; + } else { + try { + if (isPresent(rule.cssText)) { + cssText += rule.cssText + '\n\n'; + } + } catch (x) { + if (DOM.isKeyframesRule(rule) && isPresent(rule.cssRules)) { + cssText += this._ieSafeCssTextFromKeyFrameRule(rule); + } + } + } + } + } + return cssText; + }, + _ieSafeCssTextFromKeyFrameRule: function(rule) { + var cssText = '@keyframes ' + rule.name + ' {'; + for (var i = 0; i < rule.cssRules.length; i++) { + var r = rule.cssRules[i]; + cssText += ' ' + r.keyText + ' {' + r.style.cssText + '}'; + } + cssText += ' }'; + return cssText; + }, + _scopeSelector: function(selector, scopeSelector, hostSelector, strict) { + var r = [], + parts = selector.split(','); + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + p = p.trim(); + if (this._selectorNeedsScoping(p, scopeSelector)) { + p = strict && !StringWrapper.contains(p, _polyfillHostNoCombinator) ? this._applyStrictSelectorScope(p, scopeSelector) : this._applySelectorScope(p, scopeSelector, hostSelector); + } + r.push(p); + } + return r.join(', '); + }, + _selectorNeedsScoping: function(selector, scopeSelector) { + var re = this._makeScopeMatcher(scopeSelector); + return !isPresent(RegExpWrapper.firstMatch(re, selector)); + }, + _makeScopeMatcher: function(scopeSelector) { + var lre = /\[/g; + var rre = /\]/g; + scopeSelector = StringWrapper.replaceAll(scopeSelector, lre, '\\['); + scopeSelector = StringWrapper.replaceAll(scopeSelector, rre, '\\]'); + return RegExpWrapper.create('^(' + scopeSelector + ')' + _selectorReSuffix, 'm'); + }, + _applySelectorScope: function(selector, scopeSelector, hostSelector) { + return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector); + }, + _applySimpleSelectorScope: function(selector, scopeSelector, hostSelector) { + if (isPresent(RegExpWrapper.firstMatch(_polyfillHostRe, selector))) { + var replaceBy = this.strictStyling ? ("[" + hostSelector + "]") : scopeSelector; + selector = StringWrapper.replace(selector, _polyfillHostNoCombinator, replaceBy); + return StringWrapper.replaceAll(selector, _polyfillHostRe, replaceBy + ' '); + } else { + return scopeSelector + ' ' + selector; + } + }, + _applyStrictSelectorScope: function(selector, scopeSelector) { + var isRe = /\[is=([^\]]*)\]/g; + scopeSelector = StringWrapper.replaceAllMapped(scopeSelector, isRe, (function(m) { + return m[1]; + })); + var splits = [' ', '>', '+', '~'], + scoped = selector, + attrName = '[' + scopeSelector + ']'; + for (var i = 0; i < splits.length; i++) { + var sep = splits[i]; + var parts = scoped.split(sep); + scoped = ListWrapper.map(parts, function(p) { + var t = StringWrapper.replaceAll(p.trim(), _polyfillHostRe, ''); + if (t.length > 0 && !ListWrapper.contains(splits, t) && !StringWrapper.contains(t, attrName)) { + var re = /([^:]*)(:*)(.*)/g; + var m = RegExpWrapper.firstMatch(re, t); + if (isPresent(m)) { + p = m[1] + attrName + m[2] + m[3]; + } + } + return p; + }).join(sep); + } + return scoped; + }, + _insertPolyfillHostInCssText: function(selector) { + selector = StringWrapper.replaceAll(selector, _colonHostContextRe, _polyfillHostContext); + selector = StringWrapper.replaceAll(selector, _colonHostRe, _polyfillHost); + return selector; + }, + _propertiesFromRule: function(rule) { + var cssText = rule.style.cssText; + var attrRe = /['"]+|attr/g; + if (rule.style.content.length > 0 && !isPresent(RegExpWrapper.firstMatch(attrRe, rule.style.content))) { + var contentRe = /content:[^;]*;/g; + cssText = StringWrapper.replaceAll(cssText, contentRe, 'content: \'' + rule.style.content + '\';'); + } + return cssText; + } + }, {}); + }()); + $__export("ShadowCss", ShadowCss); + _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim; + _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim; + _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim; + _polyfillHost = '-shadowcsshost'; + _polyfillHostContext = '-shadowcsscontext'; + _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)'; + _cssColonHostRe = RegExpWrapper.create('(' + _polyfillHost + _parenSuffix, 'im'); + _cssColonHostContextRe = RegExpWrapper.create('(' + _polyfillHostContext + _parenSuffix, 'im'); + _polyfillHostNoCombinator = _polyfillHost + '-no-combinator'; + _shadowDOMSelectorsRe = [/>>>/g, /::shadow/g, /::content/g, /\/deep\//g, /\/shadow-deep\//g, /\/shadow\//g]; + _selectorReSuffix = '([>\\s~+\[.,{:][\\s\\S]*)?$'; + _polyfillHostRe = RegExpWrapper.create(_polyfillHost, 'im'); + _colonHostRe = /:host/gim; + _colonHostContextRe = /:host-context/gim; + } + }; +}); + +System.register("angular2/src/render/dom/view/proto_view_merger", ["angular2/src/dom/dom_adapter", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/render/dom/view/proto_view", "angular2/src/render/dom/view/element_binder", "angular2/src/render/api", "angular2/src/render/dom/util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/view/proto_view_merger"; + var DOM, + isPresent, + isBlank, + isArray, + ListWrapper, + SetWrapper, + MapWrapper, + DomProtoView, + DomProtoViewRef, + resolveInternalDomProtoView, + DomElementBinder, + RenderProtoViewMergeMapping, + ViewType, + ViewEncapsulation, + NG_BINDING_CLASS, + NG_CONTENT_ELEMENT_NAME, + cloneAndQueryProtoView, + queryBoundElements, + queryBoundTextNodeIndices, + NG_SHADOW_ROOT_ELEMENT_NAME; + function mergeProtoViewsRecursively(protoViewRefs) { + var clonedProtoViews = []; + var hostViewAndBinderIndices = []; + cloneProtoViews(protoViewRefs, clonedProtoViews, hostViewAndBinderIndices); + var mainProtoView = clonedProtoViews[0]; + mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices); + var fragments = []; + var elementsWithNativeShadowRoot = new Set(); + mergeComponents(clonedProtoViews, hostViewAndBinderIndices, fragments, elementsWithNativeShadowRoot); + markBoundTextNodeParentsAsBoundElements(clonedProtoViews); + var rootElement = createRootElementFromFragments(fragments); + var fragmentsRootNodeCount = fragments.map((function(fragment) { + return fragment.length; + })); + var rootNode = DOM.content(rootElement); + var mergedBoundElements = queryBoundElements(rootNode, false); + var mergedBoundTextIndices = new Map(); + var boundTextNodeMap = indexBoundTextNodes(clonedProtoViews); + var rootTextNodeIndices = calcRootTextNodeIndices(rootNode, boundTextNodeMap, mergedBoundTextIndices); + var mergedElementBinders = calcElementBinders(clonedProtoViews, mergedBoundElements, elementsWithNativeShadowRoot, boundTextNodeMap, mergedBoundTextIndices); + var mappedElementIndices = calcMappedElementIndices(clonedProtoViews, mergedBoundElements); + var mappedTextIndices = calcMappedTextIndices(clonedProtoViews, mergedBoundTextIndices); + var hostElementIndicesByViewIndex = calcHostElementIndicesByViewIndex(clonedProtoViews, hostViewAndBinderIndices); + var nestedViewCounts = calcNestedViewCounts(hostViewAndBinderIndices); + var mergedProtoView = DomProtoView.create(mainProtoView.original.type, rootElement, mainProtoView.original.encapsulation, fragmentsRootNodeCount, rootTextNodeIndices, mergedElementBinders, new Map()); + return new RenderProtoViewMergeMapping(new DomProtoViewRef(mergedProtoView), fragmentsRootNodeCount.length, mappedElementIndices, mergedBoundElements.length, mappedTextIndices, hostElementIndicesByViewIndex, nestedViewCounts); + } + function cloneProtoViews(protoViewRefs, targetClonedProtoViews, targetHostViewAndBinderIndices) { + var hostProtoView = resolveInternalDomProtoView(protoViewRefs[0]); + var hostPvIdx = targetClonedProtoViews.length; + targetClonedProtoViews.push(cloneAndQueryProtoView(hostProtoView, false)); + if (targetHostViewAndBinderIndices.length === 0) { + targetHostViewAndBinderIndices.push([null, null]); + } + var protoViewIdx = 1; + for (var i = 0; i < hostProtoView.elementBinders.length; i++) { + var binder = hostProtoView.elementBinders[i]; + if (binder.hasNestedProtoView) { + var nestedEntry = protoViewRefs[protoViewIdx++]; + if (isPresent(nestedEntry)) { + targetHostViewAndBinderIndices.push([hostPvIdx, i]); + if (isArray(nestedEntry)) { + cloneProtoViews(nestedEntry, targetClonedProtoViews, targetHostViewAndBinderIndices); + } else { + targetClonedProtoViews.push(cloneAndQueryProtoView(resolveInternalDomProtoView(nestedEntry), false)); + } + } + } + } + } + function markBoundTextNodeParentsAsBoundElements(mergableProtoViews) { + mergableProtoViews.forEach((function(mergableProtoView) { + mergableProtoView.boundTextNodes.forEach((function(textNode) { + var parentNode = textNode.parentNode; + if (isPresent(parentNode) && DOM.isElementNode(parentNode)) { + DOM.addClass(parentNode, NG_BINDING_CLASS); + } + })); + })); + } + function indexBoundTextNodes(mergableProtoViews) { + var boundTextNodeMap = new Map(); + for (var pvIndex = 0; pvIndex < mergableProtoViews.length; pvIndex++) { + var mergableProtoView = mergableProtoViews[pvIndex]; + mergableProtoView.boundTextNodes.forEach((function(textNode) { + boundTextNodeMap.set(textNode, null); + })); + } + return boundTextNodeMap; + } + function mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices) { + var nearestHostComponentOrRootPvIndices = calcNearestHostComponentOrRootPvIndices(clonedProtoViews, hostViewAndBinderIndices); + for (var viewIdx = 1; viewIdx < clonedProtoViews.length; viewIdx++) { + var clonedProtoView = clonedProtoViews[viewIdx]; + if (clonedProtoView.original.type === ViewType.EMBEDDED) { + var hostComponentIdx = nearestHostComponentOrRootPvIndices[viewIdx]; + var hostPv = clonedProtoViews[hostComponentIdx]; + clonedProtoView.fragments.forEach((function(fragment) { + return hostPv.fragments.push(fragment); + })); + } + } + } + function calcNearestHostComponentOrRootPvIndices(clonedProtoViews, hostViewAndBinderIndices) { + var nearestHostComponentOrRootPvIndices = ListWrapper.createFixedSize(clonedProtoViews.length); + nearestHostComponentOrRootPvIndices[0] = null; + for (var viewIdx = 1; viewIdx < hostViewAndBinderIndices.length; viewIdx++) { + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostProtoView = clonedProtoViews[hostViewIdx]; + if (hostViewIdx === 0 || hostProtoView.original.type === ViewType.COMPONENT) { + nearestHostComponentOrRootPvIndices[viewIdx] = hostViewIdx; + } else { + nearestHostComponentOrRootPvIndices[viewIdx] = nearestHostComponentOrRootPvIndices[hostViewIdx]; + } + } + return nearestHostComponentOrRootPvIndices; + } + function mergeComponents(clonedProtoViews, hostViewAndBinderIndices, targetFragments, targetElementsWithNativeShadowRoot) { + var hostProtoView = clonedProtoViews[0]; + hostProtoView.fragments.forEach((function(fragment) { + return targetFragments.push(fragment); + })); + for (var viewIdx = 1; viewIdx < clonedProtoViews.length; viewIdx++) { + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostBinderIdx = hostViewAndBinderIndices[viewIdx][1]; + var hostProtoView = clonedProtoViews[hostViewIdx]; + var clonedProtoView = clonedProtoViews[viewIdx]; + if (clonedProtoView.original.type === ViewType.COMPONENT) { + mergeComponent(hostProtoView, hostBinderIdx, clonedProtoView, targetFragments, targetElementsWithNativeShadowRoot); + } + } + } + function mergeComponent(hostProtoView, binderIdx, nestedProtoView, targetFragments, targetElementsWithNativeShadowRoot) { + var hostElement = hostProtoView.boundElements[binderIdx]; + var fragmentElements = mapFragmentsIntoElements(nestedProtoView.fragments); + var contentElements = findContentElements(fragmentElements); + var projectableNodes = DOM.childNodesAsList(hostElement); + for (var i = 0; i < contentElements.length; i++) { + var contentElement = contentElements[i]; + var select = DOM.getAttribute(contentElement, 'select'); + projectableNodes = projectMatchingNodes(select, contentElement, projectableNodes); + } + var fragments = extractFragmentNodesFromElements(fragmentElements); + var useNativeShadowRoot = nestedProtoView.original.encapsulation === ViewEncapsulation.NATIVE; + if (useNativeShadowRoot) { + targetElementsWithNativeShadowRoot.add(hostElement); + } + MapWrapper.forEach(nestedProtoView.original.hostAttributes, (function(attrValue, attrName) { + DOM.setAttribute(hostElement, attrName, attrValue); + })); + appendComponentNodesToHost(hostProtoView, binderIdx, fragments[0], useNativeShadowRoot); + for (var i = 1; i < fragments.length; i++) { + targetFragments.push(fragments[i]); + } + } + function mapFragmentsIntoElements(fragments) { + return fragments.map((function(fragment) { + var fragmentElement = DOM.createTemplate(''); + fragment.forEach((function(node) { + return DOM.appendChild(DOM.content(fragmentElement), node); + })); + return fragmentElement; + })); + } + function extractFragmentNodesFromElements(fragmentElements) { + return fragmentElements.map((function(fragmentElement) { + return DOM.childNodesAsList(DOM.content(fragmentElement)); + })); + } + function findContentElements(fragmentElements) { + var contentElements = []; + fragmentElements.forEach((function(fragmentElement) { + var fragmentContentElements = DOM.querySelectorAll(DOM.content(fragmentElement), NG_CONTENT_ELEMENT_NAME); + for (var i = 0; i < fragmentContentElements.length; i++) { + contentElements.push(fragmentContentElements[i]); + } + })); + return sortContentElements(contentElements); + } + function appendComponentNodesToHost(hostProtoView, binderIdx, componentRootNodes, useNativeShadowRoot) { + var hostElement = hostProtoView.boundElements[binderIdx]; + if (useNativeShadowRoot) { + var shadowRootWrapper = DOM.createElement(NG_SHADOW_ROOT_ELEMENT_NAME); + for (var i = 0; i < componentRootNodes.length; i++) { + DOM.appendChild(shadowRootWrapper, componentRootNodes[i]); + } + var firstChild = DOM.firstChild(hostElement); + if (isPresent(firstChild)) { + DOM.insertBefore(firstChild, shadowRootWrapper); + } else { + DOM.appendChild(hostElement, shadowRootWrapper); + } + } else { + DOM.clearNodes(hostElement); + for (var i = 0; i < componentRootNodes.length; i++) { + DOM.appendChild(hostElement, componentRootNodes[i]); + } + } + } + function projectMatchingNodes(selector, contentElement, nodes) { + var remaining = []; + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var matches = false; + if (isWildcard(selector)) { + matches = true; + } else if (DOM.isElementNode(node) && DOM.elementMatches(node, selector)) { + matches = true; + } + if (matches) { + DOM.insertBefore(contentElement, node); + } else { + remaining.push(node); + } + } + DOM.remove(contentElement); + return remaining; + } + function isWildcard(selector) { + return isBlank(selector) || selector.length === 0 || selector == '*'; + } + function sortContentElements(contentElements) { + var firstWildcard = null; + var sorted = []; + contentElements.forEach((function(contentElement) { + var select = DOM.getAttribute(contentElement, 'select'); + if (isWildcard(select)) { + if (isBlank(firstWildcard)) { + firstWildcard = contentElement; + } + } else { + sorted.push(contentElement); + } + })); + if (isPresent(firstWildcard)) { + sorted.push(firstWildcard); + } + return sorted; + } + function createRootElementFromFragments(fragments) { + var rootElement = DOM.createTemplate(''); + var rootNode = DOM.content(rootElement); + fragments.forEach((function(fragment) { + fragment.forEach((function(node) { + DOM.appendChild(rootNode, node); + })); + })); + return rootElement; + } + function calcRootTextNodeIndices(rootNode, boundTextNodes, targetBoundTextIndices) { + var rootTextNodeIndices = []; + queryBoundTextNodeIndices(rootNode, boundTextNodes, (function(textNode, nodeIndex, _) { + rootTextNodeIndices.push(nodeIndex); + targetBoundTextIndices.set(textNode, targetBoundTextIndices.size); + })); + return rootTextNodeIndices; + } + function calcElementBinders(clonedProtoViews, mergedBoundElements, elementsWithNativeShadowRoot, boundTextNodes, targetBoundTextIndices) { + var elementBinderByElement = indexElementBindersByElement(clonedProtoViews); + var mergedElementBinders = []; + for (var i = 0; i < mergedBoundElements.length; i++) { + var element = mergedBoundElements[i]; + var textNodeIndices = []; + queryBoundTextNodeIndices(element, boundTextNodes, (function(textNode, nodeIndex, _) { + textNodeIndices.push(nodeIndex); + targetBoundTextIndices.set(textNode, targetBoundTextIndices.size); + })); + mergedElementBinders.push(updateElementBinders(elementBinderByElement.get(element), textNodeIndices, SetWrapper.has(elementsWithNativeShadowRoot, element))); + } + return mergedElementBinders; + } + function indexElementBindersByElement(mergableProtoViews) { + var elementBinderByElement = new Map(); + mergableProtoViews.forEach((function(mergableProtoView) { + for (var i = 0; i < mergableProtoView.boundElements.length; i++) { + var el = mergableProtoView.boundElements[i]; + if (isPresent(el)) { + elementBinderByElement.set(el, mergableProtoView.original.elementBinders[i]); + } + } + })); + return elementBinderByElement; + } + function updateElementBinders(elementBinder, textNodeIndices, hasNativeShadowRoot) { + var result; + if (isBlank(elementBinder)) { + result = new DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: false, + eventLocals: null, + localEvents: [], + globalEvents: [], + hasNativeShadowRoot: false + }); + } else { + result = new DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: false, + eventLocals: elementBinder.eventLocals, + localEvents: elementBinder.localEvents, + globalEvents: elementBinder.globalEvents, + hasNativeShadowRoot: hasNativeShadowRoot + }); + } + return result; + } + function calcMappedElementIndices(clonedProtoViews, mergedBoundElements) { + var mergedBoundElementIndices = indexArray(mergedBoundElements); + var mappedElementIndices = []; + clonedProtoViews.forEach((function(clonedProtoView) { + clonedProtoView.boundElements.forEach((function(boundElement) { + var mappedElementIndex = mergedBoundElementIndices.get(boundElement); + mappedElementIndices.push(mappedElementIndex); + })); + })); + return mappedElementIndices; + } + function calcMappedTextIndices(clonedProtoViews, mergedBoundTextIndices) { + var mappedTextIndices = []; + clonedProtoViews.forEach((function(clonedProtoView) { + clonedProtoView.boundTextNodes.forEach((function(textNode) { + var mappedTextIndex = mergedBoundTextIndices.get(textNode); + mappedTextIndices.push(mappedTextIndex); + })); + })); + return mappedTextIndices; + } + function calcHostElementIndicesByViewIndex(clonedProtoViews, hostViewAndBinderIndices) { + var hostElementIndices = [null]; + var viewElementOffsets = [0]; + var elementIndex = clonedProtoViews[0].original.elementBinders.length; + for (var viewIdx = 1; viewIdx < hostViewAndBinderIndices.length; viewIdx++) { + viewElementOffsets.push(elementIndex); + elementIndex += clonedProtoViews[viewIdx].original.elementBinders.length; + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostBinderIdx = hostViewAndBinderIndices[viewIdx][1]; + hostElementIndices.push(viewElementOffsets[hostViewIdx] + hostBinderIdx); + } + return hostElementIndices; + } + function calcNestedViewCounts(hostViewAndBinderIndices) { + var nestedViewCounts = ListWrapper.createFixedSize(hostViewAndBinderIndices.length); + ListWrapper.fill(nestedViewCounts, 0); + for (var viewIdx = hostViewAndBinderIndices.length - 1; viewIdx >= 1; viewIdx--) { + var hostViewAndElementIdx = hostViewAndBinderIndices[viewIdx]; + if (isPresent(hostViewAndElementIdx)) { + nestedViewCounts[hostViewAndElementIdx[0]] += nestedViewCounts[viewIdx] + 1; + } + } + return nestedViewCounts; + } + function indexArray(arr) { + var map = new Map(); + for (var i = 0; i < arr.length; i++) { + map.set(arr[i], i); + } + return map; + } + $__export("mergeProtoViewsRecursively", mergeProtoViewsRecursively); + return { + setters: [function($__m) { + DOM = $__m.DOM; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + isArray = $__m.isArray; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + SetWrapper = $__m.SetWrapper; + MapWrapper = $__m.MapWrapper; + }, function($__m) { + DomProtoView = $__m.DomProtoView; + DomProtoViewRef = $__m.DomProtoViewRef; + resolveInternalDomProtoView = $__m.resolveInternalDomProtoView; + }, function($__m) { + DomElementBinder = $__m.DomElementBinder; + }, function($__m) { + RenderProtoViewMergeMapping = $__m.RenderProtoViewMergeMapping; + ViewType = $__m.ViewType; + ViewEncapsulation = $__m.ViewEncapsulation; + }, function($__m) { + NG_BINDING_CLASS = $__m.NG_BINDING_CLASS; + NG_CONTENT_ELEMENT_NAME = $__m.NG_CONTENT_ELEMENT_NAME; + cloneAndQueryProtoView = $__m.cloneAndQueryProtoView; + queryBoundElements = $__m.queryBoundElements; + queryBoundTextNodeIndices = $__m.queryBoundTextNodeIndices; + NG_SHADOW_ROOT_ELEMENT_NAME = $__m.NG_SHADOW_ROOT_ELEMENT_NAME; + }], + execute: function() { + } + }; +}); + +System.register("angular2/src/render/dom/view/view", ["angular2/src/dom/dom_adapter", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/render/api", "angular2/src/render/dom/util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/view/view"; + var DOM, + Map, + isPresent, + stringify, + RenderViewRef, + camelCaseToDashCase, + DomViewRef, + DomView; + function resolveInternalDomView(viewRef) { + return viewRef._view; + } + $__export("resolveInternalDomView", resolveInternalDomView); + return { + setters: [function($__m) { + DOM = $__m.DOM; + }, function($__m) { + Map = $__m.Map; + }, function($__m) { + isPresent = $__m.isPresent; + stringify = $__m.stringify; + }, function($__m) { + RenderViewRef = $__m.RenderViewRef; + }, function($__m) { + camelCaseToDashCase = $__m.camelCaseToDashCase; + }], + execute: function() { + DomViewRef = (function($__super) { + function DomViewRef(_view) { + $traceurRuntime.superConstructor(DomViewRef).call(this); + this._view = _view; + } + return ($traceurRuntime.createClass)(DomViewRef, {}, {}, $__super); + }(RenderViewRef)); + $__export("DomViewRef", DomViewRef); + DomView = (function() { + function DomView(proto, boundTextNodes, boundElements) { + this.proto = proto; + this.boundTextNodes = boundTextNodes; + this.boundElements = boundElements; + this.hydrated = false; + this.eventDispatcher = null; + this.eventHandlerRemovers = []; + } + return ($traceurRuntime.createClass)(DomView, { + setElementProperty: function(elementIndex, propertyName, value) { + DOM.setProperty(this.boundElements[elementIndex], propertyName, value); + }, + setElementAttribute: function(elementIndex, attributeName, value) { + var element = this.boundElements[elementIndex]; + var dashCasedAttributeName = camelCaseToDashCase(attributeName); + if (isPresent(value)) { + DOM.setAttribute(element, dashCasedAttributeName, stringify(value)); + } else { + DOM.removeAttribute(element, dashCasedAttributeName); + } + }, + setElementClass: function(elementIndex, className, isAdd) { + var element = this.boundElements[elementIndex]; + if (isAdd) { + DOM.addClass(element, className); + } else { + DOM.removeClass(element, className); + } + }, + setElementStyle: function(elementIndex, styleName, value) { + var element = this.boundElements[elementIndex]; + var dashCasedStyleName = camelCaseToDashCase(styleName); + if (isPresent(value)) { + DOM.setStyle(element, dashCasedStyleName, stringify(value)); + } else { + DOM.removeStyle(element, dashCasedStyleName); + } + }, + invokeElementMethod: function(elementIndex, methodName, args) { + var element = this.boundElements[elementIndex]; + DOM.invoke(element, methodName, args); + }, + setText: function(textIndex, value) { + DOM.setText(this.boundTextNodes[textIndex], value); + }, + dispatchEvent: function(elementIndex, eventName, event) { + var allowDefaultBehavior = true; + if (isPresent(this.eventDispatcher)) { + var evalLocals = new Map(); + evalLocals.set('$event', event); + allowDefaultBehavior = this.eventDispatcher.dispatchRenderEvent(elementIndex, eventName, evalLocals); + if (!allowDefaultBehavior) { + event.preventDefault(); + } + } + return allowDefaultBehavior; + } + }, {}); + }()); + $__export("DomView", DomView); + } + }; +}); + +System.register("angular2/src/render/dom/view/fragment", ["angular2/src/render/api"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/view/fragment"; + var RenderFragmentRef, + DomFragmentRef; + function resolveInternalDomFragment(fragmentRef) { + return fragmentRef._nodes; + } + $__export("resolveInternalDomFragment", resolveInternalDomFragment); + return { + setters: [function($__m) { + RenderFragmentRef = $__m.RenderFragmentRef; + }], + execute: function() { + DomFragmentRef = (function($__super) { + function DomFragmentRef(_nodes) { + $traceurRuntime.superConstructor(DomFragmentRef).call(this); + this._nodes = _nodes; + } + return ($traceurRuntime.createClass)(DomFragmentRef, {}, {}, $__super); + }(RenderFragmentRef)); + $__export("DomFragmentRef", DomFragmentRef); + } + }; +}); + +System.register("angular2/src/core/application_tokens", ["angular2/di", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/application_tokens"; + var OpaqueToken, + CONST_EXPR, + appComponentRefPromiseToken, + appComponentTypeToken; + return { + setters: [function($__m) { + OpaqueToken = $__m.OpaqueToken; + }, function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }], + execute: function() { + appComponentRefPromiseToken = CONST_EXPR(new OpaqueToken('Promise')); + $__export("appComponentRefPromiseToken", appComponentRefPromiseToken); + appComponentTypeToken = CONST_EXPR(new OpaqueToken('RootComponent')); + $__export("appComponentTypeToken", appComponentTypeToken); + } + }; +}); + +System.register("angular2/src/core/annotations/annotations", ["angular2/src/core/annotations_impl/annotations"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/annotations/annotations"; + return { + setters: [function($__m) { + $__export("ComponentAnnotation", $__m.Component); + $__export("DirectiveAnnotation", $__m.Directive); + $__export("LifecycleEvent", $__m.LifecycleEvent); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/core/annotations/view", ["angular2/src/core/annotations_impl/view"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/annotations/view"; + return { + setters: [function($__m) { + $__export("ViewAnnotation", $__m.View); + $__export("ViewEncapsulation", $__m.ViewEncapsulation); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/core/annotations/di", ["angular2/src/core/annotations_impl/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/annotations/di"; + return { + setters: [function($__m) { + $__export("QueryAnnotation", $__m.Query); + $__export("ViewQueryAnnotation", $__m.ViewQuery); + $__export("AttributeAnnotation", $__m.Attribute); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/core/annotations/decorators", ["angular2/src/core/annotations/annotations", "angular2/src/core/annotations/view", "angular2/src/core/annotations/di", "angular2/src/util/decorators"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/annotations/decorators"; + var ComponentAnnotation, + DirectiveAnnotation, + ViewAnnotation, + AttributeAnnotation, + QueryAnnotation, + ViewQueryAnnotation, + makeDecorator, + makeParamDecorator, + Component, + Directive, + View, + Attribute, + Query, + ViewQuery; + return { + setters: [function($__m) { + ComponentAnnotation = $__m.ComponentAnnotation; + DirectiveAnnotation = $__m.DirectiveAnnotation; + }, function($__m) { + ViewAnnotation = $__m.ViewAnnotation; + }, function($__m) { + AttributeAnnotation = $__m.AttributeAnnotation; + QueryAnnotation = $__m.QueryAnnotation; + ViewQueryAnnotation = $__m.ViewQueryAnnotation; + }, function($__m) { + makeDecorator = $__m.makeDecorator; + makeParamDecorator = $__m.makeParamDecorator; + }], + execute: function() { + Component = makeDecorator(ComponentAnnotation, (function(fn) { + return fn.View = View; + })); + $__export("Component", Component); + Directive = makeDecorator(DirectiveAnnotation); + $__export("Directive", Directive); + View = makeDecorator(ViewAnnotation, (function(fn) { + return fn.View = View; + })); + $__export("View", View); + Attribute = makeParamDecorator(AttributeAnnotation); + $__export("Attribute", Attribute); + Query = makeParamDecorator(QueryAnnotation); + $__export("Query", Query); + ViewQuery = makeParamDecorator(ViewQueryAnnotation); + $__export("ViewQuery", ViewQuery); + } + }; +}); + +System.register("angular2/core", ["angular2/src/core/application_tokens", "angular2/src/core/application_common", "angular2/src/services/app_root_url", "angular2/src/services/url_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/compiler", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/query_list", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/zone/ng_zone", "angular2/src/facade/async"], function($__export) { + "use strict"; + var __moduleName = "angular2/core"; + return { + setters: [function($__m) { + $__export("appComponentTypeToken", $__m.appComponentTypeToken); + }, function($__m) { + $__export("ApplicationRef", $__m.ApplicationRef); + }, function($__m) { + $__export("AppRootUrl", $__m.AppRootUrl); + }, function($__m) { + $__export("UrlResolver", $__m.UrlResolver); + }, function($__m) { + $__export("ComponentUrlMapper", $__m.ComponentUrlMapper); + }, function($__m) { + $__export("DirectiveResolver", $__m.DirectiveResolver); + }, function($__m) { + $__export("Compiler", $__m.Compiler); + }, function($__m) { + $__export("AppViewManager", $__m.AppViewManager); + }, function($__m) { + $__export("QueryList", $__m.QueryList); + }, function($__m) { + $__export("DynamicComponentLoader", $__m.DynamicComponentLoader); + $__export("ComponentRef", $__m.ComponentRef); + }, function($__m) { + $__export("ElementRef", $__m.ElementRef); + }, function($__m) { + $__export("TemplateRef", $__m.TemplateRef); + }, function($__m) { + $__export("ViewRef", $__m.ViewRef); + $__export("ProtoViewRef", $__m.ProtoViewRef); + }, function($__m) { + $__export("ViewContainerRef", $__m.ViewContainerRef); + }, function($__m) { + $__export("NgZone", $__m.NgZone); + }, function($__m) { + $__export("Observable", $__m.Observable); + $__export("EventEmitter", $__m.EventEmitter); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/directives/ng_for", ["angular2/annotations", "angular2/core", "angular2/change_detection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/directives/ng_for"; + var __decorate, + __metadata, + Directive, + LifecycleEvent, + ViewContainerRef, + TemplateRef, + ChangeDetectorRef, + Pipes, + isPresent, + isBlank, + NgFor, + RecordViewTuple; + return { + setters: [function($__m) { + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + ViewContainerRef = $__m.ViewContainerRef; + TemplateRef = $__m.TemplateRef; + }, function($__m) { + ChangeDetectorRef = $__m.ChangeDetectorRef; + Pipes = $__m.Pipes; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + NgFor = (($traceurRuntime.createClass)(function(viewContainer, templateRef, pipes, cdr) { + this.viewContainer = viewContainer; + this.templateRef = templateRef; + this.pipes = pipes; + this.cdr = cdr; + }, { + set ngForOf(value) { + this._ngForOf = value; + this._pipe = this.pipes.get("iterableDiff", value, this.cdr, this._pipe); + }, + onCheck: function() { + var diff = this._pipe.transform(this._ngForOf, null); + if (isPresent(diff)) + this._applyChanges(diff.wrapped); + }, + _applyChanges: function(changes) { + if (isBlank(changes)) { + this.viewContainer.clear(); + return ; + } + var recordViewTuples = []; + changes.forEachRemovedItem((function(removedRecord) { + return recordViewTuples.push(new RecordViewTuple(removedRecord, null)); + })); + changes.forEachMovedItem((function(movedRecord) { + return recordViewTuples.push(new RecordViewTuple(movedRecord, null)); + })); + var insertTuples = NgFor.bulkRemove(recordViewTuples, this.viewContainer); + changes.forEachAddedItem((function(addedRecord) { + return insertTuples.push(new RecordViewTuple(addedRecord, null)); + })); + NgFor.bulkInsert(insertTuples, this.viewContainer, this.templateRef); + for (var i = 0; i < insertTuples.length; i++) { + this._perViewChange(insertTuples[i].view, insertTuples[i].record); + } + }, + _perViewChange: function(view, record) { + view.setLocal('\$implicit', record.item); + view.setLocal('index', record.currentIndex); + } + }, { + bulkRemove: function(tuples, viewContainer) { + tuples.sort((function(a, b) { + return a.record.previousIndex - b.record.previousIndex; + })); + var movedTuples = []; + for (var i = tuples.length - 1; i >= 0; i--) { + var tuple = tuples[i]; + if (isPresent(tuple.record.currentIndex)) { + tuple.view = viewContainer.detach(tuple.record.previousIndex); + movedTuples.push(tuple); + } else { + viewContainer.remove(tuple.record.previousIndex); + } + } + return movedTuples; + }, + bulkInsert: function(tuples, viewContainer, templateRef) { + tuples.sort((function(a, b) { + return a.record.currentIndex - b.record.currentIndex; + })); + for (var i = 0; i < tuples.length; i++) { + var tuple = tuples[i]; + if (isPresent(tuple.view)) { + viewContainer.insert(tuple.view, tuple.record.currentIndex); + } else { + tuple.view = viewContainer.createEmbeddedView(templateRef, tuple.record.currentIndex); + } + } + return tuples; + } + })); + $__export("NgFor", NgFor); + $__export("NgFor", NgFor = __decorate([Directive({ + selector: '[ng-for][ng-for-of]', + properties: ['ngForOf'], + lifecycle: [LifecycleEvent.onCheck] + }), __metadata('design:paramtypes', [ViewContainerRef, TemplateRef, Pipes, ChangeDetectorRef])], NgFor)); + RecordViewTuple = (function() { + function RecordViewTuple(record, view) { + this.record = record; + this.view = view; + } + return ($traceurRuntime.createClass)(RecordViewTuple, {}, {}); + }()); + $__export("RecordViewTuple", RecordViewTuple); + } + }; +}); + +System.register("angular2/src/directives/ng_if", ["angular2/annotations", "angular2/core", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/directives/ng_if"; + var __decorate, + __metadata, + Directive, + ViewContainerRef, + TemplateRef, + isBlank, + NgIf; + return { + setters: [function($__m) { + Directive = $__m.Directive; + }, function($__m) { + ViewContainerRef = $__m.ViewContainerRef; + TemplateRef = $__m.TemplateRef; + }, function($__m) { + isBlank = $__m.isBlank; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + NgIf = (($traceurRuntime.createClass)(function(viewContainer, templateRef) { + this.viewContainer = viewContainer; + this.prevCondition = null; + this.templateRef = templateRef; + }, {set ngIf(newCondition) { + if (newCondition && (isBlank(this.prevCondition) || !this.prevCondition)) { + this.prevCondition = true; + this.viewContainer.createEmbeddedView(this.templateRef); + } else if (!newCondition && (isBlank(this.prevCondition) || this.prevCondition)) { + this.prevCondition = false; + this.viewContainer.clear(); + } + }}, {})); + $__export("NgIf", NgIf); + $__export("NgIf", NgIf = __decorate([Directive({ + selector: '[ng-if]', + properties: ['ngIf'] + }), __metadata('design:paramtypes', [ViewContainerRef, TemplateRef])], NgIf)); + } + }; +}); + +System.register("angular2/src/directives/ng_non_bindable", ["angular2/annotations"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/directives/ng_non_bindable"; + var __decorate, + __metadata, + Directive, + NgNonBindable; + return { + setters: [function($__m) { + Directive = $__m.Directive; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + NgNonBindable = (($traceurRuntime.createClass)(function() {}, {}, {})); + $__export("NgNonBindable", NgNonBindable); + $__export("NgNonBindable", NgNonBindable = __decorate([Directive({ + selector: '[ng-non-bindable]', + compileChildren: false + }), __metadata('design:paramtypes', [])], NgNonBindable)); + } + }; +}); + +System.register("angular2/src/directives/ng_switch", ["angular2/annotations", "angular2/di", "angular2/core", "angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/directives/ng_switch"; + var __decorate, + __metadata, + __param, + Directive, + Ancestor, + ViewContainerRef, + TemplateRef, + isPresent, + isBlank, + normalizeBlank, + ListWrapper, + MapWrapper, + Map, + SwitchView, + NgSwitch, + NgSwitchWhen, + NgSwitchDefault, + _whenDefault; + return { + setters: [function($__m) { + Directive = $__m.Directive; + }, function($__m) { + Ancestor = $__m.Ancestor; + }, function($__m) { + ViewContainerRef = $__m.ViewContainerRef; + TemplateRef = $__m.TemplateRef; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + normalizeBlank = $__m.normalizeBlank; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + MapWrapper = $__m.MapWrapper; + Map = $__m.Map; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + SwitchView = (function() { + function SwitchView(viewContainerRef, templateRef) { + this._templateRef = templateRef; + this._viewContainerRef = viewContainerRef; + } + return ($traceurRuntime.createClass)(SwitchView, { + create: function() { + this._viewContainerRef.createEmbeddedView(this._templateRef); + }, + destroy: function() { + this._viewContainerRef.clear(); + } + }, {}); + }()); + $__export("SwitchView", SwitchView); + NgSwitch = (($traceurRuntime.createClass)(function() { + this._valueViews = new Map(); + this._activeViews = []; + this._useDefault = false; + }, { + set ngSwitch(value) { + this._emptyAllActiveViews(); + this._useDefault = false; + var views = this._valueViews.get(value); + if (isBlank(views)) { + this._useDefault = true; + views = normalizeBlank(this._valueViews.get(_whenDefault)); + } + this._activateViews(views); + this._switchValue = value; + }, + _onWhenValueChanged: function(oldWhen, newWhen, view) { + this._deregisterView(oldWhen, view); + this._registerView(newWhen, view); + if (oldWhen === this._switchValue) { + view.destroy(); + ListWrapper.remove(this._activeViews, view); + } else if (newWhen === this._switchValue) { + if (this._useDefault) { + this._useDefault = false; + this._emptyAllActiveViews(); + } + view.create(); + this._activeViews.push(view); + } + if (this._activeViews.length === 0 && !this._useDefault) { + this._useDefault = true; + this._activateViews(this._valueViews.get(_whenDefault)); + } + }, + _emptyAllActiveViews: function() { + var activeContainers = this._activeViews; + for (var i = 0; i < activeContainers.length; i++) { + activeContainers[i].destroy(); + } + this._activeViews = []; + }, + _activateViews: function(views) { + if (isPresent(views)) { + for (var i = 0; i < views.length; i++) { + views[i].create(); + } + this._activeViews = views; + } + }, + _registerView: function(value, view) { + var views = this._valueViews.get(value); + if (isBlank(views)) { + views = []; + this._valueViews.set(value, views); + } + views.push(view); + }, + _deregisterView: function(value, view) { + if (value == _whenDefault) + return ; + var views = this._valueViews.get(value); + if (views.length == 1) { + MapWrapper.delete(this._valueViews, value); + } else { + ListWrapper.remove(views, view); + } + } + }, {})); + $__export("NgSwitch", NgSwitch); + $__export("NgSwitch", NgSwitch = __decorate([Directive({ + selector: '[ng-switch]', + properties: ['ngSwitch'] + }), __metadata('design:paramtypes', [])], NgSwitch)); + NgSwitchWhen = (($traceurRuntime.createClass)(function(viewContainer, templateRef, sswitch) { + this._value = _whenDefault; + this._switch = sswitch; + this._view = new SwitchView(viewContainer, templateRef); + }, { + onDestroy: function() { + this._switch; + }, + set ngSwitchWhen(value) { + this._switch._onWhenValueChanged(this._value, value, this._view); + this._value = value; + } + }, {})); + $__export("NgSwitchWhen", NgSwitchWhen); + $__export("NgSwitchWhen", NgSwitchWhen = __decorate([Directive({ + selector: '[ng-switch-when]', + properties: ['ngSwitchWhen'] + }), __param(2, Ancestor()), __metadata('design:paramtypes', [ViewContainerRef, TemplateRef, NgSwitch])], NgSwitchWhen)); + NgSwitchDefault = (($traceurRuntime.createClass)(function(viewContainer, templateRef, sswitch) { + sswitch._registerView(_whenDefault, new SwitchView(viewContainer, templateRef)); + }, {}, {})); + $__export("NgSwitchDefault", NgSwitchDefault); + $__export("NgSwitchDefault", NgSwitchDefault = __decorate([Directive({selector: '[ng-switch-default]'}), __param(2, Ancestor()), __metadata('design:paramtypes', [ViewContainerRef, TemplateRef, NgSwitch])], NgSwitchDefault)); + _whenDefault = new Object(); + } + }; +}); + +System.register("angular2/src/directives/class", ["angular2/annotations", "angular2/core", "angular2/src/change_detection/pipes/pipes", "angular2/src/render/api", "angular2/src/change_detection/pipes/iterable_changes", "angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/directives/class"; + var __decorate, + __metadata, + Directive, + LifecycleEvent, + ElementRef, + Pipes, + Renderer, + IterableChanges, + isPresent, + isString, + ListWrapper, + StringMapWrapper, + isListLikeIterable, + CSSClass; + return { + setters: [function($__m) { + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + ElementRef = $__m.ElementRef; + }, function($__m) { + Pipes = $__m.Pipes; + }, function($__m) { + Renderer = $__m.Renderer; + }, function($__m) { + IterableChanges = $__m.IterableChanges; + }, function($__m) { + isPresent = $__m.isPresent; + isString = $__m.isString; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + StringMapWrapper = $__m.StringMapWrapper; + isListLikeIterable = $__m.isListLikeIterable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + CSSClass = (($traceurRuntime.createClass)(function(_pipes, _ngEl, _renderer) { + this._pipes = _pipes; + this._ngEl = _ngEl; + this._renderer = _renderer; + }, { + set rawClass(v) { + this._cleanupClasses(this._rawClass); + if (isString(v)) { + v = v.split(' '); + } + this._rawClass = v; + this._pipe = this._pipes.get(isListLikeIterable(v) ? 'iterableDiff' : 'keyValDiff', v); + }, + onCheck: function() { + var diff = this._pipe.transform(this._rawClass, null); + if (isPresent(diff) && isPresent(diff.wrapped)) { + if (diff.wrapped instanceof IterableChanges) { + this._applyArrayChanges(diff.wrapped); + } else { + this._applyObjectChanges(diff.wrapped); + } + } + }, + onDestroy: function() { + this._cleanupClasses(this._rawClass); + }, + _cleanupClasses: function(rawClassVal) { + var $__0 = this; + if (isPresent(rawClassVal)) { + if (isListLikeIterable(rawClassVal)) { + ListWrapper.forEach(rawClassVal, (function(className) { + $__0._toggleClass(className, false); + })); + } else { + StringMapWrapper.forEach(rawClassVal, (function(expVal, className) { + if (expVal) + $__0._toggleClass(className, false); + })); + } + } + }, + _applyObjectChanges: function(diff) { + var $__0 = this; + diff.forEachAddedItem((function(record) { + $__0._toggleClass(record.key, record.currentValue); + })); + diff.forEachChangedItem((function(record) { + $__0._toggleClass(record.key, record.currentValue); + })); + diff.forEachRemovedItem((function(record) { + if (record.previousValue) { + $__0._toggleClass(record.key, false); + } + })); + }, + _applyArrayChanges: function(diff) { + var $__0 = this; + diff.forEachAddedItem((function(record) { + $__0._toggleClass(record.item, true); + })); + diff.forEachRemovedItem((function(record) { + $__0._toggleClass(record.item, false); + })); + }, + _toggleClass: function(className, enabled) { + this._renderer.setElementClass(this._ngEl, className, enabled); + } + }, {})); + $__export("CSSClass", CSSClass); + $__export("CSSClass", CSSClass = __decorate([Directive({ + selector: '[class]', + lifecycle: [LifecycleEvent.onCheck, LifecycleEvent.onDestroy], + properties: ['rawClass: class'] + }), __metadata('design:paramtypes', [Pipes, ElementRef, Renderer])], CSSClass)); + } + }; +}); + +System.register("angular2/src/directives/ng_style", ["angular2/annotations", "angular2/core", "angular2/src/change_detection/pipes/pipes", "angular2/src/facade/lang", "angular2/src/render/api"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/directives/ng_style"; + var __decorate, + __metadata, + Directive, + LifecycleEvent, + ElementRef, + Pipes, + isPresent, + Renderer, + NgStyle; + return { + setters: [function($__m) { + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + ElementRef = $__m.ElementRef; + }, function($__m) { + Pipes = $__m.Pipes; + }, function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + Renderer = $__m.Renderer; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + NgStyle = (($traceurRuntime.createClass)(function(_pipes, _ngEl, _renderer) { + this._pipes = _pipes; + this._ngEl = _ngEl; + this._renderer = _renderer; + }, { + set rawStyle(v) { + this._rawStyle = v; + this._pipe = this._pipes.get('keyValDiff', this._rawStyle); + }, + onCheck: function() { + var diff = this._pipe.transform(this._rawStyle, null); + if (isPresent(diff) && isPresent(diff.wrapped)) { + this._applyChanges(diff.wrapped); + } + }, + _applyChanges: function(diff) { + var $__0 = this; + diff.forEachAddedItem((function(record) { + $__0._setStyle(record.key, record.currentValue); + })); + diff.forEachChangedItem((function(record) { + $__0._setStyle(record.key, record.currentValue); + })); + diff.forEachRemovedItem((function(record) { + $__0._setStyle(record.key, null); + })); + }, + _setStyle: function(name, val) { + this._renderer.setElementStyle(this._ngEl, name, val); + } + }, {})); + $__export("NgStyle", NgStyle); + $__export("NgStyle", NgStyle = __decorate([Directive({ + selector: '[ng-style]', + lifecycle: [LifecycleEvent.onCheck], + properties: ['rawStyle: ng-style'] + }), __metadata('design:paramtypes', [Pipes, ElementRef, Renderer])], NgStyle)); + } + }; +}); + +System.register("angular2/src/http/interfaces", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/interfaces"; + var BaseException, + ConnectionBackend, + Connection; + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + }], + execute: function() { + ConnectionBackend = (function() { + function ConnectionBackend() {} + return ($traceurRuntime.createClass)(ConnectionBackend, {createConnection: function(request) { + throw new BaseException('Abstract!'); + }}, {}); + }()); + $__export("ConnectionBackend", ConnectionBackend); + Connection = (function() { + function Connection() {} + return ($traceurRuntime.createClass)(Connection, {dispose: function() { + throw new BaseException('Abstract!'); + }}, {}); + }()); + $__export("Connection", Connection); + } + }; +}); + +System.register("angular2/src/http/headers", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/headers"; + var isBlank, + BaseException, + isListLikeIterable, + Map, + MapWrapper, + ListWrapper, + StringMap, + Headers; + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + isListLikeIterable = $__m.isListLikeIterable; + Map = $__m.Map; + MapWrapper = $__m.MapWrapper; + ListWrapper = $__m.ListWrapper; + StringMap = $__m.StringMap; + }], + execute: function() { + Headers = (function() { + function Headers(headers) { + var $__0 = this; + if (isBlank(headers)) { + this._headersMap = new Map(); + return ; + } + if (headers instanceof Headers) { + this._headersMap = headers._headersMap; + } else if (headers instanceof StringMap) { + this._headersMap = MapWrapper.createFromStringMap(headers); + MapWrapper.forEach(this._headersMap, (function(v, k) { + if (!isListLikeIterable(v)) { + var list = []; + list.push(v); + $__0._headersMap.set(k, list); + } + })); + } + } + return ($traceurRuntime.createClass)(Headers, { + append: function(name, value) { + var mapName = this._headersMap.get(name); + var list = isListLikeIterable(mapName) ? mapName : []; + list.push(value); + this._headersMap.set(name, list); + }, + delete: function(name) { + MapWrapper.delete(this._headersMap, name); + }, + forEach: function(fn) { + MapWrapper.forEach(this._headersMap, fn); + }, + get: function(header) { + return ListWrapper.first(this._headersMap.get(header)); + }, + has: function(header) { + return this._headersMap.has(header); + }, + keys: function() { + return MapWrapper.keys(this._headersMap); + }, + set: function(header, value) { + var list = []; + if (isListLikeIterable(value)) { + var pushValue = value.join(','); + list.push(pushValue); + } else { + list.push(value); + } + this._headersMap.set(header, list); + }, + values: function() { + return MapWrapper.values(this._headersMap); + }, + getAll: function(header) { + var headers = this._headersMap.get(header); + return isListLikeIterable(headers) ? headers : []; + }, + entries: function() { + throw new BaseException('"entries" method is not implemented on Headers class'); + } + }, {}); + }()); + $__export("Headers", Headers); + } + }; +}); + +System.register("angular2/src/http/enums", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/enums"; + var RequestModesOpts, + RequestCacheOpts, + RequestCredentialsOpts, + RequestMethods, + RequestMethodsMap, + ReadyStates, + ResponseTypes; + return { + setters: [], + execute: function() { + $__export("RequestModesOpts", RequestModesOpts); + (function(RequestModesOpts) { + RequestModesOpts[RequestModesOpts["Cors"] = 0] = "Cors"; + RequestModesOpts[RequestModesOpts["NoCors"] = 1] = "NoCors"; + RequestModesOpts[RequestModesOpts["SameOrigin"] = 2] = "SameOrigin"; + })(RequestModesOpts || ($__export("RequestModesOpts", RequestModesOpts = {}))); + $__export("RequestCacheOpts", RequestCacheOpts); + (function(RequestCacheOpts) { + RequestCacheOpts[RequestCacheOpts["Default"] = 0] = "Default"; + RequestCacheOpts[RequestCacheOpts["NoStore"] = 1] = "NoStore"; + RequestCacheOpts[RequestCacheOpts["Reload"] = 2] = "Reload"; + RequestCacheOpts[RequestCacheOpts["NoCache"] = 3] = "NoCache"; + RequestCacheOpts[RequestCacheOpts["ForceCache"] = 4] = "ForceCache"; + RequestCacheOpts[RequestCacheOpts["OnlyIfCached"] = 5] = "OnlyIfCached"; + })(RequestCacheOpts || ($__export("RequestCacheOpts", RequestCacheOpts = {}))); + $__export("RequestCredentialsOpts", RequestCredentialsOpts); + (function(RequestCredentialsOpts) { + RequestCredentialsOpts[RequestCredentialsOpts["Omit"] = 0] = "Omit"; + RequestCredentialsOpts[RequestCredentialsOpts["SameOrigin"] = 1] = "SameOrigin"; + RequestCredentialsOpts[RequestCredentialsOpts["Include"] = 2] = "Include"; + })(RequestCredentialsOpts || ($__export("RequestCredentialsOpts", RequestCredentialsOpts = {}))); + $__export("RequestMethods", RequestMethods); + (function(RequestMethods) { + RequestMethods[RequestMethods["GET"] = 0] = "GET"; + RequestMethods[RequestMethods["POST"] = 1] = "POST"; + RequestMethods[RequestMethods["PUT"] = 2] = "PUT"; + RequestMethods[RequestMethods["DELETE"] = 3] = "DELETE"; + RequestMethods[RequestMethods["OPTIONS"] = 4] = "OPTIONS"; + RequestMethods[RequestMethods["HEAD"] = 5] = "HEAD"; + RequestMethods[RequestMethods["PATCH"] = 6] = "PATCH"; + })(RequestMethods || ($__export("RequestMethods", RequestMethods = {}))); + RequestMethodsMap = (function() { + function RequestMethodsMap() { + this._methods = ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'HEAD', 'PATCH']; + } + return ($traceurRuntime.createClass)(RequestMethodsMap, {getMethod: function(method) { + return this._methods[method]; + }}, {}); + }()); + $__export("RequestMethodsMap", RequestMethodsMap); + $__export("ReadyStates", ReadyStates); + (function(ReadyStates) { + ReadyStates[ReadyStates["UNSENT"] = 0] = "UNSENT"; + ReadyStates[ReadyStates["OPEN"] = 1] = "OPEN"; + ReadyStates[ReadyStates["HEADERS_RECEIVED"] = 2] = "HEADERS_RECEIVED"; + ReadyStates[ReadyStates["LOADING"] = 3] = "LOADING"; + ReadyStates[ReadyStates["DONE"] = 4] = "DONE"; + ReadyStates[ReadyStates["CANCELLED"] = 5] = "CANCELLED"; + })(ReadyStates || ($__export("ReadyStates", ReadyStates = {}))); + $__export("ResponseTypes", ResponseTypes); + (function(ResponseTypes) { + ResponseTypes[ResponseTypes["Basic"] = 0] = "Basic"; + ResponseTypes[ResponseTypes["Cors"] = 1] = "Cors"; + ResponseTypes[ResponseTypes["Default"] = 2] = "Default"; + ResponseTypes[ResponseTypes["Error"] = 3] = "Error"; + ResponseTypes[ResponseTypes["Opaque"] = 4] = "Opaque"; + })(ResponseTypes || ($__export("ResponseTypes", ResponseTypes = {}))); + } + }; +}); + +System.register("angular2/src/http/http_utils", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/http_utils"; + return { + setters: [function($__m) { + $__export("isJsObject", $__m.isJsObject); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/http/base_response_options", ["angular2/di", "angular2/src/facade/lang", "angular2/src/http/headers", "angular2/src/http/enums"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/base_response_options"; + var __decorate, + __metadata, + Injectable, + isPresent, + Headers, + ResponseTypes, + ResponseOptions, + BaseResponseOptions; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + Headers = $__m.Headers; + }, function($__m) { + ResponseTypes = $__m.ResponseTypes; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + ResponseOptions = (function() { + function ResponseOptions() { + var $__2 = arguments[0] !== (void 0) ? arguments[0] : {}, + body = $__2.body, + status = $__2.status, + headers = $__2.headers, + statusText = $__2.statusText, + type = $__2.type, + url = $__2.url; + this.body = isPresent(body) ? body : null; + this.status = isPresent(status) ? status : null; + this.headers = isPresent(headers) ? headers : null; + this.statusText = isPresent(statusText) ? statusText : null; + this.type = isPresent(type) ? type : null; + this.url = isPresent(url) ? url : null; + } + return ($traceurRuntime.createClass)(ResponseOptions, {merge: function(options) { + return new ResponseOptions({ + body: isPresent(options) && isPresent(options.body) ? options.body : this.body, + status: isPresent(options) && isPresent(options.status) ? options.status : this.status, + headers: isPresent(options) && isPresent(options.headers) ? options.headers : this.headers, + statusText: isPresent(options) && isPresent(options.statusText) ? options.statusText : this.statusText, + type: isPresent(options) && isPresent(options.type) ? options.type : this.type, + url: isPresent(options) && isPresent(options.url) ? options.url : this.url + }); + }}, {}); + }()); + $__export("ResponseOptions", ResponseOptions); + BaseResponseOptions = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).call(this, { + status: 200, + statusText: 'Ok', + type: ResponseTypes.Default, + headers: new Headers() + }); + } + return ($traceurRuntime.createClass)($__0, {}, {}, $__super); + }(ResponseOptions)); + $__export("BaseResponseOptions", BaseResponseOptions); + $__export("BaseResponseOptions", BaseResponseOptions = __decorate([Injectable(), __metadata('design:paramtypes', [])], BaseResponseOptions)); + } + }; +}); + +System.register("angular2/src/http/backends/browser_xhr", ["angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/backends/browser_xhr"; + var __decorate, + __metadata, + Injectable, + BrowserXhr; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + BrowserXhr = (($traceurRuntime.createClass)(function() {}, {build: function() { + return (new XMLHttpRequest()); + }}, {})); + $__export("BrowserXhr", BrowserXhr); + $__export("BrowserXhr", BrowserXhr = __decorate([Injectable(), __metadata('design:paramtypes', [])], BrowserXhr)); + } + }; +}); + +System.register("angular2/src/http/backends/browser_jsonp", ["angular2/di", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/backends/browser_jsonp"; + var __decorate, + __metadata, + Injectable, + global, + _nextRequestId, + JSONP_HOME, + _jsonpConnections, + BrowserJsonp; + function _getJsonpConnections() { + if (_jsonpConnections === null) { + _jsonpConnections = global[JSONP_HOME] = {}; + } + return _jsonpConnections; + } + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + global = $__m.global; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + _nextRequestId = 0; + JSONP_HOME = '__ng_jsonp__'; + $__export("JSONP_HOME", JSONP_HOME); + _jsonpConnections = null; + BrowserJsonp = (($traceurRuntime.createClass)(function() {}, { + build: function(url) { + var node = document.createElement('script'); + node.src = url; + return node; + }, + nextRequestID: function() { + return ("__req" + _nextRequestId++); + }, + requestCallback: function(id) { + return (JSONP_HOME + "." + id + ".finished"); + }, + exposeConnection: function(id, connection) { + var connections = _getJsonpConnections(); + connections[id] = connection; + }, + removeConnection: function(id) { + var connections = _getJsonpConnections(); + connections[id] = null; + }, + send: function(node) { + document.body.appendChild((node)); + }, + cleanup: function(node) { + if (node.parentNode) { + node.parentNode.removeChild((node)); + } + } + }, {})); + $__export("BrowserJsonp", BrowserJsonp); + $__export("BrowserJsonp", BrowserJsonp = __decorate([Injectable(), __metadata('design:paramtypes', [])], BrowserJsonp)); + } + }; +}); + +System.register("angular2/src/http/backends/mock_backend", ["angular2/di", "angular2/src/http/static_request", "angular2/src/http/enums", "angular2/src/http/interfaces", "angular2/src/facade/async", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/backends/mock_backend"; + var __decorate, + __metadata, + Injectable, + Request, + ReadyStates, + Connection, + ConnectionBackend, + ObservableWrapper, + EventEmitter, + isPresent, + IMPLEMENTS, + BaseException, + MockConnection, + MockBackend; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + Request = $__m.Request; + }, function($__m) { + ReadyStates = $__m.ReadyStates; + }, function($__m) { + Connection = $__m.Connection; + ConnectionBackend = $__m.ConnectionBackend; + }, function($__m) { + ObservableWrapper = $__m.ObservableWrapper; + EventEmitter = $__m.EventEmitter; + }, function($__m) { + isPresent = $__m.isPresent; + IMPLEMENTS = $__m.IMPLEMENTS; + BaseException = $__m.BaseException; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + MockConnection = (($traceurRuntime.createClass)(function(req) { + this.response = new EventEmitter(); + this.readyState = ReadyStates.OPEN; + this.request = req; + }, { + dispose: function() { + if (this.readyState !== ReadyStates.DONE) { + this.readyState = ReadyStates.CANCELLED; + } + }, + mockRespond: function(res) { + if (this.readyState === ReadyStates.DONE || this.readyState === ReadyStates.CANCELLED) { + throw new BaseException('Connection has already been resolved'); + } + this.readyState = ReadyStates.DONE; + ObservableWrapper.callNext(this.response, res); + ObservableWrapper.callReturn(this.response); + }, + mockDownload: function(res) {}, + mockError: function(err) { + this.readyState = ReadyStates.DONE; + ObservableWrapper.callThrow(this.response, err); + ObservableWrapper.callReturn(this.response); + } + }, {})); + $__export("MockConnection", MockConnection); + $__export("MockConnection", MockConnection = __decorate([IMPLEMENTS(Connection), __metadata('design:paramtypes', [Request])], MockConnection)); + MockBackend = (($traceurRuntime.createClass)(function() { + var $__0 = this; + this.connectionsArray = []; + this.connections = new EventEmitter(); + ObservableWrapper.subscribe(this.connections, (function(connection) { + return $__0.connectionsArray.push(connection); + })); + this.pendingConnections = new EventEmitter(); + }, { + verifyNoPendingRequests: function() { + var pending = 0; + ObservableWrapper.subscribe(this.pendingConnections, (function(c) { + return pending++; + })); + if (pending > 0) + throw new BaseException((pending + " pending connections to be resolved")); + }, + resolveAllConnections: function() { + ObservableWrapper.subscribe(this.connections, (function(c) { + return c.readyState = 4; + })); + }, + createConnection: function(req) { + if (!isPresent(req) || !(req instanceof Request)) { + throw new BaseException(("createConnection requires an instance of Request, got " + req)); + } + var connection = new MockConnection(req); + ObservableWrapper.callNext(this.connections, connection); + return connection; + } + }, {})); + $__export("MockBackend", MockBackend); + $__export("MockBackend", MockBackend = __decorate([Injectable(), IMPLEMENTS(ConnectionBackend), __metadata('design:paramtypes', [])], MockBackend)); + } + }; +}); + +System.register("angular2/src/http/url_search_params", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/url_search_params"; + var isPresent, + StringWrapper, + Map, + MapWrapper, + ListWrapper, + isListLikeIterable, + URLSearchParams; + function paramParser(rawParams) { + var map = new Map(); + var params = StringWrapper.split(rawParams, new RegExp('&')); + ListWrapper.forEach(params, (function(param) { + var split = StringWrapper.split(param, new RegExp('=')); + var key = ListWrapper.get(split, 0); + var val = ListWrapper.get(split, 1); + var list = isPresent(map.get(key)) ? map.get(key) : []; + list.push(val); + map.set(key, list); + })); + return map; + } + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + Map = $__m.Map; + MapWrapper = $__m.MapWrapper; + ListWrapper = $__m.ListWrapper; + isListLikeIterable = $__m.isListLikeIterable; + }], + execute: function() { + URLSearchParams = (function() { + function URLSearchParams(rawParams) { + this.rawParams = rawParams; + this.paramsMap = paramParser(rawParams); + } + return ($traceurRuntime.createClass)(URLSearchParams, { + has: function(param) { + return this.paramsMap.has(param); + }, + get: function(param) { + var storedParam = this.paramsMap.get(param); + if (isListLikeIterable(storedParam)) { + return ListWrapper.first(storedParam); + } else { + return null; + } + }, + getAll: function(param) { + var mapParam = this.paramsMap.get(param); + return isPresent(mapParam) ? mapParam : []; + }, + append: function(param, val) { + var mapParam = this.paramsMap.get(param); + var list = isPresent(mapParam) ? mapParam : []; + list.push(val); + this.paramsMap.set(param, list); + }, + toString: function() { + var paramsList = []; + MapWrapper.forEach(this.paramsMap, (function(values, k) { + ListWrapper.forEach(values, (function(v) { + paramsList.push(k + '=' + v); + })); + })); + return ListWrapper.join(paramsList, '&'); + }, + delete: function(param) { + MapWrapper.delete(this.paramsMap, param); + } + }, {}); + }()); + $__export("URLSearchParams", URLSearchParams); + } + }; +}); + +System.register("angular2/src/forms/validators", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/validators"; + var isBlank, + isPresent, + ListWrapper, + StringMapWrapper, + Validators; + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }], + execute: function() { + Validators = (function() { + function Validators() {} + return ($traceurRuntime.createClass)(Validators, {}, { + required: function(c) { + return isBlank(c.value) || c.value == "" ? {"required": true} : null; + }, + nullValidator: function(c) { + return null; + }, + compose: function(validators) { + return function(c) { + var res = ListWrapper.reduce(validators, (function(res, validator) { + var errors = validator(c); + return isPresent(errors) ? StringMapWrapper.merge(res, errors) : res; + }), {}); + return StringMapWrapper.isEmpty(res) ? null : res; + }; + }, + group: function(c) { + var res = {}; + StringMapWrapper.forEach(c.controls, (function(control, name) { + if (c.contains(name) && isPresent(control.errors)) { + Validators._mergeErrors(control, res); + } + })); + return StringMapWrapper.isEmpty(res) ? null : res; + }, + array: function(c) { + var res = {}; + ListWrapper.forEach(c.controls, (function(control) { + if (isPresent(control.errors)) { + Validators._mergeErrors(control, res); + } + })); + return StringMapWrapper.isEmpty(res) ? null : res; + }, + _mergeErrors: function(control, res) { + StringMapWrapper.forEach(control.errors, (function(value, error) { + if (!StringMapWrapper.contains(res, error)) { + res[error] = []; + } + var current = res[error]; + current.push(control); + })); + } + }); + }()); + $__export("Validators", Validators); + } + }; +}); + +System.register("angular2/src/forms/directives/abstract_control_directive", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/abstract_control_directive"; + var AbstractControlDirective; + return { + setters: [], + execute: function() { + AbstractControlDirective = (function() { + function AbstractControlDirective() {} + return ($traceurRuntime.createClass)(AbstractControlDirective, { + get control() { + return null; + }, + get value() { + return this.control.value; + }, + get valid() { + return this.control.valid; + }, + get errors() { + return this.control.errors; + }, + get pristine() { + return this.control.pristine; + }, + get dirty() { + return this.control.dirty; + }, + get touched() { + return this.control.touched; + }, + get untouched() { + return this.control.untouched; + } + }, {}); + }()); + $__export("AbstractControlDirective", AbstractControlDirective); + } + }; +}); + +System.register("angular2/src/forms/directives/control_container", ["angular2/src/forms/directives/abstract_control_directive"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/control_container"; + var AbstractControlDirective, + ControlContainer; + return { + setters: [function($__m) { + AbstractControlDirective = $__m.AbstractControlDirective; + }], + execute: function() { + ControlContainer = (function($__super) { + function ControlContainer() { + $traceurRuntime.superConstructor(ControlContainer).apply(this, arguments); + } + return ($traceurRuntime.createClass)(ControlContainer, { + get formDirective() { + return null; + }, + get path() { + return null; + } + }, {}, $__super); + }(AbstractControlDirective)); + $__export("ControlContainer", ControlContainer); + } + }; +}); + +System.register("angular2/src/forms/directives/ng_control", ["angular2/src/forms/directives/abstract_control_directive"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/ng_control"; + var AbstractControlDirective, + NgControl; + return { + setters: [function($__m) { + AbstractControlDirective = $__m.AbstractControlDirective; + }], + execute: function() { + NgControl = (function($__super) { + function NgControl() { + var $__2; + for (var args = [], + $__1 = 0; $__1 < arguments.length; $__1++) + args[$__1] = arguments[$__1]; + ($__2 = $traceurRuntime.superConstructor(NgControl)).call.apply($__2, $traceurRuntime.spread([this], args)); + this.name = null; + this.valueAccessor = null; + } + return ($traceurRuntime.createClass)(NgControl, { + get validator() { + return null; + }, + get path() { + return null; + }, + viewToModelUpdate: function(newValue) {} + }, {}, $__super); + }(AbstractControlDirective)); + $__export("NgControl", NgControl); + } + }; +}); + +System.register("angular2/src/forms/directives/validators", ["angular2/di", "angular2/src/facade/lang", "angular2/annotations", "angular2/src/forms/validators"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/validators"; + var __decorate, + __metadata, + forwardRef, + Binding, + CONST_EXPR, + Directive, + Validators, + NgValidator, + requiredValidatorBinding, + NgRequiredValidator; + return { + setters: [function($__m) { + forwardRef = $__m.forwardRef; + Binding = $__m.Binding; + }, function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + Directive = $__m.Directive; + }, function($__m) { + Validators = $__m.Validators; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + NgValidator = (function() { + function NgValidator() {} + return ($traceurRuntime.createClass)(NgValidator, {get validator() { + throw "Is not implemented"; + }}, {}); + }()); + $__export("NgValidator", NgValidator); + requiredValidatorBinding = CONST_EXPR(new Binding(NgValidator, {toAlias: forwardRef((function() { + return NgRequiredValidator; + }))})); + NgRequiredValidator = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, {get validator() { + return Validators.required; + }}, {}, $__super); + }(NgValidator)); + $__export("NgRequiredValidator", NgRequiredValidator); + $__export("NgRequiredValidator", NgRequiredValidator = __decorate([Directive({ + selector: '[required][ng-control],[required][ng-form-control],[required][ng-model]', + hostInjector: [requiredValidatorBinding] + }), __metadata('design:paramtypes', [])], NgRequiredValidator)); + } + }; +}); + +System.register("angular2/src/forms/directives/shared", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/forms/validators"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/shared"; + var ListWrapper, + StringMapWrapper, + isBlank, + BaseException, + looseIdentical, + Validators; + function controlPath(name, parent) { + var p = ListWrapper.clone(parent.path); + p.push(name); + return p; + } + function setUpControl(c, dir) { + if (isBlank(c)) + _throwError(dir, "Cannot find control"); + if (isBlank(dir.valueAccessor)) + _throwError(dir, "No value accessor for"); + c.validator = Validators.compose([c.validator, dir.validator]); + dir.valueAccessor.writeValue(c.value); + dir.valueAccessor.registerOnChange((function(newValue) { + dir.viewToModelUpdate(newValue); + c.updateValue(newValue, {emitModelToViewChange: false}); + c.markAsDirty(); + })); + c.registerOnChange((function(newValue) { + return dir.valueAccessor.writeValue(newValue); + })); + dir.valueAccessor.registerOnTouched((function() { + return c.markAsTouched(); + })); + } + function composeNgValidator(ngValidators) { + if (isBlank(ngValidators)) + return Validators.nullValidator; + return Validators.compose(ngValidators.map((function(v) { + return v.validator; + }))); + } + function _throwError(dir, message) { + var path = ListWrapper.join(dir.path, " -> "); + throw new BaseException((message + " '" + path + "'")); + } + function setProperty(renderer, elementRef, propName, propValue) { + renderer.setElementProperty(elementRef, propName, propValue); + } + function isPropertyUpdated(changes, viewModel) { + if (!StringMapWrapper.contains(changes, "model")) + return false; + var change = changes["model"]; + if (change.isFirstChange()) + return true; + return !looseIdentical(viewModel, change.currentValue); + } + $__export("controlPath", controlPath); + $__export("setUpControl", setUpControl); + $__export("composeNgValidator", composeNgValidator); + $__export("setProperty", setProperty); + $__export("isPropertyUpdated", isPropertyUpdated); + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + looseIdentical = $__m.looseIdentical; + }, function($__m) { + Validators = $__m.Validators; + }], + execute: function() { + } + }; +}); + +System.register("angular2/src/forms/directives/ng_form_control", ["angular2/src/facade/lang", "angular2/src/facade/async", "angular2/core", "angular2/annotations", "angular2/di", "angular2/src/forms/directives/ng_control", "angular2/src/forms/directives/validators", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/ng_form_control"; + var __decorate, + __metadata, + __param, + CONST_EXPR, + EventEmitter, + ObservableWrapper, + QueryList, + Query, + Directive, + LifecycleEvent, + forwardRef, + Binding, + NgControl, + NgValidator, + setUpControl, + composeNgValidator, + isPropertyUpdated, + formControlBinding, + NgFormControl; + return { + setters: [function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + QueryList = $__m.QueryList; + }, function($__m) { + Query = $__m.Query; + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + forwardRef = $__m.forwardRef; + Binding = $__m.Binding; + }, function($__m) { + NgControl = $__m.NgControl; + }, function($__m) { + NgValidator = $__m.NgValidator; + }, function($__m) { + setUpControl = $__m.setUpControl; + composeNgValidator = $__m.composeNgValidator; + isPropertyUpdated = $__m.isPropertyUpdated; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + formControlBinding = CONST_EXPR(new Binding(NgControl, {toAlias: forwardRef((function() { + return NgFormControl; + }))})); + NgFormControl = (function($__super) { + function $__0(ngValidators) { + $traceurRuntime.superConstructor($__0).call(this); + this.update = new EventEmitter(); + this._added = false; + this.ngValidators = ngValidators; + } + return ($traceurRuntime.createClass)($__0, { + onChange: function(c) { + if (!this._added) { + setUpControl(this.form, this); + this.form.updateValidity(); + this._added = true; + } + if (isPropertyUpdated(c, this.viewModel)) { + this.form.updateValue(this.model); + } + }, + get path() { + return []; + }, + get control() { + return this.form; + }, + get validator() { + return composeNgValidator(this.ngValidators); + }, + viewToModelUpdate: function(newValue) { + this.viewModel = newValue; + ObservableWrapper.callNext(this.update, newValue); + } + }, {}, $__super); + }(NgControl)); + $__export("NgFormControl", NgFormControl); + $__export("NgFormControl", NgFormControl = __decorate([Directive({ + selector: '[ng-form-control]', + hostInjector: [formControlBinding], + properties: ['form: ngFormControl', 'model: ngModel'], + events: ['update: ngModel'], + lifecycle: [LifecycleEvent.onChange], + exportAs: 'form' + }), __param(0, Query(NgValidator)), __metadata('design:paramtypes', [QueryList])], NgFormControl)); + } + }; +}); + +System.register("angular2/src/forms/directives/ng_model", ["angular2/src/facade/lang", "angular2/src/facade/async", "angular2/core", "angular2/annotations", "angular2/di", "angular2/src/forms/directives/ng_control", "angular2/src/forms/model", "angular2/src/forms/directives/validators", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/ng_model"; + var __decorate, + __metadata, + __param, + CONST_EXPR, + EventEmitter, + ObservableWrapper, + QueryList, + Query, + Directive, + LifecycleEvent, + forwardRef, + Binding, + NgControl, + Control, + NgValidator, + setUpControl, + composeNgValidator, + isPropertyUpdated, + formControlBinding, + NgModel; + return { + setters: [function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + QueryList = $__m.QueryList; + }, function($__m) { + Query = $__m.Query; + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + forwardRef = $__m.forwardRef; + Binding = $__m.Binding; + }, function($__m) { + NgControl = $__m.NgControl; + }, function($__m) { + Control = $__m.Control; + }, function($__m) { + NgValidator = $__m.NgValidator; + }, function($__m) { + setUpControl = $__m.setUpControl; + composeNgValidator = $__m.composeNgValidator; + isPropertyUpdated = $__m.isPropertyUpdated; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + formControlBinding = CONST_EXPR(new Binding(NgControl, {toAlias: forwardRef((function() { + return NgModel; + }))})); + NgModel = (function($__super) { + function $__0(ngValidators) { + $traceurRuntime.superConstructor($__0).call(this); + this._control = new Control(); + this._added = false; + this.update = new EventEmitter(); + this.ngValidators = ngValidators; + } + return ($traceurRuntime.createClass)($__0, { + onChange: function(c) { + if (!this._added) { + setUpControl(this._control, this); + this._control.updateValidity(); + this._added = true; + } + if (isPropertyUpdated(c, this.viewModel)) { + this._control.updateValue(this.model); + } + }, + get control() { + return this._control; + }, + get path() { + return []; + }, + get validator() { + return composeNgValidator(this.ngValidators); + }, + viewToModelUpdate: function(newValue) { + this.viewModel = newValue; + ObservableWrapper.callNext(this.update, newValue); + } + }, {}, $__super); + }(NgControl)); + $__export("NgModel", NgModel); + $__export("NgModel", NgModel = __decorate([Directive({ + selector: '[ng-model]:not([ng-control]):not([ng-form-control])', + hostInjector: [formControlBinding], + properties: ['model: ngModel'], + events: ['update: ngModel'], + lifecycle: [LifecycleEvent.onChange], + exportAs: 'form' + }), __param(0, Query(NgValidator)), __metadata('design:paramtypes', [QueryList])], NgModel)); + } + }; +}); + +System.register("angular2/src/forms/directives/ng_control_group", ["angular2/annotations", "angular2/di", "angular2/src/facade/lang", "angular2/src/forms/directives/control_container", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/ng_control_group"; + var __decorate, + __metadata, + __param, + Directive, + LifecycleEvent, + Ancestor, + forwardRef, + Binding, + CONST_EXPR, + ControlContainer, + controlPath, + controlGroupBinding, + NgControlGroup; + return { + setters: [function($__m) { + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + Ancestor = $__m.Ancestor; + forwardRef = $__m.forwardRef; + Binding = $__m.Binding; + }, function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + ControlContainer = $__m.ControlContainer; + }, function($__m) { + controlPath = $__m.controlPath; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + controlGroupBinding = CONST_EXPR(new Binding(ControlContainer, {toAlias: forwardRef((function() { + return NgControlGroup; + }))})); + NgControlGroup = (function($__super) { + function $__0(_parent) { + $traceurRuntime.superConstructor($__0).call(this); + this._parent = _parent; + } + return ($traceurRuntime.createClass)($__0, { + onInit: function() { + this.formDirective.addControlGroup(this); + }, + onDestroy: function() { + this.formDirective.removeControlGroup(this); + }, + get control() { + return this.formDirective.getControlGroup(this); + }, + get path() { + return controlPath(this.name, this._parent); + }, + get formDirective() { + return this._parent.formDirective; + } + }, {}, $__super); + }(ControlContainer)); + $__export("NgControlGroup", NgControlGroup); + $__export("NgControlGroup", NgControlGroup = __decorate([Directive({ + selector: '[ng-control-group]', + hostInjector: [controlGroupBinding], + properties: ['name: ng-control-group'], + lifecycle: [LifecycleEvent.onInit, LifecycleEvent.onDestroy], + exportAs: 'form' + }), __param(0, Ancestor()), __metadata('design:paramtypes', [ControlContainer])], NgControlGroup)); + } + }; +}); + +System.register("angular2/src/forms/directives/ng_form_model", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/facade/async", "angular2/annotations", "angular2/di", "angular2/src/forms/directives/control_container", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/ng_form_model"; + var __decorate, + __metadata, + CONST_EXPR, + ListWrapper, + ObservableWrapper, + EventEmitter, + Directive, + LifecycleEvent, + forwardRef, + Binding, + ControlContainer, + setUpControl, + formDirectiveBinding, + NgFormModel; + return { + setters: [function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + ObservableWrapper = $__m.ObservableWrapper; + EventEmitter = $__m.EventEmitter; + }, function($__m) { + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + forwardRef = $__m.forwardRef; + Binding = $__m.Binding; + }, function($__m) { + ControlContainer = $__m.ControlContainer; + }, function($__m) { + setUpControl = $__m.setUpControl; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + formDirectiveBinding = CONST_EXPR(new Binding(ControlContainer, {toAlias: forwardRef((function() { + return NgFormModel; + }))})); + NgFormModel = (function($__super) { + function $__1() { + var $__4; + for (var args = [], + $__3 = 0; $__3 < arguments.length; $__3++) + args[$__3] = arguments[$__3]; + ($__4 = $traceurRuntime.superConstructor($__1)).call.apply($__4, $traceurRuntime.spread([this], args)); + this.form = null; + this.directives = []; + this.ngSubmit = new EventEmitter(); + } + return ($traceurRuntime.createClass)($__1, { + onChange: function(_) { + this._updateDomValue(); + }, + get formDirective() { + return this; + }, + get control() { + return this.form; + }, + get path() { + return []; + }, + addControl: function(dir) { + var c = this.form.find(dir.path); + setUpControl(c, dir); + c.updateValidity(); + this.directives.push(dir); + }, + getControl: function(dir) { + return this.form.find(dir.path); + }, + removeControl: function(dir) { + ListWrapper.remove(this.directives, dir); + }, + addControlGroup: function(dir) {}, + removeControlGroup: function(dir) {}, + getControlGroup: function(dir) { + return this.form.find(dir.path); + }, + updateModel: function(dir, value) { + var c = this.form.find(dir.path); + c.updateValue(value); + }, + onSubmit: function() { + ObservableWrapper.callNext(this.ngSubmit, null); + return false; + }, + _updateDomValue: function() { + var $__0 = this; + ListWrapper.forEach(this.directives, (function(dir) { + var c = $__0.form.find(dir.path); + dir.valueAccessor.writeValue(c.value); + })); + } + }, {}, $__super); + }(ControlContainer)); + $__export("NgFormModel", NgFormModel); + $__export("NgFormModel", NgFormModel = __decorate([Directive({ + selector: '[ng-form-model]', + hostInjector: [formDirectiveBinding], + properties: ['form: ng-form-model'], + lifecycle: [LifecycleEvent.onChange], + host: {'(submit)': 'onSubmit()'}, + events: ['ngSubmit'], + exportAs: 'form' + }), __metadata('design:paramtypes', [])], NgFormModel)); + } + }; +}); + +System.register("angular2/src/forms/directives/ng_form", ["angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/annotations", "angular2/di", "angular2/src/forms/directives/control_container", "angular2/src/forms/model", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/ng_form"; + var __decorate, + __metadata, + PromiseWrapper, + ObservableWrapper, + EventEmitter, + ListWrapper, + isPresent, + CONST_EXPR, + Directive, + forwardRef, + Binding, + ControlContainer, + ControlGroup, + Control, + setUpControl, + formDirectiveBinding, + NgForm; + return { + setters: [function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + ObservableWrapper = $__m.ObservableWrapper; + EventEmitter = $__m.EventEmitter; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + Directive = $__m.Directive; + }, function($__m) { + forwardRef = $__m.forwardRef; + Binding = $__m.Binding; + }, function($__m) { + ControlContainer = $__m.ControlContainer; + }, function($__m) { + ControlGroup = $__m.ControlGroup; + Control = $__m.Control; + }, function($__m) { + setUpControl = $__m.setUpControl; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + formDirectiveBinding = CONST_EXPR(new Binding(ControlContainer, {toAlias: forwardRef((function() { + return NgForm; + }))})); + NgForm = (function($__super) { + function $__1() { + $traceurRuntime.superConstructor($__1).call(this); + this.ngSubmit = new EventEmitter(); + this.form = new ControlGroup({}); + } + return ($traceurRuntime.createClass)($__1, { + get formDirective() { + return this; + }, + get control() { + return this.form; + }, + get path() { + return []; + }, + get controls() { + return this.form.controls; + }, + addControl: function(dir) { + var $__0 = this; + this._later((function(_) { + var container = $__0._findContainer(dir.path); + var c = new Control(); + setUpControl(c, dir); + container.addControl(dir.name, c); + c.updateValidity(); + })); + }, + getControl: function(dir) { + return this.form.find(dir.path); + }, + removeControl: function(dir) { + var $__0 = this; + this._later((function(_) { + var container = $__0._findContainer(dir.path); + if (isPresent(container)) { + container.removeControl(dir.name); + container.updateValidity(); + } + })); + }, + addControlGroup: function(dir) { + var $__0 = this; + this._later((function(_) { + var container = $__0._findContainer(dir.path); + var c = new ControlGroup({}); + container.addControl(dir.name, c); + c.updateValidity(); + })); + }, + removeControlGroup: function(dir) { + var $__0 = this; + this._later((function(_) { + var container = $__0._findContainer(dir.path); + if (isPresent(container)) { + container.removeControl(dir.name); + container.updateValidity(); + } + })); + }, + getControlGroup: function(dir) { + return this.form.find(dir.path); + }, + updateModel: function(dir, value) { + var $__0 = this; + this._later((function(_) { + var c = $__0.form.find(dir.path); + c.updateValue(value); + })); + }, + onSubmit: function() { + ObservableWrapper.callNext(this.ngSubmit, null); + return false; + }, + _findContainer: function(path) { + ListWrapper.removeLast(path); + return ListWrapper.isEmpty(path) ? this.form : this.form.find(path); + }, + _later: function(fn) { + var c = PromiseWrapper.completer(); + PromiseWrapper.then(c.promise, fn, (function(_) {})); + c.resolve(null); + } + }, {}, $__super); + }(ControlContainer)); + $__export("NgForm", NgForm); + $__export("NgForm", NgForm = __decorate([Directive({ + selector: 'form:not([ng-no-form]):not([ng-form-model]),ng-form,[ng-form]', + hostInjector: [formDirectiveBinding], + host: {'(submit)': 'onSubmit()'}, + events: ['ngSubmit'], + exportAs: 'form' + }), __metadata('design:paramtypes', [])], NgForm)); + } + }; +}); + +System.register("angular2/render", ["angular2/src/render/render"], function($__export) { + "use strict"; + var __moduleName = "angular2/render"; + return { + setters: [function($__m) { + $__export("Renderer", $__m.Renderer); + $__export("RenderViewRef", $__m.RenderViewRef); + $__export("RenderProtoViewRef", $__m.RenderProtoViewRef); + $__export("RenderFragmentRef", $__m.RenderFragmentRef); + $__export("RenderViewWithFragments", $__m.RenderViewWithFragments); + $__export("DomRenderer", $__m.DomRenderer); + $__export("DOCUMENT_TOKEN", $__m.DOCUMENT_TOKEN); + $__export("APP_ID_TOKEN", $__m.APP_ID_TOKEN); + $__export("DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES", $__m.DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/forms/directives/checkbox_value_accessor", ["angular2/render", "angular2/annotations", "angular2/core", "angular2/di", "angular2/src/forms/directives/ng_control", "angular2/src/facade/lang", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/checkbox_value_accessor"; + var __decorate, + __metadata, + __param, + Renderer, + Directive, + ElementRef, + Self, + NgControl, + isPresent, + setProperty, + CheckboxControlValueAccessor; + return { + setters: [function($__m) { + Renderer = $__m.Renderer; + }, function($__m) { + Directive = $__m.Directive; + }, function($__m) { + ElementRef = $__m.ElementRef; + }, function($__m) { + Self = $__m.Self; + }, function($__m) { + NgControl = $__m.NgControl; + }, function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + setProperty = $__m.setProperty; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + CheckboxControlValueAccessor = (($traceurRuntime.createClass)(function(cd, renderer, elementRef) { + this.renderer = renderer; + this.elementRef = elementRef; + this.onChange = (function(_) {}); + this.onTouched = (function() {}); + this.cd = cd; + cd.valueAccessor = this; + }, { + writeValue: function(value) { + setProperty(this.renderer, this.elementRef, "checked", value); + }, + get ngClassUntouched() { + return isPresent(this.cd.control) ? this.cd.control.untouched : false; + }, + get ngClassTouched() { + return isPresent(this.cd.control) ? this.cd.control.touched : false; + }, + get ngClassPristine() { + return isPresent(this.cd.control) ? this.cd.control.pristine : false; + }, + get ngClassDirty() { + return isPresent(this.cd.control) ? this.cd.control.dirty : false; + }, + get ngClassValid() { + return isPresent(this.cd.control) ? this.cd.control.valid : false; + }, + get ngClassInvalid() { + return isPresent(this.cd.control) ? !this.cd.control.valid : false; + }, + registerOnChange: function(fn) { + this.onChange = fn; + }, + registerOnTouched: function(fn) { + this.onTouched = fn; + } + }, {})); + $__export("CheckboxControlValueAccessor", CheckboxControlValueAccessor); + $__export("CheckboxControlValueAccessor", CheckboxControlValueAccessor = __decorate([Directive({ + selector: 'input[type=checkbox][ng-control],input[type=checkbox][ng-form-control],input[type=checkbox][ng-model]', + host: { + '(change)': 'onChange($event.target.checked)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, Self()), __metadata('design:paramtypes', [NgControl, Renderer, ElementRef])], CheckboxControlValueAccessor)); + } + }; +}); + +System.register("angular2/src/forms/directives/select_control_value_accessor", ["angular2/render", "angular2/core", "angular2/di", "angular2/annotations", "angular2/src/forms/directives/ng_control", "angular2/src/facade/lang", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/select_control_value_accessor"; + var __decorate, + __metadata, + __param, + Renderer, + ElementRef, + QueryList, + Self, + Query, + Directive, + NgControl, + isPresent, + setProperty, + NgSelectOption, + SelectControlValueAccessor; + return { + setters: [function($__m) { + Renderer = $__m.Renderer; + }, function($__m) { + ElementRef = $__m.ElementRef; + QueryList = $__m.QueryList; + }, function($__m) { + Self = $__m.Self; + }, function($__m) { + Query = $__m.Query; + Directive = $__m.Directive; + }, function($__m) { + NgControl = $__m.NgControl; + }, function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + setProperty = $__m.setProperty; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + NgSelectOption = (($traceurRuntime.createClass)(function() {}, {}, {})); + $__export("NgSelectOption", NgSelectOption); + $__export("NgSelectOption", NgSelectOption = __decorate([Directive({selector: 'option'}), __metadata('design:paramtypes', [])], NgSelectOption)); + SelectControlValueAccessor = (($traceurRuntime.createClass)(function(cd, renderer, elementRef, query) { + this.renderer = renderer; + this.elementRef = elementRef; + this.onChange = (function(_) {}); + this.onTouched = (function() {}); + this.cd = cd; + cd.valueAccessor = this; + this._updateValueWhenListOfOptionsChanges(query); + }, { + writeValue: function(value) { + this.value = value; + setProperty(this.renderer, this.elementRef, "value", value); + }, + get ngClassUntouched() { + return isPresent(this.cd.control) ? this.cd.control.untouched : false; + }, + get ngClassTouched() { + return isPresent(this.cd.control) ? this.cd.control.touched : false; + }, + get ngClassPristine() { + return isPresent(this.cd.control) ? this.cd.control.pristine : false; + }, + get ngClassDirty() { + return isPresent(this.cd.control) ? this.cd.control.dirty : false; + }, + get ngClassValid() { + return isPresent(this.cd.control) ? this.cd.control.valid : false; + }, + get ngClassInvalid() { + return isPresent(this.cd.control) ? !this.cd.control.valid : false; + }, + registerOnChange: function(fn) { + this.onChange = fn; + }, + registerOnTouched: function(fn) { + this.onTouched = fn; + }, + _updateValueWhenListOfOptionsChanges: function(query) { + var $__0 = this; + query.onChange((function() { + return $__0.writeValue($__0.value); + })); + } + }, {})); + $__export("SelectControlValueAccessor", SelectControlValueAccessor); + $__export("SelectControlValueAccessor", SelectControlValueAccessor = __decorate([Directive({ + selector: 'select[ng-control],select[ng-form-control],select[ng-model]', + host: { + '(change)': 'onChange($event.target.value)', + '(input)': 'onChange($event.target.value)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, Self()), __param(3, Query(NgSelectOption, {descendants: true})), __metadata('design:paramtypes', [NgControl, Renderer, ElementRef, QueryList])], SelectControlValueAccessor)); + } + }; +}); + +System.register("angular2/src/forms/directives", ["angular2/src/facade/lang", "angular2/src/forms/directives/ng_control_name", "angular2/src/forms/directives/ng_form_control", "angular2/src/forms/directives/ng_model", "angular2/src/forms/directives/ng_control_group", "angular2/src/forms/directives/ng_form_model", "angular2/src/forms/directives/ng_form", "angular2/src/forms/directives/default_value_accessor", "angular2/src/forms/directives/checkbox_value_accessor", "angular2/src/forms/directives/select_control_value_accessor", "angular2/src/forms/directives/validators", "angular2/src/forms/directives/ng_control"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives"; + var CONST_EXPR, + NgControlName, + NgFormControl, + NgModel, + NgControlGroup, + NgFormModel, + NgForm, + DefaultValueAccessor, + CheckboxControlValueAccessor, + SelectControlValueAccessor, + NgSelectOption, + NgRequiredValidator, + formDirectives; + return { + setters: [function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + NgControlName = $__m.NgControlName; + $__export("NgControlName", $__m.NgControlName); + }, function($__m) { + NgFormControl = $__m.NgFormControl; + $__export("NgFormControl", $__m.NgFormControl); + }, function($__m) { + NgModel = $__m.NgModel; + $__export("NgModel", $__m.NgModel); + }, function($__m) { + NgControlGroup = $__m.NgControlGroup; + $__export("NgControlGroup", $__m.NgControlGroup); + }, function($__m) { + NgFormModel = $__m.NgFormModel; + $__export("NgFormModel", $__m.NgFormModel); + }, function($__m) { + NgForm = $__m.NgForm; + $__export("NgForm", $__m.NgForm); + }, function($__m) { + DefaultValueAccessor = $__m.DefaultValueAccessor; + $__export("DefaultValueAccessor", $__m.DefaultValueAccessor); + }, function($__m) { + CheckboxControlValueAccessor = $__m.CheckboxControlValueAccessor; + $__export("CheckboxControlValueAccessor", $__m.CheckboxControlValueAccessor); + }, function($__m) { + SelectControlValueAccessor = $__m.SelectControlValueAccessor; + NgSelectOption = $__m.NgSelectOption; + $__export("SelectControlValueAccessor", $__m.SelectControlValueAccessor); + $__export("NgSelectOption", $__m.NgSelectOption); + }, function($__m) { + NgRequiredValidator = $__m.NgRequiredValidator; + $__export("NgValidator", $__m.NgValidator); + $__export("NgRequiredValidator", $__m.NgRequiredValidator); + }, function($__m) { + $__export("NgControl", $__m.NgControl); + }], + execute: function() { + formDirectives = CONST_EXPR([NgControlName, NgControlGroup, NgFormControl, NgModel, NgFormModel, NgForm, NgSelectOption, DefaultValueAccessor, CheckboxControlValueAccessor, SelectControlValueAccessor, NgRequiredValidator]); + $__export("formDirectives", formDirectives); + } + }; +}); + +System.register("angular2/src/forms/form_builder", ["angular2/di", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/forms/model"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/form_builder"; + var __decorate, + __metadata, + Injectable, + StringMapWrapper, + ListWrapper, + isPresent, + isArray, + modelModule, + FormBuilder; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + ListWrapper = $__m.ListWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + isArray = $__m.isArray; + }, function($__m) { + modelModule = $__m; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + FormBuilder = (($traceurRuntime.createClass)(function() {}, { + group: function(controlsConfig) { + var extra = arguments[1] !== (void 0) ? arguments[1] : null; + var controls = this._reduceControls(controlsConfig); + var optionals = isPresent(extra) ? StringMapWrapper.get(extra, "optionals") : null; + var validator = isPresent(extra) ? StringMapWrapper.get(extra, "validator") : null; + if (isPresent(validator)) { + return new modelModule.ControlGroup(controls, optionals, validator); + } else { + return new modelModule.ControlGroup(controls, optionals); + } + }, + control: function(value) { + var validator = arguments[1] !== (void 0) ? arguments[1] : null; + if (isPresent(validator)) { + return new modelModule.Control(value, validator); + } else { + return new modelModule.Control(value); + } + }, + array: function(controlsConfig) { + var validator = arguments[1] !== (void 0) ? arguments[1] : null; + var $__0 = this; + var controls = ListWrapper.map(controlsConfig, (function(c) { + return $__0._createControl(c); + })); + if (isPresent(validator)) { + return new modelModule.ControlArray(controls, validator); + } else { + return new modelModule.ControlArray(controls); + } + }, + _reduceControls: function(controlsConfig) { + var $__0 = this; + var controls = {}; + StringMapWrapper.forEach(controlsConfig, (function(controlConfig, controlName) { + controls[controlName] = $__0._createControl(controlConfig); + })); + return controls; + }, + _createControl: function(controlConfig) { + if (controlConfig instanceof modelModule.Control || controlConfig instanceof modelModule.ControlGroup || controlConfig instanceof modelModule.ControlArray) { + return controlConfig; + } else if (isArray(controlConfig)) { + var value = ListWrapper.get(controlConfig, 0); + var validator = controlConfig.length > 1 ? controlConfig[1] : null; + return this.control(value, validator); + } else { + return this.control(controlConfig); + } + } + }, {})); + $__export("FormBuilder", FormBuilder); + $__export("FormBuilder", FormBuilder = __decorate([Injectable(), __metadata('design:paramtypes', [])], FormBuilder)); + } + }; +}); + +System.register("angular2/src/di/metadata", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/metadata"; + var __decorate, + __metadata, + CONST, + CONST_EXPR, + stringify, + isBlank, + InjectMetadata, + OptionalMetadata, + DependencyMetadata, + InjectableMetadata, + VisibilityMetadata, + SelfMetadata, + AncestorMetadata, + UnboundedMetadata, + DEFAULT_VISIBILITY; + return { + setters: [function($__m) { + CONST = $__m.CONST; + CONST_EXPR = $__m.CONST_EXPR; + stringify = $__m.stringify; + isBlank = $__m.isBlank; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + InjectMetadata = (($traceurRuntime.createClass)(function(token) { + this.token = token; + }, {toString: function() { + return ("@Inject(" + stringify(this.token) + ")"); + }}, {})); + $__export("InjectMetadata", InjectMetadata); + $__export("InjectMetadata", InjectMetadata = __decorate([CONST(), __metadata('design:paramtypes', [Object])], InjectMetadata)); + OptionalMetadata = (($traceurRuntime.createClass)(function() {}, {toString: function() { + return "@Optional()"; + }}, {})); + $__export("OptionalMetadata", OptionalMetadata); + $__export("OptionalMetadata", OptionalMetadata = __decorate([CONST(), __metadata('design:paramtypes', [])], OptionalMetadata)); + DependencyMetadata = (($traceurRuntime.createClass)(function() {}, {get token() { + return null; + }}, {})); + $__export("DependencyMetadata", DependencyMetadata); + $__export("DependencyMetadata", DependencyMetadata = __decorate([CONST(), __metadata('design:paramtypes', [])], DependencyMetadata)); + InjectableMetadata = (($traceurRuntime.createClass)(function() {}, {}, {})); + $__export("InjectableMetadata", InjectableMetadata); + $__export("InjectableMetadata", InjectableMetadata = __decorate([CONST(), __metadata('design:paramtypes', [])], InjectableMetadata)); + VisibilityMetadata = (($traceurRuntime.createClass)(function(crossBoundaries, _includeSelf) { + this.crossBoundaries = crossBoundaries; + this._includeSelf = _includeSelf; + }, { + get includeSelf() { + return isBlank(this._includeSelf) ? false : this._includeSelf; + }, + toString: function() { + return ("@Visibility(crossBoundaries: " + this.crossBoundaries + ", includeSelf: " + this.includeSelf + "})"); + } + }, {})); + $__export("VisibilityMetadata", VisibilityMetadata); + $__export("VisibilityMetadata", VisibilityMetadata = __decorate([CONST(), __metadata('design:paramtypes', [Boolean, Boolean])], VisibilityMetadata)); + SelfMetadata = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).call(this, false, true); + } + return ($traceurRuntime.createClass)($__0, {toString: function() { + return "@Self()"; + }}, {}, $__super); + }(VisibilityMetadata)); + $__export("SelfMetadata", SelfMetadata); + $__export("SelfMetadata", SelfMetadata = __decorate([CONST(), __metadata('design:paramtypes', [])], SelfMetadata)); + AncestorMetadata = (function($__super) { + function $__0() { + var self = (arguments[0] !== (void 0) ? arguments[0] : {}).self; + $traceurRuntime.superConstructor($__0).call(this, false, self); + } + return ($traceurRuntime.createClass)($__0, {toString: function() { + return ("@Ancestor(self: " + this.includeSelf + "})"); + }}, {}, $__super); + }(VisibilityMetadata)); + $__export("AncestorMetadata", AncestorMetadata); + $__export("AncestorMetadata", AncestorMetadata = __decorate([CONST(), __metadata('design:paramtypes', [Object])], AncestorMetadata)); + UnboundedMetadata = (function($__super) { + function $__0() { + var self = (arguments[0] !== (void 0) ? arguments[0] : {}).self; + $traceurRuntime.superConstructor($__0).call(this, true, self); + } + return ($traceurRuntime.createClass)($__0, {toString: function() { + return ("@Unbounded(self: " + this.includeSelf + "})"); + }}, {}, $__super); + }(VisibilityMetadata)); + $__export("UnboundedMetadata", UnboundedMetadata); + $__export("UnboundedMetadata", UnboundedMetadata = __decorate([CONST(), __metadata('design:paramtypes', [Object])], UnboundedMetadata)); + DEFAULT_VISIBILITY = CONST_EXPR(new UnboundedMetadata({self: true})); + $__export("DEFAULT_VISIBILITY", DEFAULT_VISIBILITY); + } + }; +}); + +System.register("angular2/src/di/decorators", ["angular2/src/di/metadata", "angular2/src/util/decorators"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/decorators"; + var InjectMetadata, + OptionalMetadata, + InjectableMetadata, + SelfMetadata, + AncestorMetadata, + UnboundedMetadata, + makeDecorator, + makeParamDecorator, + Inject, + Optional, + Injectable, + Self, + Ancestor, + Unbounded; + return { + setters: [function($__m) { + InjectMetadata = $__m.InjectMetadata; + OptionalMetadata = $__m.OptionalMetadata; + InjectableMetadata = $__m.InjectableMetadata; + SelfMetadata = $__m.SelfMetadata; + AncestorMetadata = $__m.AncestorMetadata; + UnboundedMetadata = $__m.UnboundedMetadata; + }, function($__m) { + makeDecorator = $__m.makeDecorator; + makeParamDecorator = $__m.makeParamDecorator; + }], + execute: function() { + Inject = makeParamDecorator(InjectMetadata); + $__export("Inject", Inject); + Optional = makeParamDecorator(OptionalMetadata); + $__export("Optional", Optional); + Injectable = makeDecorator(InjectableMetadata); + $__export("Injectable", Injectable); + Self = makeParamDecorator(SelfMetadata); + $__export("Self", Self); + Ancestor = makeParamDecorator(AncestorMetadata); + $__export("Ancestor", Ancestor); + Unbounded = makeParamDecorator(UnboundedMetadata); + $__export("Unbounded", Unbounded); + } + }; +}); + +System.register("angular2/src/reflection/reflection", ["angular2/src/reflection/reflector", "angular2/src/reflection/reflection_capabilities"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/reflection/reflection"; + var Reflector, + ReflectionCapabilities, + reflector; + return { + setters: [function($__m) { + Reflector = $__m.Reflector; + $__export("Reflector", $__m.Reflector); + $__export("ReflectionInfo", $__m.ReflectionInfo); + }, function($__m) { + ReflectionCapabilities = $__m.ReflectionCapabilities; + }], + execute: function() { + reflector = new Reflector(new ReflectionCapabilities()); + $__export("reflector", reflector); + } + }; +}); + +System.register("angular2/src/di/key", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/di/type_literal", "angular2/src/di/forward_ref"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/key"; + var MapWrapper, + stringify, + isBlank, + BaseException, + TypeLiteral, + resolveForwardRef, + Key, + KeyRegistry, + _globalKeyRegistry; + return { + setters: [function($__m) { + MapWrapper = $__m.MapWrapper; + }, function($__m) { + stringify = $__m.stringify; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + TypeLiteral = $__m.TypeLiteral; + $__export("TypeLiteral", $__m.TypeLiteral); + }, function($__m) { + resolveForwardRef = $__m.resolveForwardRef; + }], + execute: function() { + Key = (function() { + function Key(token, id) { + this.token = token; + this.id = id; + if (isBlank(token)) { + throw new BaseException('Token must be defined!'); + } + } + return ($traceurRuntime.createClass)(Key, {get displayName() { + return stringify(this.token); + }}, { + get: function(token) { + return _globalKeyRegistry.get(resolveForwardRef(token)); + }, + get numberOfKeys() { + return _globalKeyRegistry.numberOfKeys; + } + }); + }()); + $__export("Key", Key); + KeyRegistry = (function() { + function KeyRegistry() { + this._allKeys = new Map(); + } + return ($traceurRuntime.createClass)(KeyRegistry, { + get: function(token) { + if (token instanceof Key) + return token; + var theToken = token; + if (token instanceof TypeLiteral) { + theToken = token.type; + } + token = theToken; + if (this._allKeys.has(token)) { + return this._allKeys.get(token); + } + var newKey = new Key(token, Key.numberOfKeys); + this._allKeys.set(token, newKey); + return newKey; + }, + get numberOfKeys() { + return MapWrapper.size(this._allKeys); + } + }, {}); + }()); + $__export("KeyRegistry", KeyRegistry); + _globalKeyRegistry = new KeyRegistry(); + } + }; +}); + +System.register("angular2/src/dom/browser_adapter", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/dom/dom_adapter", "angular2/src/dom/generic_browser_adapter"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/dom/browser_adapter"; + var ListWrapper, + isBlank, + isPresent, + global, + setRootDomAdapter, + GenericBrowserDomAdapter, + _attrToPropMap, + DOM_KEY_LOCATION_NUMPAD, + _keyMap, + _chromeNumKeyPadMap, + BrowserDomAdapter, + baseElement, + urlParsingNode; + function getBaseElementHref() { + if (isBlank(baseElement)) { + baseElement = document.querySelector('base'); + if (isBlank(baseElement)) { + return null; + } + } + return baseElement.attr('href'); + } + function relativePath(url) { + if (isBlank(urlParsingNode)) { + urlParsingNode = document.createElement("a"); + } + urlParsingNode.setAttribute('href', url); + return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname : '/' + urlParsingNode.pathname; + } + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + global = $__m.global; + }, function($__m) { + setRootDomAdapter = $__m.setRootDomAdapter; + }, function($__m) { + GenericBrowserDomAdapter = $__m.GenericBrowserDomAdapter; + }], + execute: function() { + _attrToPropMap = { + 'innerHtml': 'innerHTML', + 'readonly': 'readOnly', + 'tabindex': 'tabIndex' + }; + DOM_KEY_LOCATION_NUMPAD = 3; + _keyMap = { + '\b': 'Backspace', + '\t': 'Tab', + '\x7F': 'Delete', + '\x1B': 'Escape', + 'Del': 'Delete', + 'Esc': 'Escape', + 'Left': 'ArrowLeft', + 'Right': 'ArrowRight', + 'Up': 'ArrowUp', + 'Down': 'ArrowDown', + 'Menu': 'ContextMenu', + 'Scroll': 'ScrollLock', + 'Win': 'OS' + }; + _chromeNumKeyPadMap = { + 'A': '1', + 'B': '2', + 'C': '3', + 'D': '4', + 'E': '5', + 'F': '6', + 'G': '7', + 'H': '8', + 'I': '9', + 'J': '*', + 'K': '+', + 'M': '-', + 'N': '.', + 'O': '/', + '\x60': '0', + '\x90': 'NumLock' + }; + BrowserDomAdapter = (function($__super) { + function BrowserDomAdapter() { + $traceurRuntime.superConstructor(BrowserDomAdapter).apply(this, arguments); + } + return ($traceurRuntime.createClass)(BrowserDomAdapter, { + hasProperty: function(element, name) { + return name in element; + }, + setProperty: function(el, name, value) { + el[name] = value; + }, + getProperty: function(el, name) { + return el[name]; + }, + invoke: function(el, methodName, args) { + el[methodName].apply(el, args); + }, + logError: function(error) { + window.console.error(error); + }, + log: function(error) { + window.console.log(error); + }, + logGroup: function(error) { + if (window.console.group) { + window.console.group(error); + } else { + window.console.log(error); + } + }, + logGroupEnd: function() { + if (window.console.groupEnd) { + window.console.groupEnd(); + } + }, + get attrToPropMap() { + return _attrToPropMap; + }, + query: function(selector) { + return document.querySelector(selector); + }, + querySelector: function(el, selector) { + return el.querySelector(selector); + }, + querySelectorAll: function(el, selector) { + return el.querySelectorAll(selector); + }, + on: function(el, evt, listener) { + el.addEventListener(evt, listener, false); + }, + onAndCancel: function(el, evt, listener) { + el.addEventListener(evt, listener, false); + return (function() { + el.removeEventListener(evt, listener, false); + }); + }, + dispatchEvent: function(el, evt) { + el.dispatchEvent(evt); + }, + createMouseEvent: function(eventType) { + var evt = document.createEvent('MouseEvent'); + evt.initEvent(eventType, true, true); + return evt; + }, + createEvent: function(eventType) { + var evt = document.createEvent('Event'); + evt.initEvent(eventType, true, true); + return evt; + }, + preventDefault: function(evt) { + evt.preventDefault(); + evt.returnValue = false; + }, + getInnerHTML: function(el) { + return el.innerHTML; + }, + getOuterHTML: function(el) { + return el.outerHTML; + }, + nodeName: function(node) { + return node.nodeName; + }, + nodeValue: function(node) { + return node.nodeValue; + }, + type: function(node) { + return node.type; + }, + content: function(node) { + if (this.hasProperty(node, "content")) { + return node.content; + } else { + return node; + } + }, + firstChild: function(el) { + return el.firstChild; + }, + nextSibling: function(el) { + return el.nextSibling; + }, + parentElement: function(el) { + return el.parentElement; + }, + childNodes: function(el) { + return el.childNodes; + }, + childNodesAsList: function(el) { + var childNodes = el.childNodes; + var res = ListWrapper.createFixedSize(childNodes.length); + for (var i = 0; i < childNodes.length; i++) { + res[i] = childNodes[i]; + } + return res; + }, + clearNodes: function(el) { + while (el.firstChild) { + el.firstChild.remove(); + } + }, + appendChild: function(el, node) { + el.appendChild(node); + }, + removeChild: function(el, node) { + el.removeChild(node); + }, + replaceChild: function(el, newChild, oldChild) { + el.replaceChild(newChild, oldChild); + }, + remove: function(node) { + node.remove(); + return node; + }, + insertBefore: function(el, node) { + el.parentNode.insertBefore(node, el); + }, + insertAllBefore: function(el, nodes) { + ListWrapper.forEach(nodes, (function(n) { + el.parentNode.insertBefore(n, el); + })); + }, + insertAfter: function(el, node) { + el.parentNode.insertBefore(node, el.nextSibling); + }, + setInnerHTML: function(el, value) { + el.innerHTML = value; + }, + getText: function(el) { + return el.textContent; + }, + setText: function(el, value) { + el.textContent = value; + }, + getValue: function(el) { + return el.value; + }, + setValue: function(el, value) { + el.value = value; + }, + getChecked: function(el) { + return el.checked; + }, + setChecked: function(el, value) { + el.checked = value; + }, + createTemplate: function(html) { + var t = document.createElement('template'); + t.innerHTML = html; + return t; + }, + createElement: function(tagName) { + var doc = arguments[1] !== (void 0) ? arguments[1] : document; + return doc.createElement(tagName); + }, + createTextNode: function(text) { + var doc = arguments[1] !== (void 0) ? arguments[1] : document; + return doc.createTextNode(text); + }, + createScriptTag: function(attrName, attrValue) { + var doc = arguments[2] !== (void 0) ? arguments[2] : document; + var el = doc.createElement('SCRIPT'); + el.setAttribute(attrName, attrValue); + return el; + }, + createStyleElement: function(css) { + var doc = arguments[1] !== (void 0) ? arguments[1] : document; + var style = doc.createElement('style'); + this.appendChild(style, this.createTextNode(css)); + return style; + }, + createShadowRoot: function(el) { + return el.createShadowRoot(); + }, + getShadowRoot: function(el) { + return el.shadowRoot; + }, + getHost: function(el) { + return el.host; + }, + clone: function(node) { + return node.cloneNode(true); + }, + getElementsByClassName: function(element, name) { + return element.getElementsByClassName(name); + }, + getElementsByTagName: function(element, name) { + return element.getElementsByTagName(name); + }, + classList: function(element) { + return Array.prototype.slice.call(element.classList, 0); + }, + addClass: function(element, classname) { + element.classList.add(classname); + }, + removeClass: function(element, classname) { + element.classList.remove(classname); + }, + hasClass: function(element, classname) { + return element.classList.contains(classname); + }, + setStyle: function(element, stylename, stylevalue) { + element.style[stylename] = stylevalue; + }, + removeStyle: function(element, stylename) { + element.style[stylename] = null; + }, + getStyle: function(element, stylename) { + return element.style[stylename]; + }, + tagName: function(element) { + return element.tagName; + }, + attributeMap: function(element) { + var res = new Map(); + var elAttrs = element.attributes; + for (var i = 0; i < elAttrs.length; i++) { + var attrib = elAttrs[i]; + res.set(attrib.name, attrib.value); + } + return res; + }, + hasAttribute: function(element, attribute) { + return element.hasAttribute(attribute); + }, + getAttribute: function(element, attribute) { + return element.getAttribute(attribute); + }, + setAttribute: function(element, name, value) { + element.setAttribute(name, value); + }, + removeAttribute: function(element, attribute) { + element.removeAttribute(attribute); + }, + templateAwareRoot: function(el) { + return this.isTemplateElement(el) ? this.content(el) : el; + }, + createHtmlDocument: function() { + return document.implementation.createHTMLDocument('fakeTitle'); + }, + defaultDoc: function() { + return document; + }, + getBoundingClientRect: function(el) { + try { + return el.getBoundingClientRect(); + } catch (e) { + return { + top: 0, + bottom: 0, + left: 0, + right: 0, + width: 0, + height: 0 + }; + } + }, + getTitle: function() { + return document.title; + }, + setTitle: function(newTitle) { + document.title = newTitle || ''; + }, + elementMatches: function(n, selector) { + return n instanceof HTMLElement && n.matches ? n.matches(selector) : n.msMatchesSelector(selector); + }, + isTemplateElement: function(el) { + return el instanceof HTMLElement && el.nodeName == "TEMPLATE"; + }, + isTextNode: function(node) { + return node.nodeType === Node.TEXT_NODE; + }, + isCommentNode: function(node) { + return node.nodeType === Node.COMMENT_NODE; + }, + isElementNode: function(node) { + return node.nodeType === Node.ELEMENT_NODE; + }, + hasShadowRoot: function(node) { + return node instanceof HTMLElement && isPresent(node.shadowRoot); + }, + isShadowRoot: function(node) { + return node instanceof DocumentFragment; + }, + importIntoDoc: function(node) { + var toImport = node; + if (this.isTemplateElement(node)) { + toImport = this.content(node); + } + return document.importNode(toImport, true); + }, + isPageRule: function(rule) { + return rule.type === CSSRule.PAGE_RULE; + }, + isStyleRule: function(rule) { + return rule.type === CSSRule.STYLE_RULE; + }, + isMediaRule: function(rule) { + return rule.type === CSSRule.MEDIA_RULE; + }, + isKeyframesRule: function(rule) { + return rule.type === CSSRule.KEYFRAMES_RULE; + }, + getHref: function(el) { + return el.href; + }, + getEventKey: function(event) { + var key = event.key; + if (isBlank(key)) { + key = event.keyIdentifier; + if (isBlank(key)) { + return 'Unidentified'; + } + if (key.startsWith('U+')) { + key = String.fromCharCode(parseInt(key.substring(2), 16)); + if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) { + key = _chromeNumKeyPadMap[key]; + } + } + } + if (_keyMap.hasOwnProperty(key)) { + key = _keyMap[key]; + } + return key; + }, + getGlobalEventTarget: function(target) { + if (target == "window") { + return window; + } else if (target == "document") { + return document; + } else if (target == "body") { + return document.body; + } + }, + getHistory: function() { + return window.history; + }, + getLocation: function() { + return window.location; + }, + getBaseHref: function() { + var href = getBaseElementHref(); + if (isBlank(href)) { + return null; + } + return relativePath(href); + }, + getUserAgent: function() { + return window.navigator.userAgent; + }, + setData: function(element, name, value) { + element.dataset[name] = value; + }, + getData: function(element, name) { + return element.dataset[name]; + }, + setGlobalVar: function(name, value) { + global[name] = value; + } + }, {makeCurrent: function() { + setRootDomAdapter(new BrowserDomAdapter()); + }}, $__super); + }(GenericBrowserDomAdapter)); + $__export("BrowserDomAdapter", BrowserDomAdapter); + baseElement = null; + urlParsingNode = null; + } + }; +}); + +System.register("angular2/src/facade/async", ["angular2/src/facade/lang", "rx"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/facade/async"; + var global, + Rx, + Promise, + PromiseWrapper, + TimerWrapper, + ObservableWrapper, + Observable, + EventEmitter; + return { + setters: [function($__m) { + global = $__m.global; + }, function($__m) { + Rx = $__m; + }], + execute: function() { + Promise = global.Promise; + $__export("Promise", Promise); + PromiseWrapper = (function() { + function PromiseWrapper() {} + return ($traceurRuntime.createClass)(PromiseWrapper, {}, { + resolve: function(obj) { + return Promise.resolve(obj); + }, + reject: function(obj, _) { + return Promise.reject(obj); + }, + catchError: function(promise, onError) { + return promise.catch(onError); + }, + all: function(promises) { + if (promises.length == 0) + return Promise.resolve([]); + return Promise.all(promises); + }, + then: function(promise, success, rejection) { + return promise.then(success, rejection); + }, + wrap: function(computation) { + return new Promise((function(res, rej) { + try { + res(computation()); + } catch (e) { + rej(e); + } + })); + }, + completer: function() { + var resolve; + var reject; + var p = new Promise(function(res, rej) { + resolve = res; + reject = rej; + }); + return { + promise: p, + resolve: resolve, + reject: reject + }; + } + }); + }()); + $__export("PromiseWrapper", PromiseWrapper); + TimerWrapper = (function() { + function TimerWrapper() {} + return ($traceurRuntime.createClass)(TimerWrapper, {}, { + setTimeout: function(fn, millis) { + return global.setTimeout(fn, millis); + }, + clearTimeout: function(id) { + global.clearTimeout(id); + }, + setInterval: function(fn, millis) { + return global.setInterval(fn, millis); + }, + clearInterval: function(id) { + global.clearInterval(id); + } + }); + }()); + $__export("TimerWrapper", TimerWrapper); + ObservableWrapper = (function() { + function ObservableWrapper() {} + return ($traceurRuntime.createClass)(ObservableWrapper, {}, { + subscribe: function(emitter, onNext) { + var onThrow = arguments[2] !== (void 0) ? arguments[2] : null; + var onReturn = arguments[3] !== (void 0) ? arguments[3] : null; + return emitter.observer({ + next: onNext, + throw: onThrow, + return: onReturn + }); + }, + isObservable: function(obs) { + return obs instanceof Observable; + }, + dispose: function(subscription) { + subscription.dispose(); + }, + callNext: function(emitter, value) { + emitter.next(value); + }, + callThrow: function(emitter, error) { + emitter.throw(error); + }, + callReturn: function(emitter) { + emitter.return(null); + } + }); + }()); + $__export("ObservableWrapper", ObservableWrapper); + Observable = (function() { + function Observable() {} + return ($traceurRuntime.createClass)(Observable, {observer: function(generator) { + return null; + }}, {}); + }()); + $__export("Observable", Observable); + EventEmitter = (function($__super) { + function EventEmitter() { + $traceurRuntime.superConstructor(EventEmitter).call(this); + if (Rx.hasOwnProperty('default')) { + this._subject = new Rx.default.Rx.Subject(); + this._immediateScheduler = Rx.default.Rx.Scheduler.immediate; + } else { + this._subject = new Rx.Subject(); + this._immediateScheduler = Rx.Scheduler.immediate; + } + } + return ($traceurRuntime.createClass)(EventEmitter, { + observer: function(generator) { + return this._subject.observeOn(this._immediateScheduler).subscribe((function(value) { + setTimeout((function() { + return generator.next(value); + })); + }), (function(error) { + return generator.throw ? generator.throw(error) : null; + }), (function() { + return generator.return ? generator.return() : null; + })); + }, + toRx: function() { + return this._subject; + }, + next: function(value) { + this._subject.onNext(value); + }, + throw: function(error) { + this._subject.onError(error); + }, + return: function(value) { + this._subject.onCompleted(); + } + }, {}, $__super); + }(Observable)); + $__export("EventEmitter", EventEmitter); + } + }; +}); + +System.register("angular2/src/change_detection/change_detector_ref", ["angular2/src/change_detection/constants"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/change_detector_ref"; + var DETACHED, + CHECK_ALWAYS, + ChangeDetectorRef; + return { + setters: [function($__m) { + DETACHED = $__m.DETACHED; + CHECK_ALWAYS = $__m.CHECK_ALWAYS; + }], + execute: function() { + ChangeDetectorRef = (function() { + function ChangeDetectorRef(_cd) { + this._cd = _cd; + } + return ($traceurRuntime.createClass)(ChangeDetectorRef, { + requestCheck: function() { + this._cd.markPathToRootAsCheckOnce(); + }, + detach: function() { + this._cd.mode = DETACHED; + }, + reattach: function() { + this._cd.mode = CHECK_ALWAYS; + this.requestCheck(); + } + }, {}); + }()); + $__export("ChangeDetectorRef", ChangeDetectorRef); + } + }; +}); + +System.register("angular2/src/change_detection/change_detection_util", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/exceptions", "angular2/src/change_detection/pipes/pipe", "angular2/src/change_detection/constants"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/change_detection_util"; + var CONST_EXPR, + isPresent, + isBlank, + BaseException, + StringMapWrapper, + DehydratedException, + ExpressionChangedAfterItHasBeenCheckedException, + WrappedValue, + CHECK_ALWAYS, + CHECK_ONCE, + ON_PUSH, + SimpleChange, + _simpleChangesIndex, + _simpleChanges, + ChangeDetectionUtil; + function _simpleChange(previousValue, currentValue) { + var index = _simpleChangesIndex++ % 20; + var s = _simpleChanges[index]; + s.previousValue = previousValue; + s.currentValue = currentValue; + return s; + } + return { + setters: [function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + DehydratedException = $__m.DehydratedException; + ExpressionChangedAfterItHasBeenCheckedException = $__m.ExpressionChangedAfterItHasBeenCheckedException; + }, function($__m) { + WrappedValue = $__m.WrappedValue; + }, function($__m) { + CHECK_ALWAYS = $__m.CHECK_ALWAYS; + CHECK_ONCE = $__m.CHECK_ONCE; + ON_PUSH = $__m.ON_PUSH; + }], + execute: function() { + SimpleChange = (function() { + function SimpleChange(previousValue, currentValue) { + this.previousValue = previousValue; + this.currentValue = currentValue; + } + return ($traceurRuntime.createClass)(SimpleChange, {isFirstChange: function() { + return this.previousValue === ChangeDetectionUtil.uninitialized; + }}, {}); + }()); + $__export("SimpleChange", SimpleChange); + _simpleChangesIndex = 0; + _simpleChanges = [new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null)]; + ChangeDetectionUtil = (function() { + function ChangeDetectionUtil() {} + return ($traceurRuntime.createClass)(ChangeDetectionUtil, {}, { + arrayFn0: function() { + return []; + }, + arrayFn1: function(a1) { + return [a1]; + }, + arrayFn2: function(a1, a2) { + return [a1, a2]; + }, + arrayFn3: function(a1, a2, a3) { + return [a1, a2, a3]; + }, + arrayFn4: function(a1, a2, a3, a4) { + return [a1, a2, a3, a4]; + }, + arrayFn5: function(a1, a2, a3, a4, a5) { + return [a1, a2, a3, a4, a5]; + }, + arrayFn6: function(a1, a2, a3, a4, a5, a6) { + return [a1, a2, a3, a4, a5, a6]; + }, + arrayFn7: function(a1, a2, a3, a4, a5, a6, a7) { + return [a1, a2, a3, a4, a5, a6, a7]; + }, + arrayFn8: function(a1, a2, a3, a4, a5, a6, a7, a8) { + return [a1, a2, a3, a4, a5, a6, a7, a8]; + }, + arrayFn9: function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return [a1, a2, a3, a4, a5, a6, a7, a8, a9]; + }, + operation_negate: function(value) { + return !value; + }, + operation_add: function(left, right) { + return left + right; + }, + operation_subtract: function(left, right) { + return left - right; + }, + operation_multiply: function(left, right) { + return left * right; + }, + operation_divide: function(left, right) { + return left / right; + }, + operation_remainder: function(left, right) { + return left % right; + }, + operation_equals: function(left, right) { + return left == right; + }, + operation_not_equals: function(left, right) { + return left != right; + }, + operation_identical: function(left, right) { + return left === right; + }, + operation_not_identical: function(left, right) { + return left !== right; + }, + operation_less_then: function(left, right) { + return left < right; + }, + operation_greater_then: function(left, right) { + return left > right; + }, + operation_less_or_equals_then: function(left, right) { + return left <= right; + }, + operation_greater_or_equals_then: function(left, right) { + return left >= right; + }, + operation_logical_and: function(left, right) { + return left && right; + }, + operation_logical_or: function(left, right) { + return left || right; + }, + cond: function(cond, trueVal, falseVal) { + return cond ? trueVal : falseVal; + }, + mapFn: function(keys) { + function buildMap(values) { + var res = StringMapWrapper.create(); + for (var i = 0; i < keys.length; ++i) { + StringMapWrapper.set(res, keys[i], values[i]); + } + return res; + } + switch (keys.length) { + case 0: + return (function() { + return []; + }); + case 1: + return (function(a1) { + return buildMap([a1]); + }); + case 2: + return (function(a1, a2) { + return buildMap([a1, a2]); + }); + case 3: + return (function(a1, a2, a3) { + return buildMap([a1, a2, a3]); + }); + case 4: + return (function(a1, a2, a3, a4) { + return buildMap([a1, a2, a3, a4]); + }); + case 5: + return (function(a1, a2, a3, a4, a5) { + return buildMap([a1, a2, a3, a4, a5]); + }); + case 6: + return (function(a1, a2, a3, a4, a5, a6) { + return buildMap([a1, a2, a3, a4, a5, a6]); + }); + case 7: + return (function(a1, a2, a3, a4, a5, a6, a7) { + return buildMap([a1, a2, a3, a4, a5, a6, a7]); + }); + case 8: + return (function(a1, a2, a3, a4, a5, a6, a7, a8) { + return buildMap([a1, a2, a3, a4, a5, a6, a7, a8]); + }); + case 9: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return buildMap([a1, a2, a3, a4, a5, a6, a7, a8, a9]); + }); + default: + throw new BaseException("Does not support literal maps with more than 9 elements"); + } + }, + keyedAccess: function(obj, args) { + return obj[args[0]]; + }, + unwrapValue: function(value) { + if (value instanceof WrappedValue) { + return value.wrapped; + } else { + return value; + } + }, + throwOnChange: function(proto, change) { + throw new ExpressionChangedAfterItHasBeenCheckedException(proto, change, null); + }, + throwDehydrated: function() { + throw new DehydratedException(); + }, + changeDetectionMode: function(strategy) { + return strategy == ON_PUSH ? CHECK_ONCE : CHECK_ALWAYS; + }, + simpleChange: function(previousValue, currentValue) { + return _simpleChange(previousValue, currentValue); + }, + addChange: function(changes, propertyName, change) { + if (isBlank(changes)) { + changes = {}; + } + changes[propertyName] = change; + return changes; + }, + isValueBlank: function(value) { + return isBlank(value); + }, + s: function(value) { + return isPresent(value) ? ("" + value) : ''; + } + }); + }()); + $__export("ChangeDetectionUtil", ChangeDetectionUtil); + ChangeDetectionUtil.uninitialized = CONST_EXPR(new Object()); + } + }; +}); + +System.register("angular2/src/change_detection/proto_change_detector", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/parser/ast", "angular2/src/change_detection/change_detection_util", "angular2/src/change_detection/dynamic_change_detector", "angular2/src/change_detection/directive_record", "angular2/src/change_detection/coalesce", "angular2/src/change_detection/proto_record"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/proto_change_detector"; + var BaseException, + isPresent, + isString, + ListWrapper, + ImplicitReceiver, + ChangeDetectionUtil, + DynamicChangeDetector, + DirectiveIndex, + coalesce, + ProtoRecord, + RecordType, + DynamicProtoChangeDetector, + ProtoRecordBuilder, + _ConvertAstIntoProtoRecords; + function _arrayFn(length) { + switch (length) { + case 0: + return ChangeDetectionUtil.arrayFn0; + case 1: + return ChangeDetectionUtil.arrayFn1; + case 2: + return ChangeDetectionUtil.arrayFn2; + case 3: + return ChangeDetectionUtil.arrayFn3; + case 4: + return ChangeDetectionUtil.arrayFn4; + case 5: + return ChangeDetectionUtil.arrayFn5; + case 6: + return ChangeDetectionUtil.arrayFn6; + case 7: + return ChangeDetectionUtil.arrayFn7; + case 8: + return ChangeDetectionUtil.arrayFn8; + case 9: + return ChangeDetectionUtil.arrayFn9; + default: + throw new BaseException("Does not support literal maps with more than 9 elements"); + } + } + function _mapPrimitiveName(keys) { + var stringifiedKeys = ListWrapper.join(ListWrapper.map(keys, (function(k) { + return isString(k) ? ("\"" + k + "\"") : ("" + k); + })), ", "); + return ("mapFn([" + stringifiedKeys + "])"); + } + function _operationToPrimitiveName(operation) { + switch (operation) { + case '+': + return "operation_add"; + case '-': + return "operation_subtract"; + case '*': + return "operation_multiply"; + case '/': + return "operation_divide"; + case '%': + return "operation_remainder"; + case '==': + return "operation_equals"; + case '!=': + return "operation_not_equals"; + case '===': + return "operation_identical"; + case '!==': + return "operation_not_identical"; + case '<': + return "operation_less_then"; + case '>': + return "operation_greater_then"; + case '<=': + return "operation_less_or_equals_then"; + case '>=': + return "operation_greater_or_equals_then"; + case '&&': + return "operation_logical_and"; + case '||': + return "operation_logical_or"; + default: + throw new BaseException(("Unsupported operation " + operation)); + } + } + function _operationToFunction(operation) { + switch (operation) { + case '+': + return ChangeDetectionUtil.operation_add; + case '-': + return ChangeDetectionUtil.operation_subtract; + case '*': + return ChangeDetectionUtil.operation_multiply; + case '/': + return ChangeDetectionUtil.operation_divide; + case '%': + return ChangeDetectionUtil.operation_remainder; + case '==': + return ChangeDetectionUtil.operation_equals; + case '!=': + return ChangeDetectionUtil.operation_not_equals; + case '===': + return ChangeDetectionUtil.operation_identical; + case '!==': + return ChangeDetectionUtil.operation_not_identical; + case '<': + return ChangeDetectionUtil.operation_less_then; + case '>': + return ChangeDetectionUtil.operation_greater_then; + case '<=': + return ChangeDetectionUtil.operation_less_or_equals_then; + case '>=': + return ChangeDetectionUtil.operation_greater_or_equals_then; + case '&&': + return ChangeDetectionUtil.operation_logical_and; + case '||': + return ChangeDetectionUtil.operation_logical_or; + default: + throw new BaseException(("Unsupported operation " + operation)); + } + } + function s(v) { + return isPresent(v) ? ("" + v) : ''; + } + function _interpolationFn(strings) { + var length = strings.length; + var c0 = length > 0 ? strings[0] : null; + var c1 = length > 1 ? strings[1] : null; + var c2 = length > 2 ? strings[2] : null; + var c3 = length > 3 ? strings[3] : null; + var c4 = length > 4 ? strings[4] : null; + var c5 = length > 5 ? strings[5] : null; + var c6 = length > 6 ? strings[6] : null; + var c7 = length > 7 ? strings[7] : null; + var c8 = length > 8 ? strings[8] : null; + var c9 = length > 9 ? strings[9] : null; + switch (length - 1) { + case 1: + return (function(a1) { + return c0 + s(a1) + c1; + }); + case 2: + return (function(a1, a2) { + return c0 + s(a1) + c1 + s(a2) + c2; + }); + case 3: + return (function(a1, a2, a3) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3; + }); + case 4: + return (function(a1, a2, a3, a4) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4; + }); + case 5: + return (function(a1, a2, a3, a4, a5) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5; + }); + case 6: + return (function(a1, a2, a3, a4, a5, a6) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6; + }); + case 7: + return (function(a1, a2, a3, a4, a5, a6, a7) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7; + }); + case 8: + return (function(a1, a2, a3, a4, a5, a6, a7, a8) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7 + s(a8) + c8; + }); + case 9: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7 + s(a8) + c8 + s(a9) + c9; + }); + default: + throw new BaseException("Does not support more than 9 expressions"); + } + } + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + isPresent = $__m.isPresent; + isString = $__m.isString; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + ImplicitReceiver = $__m.ImplicitReceiver; + }, function($__m) { + ChangeDetectionUtil = $__m.ChangeDetectionUtil; + }, function($__m) { + DynamicChangeDetector = $__m.DynamicChangeDetector; + }, function($__m) { + DirectiveIndex = $__m.DirectiveIndex; + }, function($__m) { + coalesce = $__m.coalesce; + }, function($__m) { + ProtoRecord = $__m.ProtoRecord; + RecordType = $__m.RecordType; + }], + execute: function() { + DynamicProtoChangeDetector = (function() { + function DynamicProtoChangeDetector(definition) { + this.definition = definition; + this._records = this._createRecords(definition); + } + return ($traceurRuntime.createClass)(DynamicProtoChangeDetector, { + instantiate: function(dispatcher) { + return new DynamicChangeDetector(this.definition.id, this.definition.strategy, dispatcher, this._records, this.definition.directiveRecords); + }, + _createRecords: function(definition) { + var recordBuilder = new ProtoRecordBuilder(); + ListWrapper.forEach(definition.bindingRecords, (function(b) { + recordBuilder.add(b, definition.variableNames); + })); + return coalesce(recordBuilder.records); + } + }, {}); + }()); + $__export("DynamicProtoChangeDetector", DynamicProtoChangeDetector); + ProtoRecordBuilder = (function() { + function ProtoRecordBuilder() { + this.records = []; + } + return ($traceurRuntime.createClass)(ProtoRecordBuilder, { + add: function(b) { + var variableNames = arguments[1] !== (void 0) ? arguments[1] : null; + var oldLast = ListWrapper.last(this.records); + if (isPresent(oldLast) && oldLast.bindingRecord.directiveRecord == b.directiveRecord) { + oldLast.lastInDirective = false; + } + this._appendRecords(b, variableNames); + var newLast = ListWrapper.last(this.records); + if (isPresent(newLast) && newLast !== oldLast) { + newLast.lastInBinding = true; + newLast.lastInDirective = true; + } + }, + _appendRecords: function(b, variableNames) { + if (b.isDirectiveLifecycle()) { + this.records.push(new ProtoRecord(RecordType.DIRECTIVE_LIFECYCLE, b.lifecycleEvent, null, [], [], -1, null, this.records.length + 1, b, null, false, false)); + } else { + _ConvertAstIntoProtoRecords.append(this.records, b, variableNames); + } + } + }, {}); + }()); + $__export("ProtoRecordBuilder", ProtoRecordBuilder); + _ConvertAstIntoProtoRecords = (function() { + function _ConvertAstIntoProtoRecords(_records, _bindingRecord, _expressionAsString, _variableNames) { + this._records = _records; + this._bindingRecord = _bindingRecord; + this._expressionAsString = _expressionAsString; + this._variableNames = _variableNames; + } + return ($traceurRuntime.createClass)(_ConvertAstIntoProtoRecords, { + visitImplicitReceiver: function(ast) { + return this._bindingRecord.implicitReceiver; + }, + visitInterpolation: function(ast) { + var args = this._visitAll(ast.expressions); + return this._addRecord(RecordType.INTERPOLATE, "interpolate", _interpolationFn(ast.strings), args, ast.strings, 0); + }, + visitLiteralPrimitive: function(ast) { + return this._addRecord(RecordType.CONST, "literal", ast.value, [], null, 0); + }, + visitAccessMember: function(ast) { + var receiver = ast.receiver.visit(this); + if (isPresent(this._variableNames) && ListWrapper.contains(this._variableNames, ast.name) && ast.receiver instanceof ImplicitReceiver) { + return this._addRecord(RecordType.LOCAL, ast.name, ast.name, [], null, receiver); + } else { + return this._addRecord(RecordType.PROPERTY, ast.name, ast.getter, [], null, receiver); + } + }, + visitSafeAccessMember: function(ast) { + var receiver = ast.receiver.visit(this); + return this._addRecord(RecordType.SAFE_PROPERTY, ast.name, ast.getter, [], null, receiver); + }, + visitMethodCall: function(ast) { + var receiver = ast.receiver.visit(this); + var args = this._visitAll(ast.args); + if (isPresent(this._variableNames) && ListWrapper.contains(this._variableNames, ast.name)) { + var target = this._addRecord(RecordType.LOCAL, ast.name, ast.name, [], null, receiver); + return this._addRecord(RecordType.INVOKE_CLOSURE, "closure", null, args, null, target); + } else { + return this._addRecord(RecordType.INVOKE_METHOD, ast.name, ast.fn, args, null, receiver); + } + }, + visitSafeMethodCall: function(ast) { + var receiver = ast.receiver.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(RecordType.SAFE_INVOKE_METHOD, ast.name, ast.fn, args, null, receiver); + }, + visitFunctionCall: function(ast) { + var target = ast.target.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(RecordType.INVOKE_CLOSURE, "closure", null, args, null, target); + }, + visitLiteralArray: function(ast) { + var primitiveName = ("arrayFn" + ast.expressions.length); + return this._addRecord(RecordType.PRIMITIVE_OP, primitiveName, _arrayFn(ast.expressions.length), this._visitAll(ast.expressions), null, 0); + }, + visitLiteralMap: function(ast) { + return this._addRecord(RecordType.PRIMITIVE_OP, _mapPrimitiveName(ast.keys), ChangeDetectionUtil.mapFn(ast.keys), this._visitAll(ast.values), null, 0); + }, + visitBinary: function(ast) { + var left = ast.left.visit(this); + var right = ast.right.visit(this); + return this._addRecord(RecordType.PRIMITIVE_OP, _operationToPrimitiveName(ast.operation), _operationToFunction(ast.operation), [left, right], null, 0); + }, + visitPrefixNot: function(ast) { + var exp = ast.expression.visit(this); + return this._addRecord(RecordType.PRIMITIVE_OP, "operation_negate", ChangeDetectionUtil.operation_negate, [exp], null, 0); + }, + visitConditional: function(ast) { + var c = ast.condition.visit(this); + var t = ast.trueExp.visit(this); + var f = ast.falseExp.visit(this); + return this._addRecord(RecordType.PRIMITIVE_OP, "cond", ChangeDetectionUtil.cond, [c, t, f], null, 0); + }, + visitPipe: function(ast) { + var value = ast.exp.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(RecordType.PIPE, ast.name, ast.name, args, null, value); + }, + visitKeyedAccess: function(ast) { + var obj = ast.obj.visit(this); + var key = ast.key.visit(this); + return this._addRecord(RecordType.KEYED_ACCESS, "keyedAccess", ChangeDetectionUtil.keyedAccess, [key], null, obj); + }, + visitAssignment: function(ast) { + throw new BaseException('Not supported'); + }, + visitChain: function(ast) { + throw new BaseException('Not supported'); + }, + visitIf: function(ast) { + throw new BaseException('Not supported'); + }, + _visitAll: function(asts) { + var res = ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }, + _addRecord: function(type, name, funcOrValue, args, fixedArgs, context) { + var selfIndex = this._records.length + 1; + if (context instanceof DirectiveIndex) { + this._records.push(new ProtoRecord(type, name, funcOrValue, args, fixedArgs, -1, context, selfIndex, this._bindingRecord, this._expressionAsString, false, false)); + } else { + this._records.push(new ProtoRecord(type, name, funcOrValue, args, fixedArgs, context, null, selfIndex, this._bindingRecord, this._expressionAsString, false, false)); + } + return selfIndex; + } + }, {append: function(records, b, variableNames) { + var c = new _ConvertAstIntoProtoRecords(records, b, b.ast.toString(), variableNames); + b.ast.visit(c); + }}); + }()); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/limit_to_pipe", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/facade/math"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/limit_to_pipe"; + var __decorate, + __metadata, + isBlank, + isString, + isArray, + StringWrapper, + BaseException, + CONST, + ListWrapper, + Math, + LimitToPipe, + LimitToPipeFactory; + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + isString = $__m.isString; + isArray = $__m.isArray; + StringWrapper = $__m.StringWrapper; + BaseException = $__m.BaseException; + CONST = $__m.CONST; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + Math = $__m.Math; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + LimitToPipe = (function() { + function LimitToPipe() {} + return ($traceurRuntime.createClass)(LimitToPipe, { + supports: function(obj) { + return LimitToPipe.supportsObj(obj); + }, + transform: function(value) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + if (isBlank(args) || args.length == 0) { + throw new BaseException('limitTo pipe requires one argument'); + } + var limit = args[0]; + var left = 0, + right = Math.min(limit, value.length); + if (limit < 0) { + left = Math.max(0, value.length + limit); + right = value.length; + } + if (isString(value)) { + return StringWrapper.substring(value, left, right); + } + return ListWrapper.slice(value, left, right); + }, + onDestroy: function() {} + }, {supportsObj: function(obj) { + return isString(obj) || isArray(obj); + }}); + }()); + $__export("LimitToPipe", LimitToPipe); + LimitToPipeFactory = (($traceurRuntime.createClass)(function() {}, { + supports: function(obj) { + return LimitToPipe.supportsObj(obj); + }, + create: function(cdRef) { + return new LimitToPipe(); + } + }, {})); + $__export("LimitToPipeFactory", LimitToPipeFactory); + $__export("LimitToPipeFactory", LimitToPipeFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], LimitToPipeFactory)); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/date_pipe", ["angular2/src/facade/lang", "angular2/src/facade/intl", "angular2/src/facade/collection", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/date_pipe"; + var __decorate, + __metadata, + isDate, + isNumber, + isPresent, + DateWrapper, + CONST, + DateFormatter, + StringMapWrapper, + BasePipe, + defaultLocale, + DatePipe; + return { + setters: [function($__m) { + isDate = $__m.isDate; + isNumber = $__m.isNumber; + isPresent = $__m.isPresent; + DateWrapper = $__m.DateWrapper; + CONST = $__m.CONST; + }, function($__m) { + DateFormatter = $__m.DateFormatter; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + BasePipe = $__m.BasePipe; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + defaultLocale = 'en-US'; + DatePipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, { + transform: function(value, args) { + var pattern = isPresent(args) && args.length > 0 ? args[0] : 'mediumDate'; + if (isNumber(value)) { + value = DateWrapper.fromMillis(value); + } + if (StringMapWrapper.contains(DatePipe._ALIASES, pattern)) { + pattern = StringMapWrapper.get(DatePipe._ALIASES, pattern); + } + return DateFormatter.format(value, defaultLocale, pattern); + }, + supports: function(obj) { + return isDate(obj) || isNumber(obj); + }, + create: function(cdRef) { + return this; + } + }, {}, $__super); + }(BasePipe)); + $__export("DatePipe", DatePipe); + DatePipe._ALIASES = { + 'medium': 'yMMMdjms', + 'short': 'yMdjm', + 'fullDate': 'yMMMMEEEEd', + 'longDate': 'yMMMMd', + 'mediumDate': 'yMMMd', + 'shortDate': 'yMd', + 'mediumTime': 'jms', + 'shortTime': 'jm' + }; + $__export("DatePipe", DatePipe = __decorate([CONST(), __metadata('design:paramtypes', [])], DatePipe)); + } + }; +}); + +System.register("angular2/src/core/compiler/view", ["angular2/src/facade/collection", "angular2/src/change_detection/change_detection", "angular2/src/core/compiler/element_binder", "angular2/src/facade/lang", "angular2/src/core/compiler/view_ref"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view"; + var ListWrapper, + MapWrapper, + Map, + StringMapWrapper, + Locals, + ElementBinder, + isPresent, + isBlank, + BaseException, + ViewRef, + ProtoViewRef, + internalView, + AppProtoViewMergeMapping, + AppViewContainer, + AppView, + DebugContext, + _Context, + EventEvaluationError, + AppProtoView; + function inverseIndexMapping(input, resultLength) { + var result = ListWrapper.createGrowableSize(resultLength); + for (var i = 0; i < input.length; i++) { + var value = input[i]; + if (isPresent(value)) { + result[input[i]] = i; + } + } + return result; + } + function _localsToStringMap(locals) { + var res = {}; + var c = locals; + while (isPresent(c)) { + res = StringMapWrapper.merge(res, MapWrapper.toStringMap(c.current)); + c = c.parent; + } + return res; + } + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + MapWrapper = $__m.MapWrapper; + Map = $__m.Map; + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + Locals = $__m.Locals; + }, function($__m) { + ElementBinder = $__m.ElementBinder; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + ViewRef = $__m.ViewRef; + ProtoViewRef = $__m.ProtoViewRef; + internalView = $__m.internalView; + }], + execute: function() { + AppProtoViewMergeMapping = (function() { + function AppProtoViewMergeMapping(renderProtoViewMergeMapping) { + this.renderProtoViewRef = renderProtoViewMergeMapping.mergedProtoViewRef; + this.renderFragmentCount = renderProtoViewMergeMapping.fragmentCount; + this.renderElementIndices = renderProtoViewMergeMapping.mappedElementIndices; + this.renderInverseElementIndices = inverseIndexMapping(this.renderElementIndices, renderProtoViewMergeMapping.mappedElementCount); + this.renderTextIndices = renderProtoViewMergeMapping.mappedTextIndices; + this.hostElementIndicesByViewIndex = renderProtoViewMergeMapping.hostElementIndicesByViewIndex; + this.nestedViewIndicesByElementIndex = inverseIndexMapping(this.hostElementIndicesByViewIndex, this.renderElementIndices.length); + this.nestedViewCountByViewIndex = renderProtoViewMergeMapping.nestedViewCountByViewIndex; + } + return ($traceurRuntime.createClass)(AppProtoViewMergeMapping, {}, {}); + }()); + $__export("AppProtoViewMergeMapping", AppProtoViewMergeMapping); + AppViewContainer = (function() { + function AppViewContainer() { + this.views = []; + } + return ($traceurRuntime.createClass)(AppViewContainer, {}, {}); + }()); + $__export("AppViewContainer", AppViewContainer); + AppView = (function() { + function AppView(renderer, proto, mainMergeMapping, viewOffset, elementOffset, textOffset, protoLocals, render, renderFragment) { + this.renderer = renderer; + this.proto = proto; + this.mainMergeMapping = mainMergeMapping; + this.viewOffset = viewOffset; + this.elementOffset = elementOffset; + this.textOffset = textOffset; + this.render = render; + this.renderFragment = renderFragment; + this.views = null; + this.elementInjectors = null; + this.viewContainers = null; + this.preBuiltObjects = null; + this.changeDetector = null; + this.context = null; + this.ref = new ViewRef(this); + this.locals = new Locals(null, MapWrapper.clone(protoLocals)); + } + return ($traceurRuntime.createClass)(AppView, { + init: function(changeDetector, elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers) { + this.changeDetector = changeDetector; + this.elementInjectors = elementInjectors; + this.rootElementInjectors = rootElementInjectors; + this.preBuiltObjects = preBuiltObjects; + this.views = views; + this.elementRefs = elementRefs; + this.viewContainers = viewContainers; + }, + setLocal: function(contextName, value) { + if (!this.hydrated()) + throw new BaseException('Cannot set locals on dehydrated view.'); + if (!this.proto.variableBindings.has(contextName)) { + return ; + } + var templateName = this.proto.variableBindings.get(contextName); + this.locals.set(templateName, value); + }, + hydrated: function() { + return isPresent(this.context); + }, + triggerEventHandlers: function(eventName, eventObj, boundElementIndex) { + var locals = new Map(); + locals.set('$event', eventObj); + this.dispatchEvent(boundElementIndex, eventName, locals); + }, + notifyOnBinding: function(b, currentValue) { + if (b.isTextNode()) { + this.renderer.setText(this.render, this.mainMergeMapping.renderTextIndices[b.elementIndex + this.textOffset], currentValue); + } else { + var elementRef = this.elementRefs[this.elementOffset + b.elementIndex]; + if (b.isElementProperty()) { + this.renderer.setElementProperty(elementRef, b.propertyName, currentValue); + } else if (b.isElementAttribute()) { + this.renderer.setElementAttribute(elementRef, b.propertyName, currentValue); + } else if (b.isElementClass()) { + this.renderer.setElementClass(elementRef, b.propertyName, currentValue); + } else if (b.isElementStyle()) { + var unit = isPresent(b.propertyUnit) ? b.propertyUnit : ''; + this.renderer.setElementStyle(elementRef, b.propertyName, ("" + currentValue + unit)); + } else { + throw new BaseException('Unsupported directive record'); + } + } + }, + notifyOnAllChangesDone: function() { + var eiCount = this.proto.elementBinders.length; + var ei = this.elementInjectors; + for (var i = eiCount - 1; i >= 0; i--) { + if (isPresent(ei[i + this.elementOffset])) + ei[i + this.elementOffset].onAllChangesDone(); + } + }, + getDirectiveFor: function(directive) { + var elementInjector = this.elementInjectors[this.elementOffset + directive.elementIndex]; + return elementInjector.getDirectiveAtIndex(directive.directiveIndex); + }, + getNestedView: function(boundElementIndex) { + var viewIndex = this.mainMergeMapping.nestedViewIndicesByElementIndex[boundElementIndex]; + return isPresent(viewIndex) ? this.views[viewIndex] : null; + }, + getHostElement: function() { + var boundElementIndex = this.mainMergeMapping.hostElementIndicesByViewIndex[this.viewOffset]; + return isPresent(boundElementIndex) ? this.elementRefs[boundElementIndex] : null; + }, + getDebugContext: function(elementIndex, directiveIndex) { + try { + var offsettedIndex = this.elementOffset + elementIndex; + var hasRefForIndex = offsettedIndex < this.elementRefs.length; + var elementRef = hasRefForIndex ? this.elementRefs[this.elementOffset + elementIndex] : null; + var host = this.getHostElement(); + var ei = hasRefForIndex ? this.elementInjectors[this.elementOffset + elementIndex] : null; + var element = isPresent(elementRef) ? elementRef.nativeElement : null; + var componentElement = isPresent(host) ? host.nativeElement : null; + var directive = isPresent(directiveIndex) ? this.getDirectiveFor(directiveIndex) : null; + var injector = isPresent(ei) ? ei.getInjector() : null; + return new DebugContext(element, componentElement, directive, this.context, _localsToStringMap(this.locals), injector); + } catch (e) { + return null; + } + }, + getDetectorFor: function(directive) { + var childView = this.getNestedView(this.elementOffset + directive.elementIndex); + return isPresent(childView) ? childView.changeDetector : null; + }, + invokeElementMethod: function(elementIndex, methodName, args) { + this.renderer.invokeElementMethod(this.elementRefs[elementIndex], methodName, args); + }, + dispatchRenderEvent: function(renderElementIndex, eventName, locals) { + var elementRef = this.elementRefs[this.mainMergeMapping.renderInverseElementIndices[renderElementIndex]]; + var view = internalView(elementRef.parentView); + return view.dispatchEvent(elementRef.boundElementIndex, eventName, locals); + }, + dispatchEvent: function(boundElementIndex, eventName, locals) { + var $__0 = this; + try { + var allowDefaultBehavior = true; + if (this.hydrated()) { + var elBinder = this.proto.elementBinders[boundElementIndex - this.elementOffset]; + if (isBlank(elBinder.hostListeners)) + return allowDefaultBehavior; + var eventMap = elBinder.hostListeners[eventName]; + if (isBlank(eventMap)) + return allowDefaultBehavior; + MapWrapper.forEach(eventMap, (function(expr, directiveIndex) { + var context; + if (directiveIndex === -1) { + context = $__0.context; + } else { + context = $__0.elementInjectors[boundElementIndex].getDirectiveAtIndex(directiveIndex); + } + var result = expr.eval(context, new Locals($__0.locals, locals)); + if (isPresent(result)) { + allowDefaultBehavior = allowDefaultBehavior && result == true; + } + })); + } + return allowDefaultBehavior; + } catch (e) { + var c = this.getDebugContext(boundElementIndex - this.elementOffset, null); + var context = isPresent(c) ? new _Context(c.element, c.componentElement, c.context, c.locals, c.injector) : null; + throw new EventEvaluationError(eventName, e, e.stack, context); + } + } + }, {}); + }()); + $__export("AppView", AppView); + DebugContext = (function() { + function DebugContext(element, componentElement, directive, context, locals, injector) { + this.element = element; + this.componentElement = componentElement; + this.directive = directive; + this.context = context; + this.locals = locals; + this.injector = injector; + } + return ($traceurRuntime.createClass)(DebugContext, {}, {}); + }()); + $__export("DebugContext", DebugContext); + _Context = (function() { + function _Context(element, componentElement, context, locals, injector) { + this.element = element; + this.componentElement = componentElement; + this.context = context; + this.locals = locals; + this.injector = injector; + } + return ($traceurRuntime.createClass)(_Context, {}, {}); + }()); + EventEvaluationError = (function($__super) { + function EventEvaluationError(eventName, originalException, originalStack, context) { + $traceurRuntime.superConstructor(EventEvaluationError).call(this, ("Error during evaluation of \"" + eventName + "\""), originalException, originalStack, context); + } + return ($traceurRuntime.createClass)(EventEvaluationError, {}, {}, $__super); + }(BaseException)); + AppProtoView = (function() { + function AppProtoView(type, isEmbeddedFragment, render, protoChangeDetector, variableBindings, variableLocations, textBindingCount) { + var $__0 = this; + this.type = type; + this.isEmbeddedFragment = isEmbeddedFragment; + this.render = render; + this.protoChangeDetector = protoChangeDetector; + this.variableBindings = variableBindings; + this.variableLocations = variableLocations; + this.textBindingCount = textBindingCount; + this.elementBinders = []; + this.protoLocals = new Map(); + this.ref = new ProtoViewRef(this); + if (isPresent(variableBindings)) { + MapWrapper.forEach(variableBindings, (function(templateName, _) { + $__0.protoLocals.set(templateName, null); + })); + } + } + return ($traceurRuntime.createClass)(AppProtoView, { + bindElement: function(parent, distanceToParent, protoElementInjector) { + var componentDirective = arguments[3] !== (void 0) ? arguments[3] : null; + var elBinder = new ElementBinder(this.elementBinders.length, parent, distanceToParent, protoElementInjector, componentDirective); + this.elementBinders.push(elBinder); + return elBinder; + }, + bindEvent: function(eventBindings, boundElementIndex) { + var directiveIndex = arguments[2] !== (void 0) ? arguments[2] : -1; + var elBinder = this.elementBinders[boundElementIndex]; + var events = elBinder.hostListeners; + if (isBlank(events)) { + events = StringMapWrapper.create(); + elBinder.hostListeners = events; + } + for (var i = 0; i < eventBindings.length; i++) { + var eventBinding = eventBindings[i]; + var eventName = eventBinding.fullName; + var event = StringMapWrapper.get(events, eventName); + if (isBlank(event)) { + event = new Map(); + StringMapWrapper.set(events, eventName, event); + } + event.set(directiveIndex, eventBinding.source); + } + } + }, {}); + }()); + $__export("AppProtoView", AppProtoView); + } + }; +}); + +System.register("angular2/src/core/compiler/view_manager_utils", ["angular2/di", "angular2/src/facade/collection", "angular2/src/core/compiler/element_injector", "angular2/src/facade/lang", "angular2/src/core/compiler/view", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/render/api"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view_manager_utils"; + var __decorate, + __metadata, + Injector, + Injectable, + ListWrapper, + MapWrapper, + eli, + isPresent, + isBlank, + viewModule, + internalView, + ElementRef, + TemplateRef, + ViewType, + AppViewManagerUtils; + return { + setters: [function($__m) { + Injector = $__m.Injector; + Injectable = $__m.Injectable; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + MapWrapper = $__m.MapWrapper; + }, function($__m) { + eli = $__m; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + }, function($__m) { + viewModule = $__m; + }, function($__m) { + internalView = $__m.internalView; + }, function($__m) { + ElementRef = $__m.ElementRef; + }, function($__m) { + TemplateRef = $__m.TemplateRef; + }, function($__m) { + ViewType = $__m.ViewType; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + AppViewManagerUtils = (($traceurRuntime.createClass)(function() {}, { + getComponentInstance: function(parentView, boundElementIndex) { + var eli = parentView.elementInjectors[boundElementIndex]; + return eli.getComponent(); + }, + createView: function(mergedParentViewProto, renderViewWithFragments, viewManager, renderer) { + var renderFragments = renderViewWithFragments.fragmentRefs; + var renderView = renderViewWithFragments.viewRef; + var elementCount = mergedParentViewProto.mergeMapping.renderElementIndices.length; + var viewCount = mergedParentViewProto.mergeMapping.nestedViewCountByViewIndex[0] + 1; + var elementRefs = ListWrapper.createFixedSize(elementCount); + var viewContainers = ListWrapper.createFixedSize(elementCount); + var preBuiltObjects = ListWrapper.createFixedSize(elementCount); + var elementInjectors = ListWrapper.createFixedSize(elementCount); + var views = ListWrapper.createFixedSize(viewCount); + var elementOffset = 0; + var textOffset = 0; + var fragmentIdx = 0; + for (var viewOffset = 0; viewOffset < viewCount; viewOffset++) { + var hostElementIndex = mergedParentViewProto.mergeMapping.hostElementIndicesByViewIndex[viewOffset]; + var parentView = isPresent(hostElementIndex) ? internalView(elementRefs[hostElementIndex].parentView) : null; + var protoView = isPresent(hostElementIndex) ? parentView.proto.elementBinders[hostElementIndex - parentView.elementOffset].nestedProtoView : mergedParentViewProto; + var renderFragment = null; + if (viewOffset === 0 || protoView.type === ViewType.EMBEDDED) { + renderFragment = renderFragments[fragmentIdx++]; + } + var currentView = new viewModule.AppView(renderer, protoView, mergedParentViewProto.mergeMapping, viewOffset, elementOffset, textOffset, protoView.protoLocals, renderView, renderFragment); + views[viewOffset] = currentView; + var rootElementInjectors = []; + for (var binderIdx = 0; binderIdx < protoView.elementBinders.length; binderIdx++) { + var binder = protoView.elementBinders[binderIdx]; + var boundElementIndex = elementOffset + binderIdx; + var elementInjector = null; + var protoElementInjector = binder.protoElementInjector; + if (isPresent(protoElementInjector)) { + if (isPresent(protoElementInjector.parent)) { + var parentElementInjector = elementInjectors[elementOffset + protoElementInjector.parent.index]; + elementInjector = protoElementInjector.instantiate(parentElementInjector); + } else { + elementInjector = protoElementInjector.instantiate(null); + rootElementInjectors.push(elementInjector); + } + } + elementInjectors[boundElementIndex] = elementInjector; + var el = new ElementRef(currentView.ref, boundElementIndex, mergedParentViewProto.mergeMapping.renderElementIndices[boundElementIndex], renderer); + elementRefs[el.boundElementIndex] = el; + if (isPresent(elementInjector)) { + var templateRef = binder.hasEmbeddedProtoView() ? new TemplateRef(el) : null; + preBuiltObjects[boundElementIndex] = new eli.PreBuiltObjects(viewManager, currentView, el, templateRef); + } + } + currentView.init(protoView.protoChangeDetector.instantiate(currentView), elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers); + if (isPresent(parentView) && protoView.type === ViewType.COMPONENT) { + parentView.changeDetector.addShadowDomChild(currentView.changeDetector); + } + elementOffset += protoView.elementBinders.length; + textOffset += protoView.textBindingCount; + } + return views[0]; + }, + hydrateRootHostView: function(hostView, injector) { + this._hydrateView(hostView, injector, null, new Object(), null); + }, + attachViewInContainer: function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view) { + if (isBlank(contextView)) { + contextView = parentView; + contextBoundElementIndex = boundElementIndex; + } + parentView.changeDetector.addChild(view.changeDetector); + var viewContainer = parentView.viewContainers[boundElementIndex]; + if (isBlank(viewContainer)) { + viewContainer = new viewModule.AppViewContainer(); + parentView.viewContainers[boundElementIndex] = viewContainer; + } + ListWrapper.insert(viewContainer.views, atIndex, view); + var sibling; + if (atIndex == 0) { + sibling = null; + } else { + sibling = ListWrapper.last(viewContainer.views[atIndex - 1].rootElementInjectors); + } + var elementInjector = contextView.elementInjectors[contextBoundElementIndex]; + for (var i = view.rootElementInjectors.length - 1; i >= 0; i--) { + if (isPresent(elementInjector.parent)) { + view.rootElementInjectors[i].linkAfter(elementInjector.parent, sibling); + } else { + contextView.rootElementInjectors.push(view.rootElementInjectors[i]); + } + } + }, + detachViewInContainer: function(parentView, boundElementIndex, atIndex) { + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + view.changeDetector.remove(); + ListWrapper.removeAt(viewContainer.views, atIndex); + for (var i = 0; i < view.rootElementInjectors.length; ++i) { + var inj = view.rootElementInjectors[i]; + if (isPresent(inj.parent)) { + inj.unlink(); + } else { + var removeIdx = ListWrapper.indexOf(parentView.rootElementInjectors, inj); + if (removeIdx >= 0) { + ListWrapper.removeAt(parentView.rootElementInjectors, removeIdx); + } + } + } + }, + hydrateViewInContainer: function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, imperativelyCreatedBindings) { + if (isBlank(contextView)) { + contextView = parentView; + contextBoundElementIndex = boundElementIndex; + } + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + var elementInjector = contextView.elementInjectors[contextBoundElementIndex]; + var injector = isPresent(imperativelyCreatedBindings) ? Injector.fromResolvedBindings(imperativelyCreatedBindings) : null; + this._hydrateView(view, injector, elementInjector.getHost(), contextView.context, contextView.locals); + }, + _hydrateView: function(initView, imperativelyCreatedInjector, hostElementInjector, context, parentLocals) { + var viewIdx = initView.viewOffset; + var endViewOffset = viewIdx + initView.mainMergeMapping.nestedViewCountByViewIndex[viewIdx]; + while (viewIdx <= endViewOffset) { + var currView = initView.views[viewIdx]; + var currProtoView = currView.proto; + if (currView !== initView && currView.proto.type === ViewType.EMBEDDED) { + viewIdx += initView.mainMergeMapping.nestedViewCountByViewIndex[viewIdx] + 1; + } else { + if (currView !== initView) { + imperativelyCreatedInjector = null; + parentLocals = null; + var hostElementIndex = initView.mainMergeMapping.hostElementIndicesByViewIndex[viewIdx]; + hostElementInjector = initView.elementInjectors[hostElementIndex]; + context = hostElementInjector.getComponent(); + } + currView.context = context; + currView.locals.parent = parentLocals; + var binders = currProtoView.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var boundElementIndex = binderIdx + currView.elementOffset; + var elementInjector = initView.elementInjectors[boundElementIndex]; + if (isPresent(elementInjector)) { + elementInjector.hydrate(imperativelyCreatedInjector, hostElementInjector, currView.preBuiltObjects[boundElementIndex]); + this._populateViewLocals(currView, elementInjector, boundElementIndex); + this._setUpEventEmitters(currView, elementInjector, boundElementIndex); + this._setUpHostActions(currView, elementInjector, boundElementIndex); + } + } + var pipes = this._getPipes(imperativelyCreatedInjector, hostElementInjector); + currView.changeDetector.hydrate(currView.context, currView.locals, currView, pipes); + viewIdx++; + } + } + }, + _getPipes: function(imperativelyCreatedInjector, hostElementInjector) { + var pipesKey = eli.StaticKeys.instance().pipesKey; + if (isPresent(imperativelyCreatedInjector)) + return imperativelyCreatedInjector.getOptional(pipesKey); + if (isPresent(hostElementInjector)) + return hostElementInjector.getPipes(); + return null; + }, + _populateViewLocals: function(view, elementInjector, boundElementIdx) { + if (isPresent(elementInjector.getDirectiveVariableBindings())) { + MapWrapper.forEach(elementInjector.getDirectiveVariableBindings(), (function(directiveIndex, name) { + if (isBlank(directiveIndex)) { + view.locals.set(name, view.elementRefs[boundElementIdx].nativeElement); + } else { + view.locals.set(name, elementInjector.getDirectiveAtIndex(directiveIndex)); + } + })); + } + }, + _setUpEventEmitters: function(view, elementInjector, boundElementIndex) { + var emitters = elementInjector.getEventEmitterAccessors(); + for (var directiveIndex = 0; directiveIndex < emitters.length; ++directiveIndex) { + var directiveEmitters = emitters[directiveIndex]; + var directive = elementInjector.getDirectiveAtIndex(directiveIndex); + for (var eventIndex = 0; eventIndex < directiveEmitters.length; ++eventIndex) { + var eventEmitterAccessor = directiveEmitters[eventIndex]; + eventEmitterAccessor.subscribe(view, boundElementIndex, directive); + } + } + }, + _setUpHostActions: function(view, elementInjector, boundElementIndex) { + var hostActions = elementInjector.getHostActionAccessors(); + for (var directiveIndex = 0; directiveIndex < hostActions.length; ++directiveIndex) { + var directiveHostActions = hostActions[directiveIndex]; + var directive = elementInjector.getDirectiveAtIndex(directiveIndex); + for (var index = 0; index < directiveHostActions.length; ++index) { + var hostActionAccessor = directiveHostActions[index]; + hostActionAccessor.subscribe(view, boundElementIndex, directive); + } + } + }, + dehydrateView: function(initView) { + var endViewOffset = initView.viewOffset + initView.mainMergeMapping.nestedViewCountByViewIndex[initView.viewOffset]; + for (var viewIdx = initView.viewOffset; viewIdx <= endViewOffset; viewIdx++) { + var currView = initView.views[viewIdx]; + if (currView.hydrated()) { + if (isPresent(currView.locals)) { + currView.locals.clearValues(); + } + currView.context = null; + currView.changeDetector.dehydrate(); + var binders = currView.proto.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var eli = initView.elementInjectors[currView.elementOffset + binderIdx]; + if (isPresent(eli)) { + eli.dehydrate(); + } + } + } + } + } + }, {})); + $__export("AppViewManagerUtils", AppViewManagerUtils); + $__export("AppViewManagerUtils", AppViewManagerUtils = __decorate([Injectable(), __metadata('design:paramtypes', [])], AppViewManagerUtils)); + } + }; +}); + +System.register("angular2/src/core/compiler/view_resolver", ["angular2/di", "angular2/src/core/annotations_impl/view", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/reflection/reflection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view_resolver"; + var __decorate, + __metadata, + Injectable, + View, + stringify, + isBlank, + BaseException, + Map, + reflector, + ViewResolver; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + View = $__m.View; + }, function($__m) { + stringify = $__m.stringify; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + Map = $__m.Map; + }, function($__m) { + reflector = $__m.reflector; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + ViewResolver = (($traceurRuntime.createClass)(function() { + this._cache = new Map(); + }, { + resolve: function(component) { + var view = this._cache.get(component); + if (isBlank(view)) { + view = this._resolve(component); + this._cache.set(component, view); + } + return view; + }, + _resolve: function(component) { + var annotations = reflector.annotations(component); + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + if (annotation instanceof View) { + return annotation; + } + } + throw new BaseException(("No View annotation found on component " + stringify(component))); + } + }, {})); + $__export("ViewResolver", ViewResolver); + $__export("ViewResolver", ViewResolver = __decorate([Injectable(), __metadata('design:paramtypes', [])], ViewResolver)); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/style_inliner", ["angular2/di", "angular2/src/render/xhr", "angular2/src/facade/collection", "angular2/src/services/url_resolver", "angular2/src/render/dom/compiler/style_url_resolver", "angular2/src/facade/lang", "angular2/src/facade/async"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/style_inliner"; + var __decorate, + __metadata, + Injectable, + XHR, + ListWrapper, + UrlResolver, + StyleUrlResolver, + isBlank, + isPresent, + RegExpWrapper, + StringWrapper, + isPromise, + PromiseWrapper, + StyleInliner, + _importRe, + _urlRe, + _mediaQueryRe; + function _extractUrl(importRule) { + var match = RegExpWrapper.firstMatch(_urlRe, importRule); + if (isBlank(match)) + return null; + return isPresent(match[1]) ? match[1] : match[2]; + } + function _extractMediaQuery(importRule) { + var match = RegExpWrapper.firstMatch(_mediaQueryRe, importRule); + if (isBlank(match)) + return null; + var mediaQuery = match[1].trim(); + return (mediaQuery.length > 0) ? mediaQuery : null; + } + function _wrapInMediaRule(css, query) { + return (isBlank(query)) ? css : ("@media " + query + " {\n" + css + "\n}"); + } + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + XHR = $__m.XHR; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + UrlResolver = $__m.UrlResolver; + }, function($__m) { + StyleUrlResolver = $__m.StyleUrlResolver; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + RegExpWrapper = $__m.RegExpWrapper; + StringWrapper = $__m.StringWrapper; + isPromise = $__m.isPromise; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + StyleInliner = (($traceurRuntime.createClass)(function(_xhr, _styleUrlResolver, _urlResolver) { + this._xhr = _xhr; + this._styleUrlResolver = _styleUrlResolver; + this._urlResolver = _urlResolver; + }, { + inlineImports: function(cssText, baseUrl) { + return this._inlineImports(cssText, baseUrl, []); + }, + _inlineImports: function(cssText, baseUrl, inlinedUrls) { + var $__0 = this; + var partIndex = 0; + var parts = StringWrapper.split(cssText, _importRe); + if (parts.length === 1) { + return cssText; + } + var promises = []; + while (partIndex < parts.length - 1) { + var prefix = parts[partIndex]; + var rule = parts[partIndex + 1]; + var url = _extractUrl(rule); + if (isPresent(url)) { + url = this._urlResolver.resolve(baseUrl, url); + } + var mediaQuery = _extractMediaQuery(rule); + var promise = void 0; + if (isBlank(url)) { + promise = PromiseWrapper.resolve(("/* Invalid import rule: \"@import " + rule + ";\" */")); + } else if (ListWrapper.contains(inlinedUrls, url)) { + promise = PromiseWrapper.resolve(prefix); + } else { + inlinedUrls.push(url); + promise = PromiseWrapper.then(this._xhr.get(url), (function(rawCss) { + var inlinedCss = $__0._inlineImports(rawCss, url, inlinedUrls); + if (isPromise(inlinedCss)) { + return inlinedCss.then((function(css) { + return prefix + $__0._transformImportedCss(css, mediaQuery, url) + '\n'; + })); + } else { + return prefix + $__0._transformImportedCss(inlinedCss, mediaQuery, url) + '\n'; + } + }), (function(error) { + return ("/* failed to import " + url + " */\n"); + })); + } + promises.push(promise); + partIndex += 2; + } + return PromiseWrapper.all(promises).then(function(cssParts) { + var cssText = cssParts.join(''); + if (partIndex < parts.length) { + cssText += parts[partIndex]; + } + return cssText; + }); + }, + _transformImportedCss: function(css, mediaQuery, url) { + css = this._styleUrlResolver.resolveUrls(css, url); + return _wrapInMediaRule(css, mediaQuery); + } + }, {})); + $__export("StyleInliner", StyleInliner); + $__export("StyleInliner", StyleInliner = __decorate([Injectable(), __metadata('design:paramtypes', [XHR, StyleUrlResolver, UrlResolver])], StyleInliner)); + _importRe = /@import\s+([^;]+);/g; + _urlRe = RegExpWrapper.create('url\\(\\s*?[\'"]?([^\'")]+)[\'"]?|' + '[\'"]([^\'")]+)[\'"]'); + _mediaQueryRe = /['"][^'"]+['"]\s*\)?\s*(.*)/g; + } + }; +}); + +System.register("angular2/src/render/dom/events/hammer_gestures", ["angular2/src/render/dom/events/hammer_common", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/events/hammer_gestures"; + var HammerGesturesPluginCommon, + isPresent, + BaseException, + HammerGesturesPlugin; + return { + setters: [function($__m) { + HammerGesturesPluginCommon = $__m.HammerGesturesPluginCommon; + }, function($__m) { + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + }], + execute: function() { + HammerGesturesPlugin = (function($__super) { + function HammerGesturesPlugin() { + $traceurRuntime.superConstructor(HammerGesturesPlugin).call(this); + } + return ($traceurRuntime.createClass)(HammerGesturesPlugin, { + supports: function(eventName) { + if (!$traceurRuntime.superGet(this, HammerGesturesPlugin.prototype, "supports").call(this, eventName)) + return false; + if (!isPresent(window['Hammer'])) { + throw new BaseException(("Hammer.js is not loaded, can not bind " + eventName + " event")); + } + return true; + }, + addEventListener: function(element, eventName, handler, shouldSupportBubble) { + if (shouldSupportBubble) + throw new BaseException('Hammer.js plugin does not support bubbling gestures.'); + var zone = this.manager.getZone(); + eventName = eventName.toLowerCase(); + zone.runOutsideAngular(function() { + var mc = new Hammer(element); + mc.get('pinch').set({enable: true}); + mc.get('rotate').set({enable: true}); + mc.on(eventName, function(eventObj) { + zone.run(function() { + handler(eventObj); + }); + }); + }); + } + }, {}, $__super); + }(HammerGesturesPluginCommon)); + $__export("HammerGesturesPlugin", HammerGesturesPlugin); + } + }; +}); + +System.register("angular2/src/core/testability/testability", ["angular2/di", "angular2/src/dom/dom_adapter", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/core/testability/get_testability", "angular2/src/core/zone/ng_zone", "angular2/src/facade/async"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/testability/testability"; + var __decorate, + __metadata, + Injectable, + DOM, + Map, + BaseException, + getTestabilityModule, + NgZone, + PromiseWrapper, + Testability, + TestabilityRegistry; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + Map = $__m.Map; + }, function($__m) { + BaseException = $__m.BaseException; + }, function($__m) { + getTestabilityModule = $__m; + }, function($__m) { + NgZone = $__m.NgZone; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Testability = (($traceurRuntime.createClass)(function(_ngZone) { + this._ngZone = _ngZone; + this._pendingCount = 0; + this._callbacks = []; + this._isAngularEventPending = false; + this._watchAngularEvents(_ngZone); + }, { + _watchAngularEvents: function(_ngZone) { + var $__0 = this; + _ngZone.overrideOnTurnStart((function() { + $__0._isAngularEventPending = true; + })); + _ngZone.overrideOnEventDone((function() { + $__0._isAngularEventPending = false; + $__0._runCallbacksIfReady(); + }), true); + }, + increasePendingRequestCount: function() { + this._pendingCount += 1; + return this._pendingCount; + }, + decreasePendingRequestCount: function() { + this._pendingCount -= 1; + if (this._pendingCount < 0) { + throw new BaseException('pending async requests below zero'); + } + this._runCallbacksIfReady(); + return this._pendingCount; + }, + _runCallbacksIfReady: function() { + var $__0 = this; + if (this._pendingCount != 0 || this._isAngularEventPending) { + return ; + } + PromiseWrapper.resolve(null).then((function(_) { + while ($__0._callbacks.length !== 0) { + ($__0._callbacks.pop())(); + } + })); + }, + whenStable: function(callback) { + this._callbacks.push(callback); + this._runCallbacksIfReady(); + }, + getPendingRequestCount: function() { + return this._pendingCount; + }, + isAngularEventPending: function() { + return this._isAngularEventPending; + }, + findBindings: function(using, binding, exactMatch) { + return []; + } + }, {})); + $__export("Testability", Testability); + $__export("Testability", Testability = __decorate([Injectable(), __metadata('design:paramtypes', [NgZone])], Testability)); + TestabilityRegistry = (($traceurRuntime.createClass)(function() { + this._applications = new Map(); + getTestabilityModule.GetTestability.addToWindow(this); + }, { + registerApplication: function(token, testability) { + this._applications.set(token, testability); + }, + findTestabilityInTree: function(elem) { + if (elem == null) { + return null; + } + if (this._applications.has(elem)) { + return this._applications.get(elem); + } + if (DOM.isShadowRoot(elem)) { + return this.findTestabilityInTree(DOM.getHost(elem)); + } + return this.findTestabilityInTree(DOM.parentElement(elem)); + } + }, {})); + $__export("TestabilityRegistry", TestabilityRegistry); + $__export("TestabilityRegistry", TestabilityRegistry = __decorate([Injectable(), __metadata('design:paramtypes', [])], TestabilityRegistry)); + } + }; +}); + +System.register("angular2/src/render/dom/view/shared_styles_host", ["angular2/src/dom/dom_adapter", "angular2/di", "angular2/src/facade/collection", "angular2/src/render/dom/dom_tokens"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/view/shared_styles_host"; + var __decorate, + __metadata, + __param, + DOM, + Inject, + Injectable, + SetWrapper, + DOCUMENT_TOKEN, + SharedStylesHost, + DomSharedStylesHost; + return { + setters: [function($__m) { + DOM = $__m.DOM; + }, function($__m) { + Inject = $__m.Inject; + Injectable = $__m.Injectable; + }, function($__m) { + SetWrapper = $__m.SetWrapper; + }, function($__m) { + DOCUMENT_TOKEN = $__m.DOCUMENT_TOKEN; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + SharedStylesHost = (($traceurRuntime.createClass)(function() { + this._styles = []; + this._stylesSet = new Set(); + }, { + addStyles: function(styles) { + var $__0 = this; + var additions = []; + styles.forEach((function(style) { + if (!SetWrapper.has($__0._stylesSet, style)) { + $__0._stylesSet.add(style); + $__0._styles.push(style); + additions.push(style); + } + })); + this.onStylesAdded(additions); + }, + onStylesAdded: function(additions) {}, + getAllStyles: function() { + return this._styles; + } + }, {})); + $__export("SharedStylesHost", SharedStylesHost); + $__export("SharedStylesHost", SharedStylesHost = __decorate([Injectable(), __metadata('design:paramtypes', [])], SharedStylesHost)); + DomSharedStylesHost = (function($__super) { + function $__1(doc) { + $traceurRuntime.superConstructor($__1).call(this); + this._hostNodes = new Set(); + this._hostNodes.add(doc.head); + } + return ($traceurRuntime.createClass)($__1, { + _addStylesToHost: function(styles, host) { + for (var i = 0; i < styles.length; i++) { + var style = styles[i]; + DOM.appendChild(host, DOM.createStyleElement(style)); + } + }, + addHost: function(hostNode) { + this._addStylesToHost(this._styles, hostNode); + this._hostNodes.add(hostNode); + }, + removeHost: function(hostNode) { + SetWrapper.delete(this._hostNodes, hostNode); + }, + onStylesAdded: function(additions) { + var $__0 = this; + this._hostNodes.forEach((function(hostNode) { + $__0._addStylesToHost(additions, hostNode); + })); + } + }, {}, $__super); + }(SharedStylesHost)); + $__export("DomSharedStylesHost", DomSharedStylesHost); + $__export("DomSharedStylesHost", DomSharedStylesHost = __decorate([Injectable(), __param(0, Inject(DOCUMENT_TOKEN)), __metadata('design:paramtypes', [Object])], DomSharedStylesHost)); + } + }; +}); + +System.register("angular2/src/render/dom/view/proto_view_builder", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/dom/dom_adapter", "angular2/src/change_detection/change_detection", "angular2/src/render/dom/view/proto_view", "angular2/src/render/dom/view/element_binder", "angular2/src/render/api", "angular2/src/render/dom/util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/view/proto_view_builder"; + var isPresent, + isBlank, + BaseException, + StringWrapper, + ListWrapper, + MapWrapper, + Set, + SetWrapper, + StringMapWrapper, + DOM, + ASTWithSource, + AstTransformer, + AccessMember, + LiteralArray, + ImplicitReceiver, + DomProtoView, + DomProtoViewRef, + DomElementBinder, + Event, + api, + NG_BINDING_CLASS, + EVENT_TARGET_SEPARATOR, + queryBoundTextNodeIndices, + camelCaseToDashCase, + ProtoViewBuilder, + ElementBinderBuilder, + DirectiveBuilder, + EventBuilder, + PROPERTY_PARTS_SEPARATOR, + ATTRIBUTE_PREFIX, + CLASS_PREFIX, + STYLE_PREFIX; + function buildElementPropertyBindings(protoElement, isNgComponent, bindingsInTemplate, directiveTempaltePropertyNames) { + var propertyBindings = []; + MapWrapper.forEach(bindingsInTemplate, (function(ast, propertyNameInTemplate) { + var propertyBinding = createElementPropertyBinding(ast, propertyNameInTemplate); + if (isValidElementPropertyBinding(protoElement, isNgComponent, propertyBinding)) { + propertyBindings.push(propertyBinding); + } else if (!SetWrapper.has(directiveTempaltePropertyNames, propertyNameInTemplate)) { + throw new BaseException(("Can't bind to '" + propertyNameInTemplate + "' since it isn't a known property of the '<" + DOM.tagName(protoElement).toLowerCase() + ">' element and there are no matching directives with a corresponding property")); + } + })); + return propertyBindings; + } + function isValidElementPropertyBinding(protoElement, isNgComponent, binding) { + if (binding.type === api.PropertyBindingType.PROPERTY) { + var tagName = DOM.tagName(protoElement); + var possibleCustomElement = tagName.indexOf('-') !== -1; + if (possibleCustomElement && !isNgComponent) { + return true; + } else { + return DOM.hasProperty(protoElement, binding.property); + } + } + return true; + } + function createElementPropertyBinding(ast, propertyNameInTemplate) { + var parts = StringWrapper.split(propertyNameInTemplate, PROPERTY_PARTS_SEPARATOR); + if (parts.length === 1) { + var propName = parts[0]; + var mappedPropName = StringMapWrapper.get(DOM.attrToPropMap, propName); + propName = isPresent(mappedPropName) ? mappedPropName : propName; + return new api.ElementPropertyBinding(api.PropertyBindingType.PROPERTY, ast, propName); + } else if (parts[0] == ATTRIBUTE_PREFIX) { + return new api.ElementPropertyBinding(api.PropertyBindingType.ATTRIBUTE, ast, parts[1]); + } else if (parts[0] == CLASS_PREFIX) { + return new api.ElementPropertyBinding(api.PropertyBindingType.CLASS, ast, camelCaseToDashCase(parts[1])); + } else if (parts[0] == STYLE_PREFIX) { + var unit = parts.length > 2 ? parts[2] : null; + return new api.ElementPropertyBinding(api.PropertyBindingType.STYLE, ast, parts[1], unit); + } else { + throw new BaseException(("Invalid property name " + propertyNameInTemplate)); + } + } + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + MapWrapper = $__m.MapWrapper; + Set = $__m.Set; + SetWrapper = $__m.SetWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + ASTWithSource = $__m.ASTWithSource; + AstTransformer = $__m.AstTransformer; + AccessMember = $__m.AccessMember; + LiteralArray = $__m.LiteralArray; + ImplicitReceiver = $__m.ImplicitReceiver; + }, function($__m) { + DomProtoView = $__m.DomProtoView; + DomProtoViewRef = $__m.DomProtoViewRef; + }, function($__m) { + DomElementBinder = $__m.DomElementBinder; + Event = $__m.Event; + }, function($__m) { + api = $__m; + }, function($__m) { + NG_BINDING_CLASS = $__m.NG_BINDING_CLASS; + EVENT_TARGET_SEPARATOR = $__m.EVENT_TARGET_SEPARATOR; + queryBoundTextNodeIndices = $__m.queryBoundTextNodeIndices; + camelCaseToDashCase = $__m.camelCaseToDashCase; + }], + execute: function() { + ProtoViewBuilder = (function() { + function ProtoViewBuilder(rootElement, type, viewEncapsulation) { + this.rootElement = rootElement; + this.type = type; + this.viewEncapsulation = viewEncapsulation; + this.variableBindings = new Map(); + this.elements = []; + this.rootTextBindings = new Map(); + this.ngContentCount = 0; + this.hostAttributes = new Map(); + } + return ($traceurRuntime.createClass)(ProtoViewBuilder, { + bindElement: function(element) { + var description = arguments[1] !== (void 0) ? arguments[1] : null; + var builder = new ElementBinderBuilder(this.elements.length, element, description); + this.elements.push(builder); + DOM.addClass(element, NG_BINDING_CLASS); + return builder; + }, + bindVariable: function(name, value) { + this.variableBindings.set(value, name); + }, + bindRootText: function(textNode, expression) { + this.rootTextBindings.set(textNode, expression); + }, + bindNgContent: function() { + this.ngContentCount++; + }, + setHostAttribute: function(name, value) { + this.hostAttributes.set(name, value); + }, + build: function() { + var domElementBinders = []; + var apiElementBinders = []; + var textNodeExpressions = []; + var rootTextNodeIndices = []; + var transitiveNgContentCount = this.ngContentCount; + queryBoundTextNodeIndices(DOM.content(this.rootElement), this.rootTextBindings, (function(node, nodeIndex, expression) { + textNodeExpressions.push(expression); + rootTextNodeIndices.push(nodeIndex); + })); + ListWrapper.forEach(this.elements, (function(ebb) { + var directiveTemplatePropertyNames = new Set(); + var apiDirectiveBinders = ListWrapper.map(ebb.directives, (function(dbb) { + ebb.eventBuilder.merge(dbb.eventBuilder); + ListWrapper.forEach(dbb.templatePropertyNames, (function(name) { + return directiveTemplatePropertyNames.add(name); + })); + return new api.DirectiveBinder({ + directiveIndex: dbb.directiveIndex, + propertyBindings: dbb.propertyBindings, + eventBindings: dbb.eventBindings, + hostPropertyBindings: buildElementPropertyBindings(ebb.element, isPresent(ebb.componentId), dbb.hostPropertyBindings, directiveTemplatePropertyNames) + }); + })); + var nestedProtoView = isPresent(ebb.nestedProtoView) ? ebb.nestedProtoView.build() : null; + if (isPresent(nestedProtoView)) { + transitiveNgContentCount += nestedProtoView.transitiveNgContentCount; + } + var parentIndex = isPresent(ebb.parent) ? ebb.parent.index : -1; + var textNodeIndices = []; + queryBoundTextNodeIndices(ebb.element, ebb.textBindings, (function(node, nodeIndex, expression) { + textNodeExpressions.push(expression); + textNodeIndices.push(nodeIndex); + })); + apiElementBinders.push(new api.ElementBinder({ + index: ebb.index, + parentIndex: parentIndex, + distanceToParent: ebb.distanceToParent, + directives: apiDirectiveBinders, + nestedProtoView: nestedProtoView, + propertyBindings: buildElementPropertyBindings(ebb.element, isPresent(ebb.componentId), ebb.propertyBindings, directiveTemplatePropertyNames), + variableBindings: ebb.variableBindings, + eventBindings: ebb.eventBindings, + readAttributes: ebb.readAttributes + })); + domElementBinders.push(new DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: isPresent(nestedProtoView) || isPresent(ebb.componentId), + hasNativeShadowRoot: false, + eventLocals: new LiteralArray(ebb.eventBuilder.buildEventLocals()), + localEvents: ebb.eventBuilder.buildLocalEvents(), + globalEvents: ebb.eventBuilder.buildGlobalEvents() + })); + })); + var rootNodeCount = DOM.childNodes(DOM.content(this.rootElement)).length; + return new api.ProtoViewDto({ + render: new DomProtoViewRef(DomProtoView.create(this.type, this.rootElement, this.viewEncapsulation, [rootNodeCount], rootTextNodeIndices, domElementBinders, this.hostAttributes)), + type: this.type, + elementBinders: apiElementBinders, + variableBindings: this.variableBindings, + textBindings: textNodeExpressions, + transitiveNgContentCount: transitiveNgContentCount + }); + } + }, {}); + }()); + $__export("ProtoViewBuilder", ProtoViewBuilder); + ElementBinderBuilder = (function() { + function ElementBinderBuilder(index, element, description) { + this.index = index; + this.element = element; + this.parent = null; + this.distanceToParent = 0; + this.directives = []; + this.nestedProtoView = null; + this.propertyBindings = new Map(); + this.variableBindings = new Map(); + this.eventBindings = []; + this.eventBuilder = new EventBuilder(); + this.textBindings = new Map(); + this.readAttributes = new Map(); + this.componentId = null; + } + return ($traceurRuntime.createClass)(ElementBinderBuilder, { + setParent: function(parent, distanceToParent) { + this.parent = parent; + if (isPresent(parent)) { + this.distanceToParent = distanceToParent; + } + return this; + }, + readAttribute: function(attrName) { + if (isBlank(this.readAttributes.get(attrName))) { + this.readAttributes.set(attrName, DOM.getAttribute(this.element, attrName)); + } + }, + bindDirective: function(directiveIndex) { + var directive = new DirectiveBuilder(directiveIndex); + this.directives.push(directive); + return directive; + }, + bindNestedProtoView: function(rootElement) { + if (isPresent(this.nestedProtoView)) { + throw new BaseException('Only one nested view per element is allowed'); + } + this.nestedProtoView = new ProtoViewBuilder(rootElement, api.ViewType.EMBEDDED, api.ViewEncapsulation.NONE); + return this.nestedProtoView; + }, + bindProperty: function(name, expression) { + this.propertyBindings.set(name, expression); + }, + bindVariable: function(name, value) { + if (isPresent(this.nestedProtoView)) { + this.nestedProtoView.bindVariable(name, value); + } else { + this.variableBindings.set(value, name); + } + }, + bindEvent: function(name, expression) { + var target = arguments[2] !== (void 0) ? arguments[2] : null; + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); + }, + bindText: function(textNode, expression) { + this.textBindings.set(textNode, expression); + }, + setComponentId: function(componentId) { + this.componentId = componentId; + } + }, {}); + }()); + $__export("ElementBinderBuilder", ElementBinderBuilder); + DirectiveBuilder = (function() { + function DirectiveBuilder(directiveIndex) { + this.directiveIndex = directiveIndex; + this.propertyBindings = new Map(); + this.templatePropertyNames = []; + this.hostPropertyBindings = new Map(); + this.eventBindings = []; + this.eventBuilder = new EventBuilder(); + } + return ($traceurRuntime.createClass)(DirectiveBuilder, { + bindProperty: function(name, expression, elProp) { + this.propertyBindings.set(name, expression); + if (isPresent(elProp)) { + this.templatePropertyNames.push(elProp); + } + }, + bindHostProperty: function(name, expression) { + this.hostPropertyBindings.set(name, expression); + }, + bindEvent: function(name, expression) { + var target = arguments[2] !== (void 0) ? arguments[2] : null; + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); + } + }, {}); + }()); + $__export("DirectiveBuilder", DirectiveBuilder); + EventBuilder = (function($__super) { + function EventBuilder() { + $traceurRuntime.superConstructor(EventBuilder).call(this); + this.locals = []; + this.localEvents = []; + this.globalEvents = []; + this._implicitReceiver = new ImplicitReceiver(); + } + return ($traceurRuntime.createClass)(EventBuilder, { + add: function(name, source, target) { + var adjustedAst = source.ast; + var fullName = isPresent(target) ? target + EVENT_TARGET_SEPARATOR + name : name; + var result = new api.EventBinding(fullName, new ASTWithSource(adjustedAst, source.source, source.location)); + var event = new Event(name, target, fullName); + if (isBlank(target)) { + this.localEvents.push(event); + } else { + this.globalEvents.push(event); + } + return result; + }, + visitAccessMember: function(ast) { + var isEventAccess = false; + var current = ast; + while (!isEventAccess && (current instanceof AccessMember)) { + var am = current; + if (am.name == '$event') { + isEventAccess = true; + } + current = am.receiver; + } + if (isEventAccess) { + this.locals.push(ast); + var index = this.locals.length - 1; + return new AccessMember(this._implicitReceiver, ("" + index), (function(arr) { + return arr[index]; + }), null); + } else { + return ast; + } + }, + buildEventLocals: function() { + return this.locals; + }, + buildLocalEvents: function() { + return this.localEvents; + }, + buildGlobalEvents: function() { + return this.globalEvents; + }, + merge: function(eventBuilder) { + this._merge(this.localEvents, eventBuilder.localEvents); + this._merge(this.globalEvents, eventBuilder.globalEvents); + ListWrapper.concat(this.locals, eventBuilder.locals); + }, + _merge: function(host, tobeAdded) { + var names = []; + for (var i = 0; i < host.length; i++) { + names.push(host[i].fullName); + } + for (var j = 0; j < tobeAdded.length; j++) { + if (!ListWrapper.contains(names, tobeAdded[j].fullName)) { + host.push(tobeAdded[j]); + } + } + } + }, {}, $__super); + }(AstTransformer)); + $__export("EventBuilder", EventBuilder); + PROPERTY_PARTS_SEPARATOR = new RegExp('\\.'); + ATTRIBUTE_PREFIX = 'attr'; + CLASS_PREFIX = 'class'; + STYLE_PREFIX = 'style'; + } + }; +}); + +System.register("angular2/src/render/dom/compiler/directive_parser", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/dom/dom_adapter", "angular2/src/render/dom/compiler/selector", "angular2/src/render/api", "angular2/src/render/dom/util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/directive_parser"; + var isPresent, + isBlank, + BaseException, + StringWrapper, + MapWrapper, + ListWrapper, + DOM, + SelectorMatcher, + CssSelector, + DirectiveMetadata, + dashCaseToCamelCase, + camelCaseToDashCase, + EVENT_TARGET_SEPARATOR, + DirectiveParser; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + MapWrapper = $__m.MapWrapper; + ListWrapper = $__m.ListWrapper; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + SelectorMatcher = $__m.SelectorMatcher; + CssSelector = $__m.CssSelector; + }, function($__m) { + DirectiveMetadata = $__m.DirectiveMetadata; + }, function($__m) { + dashCaseToCamelCase = $__m.dashCaseToCamelCase; + camelCaseToDashCase = $__m.camelCaseToDashCase; + EVENT_TARGET_SEPARATOR = $__m.EVENT_TARGET_SEPARATOR; + }], + execute: function() { + DirectiveParser = (function() { + function DirectiveParser(_parser, _directives) { + this._parser = _parser; + this._directives = _directives; + this._selectorMatcher = new SelectorMatcher(); + for (var i = 0; i < _directives.length; i++) { + var directive = _directives[i]; + var selector = CssSelector.parse(directive.selector); + this._ensureComponentOnlyHasElementSelector(selector, directive); + this._selectorMatcher.addSelectables(selector, i); + } + } + return ($traceurRuntime.createClass)(DirectiveParser, { + processStyle: function(style) { + return style; + }, + _ensureComponentOnlyHasElementSelector: function(selector, directive) { + var isElementSelector = selector.length === 1 && selector[0].isElementSelector(); + if (!isElementSelector && directive.type === DirectiveMetadata.COMPONENT_TYPE) { + throw new BaseException(("Component '" + directive.id + "' can only have an element selector, but had '" + directive.selector + "'")); + } + }, + processElement: function(parent, current, control) { + var $__0 = this; + var attrs = current.attrs(); + var classList = current.classList(); + var cssSelector = new CssSelector(); + var foundDirectiveIndices = []; + var elementBinder = null; + cssSelector.setElement(DOM.nodeName(current.element)); + for (var i = 0; i < classList.length; i++) { + cssSelector.addClassName(classList[i]); + } + MapWrapper.forEach(attrs, (function(attrValue, attrName) { + cssSelector.addAttribute(attrName, attrValue); + })); + this._selectorMatcher.match(cssSelector, (function(selector, directiveIndex) { + var directive = $__0._directives[directiveIndex]; + elementBinder = current.bindElement(); + if (directive.type === DirectiveMetadata.COMPONENT_TYPE) { + $__0._ensureHasOnlyOneComponent(elementBinder, current.elementDescription); + ListWrapper.insert(foundDirectiveIndices, 0, directiveIndex); + elementBinder.setComponentId(directive.id); + } else { + foundDirectiveIndices.push(directiveIndex); + } + })); + ListWrapper.forEach(foundDirectiveIndices, (function(directiveIndex) { + var dirMetadata = $__0._directives[directiveIndex]; + var directiveBinderBuilder = elementBinder.bindDirective(directiveIndex); + current.compileChildren = current.compileChildren && dirMetadata.compileChildren; + if (isPresent(dirMetadata.properties)) { + ListWrapper.forEach(dirMetadata.properties, (function(bindConfig) { + $__0._bindDirectiveProperty(bindConfig, current, directiveBinderBuilder); + })); + } + if (isPresent(dirMetadata.hostListeners)) { + $__0._sortedKeysForEach(dirMetadata.hostListeners, (function(action, eventName) { + $__0._bindDirectiveEvent(eventName, action, current, directiveBinderBuilder); + })); + } + if (isPresent(dirMetadata.hostProperties)) { + $__0._sortedKeysForEach(dirMetadata.hostProperties, (function(expression, hostPropertyName) { + $__0._bindHostProperty(hostPropertyName, expression, current, directiveBinderBuilder); + })); + } + if (isPresent(dirMetadata.hostAttributes)) { + $__0._sortedKeysForEach(dirMetadata.hostAttributes, (function(hostAttrValue, hostAttrName) { + $__0._addHostAttribute(hostAttrName, hostAttrValue, current); + })); + } + if (isPresent(dirMetadata.readAttributes)) { + ListWrapper.forEach(dirMetadata.readAttributes, (function(attrName) { + elementBinder.readAttribute(attrName); + })); + } + })); + }, + _sortedKeysForEach: function(map, fn) { + var keys = MapWrapper.keys(map); + ListWrapper.sort(keys, (function(a, b) { + var compareVal = StringWrapper.compare(a, b); + return compareVal == 0 ? -1 : compareVal; + })); + ListWrapper.forEach(keys, (function(key) { + fn(MapWrapper.get(map, key), key); + })); + }, + _ensureHasOnlyOneComponent: function(elementBinder, elDescription) { + if (isPresent(elementBinder.componentId)) { + throw new BaseException(("Only one component directive is allowed per element - check " + elDescription)); + } + }, + _bindDirectiveProperty: function(bindConfig, compileElement, directiveBinderBuilder) { + var dirProperty; + var elProp; + var pipes; + var assignIndex = bindConfig.indexOf(':'); + if (assignIndex > -1) { + dirProperty = StringWrapper.substring(bindConfig, 0, assignIndex).trim(); + pipes = this._splitBindConfig(StringWrapper.substring(bindConfig, assignIndex + 1)); + elProp = ListWrapper.removeAt(pipes, 0); + } else { + dirProperty = bindConfig; + elProp = bindConfig; + pipes = []; + } + elProp = dashCaseToCamelCase(elProp); + var bindingAst = compileElement.bindElement().propertyBindings.get(elProp); + if (isBlank(bindingAst)) { + var attributeValue = compileElement.attrs().get(camelCaseToDashCase(elProp)); + if (isPresent(attributeValue)) { + bindingAst = this._parser.wrapLiteralPrimitive(attributeValue, compileElement.elementDescription); + } + } + if (isPresent(bindingAst)) { + directiveBinderBuilder.bindProperty(dirProperty, bindingAst, elProp); + } + }, + _bindDirectiveEvent: function(eventName, action, compileElement, directiveBinderBuilder) { + var ast = this._parser.parseAction(action, compileElement.elementDescription); + if (StringWrapper.contains(eventName, EVENT_TARGET_SEPARATOR)) { + var parts = eventName.split(EVENT_TARGET_SEPARATOR); + directiveBinderBuilder.bindEvent(parts[1], ast, parts[0]); + } else { + directiveBinderBuilder.bindEvent(eventName, ast); + } + }, + _bindHostProperty: function(hostPropertyName, expression, compileElement, directiveBinderBuilder) { + var ast = this._parser.parseSimpleBinding(expression, ("hostProperties of " + compileElement.elementDescription)); + directiveBinderBuilder.bindHostProperty(hostPropertyName, ast); + }, + _addHostAttribute: function(attrName, attrValue, compileElement) { + if (StringWrapper.equals(attrName, 'class')) { + ListWrapper.forEach(attrValue.split(' '), (function(className) { + DOM.addClass(compileElement.element, className); + })); + } else if (!DOM.hasAttribute(compileElement.element, attrName)) { + DOM.setAttribute(compileElement.element, attrName, attrValue); + } + }, + _splitBindConfig: function(bindConfig) { + return ListWrapper.map(bindConfig.split('|'), (function(s) { + return s.trim(); + })); + } + }, {}); + }()); + $__export("DirectiveParser", DirectiveParser); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/style_encapsulator", ["angular2/src/render/api", "angular2/src/render/dom/util", "angular2/src/dom/dom_adapter", "angular2/src/facade/lang", "angular2/src/render/dom/compiler/shadow_css"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/style_encapsulator"; + var ViewEncapsulation, + ViewType, + NG_CONTENT_ELEMENT_NAME, + isElementWithTag, + DOM, + isBlank, + isPresent, + ShadowCss, + StyleEncapsulator; + function getHostAttribute(compId) { + return ("_nghost-" + compId); + } + function getContentAttribute(compId) { + return ("_ngcontent-" + compId); + } + return { + setters: [function($__m) { + ViewEncapsulation = $__m.ViewEncapsulation; + ViewType = $__m.ViewType; + }, function($__m) { + NG_CONTENT_ELEMENT_NAME = $__m.NG_CONTENT_ELEMENT_NAME; + isElementWithTag = $__m.isElementWithTag; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + }, function($__m) { + ShadowCss = $__m.ShadowCss; + }], + execute: function() { + StyleEncapsulator = (function() { + function StyleEncapsulator(_appId, _view, _componentUIDsCache) { + this._appId = _appId; + this._view = _view; + this._componentUIDsCache = _componentUIDsCache; + } + return ($traceurRuntime.createClass)(StyleEncapsulator, { + processElement: function(parent, current, control) { + if (isElementWithTag(current.element, NG_CONTENT_ELEMENT_NAME)) { + current.inheritedProtoView.bindNgContent(); + } else { + if (this._view.encapsulation === ViewEncapsulation.EMULATED) { + this._processEmulatedScopedElement(current, parent); + } + } + }, + processStyle: function(style) { + var encapsulation = this._view.encapsulation; + if (encapsulation === ViewEncapsulation.EMULATED) { + return this._shimCssForComponent(style, this._view.componentId); + } else { + return style; + } + }, + _processEmulatedScopedElement: function(current, parent) { + var element = current.element; + var hostComponentId = this._view.componentId; + var viewType = current.inheritedProtoView.type; + if (viewType !== ViewType.HOST && isPresent(hostComponentId)) { + var contentAttribute = getContentAttribute(this._getComponentId(hostComponentId)); + DOM.setAttribute(element, contentAttribute, ''); + if (isBlank(parent) && viewType == ViewType.COMPONENT) { + var hostAttribute = getHostAttribute(this._getComponentId(hostComponentId)); + current.inheritedProtoView.setHostAttribute(hostAttribute, ''); + } + } + }, + _shimCssForComponent: function(cssText, componentId) { + var id = this._getComponentId(componentId); + var shadowCss = new ShadowCss(); + return shadowCss.shimCssText(cssText, getContentAttribute(id), getHostAttribute(id)); + }, + _getComponentId: function(componentStringId) { + var id = this._componentUIDsCache.get(componentStringId); + if (isBlank(id)) { + id = (this._appId + "-" + this._componentUIDsCache.size); + this._componentUIDsCache.set(componentStringId, id); + } + return id; + } + }, {}); + }()); + $__export("StyleEncapsulator", StyleEncapsulator); + } + }; +}); + +System.register("angular2/src/render/dom/dom_renderer", ["angular2/di", "angular2/src/facade/lang", "angular2/src/dom/dom_adapter", "angular2/src/render/dom/events/event_manager", "angular2/src/render/dom/view/proto_view", "angular2/src/render/dom/view/view", "angular2/src/render/dom/view/fragment", "angular2/src/render/dom/view/shared_styles_host", "angular2/src/render/dom/util", "angular2/src/render/api", "angular2/src/render/dom/dom_tokens"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/dom_renderer"; + var __decorate, + __metadata, + __param, + Inject, + Injectable, + isPresent, + isBlank, + BaseException, + DOM, + EventManager, + resolveInternalDomProtoView, + DomView, + DomViewRef, + resolveInternalDomView, + DomFragmentRef, + resolveInternalDomFragment, + DomSharedStylesHost, + cloneAndQueryProtoView, + camelCaseToDashCase, + Renderer, + RenderViewWithFragments, + DOCUMENT_TOKEN, + DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES, + REFLECT_PREFIX, + DomRenderer; + function moveNodesAfterSibling(sibling, nodes) { + if (nodes.length > 0 && isPresent(DOM.parentElement(sibling))) { + for (var i = 0; i < nodes.length; i++) { + DOM.insertBefore(sibling, nodes[i]); + } + DOM.insertBefore(nodes[nodes.length - 1], sibling); + } + } + function moveChildNodes(source, target) { + var currChild = DOM.firstChild(source); + while (isPresent(currChild)) { + var nextChild = DOM.nextSibling(currChild); + DOM.appendChild(target, currChild); + currChild = nextChild; + } + } + return { + setters: [function($__m) { + Inject = $__m.Inject; + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + EventManager = $__m.EventManager; + }, function($__m) { + resolveInternalDomProtoView = $__m.resolveInternalDomProtoView; + }, function($__m) { + DomView = $__m.DomView; + DomViewRef = $__m.DomViewRef; + resolveInternalDomView = $__m.resolveInternalDomView; + }, function($__m) { + DomFragmentRef = $__m.DomFragmentRef; + resolveInternalDomFragment = $__m.resolveInternalDomFragment; + }, function($__m) { + DomSharedStylesHost = $__m.DomSharedStylesHost; + }, function($__m) { + cloneAndQueryProtoView = $__m.cloneAndQueryProtoView; + camelCaseToDashCase = $__m.camelCaseToDashCase; + }, function($__m) { + Renderer = $__m.Renderer; + RenderViewWithFragments = $__m.RenderViewWithFragments; + }, function($__m) { + DOCUMENT_TOKEN = $__m.DOCUMENT_TOKEN; + DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES = $__m.DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + REFLECT_PREFIX = 'ng-reflect-'; + DomRenderer = (function($__super) { + function $__0(_eventManager, _domSharedStylesHost, document, reflectPropertiesAsAttributes) { + $traceurRuntime.superConstructor($__0).call(this); + this._eventManager = _eventManager; + this._domSharedStylesHost = _domSharedStylesHost; + this._reflectPropertiesAsAttributes = reflectPropertiesAsAttributes; + this._document = document; + } + return ($traceurRuntime.createClass)($__0, { + createRootHostView: function(hostProtoViewRef, fragmentCount, hostElementSelector) { + var hostProtoView = resolveInternalDomProtoView(hostProtoViewRef); + var element = DOM.querySelector(this._document, hostElementSelector); + if (isBlank(element)) { + throw new BaseException(("The selector \"" + hostElementSelector + "\" did not match any elements")); + } + return this._createView(hostProtoView, element); + }, + createView: function(protoViewRef, fragmentCount) { + var protoView = resolveInternalDomProtoView(protoViewRef); + return this._createView(protoView, null); + }, + destroyView: function(viewRef) { + var view = resolveInternalDomView(viewRef); + var elementBinders = view.proto.elementBinders; + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + if (binder.hasNativeShadowRoot) { + this._domSharedStylesHost.removeHost(DOM.getShadowRoot(view.boundElements[i])); + } + } + }, + getNativeElementSync: function(location) { + if (isBlank(location.renderBoundElementIndex)) { + return null; + } + return resolveInternalDomView(location.renderView).boundElements[location.renderBoundElementIndex]; + }, + getRootNodes: function(fragment) { + return resolveInternalDomFragment(fragment); + }, + attachFragmentAfterFragment: function(previousFragmentRef, fragmentRef) { + var previousFragmentNodes = resolveInternalDomFragment(previousFragmentRef); + if (previousFragmentNodes.length > 0) { + var sibling = previousFragmentNodes[previousFragmentNodes.length - 1]; + moveNodesAfterSibling(sibling, resolveInternalDomFragment(fragmentRef)); + } + }, + attachFragmentAfterElement: function(elementRef, fragmentRef) { + if (isBlank(elementRef.renderBoundElementIndex)) { + return ; + } + var parentView = resolveInternalDomView(elementRef.renderView); + var element = parentView.boundElements[elementRef.renderBoundElementIndex]; + moveNodesAfterSibling(element, resolveInternalDomFragment(fragmentRef)); + }, + detachFragment: function(fragmentRef) { + var fragmentNodes = resolveInternalDomFragment(fragmentRef); + for (var i = 0; i < fragmentNodes.length; i++) { + DOM.remove(fragmentNodes[i]); + } + }, + hydrateView: function(viewRef) { + var view = resolveInternalDomView(viewRef); + if (view.hydrated) + throw new BaseException('The view is already hydrated.'); + view.hydrated = true; + view.eventHandlerRemovers = []; + var binders = view.proto.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var binder = binders[binderIdx]; + if (isPresent(binder.globalEvents)) { + for (var i = 0; i < binder.globalEvents.length; i++) { + var globalEvent = binder.globalEvents[i]; + var remover = this._createGlobalEventListener(view, binderIdx, globalEvent.name, globalEvent.target, globalEvent.fullName); + view.eventHandlerRemovers.push(remover); + } + } + } + }, + dehydrateView: function(viewRef) { + var view = resolveInternalDomView(viewRef); + for (var i = 0; i < view.eventHandlerRemovers.length; i++) { + view.eventHandlerRemovers[i](); + } + view.eventHandlerRemovers = null; + view.hydrated = false; + }, + setElementProperty: function(location, propertyName, propertyValue) { + if (isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = resolveInternalDomView(location.renderView); + view.setElementProperty(location.renderBoundElementIndex, propertyName, propertyValue); + if (this._reflectPropertiesAsAttributes) { + this.setElementAttribute(location, ("" + REFLECT_PREFIX + camelCaseToDashCase(propertyName)), ("" + propertyValue)); + } + }, + setElementAttribute: function(location, attributeName, attributeValue) { + if (isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = resolveInternalDomView(location.renderView); + view.setElementAttribute(location.renderBoundElementIndex, attributeName, attributeValue); + }, + setElementClass: function(location, className, isAdd) { + if (isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = resolveInternalDomView(location.renderView); + view.setElementClass(location.renderBoundElementIndex, className, isAdd); + }, + setElementStyle: function(location, styleName, styleValue) { + if (isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = resolveInternalDomView(location.renderView); + view.setElementStyle(location.renderBoundElementIndex, styleName, styleValue); + }, + invokeElementMethod: function(location, methodName, args) { + if (isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = resolveInternalDomView(location.renderView); + view.invokeElementMethod(location.renderBoundElementIndex, methodName, args); + }, + setText: function(viewRef, textNodeIndex, text) { + if (isBlank(textNodeIndex)) { + return ; + } + var view = resolveInternalDomView(viewRef); + DOM.setText(view.boundTextNodes[textNodeIndex], text); + }, + setEventDispatcher: function(viewRef, dispatcher) { + var view = resolveInternalDomView(viewRef); + view.eventDispatcher = dispatcher; + }, + _createView: function(protoView, inplaceElement) { + var clonedProtoView = cloneAndQueryProtoView(protoView, true); + var boundElements = clonedProtoView.boundElements; + if (isPresent(inplaceElement)) { + if (protoView.fragmentsRootNodeCount[0] !== 1) { + throw new BaseException('Root proto views can only contain one element!'); + } + DOM.clearNodes(inplaceElement); + var tempRoot = clonedProtoView.fragments[0][0]; + moveChildNodes(tempRoot, inplaceElement); + if (boundElements.length > 0 && boundElements[0] === tempRoot) { + boundElements[0] = inplaceElement; + } + clonedProtoView.fragments[0][0] = inplaceElement; + } + var view = new DomView(protoView, clonedProtoView.boundTextNodes, boundElements); + var binders = protoView.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var binder = binders[binderIdx]; + var element = boundElements[binderIdx]; + if (binder.hasNativeShadowRoot) { + var shadowRootWrapper = DOM.firstChild(element); + var shadowRoot = DOM.createShadowRoot(element); + this._domSharedStylesHost.addHost(shadowRoot); + moveChildNodes(shadowRootWrapper, shadowRoot); + DOM.remove(shadowRootWrapper); + } + if (isPresent(binder.eventLocals) && isPresent(binder.localEvents)) { + for (var i = 0; i < binder.localEvents.length; i++) { + this._createEventListener(view, element, binderIdx, binder.localEvents[i].name, binder.eventLocals); + } + } + } + return new RenderViewWithFragments(new DomViewRef(view), clonedProtoView.fragments.map((function(nodes) { + return new DomFragmentRef(nodes); + }))); + }, + _createEventListener: function(view, element, elementIndex, eventName, eventLocals) { + this._eventManager.addEventListener(element, eventName, (function(event) { + view.dispatchEvent(elementIndex, eventName, event); + })); + }, + _createGlobalEventListener: function(view, elementIndex, eventName, eventTarget, fullName) { + return this._eventManager.addGlobalEventListener(eventTarget, eventName, (function(event) { + view.dispatchEvent(elementIndex, fullName, event); + })); + } + }, {}, $__super); + }(Renderer)); + $__export("DomRenderer", DomRenderer); + $__export("DomRenderer", DomRenderer = __decorate([Injectable(), __param(2, Inject(DOCUMENT_TOKEN)), __param(3, Inject(DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES)), __metadata('design:paramtypes', [EventManager, DomSharedStylesHost, Object, Boolean])], DomRenderer)); + } + }; +}); + +System.register("angular2/annotations", ["angular2/src/core/annotations/annotations", "angular2/src/core/annotations/view", "angular2/src/core/annotations/di", "angular2/src/util/decorators", "angular2/src/core/annotations/decorators"], function($__export) { + "use strict"; + var __moduleName = "angular2/annotations"; + return { + setters: [function($__m) { + $__export("ComponentAnnotation", $__m.ComponentAnnotation); + $__export("DirectiveAnnotation", $__m.DirectiveAnnotation); + $__export("LifecycleEvent", $__m.LifecycleEvent); + }, function($__m) { + $__export("ViewAnnotation", $__m.ViewAnnotation); + $__export("ViewEncapsulation", $__m.ViewEncapsulation); + }, function($__m) { + $__export("QueryAnnotation", $__m.QueryAnnotation); + $__export("AttributeAnnotation", $__m.AttributeAnnotation); + }, function($__m) { + $__export("Class", $__m.Class); + }, function($__m) { + $__export("Attribute", $__m.Attribute); + $__export("Component", $__m.Component); + $__export("Directive", $__m.Directive); + $__export("View", $__m.View); + $__export("Query", $__m.Query); + $__export("ViewQuery", $__m.ViewQuery); + }], + execute: function() {} + }; +}); + +System.register("angular2/directives", ["angular2/src/facade/lang", "angular2/src/directives/ng_for", "angular2/src/directives/ng_if", "angular2/src/directives/ng_non_bindable", "angular2/src/directives/ng_switch", "angular2/src/directives/class", "angular2/src/directives/ng_style"], function($__export) { + "use strict"; + var __moduleName = "angular2/directives"; + var CONST_EXPR, + NgFor, + NgIf, + NgNonBindable, + NgSwitch, + NgSwitchWhen, + NgSwitchDefault, + coreDirectives; + var $__exportNames = {coreDirectives: true}; + var $__exportNames = {coreDirectives: true}; + var $__exportNames = {coreDirectives: true}; + var $__exportNames = {coreDirectives: true}; + var $__exportNames = {coreDirectives: true}; + var $__exportNames = {coreDirectives: true}; + return { + setters: [function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + NgFor = $__m.NgFor; + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + NgIf = $__m.NgIf; + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + NgNonBindable = $__m.NgNonBindable; + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + NgSwitch = $__m.NgSwitch; + NgSwitchWhen = $__m.NgSwitchWhen; + NgSwitchDefault = $__m.NgSwitchDefault; + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }], + execute: function() { + coreDirectives = CONST_EXPR([NgFor, NgIf, NgNonBindable, NgSwitch, NgSwitchWhen, NgSwitchDefault]); + $__export("coreDirectives", coreDirectives); + } + }; +}); + +System.register("angular2/src/http/static_request", ["angular2/src/http/headers", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/static_request"; + var Headers, + isPresent, + Request; + return { + setters: [function($__m) { + Headers = $__m.Headers; + }, function($__m) { + isPresent = $__m.isPresent; + }], + execute: function() { + Request = (function() { + function Request(requestOptions) { + this.url = requestOptions.url; + this._body = requestOptions.body; + this.method = requestOptions.method; + this.mode = requestOptions.mode; + this.credentials = requestOptions.credentials; + this.headers = new Headers(requestOptions.headers); + this.cache = requestOptions.cache; + } + return ($traceurRuntime.createClass)(Request, {text: function() { + return isPresent(this._body) ? this._body.toString() : ''; + }}, {}); + }()); + $__export("Request", Request); + } + }; +}); + +System.register("angular2/src/http/base_request_options", ["angular2/src/facade/lang", "angular2/src/http/headers", "angular2/src/http/enums", "angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/base_request_options"; + var __decorate, + __metadata, + isPresent, + Headers, + RequestModesOpts, + RequestMethods, + Injectable, + RequestOptions, + BaseRequestOptions; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + Headers = $__m.Headers; + }, function($__m) { + RequestModesOpts = $__m.RequestModesOpts; + RequestMethods = $__m.RequestMethods; + }, function($__m) { + Injectable = $__m.Injectable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + RequestOptions = (function() { + function RequestOptions() { + var $__2 = arguments[0] !== (void 0) ? arguments[0] : {}, + method = $__2.method, + headers = $__2.headers, + body = $__2.body, + mode = $__2.mode, + credentials = $__2.credentials, + cache = $__2.cache, + url = $__2.url; + this.method = isPresent(method) ? method : null; + this.headers = isPresent(headers) ? headers : null; + this.body = isPresent(body) ? body : null; + this.mode = isPresent(mode) ? mode : null; + this.credentials = isPresent(credentials) ? credentials : null; + this.cache = isPresent(cache) ? cache : null; + this.url = isPresent(url) ? url : null; + } + return ($traceurRuntime.createClass)(RequestOptions, {merge: function(options) { + return new RequestOptions({ + method: isPresent(options) && isPresent(options.method) ? options.method : this.method, + headers: isPresent(options) && isPresent(options.headers) ? options.headers : this.headers, + body: isPresent(options) && isPresent(options.body) ? options.body : this.body, + mode: isPresent(options) && isPresent(options.mode) ? options.mode : this.mode, + credentials: isPresent(options) && isPresent(options.credentials) ? options.credentials : this.credentials, + cache: isPresent(options) && isPresent(options.cache) ? options.cache : this.cache, + url: isPresent(options) && isPresent(options.url) ? options.url : this.url + }); + }}, {}); + }()); + $__export("RequestOptions", RequestOptions); + BaseRequestOptions = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).call(this, { + method: RequestMethods.GET, + headers: new Headers(), + mode: RequestModesOpts.Cors + }); + } + return ($traceurRuntime.createClass)($__0, {}, {}, $__super); + }(RequestOptions)); + $__export("BaseRequestOptions", BaseRequestOptions); + $__export("BaseRequestOptions", BaseRequestOptions = __decorate([Injectable(), __metadata('design:paramtypes', [])], BaseRequestOptions)); + } + }; +}); + +System.register("angular2/src/http/static_response", ["angular2/src/facade/lang", "angular2/src/http/http_utils"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/static_response"; + var BaseException, + isString, + Json, + isJsObject, + Response; + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + isString = $__m.isString; + Json = $__m.Json; + }, function($__m) { + isJsObject = $__m.isJsObject; + }], + execute: function() { + Response = (function() { + function Response(responseOptions) { + this._body = responseOptions.body; + this.status = responseOptions.status; + this.statusText = responseOptions.statusText; + this.headers = responseOptions.headers; + this.type = responseOptions.type; + this.url = responseOptions.url; + } + return ($traceurRuntime.createClass)(Response, { + blob: function() { + throw new BaseException('"blob()" method not implemented on Response superclass'); + }, + json: function() { + var jsonResponse; + if (isJsObject(this._body)) { + jsonResponse = this._body; + } else if (isString(this._body)) { + jsonResponse = Json.parse(this._body); + } + return jsonResponse; + }, + text: function() { + return this._body.toString(); + }, + arrayBuffer: function() { + throw new BaseException('"arrayBuffer()" method not implemented on Response superclass'); + } + }, {}); + }()); + $__export("Response", Response); + } + }; +}); + +System.register("angular2/src/http/backends/jsonp_backend", ["angular2/src/http/enums", "angular2/src/http/static_response", "angular2/src/http/base_response_options", "angular2/di", "angular2/src/http/backends/browser_jsonp", "angular2/src/facade/async", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/backends/jsonp_backend"; + var __decorate, + __metadata, + ReadyStates, + RequestMethods, + Response, + ResponseOptions, + Injectable, + BrowserJsonp, + EventEmitter, + ObservableWrapper, + StringWrapper, + isPresent, + makeTypeError, + JSONPConnection, + JSONPBackend; + return { + setters: [function($__m) { + ReadyStates = $__m.ReadyStates; + RequestMethods = $__m.RequestMethods; + }, function($__m) { + Response = $__m.Response; + }, function($__m) { + ResponseOptions = $__m.ResponseOptions; + }, function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + BrowserJsonp = $__m.BrowserJsonp; + }, function($__m) { + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + StringWrapper = $__m.StringWrapper; + isPresent = $__m.isPresent; + makeTypeError = $__m.makeTypeError; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + JSONPConnection = (function() { + function JSONPConnection(req, _dom, baseResponseOptions) { + var $__0 = this; + this._dom = _dom; + this.baseResponseOptions = baseResponseOptions; + this._finished = false; + if (req.method !== RequestMethods.GET) { + throw makeTypeError("JSONP requests must use GET request method."); + } + this.request = req; + this.response = new EventEmitter(); + this.readyState = ReadyStates.LOADING; + this._id = _dom.nextRequestID(); + _dom.exposeConnection(this._id, this); + var callback = _dom.requestCallback(this._id); + var url = req.url; + if (url.indexOf('=JSONP_CALLBACK&') > -1) { + url = StringWrapper.replace(url, '=JSONP_CALLBACK&', ("=" + callback + "&")); + } else if (url.lastIndexOf('=JSONP_CALLBACK') === url.length - '=JSONP_CALLBACK'.length) { + url = StringWrapper.substring(url, 0, url.length - '=JSONP_CALLBACK'.length) + ("=" + callback); + } + var script = this._script = _dom.build(url); + script.addEventListener('load', (function(event) { + if ($__0.readyState === ReadyStates.CANCELLED) + return ; + $__0.readyState = ReadyStates.DONE; + _dom.cleanup(script); + if (!$__0._finished) { + ObservableWrapper.callThrow($__0.response, makeTypeError('JSONP injected script did not invoke callback.')); + return ; + } + var responseOptions = new ResponseOptions({body: $__0._responseData}); + if (isPresent($__0.baseResponseOptions)) { + responseOptions = $__0.baseResponseOptions.merge(responseOptions); + } + ObservableWrapper.callNext($__0.response, new Response(responseOptions)); + })); + script.addEventListener('error', (function(error) { + if ($__0.readyState === ReadyStates.CANCELLED) + return ; + $__0.readyState = ReadyStates.DONE; + _dom.cleanup(script); + ObservableWrapper.callThrow($__0.response, error); + })); + _dom.send(script); + } + return ($traceurRuntime.createClass)(JSONPConnection, { + finished: function(data) { + this._finished = true; + this._dom.removeConnection(this._id); + if (this.readyState === ReadyStates.CANCELLED) + return ; + this._responseData = data; + }, + dispose: function() { + this.readyState = ReadyStates.CANCELLED; + var script = this._script; + this._script = null; + if (isPresent(script)) { + this._dom.cleanup(script); + } + ObservableWrapper.callReturn(this.response); + } + }, {}); + }()); + $__export("JSONPConnection", JSONPConnection); + JSONPBackend = (($traceurRuntime.createClass)(function(_browserJSONP, _baseResponseOptions) { + this._browserJSONP = _browserJSONP; + this._baseResponseOptions = _baseResponseOptions; + }, {createConnection: function(request) { + return new JSONPConnection(request, this._browserJSONP, this._baseResponseOptions); + }}, {})); + $__export("JSONPBackend", JSONPBackend); + $__export("JSONPBackend", JSONPBackend = __decorate([Injectable(), __metadata('design:paramtypes', [BrowserJsonp, ResponseOptions])], JSONPBackend)); + } + }; +}); + +System.register("angular2/src/forms/model", ["angular2/src/facade/lang", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/forms/validators"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/model"; + var StringWrapper, + isPresent, + isBlank, + EventEmitter, + ObservableWrapper, + StringMapWrapper, + ListWrapper, + List, + Validators, + VALID, + INVALID, + AbstractControl, + Control, + ControlGroup, + ControlArray; + function isControl(c) { + return c instanceof AbstractControl; + } + function _find(c, path) { + if (isBlank(path)) + return null; + if (!(path instanceof List)) { + path = StringWrapper.split(path, new RegExp("/")); + } + if (path instanceof List && ListWrapper.isEmpty(path)) + return null; + return ListWrapper.reduce(path, (function(v, name) { + if (v instanceof ControlGroup) { + return isPresent(v.controls[name]) ? v.controls[name] : null; + } else if (v instanceof ControlArray) { + var index = name; + return isPresent(v.at(index)) ? v.at(index) : null; + } else { + return null; + } + }), c); + } + $__export("isControl", isControl); + return { + setters: [function($__m) { + StringWrapper = $__m.StringWrapper; + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + }, function($__m) { + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + ListWrapper = $__m.ListWrapper; + List = $__m.List; + }, function($__m) { + Validators = $__m.Validators; + }], + execute: function() { + VALID = "VALID"; + $__export("VALID", VALID); + INVALID = "INVALID"; + $__export("INVALID", INVALID); + AbstractControl = (function() { + function AbstractControl(validator) { + this.validator = validator; + this._pristine = true; + this._touched = false; + } + return ($traceurRuntime.createClass)(AbstractControl, { + get value() { + return this._value; + }, + get status() { + return this._status; + }, + get valid() { + return this._status === VALID; + }, + get errors() { + return this._errors; + }, + get pristine() { + return this._pristine; + }, + get dirty() { + return !this.pristine; + }, + get touched() { + return this._touched; + }, + get untouched() { + return !this._touched; + }, + get valueChanges() { + return this._valueChanges; + }, + markAsTouched: function() { + this._touched = true; + }, + markAsDirty: function() { + var onlySelf = (arguments[0] !== (void 0) ? arguments[0] : {}).onlySelf; + onlySelf = isPresent(onlySelf) ? onlySelf : false; + this._pristine = false; + if (isPresent(this._parent) && !onlySelf) { + this._parent.markAsDirty({onlySelf: onlySelf}); + } + }, + setParent: function(parent) { + this._parent = parent; + }, + updateValidity: function() { + var onlySelf = (arguments[0] !== (void 0) ? arguments[0] : {}).onlySelf; + onlySelf = isPresent(onlySelf) ? onlySelf : false; + this._errors = this.validator(this); + this._status = isPresent(this._errors) ? INVALID : VALID; + if (isPresent(this._parent) && !onlySelf) { + this._parent.updateValidity({onlySelf: onlySelf}); + } + }, + updateValueAndValidity: function() { + var $__2 = arguments[0] !== (void 0) ? arguments[0] : {}, + onlySelf = $__2.onlySelf, + emitEvent = $__2.emitEvent; + onlySelf = isPresent(onlySelf) ? onlySelf : false; + emitEvent = isPresent(emitEvent) ? emitEvent : true; + this._updateValue(); + if (emitEvent) { + ObservableWrapper.callNext(this._valueChanges, this._value); + } + this._errors = this.validator(this); + this._status = isPresent(this._errors) ? INVALID : VALID; + if (isPresent(this._parent) && !onlySelf) { + this._parent.updateValueAndValidity({ + onlySelf: onlySelf, + emitEvent: emitEvent + }); + } + }, + find: function(path) { + return _find(this, path); + }, + getError: function(errorCode) { + var path = arguments[1] !== (void 0) ? arguments[1] : null; + var c = isPresent(path) && !ListWrapper.isEmpty(path) ? this.find(path) : this; + if (isPresent(c) && isPresent(c._errors)) { + return StringMapWrapper.get(c._errors, errorCode); + } else { + return null; + } + }, + hasError: function(errorCode) { + var path = arguments[1] !== (void 0) ? arguments[1] : null; + return isPresent(this.getError(errorCode, path)); + }, + _updateValue: function() {} + }, {}); + }()); + $__export("AbstractControl", AbstractControl); + Control = (function($__super) { + function Control() { + var value = arguments[0] !== (void 0) ? arguments[0] : null; + var validator = arguments[1] !== (void 0) ? arguments[1] : Validators.nullValidator; + $traceurRuntime.superConstructor(Control).call(this, validator); + this._value = value; + this.updateValidity({onlySelf: true}); + this._valueChanges = new EventEmitter(); + } + return ($traceurRuntime.createClass)(Control, { + updateValue: function(value) { + var $__2 = arguments[1] !== (void 0) ? arguments[1] : {}, + onlySelf = $__2.onlySelf, + emitEvent = $__2.emitEvent, + emitModelToViewChange = $__2.emitModelToViewChange; + emitModelToViewChange = isPresent(emitModelToViewChange) ? emitModelToViewChange : true; + this._value = value; + if (isPresent(this._onChange) && emitModelToViewChange) + this._onChange(this._value); + this.updateValueAndValidity({ + onlySelf: onlySelf, + emitEvent: emitEvent + }); + }, + registerOnChange: function(fn) { + this._onChange = fn; + } + }, {}, $__super); + }(AbstractControl)); + $__export("Control", Control); + ControlGroup = (function($__super) { + function ControlGroup(controls) { + var optionals = arguments[1] !== (void 0) ? arguments[1] : null; + var validator = arguments[2] !== (void 0) ? arguments[2] : Validators.group; + $traceurRuntime.superConstructor(ControlGroup).call(this, validator); + this.controls = controls; + this._optionals = isPresent(optionals) ? optionals : {}; + this._valueChanges = new EventEmitter(); + this._setParentForControls(); + this._value = this._reduceValue(); + this.updateValidity({onlySelf: true}); + } + return ($traceurRuntime.createClass)(ControlGroup, { + addControl: function(name, c) { + this.controls[name] = c; + c.setParent(this); + }, + removeControl: function(name) { + StringMapWrapper.delete(this.controls, name); + }, + include: function(controlName) { + StringMapWrapper.set(this._optionals, controlName, true); + this.updateValueAndValidity(); + }, + exclude: function(controlName) { + StringMapWrapper.set(this._optionals, controlName, false); + this.updateValueAndValidity(); + }, + contains: function(controlName) { + var c = StringMapWrapper.contains(this.controls, controlName); + return c && this._included(controlName); + }, + _setParentForControls: function() { + var $__0 = this; + StringMapWrapper.forEach(this.controls, (function(control, name) { + control.setParent($__0); + })); + }, + _updateValue: function() { + this._value = this._reduceValue(); + }, + _reduceValue: function() { + return this._reduceChildren({}, (function(acc, control, name) { + acc[name] = control.value; + return acc; + })); + }, + _reduceChildren: function(initValue, fn) { + var $__0 = this; + var res = initValue; + StringMapWrapper.forEach(this.controls, (function(control, name) { + if ($__0._included(name)) { + res = fn(res, control, name); + } + })); + return res; + }, + _included: function(controlName) { + var isOptional = StringMapWrapper.contains(this._optionals, controlName); + return !isOptional || StringMapWrapper.get(this._optionals, controlName); + } + }, {}, $__super); + }(AbstractControl)); + $__export("ControlGroup", ControlGroup); + ControlArray = (function($__super) { + function ControlArray(controls) { + var validator = arguments[1] !== (void 0) ? arguments[1] : Validators.array; + $traceurRuntime.superConstructor(ControlArray).call(this, validator); + this.controls = controls; + this._valueChanges = new EventEmitter(); + this._setParentForControls(); + this._updateValue(); + this.updateValidity({onlySelf: true}); + } + return ($traceurRuntime.createClass)(ControlArray, { + at: function(index) { + return this.controls[index]; + }, + push: function(control) { + this.controls.push(control); + control.setParent(this); + this.updateValueAndValidity(); + }, + insert: function(index, control) { + ListWrapper.insert(this.controls, index, control); + control.setParent(this); + this.updateValueAndValidity(); + }, + removeAt: function(index) { + ListWrapper.removeAt(this.controls, index); + this.updateValueAndValidity(); + }, + get length() { + return this.controls.length; + }, + _updateValue: function() { + this._value = ListWrapper.map(this.controls, (function(c) { + return c.value; + })); + }, + _setParentForControls: function() { + var $__0 = this; + ListWrapper.forEach(this.controls, (function(control) { + control.setParent($__0); + })); + } + }, {}, $__super); + }(AbstractControl)); + $__export("ControlArray", ControlArray); + } + }; +}); + +System.register("angular2/src/forms/directives/ng_control_name", ["angular2/src/facade/lang", "angular2/src/facade/async", "angular2/core", "angular2/annotations", "angular2/di", "angular2/src/forms/directives/control_container", "angular2/src/forms/directives/ng_control", "angular2/src/forms/directives/validators", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/ng_control_name"; + var __decorate, + __metadata, + __param, + CONST_EXPR, + EventEmitter, + ObservableWrapper, + QueryList, + Query, + Directive, + LifecycleEvent, + forwardRef, + Ancestor, + Binding, + ControlContainer, + NgControl, + NgValidator, + controlPath, + composeNgValidator, + isPropertyUpdated, + controlNameBinding, + NgControlName; + return { + setters: [function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + QueryList = $__m.QueryList; + }, function($__m) { + Query = $__m.Query; + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + forwardRef = $__m.forwardRef; + Ancestor = $__m.Ancestor; + Binding = $__m.Binding; + }, function($__m) { + ControlContainer = $__m.ControlContainer; + }, function($__m) { + NgControl = $__m.NgControl; + }, function($__m) { + NgValidator = $__m.NgValidator; + }, function($__m) { + controlPath = $__m.controlPath; + composeNgValidator = $__m.composeNgValidator; + isPropertyUpdated = $__m.isPropertyUpdated; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + controlNameBinding = CONST_EXPR(new Binding(NgControl, {toAlias: forwardRef((function() { + return NgControlName; + }))})); + NgControlName = (function($__super) { + function $__0(parent, ngValidators) { + $traceurRuntime.superConstructor($__0).call(this); + this.update = new EventEmitter(); + this._added = false; + this._parent = parent; + this.ngValidators = ngValidators; + } + return ($traceurRuntime.createClass)($__0, { + onChange: function(c) { + if (!this._added) { + this.formDirective.addControl(this); + this._added = true; + } + if (isPropertyUpdated(c, this.viewModel)) { + this.viewModel = this.model; + this.formDirective.updateModel(this, this.model); + } + }, + onDestroy: function() { + this.formDirective.removeControl(this); + }, + viewToModelUpdate: function(newValue) { + this.viewModel = newValue; + ObservableWrapper.callNext(this.update, newValue); + }, + get path() { + return controlPath(this.name, this._parent); + }, + get formDirective() { + return this._parent.formDirective; + }, + get control() { + return this.formDirective.getControl(this); + }, + get validator() { + return composeNgValidator(this.ngValidators); + } + }, {}, $__super); + }(NgControl)); + $__export("NgControlName", NgControlName); + $__export("NgControlName", NgControlName = __decorate([Directive({ + selector: '[ng-control]', + hostInjector: [controlNameBinding], + properties: ['name: ngControl', 'model: ngModel'], + events: ['update: ngModel'], + lifecycle: [LifecycleEvent.onDestroy, LifecycleEvent.onChange], + exportAs: 'form' + }), __param(0, Ancestor()), __param(1, Query(NgValidator)), __metadata('design:paramtypes', [ControlContainer, QueryList])], NgControlName)); + } + }; +}); + +System.register("angular2/src/forms/directives/default_value_accessor", ["angular2/render", "angular2/annotations", "angular2/core", "angular2/di", "angular2/src/forms/directives/ng_control", "angular2/src/facade/lang", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/default_value_accessor"; + var __decorate, + __metadata, + __param, + Renderer, + Directive, + ElementRef, + Self, + NgControl, + isBlank, + isPresent, + setProperty, + DefaultValueAccessor; + return { + setters: [function($__m) { + Renderer = $__m.Renderer; + }, function($__m) { + Directive = $__m.Directive; + }, function($__m) { + ElementRef = $__m.ElementRef; + }, function($__m) { + Self = $__m.Self; + }, function($__m) { + NgControl = $__m.NgControl; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + }, function($__m) { + setProperty = $__m.setProperty; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + DefaultValueAccessor = (($traceurRuntime.createClass)(function(cd, renderer, elementRef) { + this.renderer = renderer; + this.elementRef = elementRef; + this.onChange = (function(_) {}); + this.onTouched = (function() {}); + this.cd = cd; + cd.valueAccessor = this; + }, { + writeValue: function(value) { + var normalizedValue = isBlank(value) ? '' : value; + setProperty(this.renderer, this.elementRef, 'value', normalizedValue); + }, + get ngClassUntouched() { + return isPresent(this.cd.control) ? this.cd.control.untouched : false; + }, + get ngClassTouched() { + return isPresent(this.cd.control) ? this.cd.control.touched : false; + }, + get ngClassPristine() { + return isPresent(this.cd.control) ? this.cd.control.pristine : false; + }, + get ngClassDirty() { + return isPresent(this.cd.control) ? this.cd.control.dirty : false; + }, + get ngClassValid() { + return isPresent(this.cd.control) ? this.cd.control.valid : false; + }, + get ngClassInvalid() { + return isPresent(this.cd.control) ? !this.cd.control.valid : false; + }, + registerOnChange: function(fn) { + this.onChange = fn; + }, + registerOnTouched: function(fn) { + this.onTouched = fn; + } + }, {})); + $__export("DefaultValueAccessor", DefaultValueAccessor); + $__export("DefaultValueAccessor", DefaultValueAccessor = __decorate([Directive({ + selector: 'input:not([type=checkbox])[ng-control],textarea[ng-control],input:not([type=checkbox])[ng-form-control],textarea[ng-form-control],input:not([type=checkbox])[ng-model],textarea[ng-model]', + host: { + '(change)': 'onChange($event.target.value)', + '(input)': 'onChange($event.target.value)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, Self()), __metadata('design:paramtypes', [NgControl, Renderer, ElementRef])], DefaultValueAccessor)); + } + }; +}); + +System.register("angular2/src/di/binding", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/reflection/reflection", "angular2/src/di/key", "angular2/src/di/metadata", "angular2/src/di/exceptions", "angular2/src/di/forward_ref"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/binding"; + var __decorate, + __metadata, + Type, + isBlank, + isPresent, + CONST, + CONST_EXPR, + BaseException, + stringify, + isArray, + ListWrapper, + reflector, + Key, + InjectMetadata, + VisibilityMetadata, + OptionalMetadata, + DEFAULT_VISIBILITY, + DependencyMetadata, + NoAnnotationError, + resolveForwardRef, + Dependency, + _EMPTY_LIST, + Binding, + ResolvedBinding, + BindingBuilder; + function bind(token) { + return new BindingBuilder(token); + } + function _constructDependencies(factoryFunction, dependencies) { + if (isBlank(dependencies)) { + return _dependenciesFor(factoryFunction); + } else { + var params = ListWrapper.map(dependencies, (function(t) { + return [t]; + })); + return ListWrapper.map(dependencies, (function(t) { + return _extractToken(factoryFunction, t, params); + })); + } + } + function _dependenciesFor(typeOrFunc) { + var params = reflector.parameters(typeOrFunc); + if (isBlank(params)) + return []; + if (ListWrapper.any(params, (function(p) { + return isBlank(p); + }))) { + throw new NoAnnotationError(typeOrFunc, params); + } + return ListWrapper.map(params, (function(p) { + return _extractToken(typeOrFunc, p, params); + })); + } + function _extractToken(typeOrFunc, annotations, params) { + var depProps = []; + var token = null; + var optional = false; + if (!isArray(annotations)) { + return _createDependency(annotations, optional, DEFAULT_VISIBILITY, depProps); + } + var visibility = DEFAULT_VISIBILITY; + for (var i = 0; i < annotations.length; ++i) { + var paramAnnotation = annotations[i]; + if (paramAnnotation instanceof Type) { + token = paramAnnotation; + } else if (paramAnnotation instanceof InjectMetadata) { + token = paramAnnotation.token; + } else if (paramAnnotation instanceof OptionalMetadata) { + optional = true; + } else if (paramAnnotation instanceof VisibilityMetadata) { + visibility = paramAnnotation; + } else if (paramAnnotation instanceof DependencyMetadata) { + if (isPresent(paramAnnotation.token)) { + token = paramAnnotation.token; + } + depProps.push(paramAnnotation); + } + } + token = resolveForwardRef(token); + if (isPresent(token)) { + return _createDependency(token, optional, visibility, depProps); + } else { + throw new NoAnnotationError(typeOrFunc, params); + } + } + function _createDependency(token, optional, visibility, depProps) { + return new Dependency(Key.get(token), optional, visibility, depProps); + } + $__export("bind", bind); + return { + setters: [function($__m) { + Type = $__m.Type; + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + CONST = $__m.CONST; + CONST_EXPR = $__m.CONST_EXPR; + BaseException = $__m.BaseException; + stringify = $__m.stringify; + isArray = $__m.isArray; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + reflector = $__m.reflector; + }, function($__m) { + Key = $__m.Key; + }, function($__m) { + InjectMetadata = $__m.InjectMetadata; + VisibilityMetadata = $__m.VisibilityMetadata; + OptionalMetadata = $__m.OptionalMetadata; + DEFAULT_VISIBILITY = $__m.DEFAULT_VISIBILITY; + DependencyMetadata = $__m.DependencyMetadata; + }, function($__m) { + NoAnnotationError = $__m.NoAnnotationError; + }, function($__m) { + resolveForwardRef = $__m.resolveForwardRef; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Dependency = (function() { + function Dependency(key, optional, visibility, properties) { + this.key = key; + this.optional = optional; + this.visibility = visibility; + this.properties = properties; + } + return ($traceurRuntime.createClass)(Dependency, {}, {fromKey: function(key) { + return new Dependency(key, false, DEFAULT_VISIBILITY, []); + }}); + }()); + $__export("Dependency", Dependency); + _EMPTY_LIST = CONST_EXPR([]); + Binding = (($traceurRuntime.createClass)(function(token, $__3) { + var $__4 = $__3, + toClass = $__4.toClass, + toValue = $__4.toValue, + toAlias = $__4.toAlias, + toFactory = $__4.toFactory, + deps = $__4.deps; + this.token = token; + this.toClass = toClass; + this.toValue = toValue; + this.toAlias = toAlias; + this.toFactory = toFactory; + this.dependencies = deps; + }, {resolve: function() { + var $__0 = this; + var factoryFn; + var resolvedDeps; + if (isPresent(this.toClass)) { + var toClass = resolveForwardRef(this.toClass); + factoryFn = reflector.factory(toClass); + resolvedDeps = _dependenciesFor(toClass); + } else if (isPresent(this.toAlias)) { + factoryFn = (function(aliasInstance) { + return aliasInstance; + }); + resolvedDeps = [Dependency.fromKey(Key.get(this.toAlias))]; + } else if (isPresent(this.toFactory)) { + factoryFn = this.toFactory; + resolvedDeps = _constructDependencies(this.toFactory, this.dependencies); + } else { + factoryFn = (function() { + return $__0.toValue; + }); + resolvedDeps = _EMPTY_LIST; + } + return new ResolvedBinding(Key.get(this.token), factoryFn, resolvedDeps); + }}, {})); + $__export("Binding", Binding); + $__export("Binding", Binding = __decorate([CONST(), __metadata('design:paramtypes', [Object, Object])], Binding)); + ResolvedBinding = (function() { + function ResolvedBinding(key, factory, dependencies) { + this.key = key; + this.factory = factory; + this.dependencies = dependencies; + } + return ($traceurRuntime.createClass)(ResolvedBinding, {}, {}); + }()); + $__export("ResolvedBinding", ResolvedBinding); + BindingBuilder = (function() { + function BindingBuilder(token) { + this.token = token; + } + return ($traceurRuntime.createClass)(BindingBuilder, { + toClass: function(type) { + return new Binding(this.token, {toClass: type}); + }, + toValue: function(value) { + return new Binding(this.token, {toValue: value}); + }, + toAlias: function(aliasToken) { + if (isBlank(aliasToken)) { + throw new BaseException(("Can not alias " + stringify(this.token) + " to a blank value!")); + } + return new Binding(this.token, {toAlias: aliasToken}); + }, + toFactory: function(factoryFunction, dependencies) { + return new Binding(this.token, { + toFactory: factoryFunction, + deps: dependencies + }); + } + }, {}); + }()); + $__export("BindingBuilder", BindingBuilder); + } + }; +}); + +System.register("angular2/src/change_detection/abstract_change_detector", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/change_detector_ref", "angular2/src/change_detection/exceptions", "angular2/src/change_detection/constants"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/abstract_change_detector"; + var isPresent, + BaseException, + ListWrapper, + ChangeDetectorRef, + ChangeDetectionError, + CHECK_ONCE, + CHECKED, + DETACHED, + _Context, + AbstractChangeDetector; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + ChangeDetectorRef = $__m.ChangeDetectorRef; + }, function($__m) { + ChangeDetectionError = $__m.ChangeDetectionError; + }, function($__m) { + CHECK_ONCE = $__m.CHECK_ONCE; + CHECKED = $__m.CHECKED; + DETACHED = $__m.DETACHED; + }], + execute: function() { + _Context = (function() { + function _Context(element, componentElement, instance, context, locals, injector, expression) { + this.element = element; + this.componentElement = componentElement; + this.instance = instance; + this.context = context; + this.locals = locals; + this.injector = injector; + this.expression = expression; + } + return ($traceurRuntime.createClass)(_Context, {}, {}); + }()); + AbstractChangeDetector = (function() { + function AbstractChangeDetector(id, dispatcher) { + this.id = id; + this.dispatcher = dispatcher; + this.lightDomChildren = []; + this.shadowDomChildren = []; + this.mode = null; + this.ref = new ChangeDetectorRef(this); + } + return ($traceurRuntime.createClass)(AbstractChangeDetector, { + addChild: function(cd) { + this.lightDomChildren.push(cd); + cd.parent = this; + }, + removeChild: function(cd) { + ListWrapper.remove(this.lightDomChildren, cd); + }, + addShadowDomChild: function(cd) { + this.shadowDomChildren.push(cd); + cd.parent = this; + }, + removeShadowDomChild: function(cd) { + ListWrapper.remove(this.shadowDomChildren, cd); + }, + remove: function() { + this.parent.removeChild(this); + }, + detectChanges: function() { + this.runDetectChanges(false); + }, + checkNoChanges: function() { + throw new BaseException("Not implemented"); + }, + runDetectChanges: function(throwOnChange) { + if (this.mode === DETACHED || this.mode === CHECKED) + return ; + this.detectChangesInRecords(throwOnChange); + this._detectChangesInLightDomChildren(throwOnChange); + if (throwOnChange === false) + this.callOnAllChangesDone(); + this._detectChangesInShadowDomChildren(throwOnChange); + if (this.mode === CHECK_ONCE) + this.mode = CHECKED; + }, + detectChangesInRecords: function(throwOnChange) {}, + hydrate: function(context, locals, directives, pipes) {}, + hydrateDirectives: function(directives) {}, + dehydrate: function() {}, + dehydrateDirectives: function(destroyPipes) {}, + callOnAllChangesDone: function() {}, + _detectChangesInLightDomChildren: function(throwOnChange) { + var c = this.lightDomChildren; + for (var i = 0; i < c.length; ++i) { + c[i].runDetectChanges(throwOnChange); + } + }, + _detectChangesInShadowDomChildren: function(throwOnChange) { + var c = this.shadowDomChildren; + for (var i = 0; i < c.length; ++i) { + c[i].runDetectChanges(throwOnChange); + } + }, + markAsCheckOnce: function() { + this.mode = CHECK_ONCE; + }, + markPathToRootAsCheckOnce: function() { + var c = this; + while (isPresent(c) && c.mode != DETACHED) { + if (c.mode === CHECKED) + c.mode = CHECK_ONCE; + c = c.parent; + } + }, + throwError: function(proto, exception, stack) { + var c = this.dispatcher.getDebugContext(proto.bindingRecord.elementIndex, proto.directiveIndex); + var context = isPresent(c) ? new _Context(c.element, c.componentElement, c.directive, c.context, c.locals, c.injector, proto.expressionAsString) : null; + throw new ChangeDetectionError(proto, exception, stack, context); + } + }, {}); + }()); + $__export("AbstractChangeDetector", AbstractChangeDetector); + } + }; +}); + +System.register("angular2/src/core/compiler/view_manager", ["angular2/di", "angular2/src/facade/lang", "angular2/src/core/compiler/view_ref", "angular2/src/render/api", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_listener"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view_manager"; + var __decorate, + __metadata, + Injectable, + isPresent, + isBlank, + BaseException, + internalView, + internalProtoView, + Renderer, + ViewType, + AppViewManagerUtils, + AppViewPool, + AppViewListener, + AppViewManager; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + internalView = $__m.internalView; + internalProtoView = $__m.internalProtoView; + }, function($__m) { + Renderer = $__m.Renderer; + ViewType = $__m.ViewType; + }, function($__m) { + AppViewManagerUtils = $__m.AppViewManagerUtils; + }, function($__m) { + AppViewPool = $__m.AppViewPool; + }, function($__m) { + AppViewListener = $__m.AppViewListener; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + AppViewManager = (($traceurRuntime.createClass)(function(_viewPool, _viewListener, _utils, _renderer) { + this._viewPool = _viewPool; + this._viewListener = _viewListener; + this._utils = _utils; + this._renderer = _renderer; + }, { + getViewContainer: function(location) { + var hostView = internalView(location.parentView); + return hostView.elementInjectors[location.boundElementIndex].getViewContainerRef(); + }, + getHostElement: function(hostViewRef) { + var hostView = internalView(hostViewRef); + if (hostView.proto.type !== ViewType.HOST) { + throw new BaseException('This operation is only allowed on host views'); + } + return hostView.elementRefs[hostView.elementOffset]; + }, + getNamedElementInComponentView: function(hostLocation, variableName) { + var hostView = internalView(hostLocation.parentView); + var boundElementIndex = hostLocation.boundElementIndex; + var componentView = hostView.getNestedView(boundElementIndex); + if (isBlank(componentView)) { + throw new BaseException(("There is no component directive at element " + boundElementIndex)); + } + var binderIdx = componentView.proto.variableLocations.get(variableName); + if (isBlank(binderIdx)) { + throw new BaseException(("Could not find variable " + variableName)); + } + return componentView.elementRefs[componentView.elementOffset + binderIdx]; + }, + getComponent: function(hostLocation) { + var hostView = internalView(hostLocation.parentView); + var boundElementIndex = hostLocation.boundElementIndex; + return this._utils.getComponentInstance(hostView, boundElementIndex); + }, + createRootHostView: function(hostProtoViewRef, overrideSelector, injector) { + var hostProtoView = internalProtoView(hostProtoViewRef); + var hostElementSelector = overrideSelector; + if (isBlank(hostElementSelector)) { + hostElementSelector = hostProtoView.elementBinders[0].componentDirective.metadata.selector; + } + var renderViewWithFragments = this._renderer.createRootHostView(hostProtoView.mergeMapping.renderProtoViewRef, hostProtoView.mergeMapping.renderFragmentCount, hostElementSelector); + var hostView = this._createMainView(hostProtoView, renderViewWithFragments); + this._renderer.hydrateView(hostView.render); + this._utils.hydrateRootHostView(hostView, injector); + return hostView.ref; + }, + destroyRootHostView: function(hostViewRef) { + var hostView = internalView(hostViewRef); + this._renderer.detachFragment(hostView.renderFragment); + this._renderer.dehydrateView(hostView.render); + this._viewDehydrateRecurse(hostView); + this._viewListener.viewDestroyed(hostView); + this._renderer.destroyView(hostView.render); + }, + createEmbeddedViewInContainer: function(viewContainerLocation, atIndex, templateRef) { + var protoView = internalProtoView(templateRef.protoViewRef); + if (protoView.type !== ViewType.EMBEDDED) { + throw new BaseException('This method can only be called with embedded ProtoViews!'); + } + return this._createViewInContainer(viewContainerLocation, atIndex, protoView, templateRef.elementRef, null); + }, + createHostViewInContainer: function(viewContainerLocation, atIndex, protoViewRef, imperativelyCreatedInjector) { + var protoView = internalProtoView(protoViewRef); + if (protoView.type !== ViewType.HOST) { + throw new BaseException('This method can only be called with host ProtoViews!'); + } + return this._createViewInContainer(viewContainerLocation, atIndex, protoView, viewContainerLocation, imperativelyCreatedInjector); + }, + _createViewInContainer: function(viewContainerLocation, atIndex, protoView, context, imperativelyCreatedInjector) { + var parentView = internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + var contextView = internalView(context.parentView); + var contextBoundElementIndex = context.boundElementIndex; + var embeddedFragmentView = contextView.getNestedView(contextBoundElementIndex); + var view; + if (protoView.type === ViewType.EMBEDDED && isPresent(embeddedFragmentView) && !embeddedFragmentView.hydrated()) { + view = embeddedFragmentView; + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + } else { + view = this._createPooledView(protoView); + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + this._renderer.hydrateView(view.render); + } + this._utils.attachViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view); + this._utils.hydrateViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, imperativelyCreatedInjector); + return view.ref; + }, + _attachRenderView: function(parentView, boundElementIndex, atIndex, view) { + var elementRef = parentView.elementRefs[boundElementIndex]; + if (atIndex === 0) { + this._renderer.attachFragmentAfterElement(elementRef, view.renderFragment); + } else { + var prevView = parentView.viewContainers[boundElementIndex].views[atIndex - 1]; + this._renderer.attachFragmentAfterFragment(prevView.renderFragment, view.renderFragment); + } + }, + destroyViewInContainer: function(viewContainerLocation, atIndex) { + var parentView = internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + this._destroyViewInContainer(parentView, boundElementIndex, atIndex); + }, + attachViewInContainer: function(viewContainerLocation, atIndex, viewRef) { + var view = internalView(viewRef); + var parentView = internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + this._utils.attachViewInContainer(parentView, boundElementIndex, null, null, atIndex, view); + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + return viewRef; + }, + detachViewInContainer: function(viewContainerLocation, atIndex) { + var parentView = internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex); + this._renderer.detachFragment(view.renderFragment); + return view.ref; + }, + _createMainView: function(protoView, renderViewWithFragments) { + var mergedParentView = this._utils.createView(protoView, renderViewWithFragments, this, this._renderer); + this._renderer.setEventDispatcher(mergedParentView.render, mergedParentView); + this._viewListener.viewCreated(mergedParentView); + return mergedParentView; + }, + _createPooledView: function(protoView) { + var view = this._viewPool.getView(protoView); + if (isBlank(view)) { + view = this._createMainView(protoView, this._renderer.createView(protoView.mergeMapping.renderProtoViewRef, protoView.mergeMapping.renderFragmentCount)); + } + return view; + }, + _destroyPooledView: function(view) { + var wasReturned = this._viewPool.returnView(view); + if (!wasReturned) { + this._viewListener.viewDestroyed(view); + this._renderer.destroyView(view.render); + } + }, + _destroyViewInContainer: function(parentView, boundElementIndex, atIndex) { + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + this._viewDehydrateRecurse(view); + this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex); + if (view.viewOffset > 0) { + this._renderer.detachFragment(view.renderFragment); + } else { + this._renderer.dehydrateView(view.render); + this._renderer.detachFragment(view.renderFragment); + this._destroyPooledView(view); + } + }, + _viewDehydrateRecurse: function(view) { + if (view.hydrated()) { + this._utils.dehydrateView(view); + } + var viewContainers = view.viewContainers; + var startViewOffset = view.viewOffset; + var endViewOffset = view.viewOffset + view.mainMergeMapping.nestedViewCountByViewIndex[view.viewOffset]; + var elementOffset = view.elementOffset; + for (var viewIdx = startViewOffset; viewIdx <= endViewOffset; viewIdx++) { + var currView = view.views[viewIdx]; + for (var binderIdx = 0; binderIdx < currView.proto.elementBinders.length; binderIdx++, elementOffset++) { + var vc = viewContainers[elementOffset]; + if (isPresent(vc)) { + for (var j = vc.views.length - 1; j >= 0; j--) { + this._destroyViewInContainer(currView, elementOffset, j); + } + } + } + } + } + }, {})); + $__export("AppViewManager", AppViewManager); + $__export("AppViewManager", AppViewManager = __decorate([Injectable(), __metadata('design:paramtypes', [AppViewPool, AppViewListener, AppViewManagerUtils, Renderer])], AppViewManager)); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/view_loader", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/facade/async", "angular2/src/dom/dom_adapter", "angular2/src/render/xhr", "angular2/src/render/dom/compiler/style_inliner", "angular2/src/render/dom/compiler/style_url_resolver"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/view_loader"; + var __decorate, + __metadata, + Injectable, + isBlank, + isPresent, + BaseException, + isPromise, + StringWrapper, + Map, + MapWrapper, + ListWrapper, + PromiseWrapper, + DOM, + XHR, + StyleInliner, + StyleUrlResolver, + TemplateAndStyles, + ViewLoader; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + isPromise = $__m.isPromise; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + Map = $__m.Map; + MapWrapper = $__m.MapWrapper; + ListWrapper = $__m.ListWrapper; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + XHR = $__m.XHR; + }, function($__m) { + StyleInliner = $__m.StyleInliner; + }, function($__m) { + StyleUrlResolver = $__m.StyleUrlResolver; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + TemplateAndStyles = (function() { + function TemplateAndStyles(template, styles) { + this.template = template; + this.styles = styles; + } + return ($traceurRuntime.createClass)(TemplateAndStyles, {}, {}); + }()); + $__export("TemplateAndStyles", TemplateAndStyles); + ViewLoader = (($traceurRuntime.createClass)(function(_xhr, _styleInliner, _styleUrlResolver) { + this._xhr = _xhr; + this._styleInliner = _styleInliner; + this._styleUrlResolver = _styleUrlResolver; + this._cache = new Map(); + }, { + load: function(viewDef) { + var $__0 = this; + var tplAndStyles = [this._loadHtml(viewDef.template, viewDef.templateAbsUrl)]; + if (isPresent(viewDef.styles)) { + viewDef.styles.forEach((function(cssText) { + var textOrPromise = $__0._resolveAndInlineCssText(cssText, viewDef.templateAbsUrl); + tplAndStyles.push(textOrPromise); + })); + } + if (isPresent(viewDef.styleAbsUrls)) { + viewDef.styleAbsUrls.forEach((function(url) { + var promise = $__0._loadText(url).then((function(cssText) { + return $__0._resolveAndInlineCssText(cssText, viewDef.templateAbsUrl); + })); + tplAndStyles.push(promise); + })); + } + return PromiseWrapper.all(tplAndStyles).then((function(res) { + var loadedTplAndStyles = res[0]; + var styles = ListWrapper.slice(res, 1); + return new TemplateAndStyles(loadedTplAndStyles.template, loadedTplAndStyles.styles.concat(styles)); + })); + }, + _loadText: function(url) { + var response = this._cache.get(url); + if (isBlank(response)) { + response = PromiseWrapper.catchError(this._xhr.get(url), (function(_) { + return PromiseWrapper.reject(new BaseException(("Failed to fetch url \"" + url + "\"")), null); + })); + this._cache.set(url, response); + } + return response; + }, + _loadHtml: function(template, templateAbsUrl) { + var $__0 = this; + var html; + if (isPresent(template)) { + html = PromiseWrapper.resolve(template); + } else if (isPresent(templateAbsUrl)) { + html = this._loadText(templateAbsUrl); + } else { + throw new BaseException('View should have either the templateUrl or template property set'); + } + return html.then((function(html) { + var tplEl = DOM.createTemplate(html); + if (isPresent(templateAbsUrl) && templateAbsUrl.indexOf("/") >= 0) { + var baseUrl = templateAbsUrl.substring(0, templateAbsUrl.lastIndexOf("/")); + $__0._substituteBaseUrl(DOM.content(tplEl), baseUrl); + } + var styleEls = DOM.querySelectorAll(DOM.content(tplEl), 'STYLE'); + var unresolvedStyles = []; + for (var i = 0; i < styleEls.length; i++) { + var styleEl = styleEls[i]; + unresolvedStyles.push(DOM.getText(styleEl)); + DOM.remove(styleEl); + } + var syncStyles = []; + var asyncStyles = []; + for (var i$__3 = 0; i$__3 < styleEls.length; i$__3++) { + var styleEl = styleEls[i$__3]; + var resolvedStyled = $__0._resolveAndInlineCssText(DOM.getText(styleEl), templateAbsUrl); + if (isPromise(resolvedStyled)) { + asyncStyles.push(resolvedStyled); + } else { + syncStyles.push(resolvedStyled); + } + } + if (asyncStyles.length === 0) { + return PromiseWrapper.resolve(new TemplateAndStyles(DOM.getInnerHTML(tplEl), syncStyles)); + } else { + return PromiseWrapper.all(asyncStyles).then((function(loadedStyles) { + return new TemplateAndStyles(DOM.getInnerHTML(tplEl), syncStyles.concat(loadedStyles)); + })); + } + })); + }, + _substituteBaseUrl: function(element, baseUrl) { + if (DOM.isElementNode(element)) { + var attrs = DOM.attributeMap(element); + MapWrapper.forEach(attrs, (function(v, k) { + if (isPresent(v) && v.indexOf('$baseUrl') >= 0) { + DOM.setAttribute(element, k, StringWrapper.replaceAll(v, /\$baseUrl/g, baseUrl)); + } + })); + } + var children = DOM.childNodes(element); + for (var i = 0; i < children.length; i++) { + if (DOM.isElementNode(children[i])) { + this._substituteBaseUrl(children[i], baseUrl); + } + } + }, + _resolveAndInlineCssText: function(cssText, baseUrl) { + cssText = this._styleUrlResolver.resolveUrls(cssText, baseUrl); + return this._styleInliner.inlineImports(cssText, baseUrl); + } + }, {})); + $__export("ViewLoader", ViewLoader); + $__export("ViewLoader", ViewLoader = __decorate([Injectable(), __metadata('design:paramtypes', [XHR, StyleInliner, StyleUrlResolver])], ViewLoader)); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/compile_pipeline", ["angular2/src/facade/lang", "angular2/src/dom/dom_adapter", "angular2/src/render/dom/compiler/compile_element", "angular2/src/render/dom/compiler/compile_control", "angular2/src/render/dom/view/proto_view_builder"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/compile_pipeline"; + var isPresent, + DOM, + CompileElement, + CompileControl, + ProtoViewBuilder, + CompilePipeline; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + CompileElement = $__m.CompileElement; + }, function($__m) { + CompileControl = $__m.CompileControl; + }, function($__m) { + ProtoViewBuilder = $__m.ProtoViewBuilder; + }], + execute: function() { + CompilePipeline = (function() { + function CompilePipeline(steps) { + this.steps = steps; + this._control = new CompileControl(steps); + } + return ($traceurRuntime.createClass)(CompilePipeline, { + processStyles: function(styles) { + var $__0 = this; + return styles.map((function(style) { + $__0.steps.forEach((function(step) { + style = step.processStyle(style); + })); + return style; + })); + }, + processElements: function(rootElement, protoViewType, viewDef) { + var results = []; + var compilationCtxtDescription = viewDef.componentId; + var rootCompileElement = new CompileElement(rootElement, compilationCtxtDescription); + rootCompileElement.inheritedProtoView = new ProtoViewBuilder(rootElement, protoViewType, viewDef.encapsulation); + rootCompileElement.isViewRoot = true; + this._processElement(results, null, rootCompileElement, compilationCtxtDescription); + return results; + }, + _processElement: function(results, parent, current) { + var compilationCtxtDescription = arguments[3] !== (void 0) ? arguments[3] : ''; + var additionalChildren = this._control.internalProcess(results, 0, parent, current); + if (current.compileChildren) { + var node = DOM.firstChild(DOM.templateAwareRoot(current.element)); + while (isPresent(node)) { + var nextNode = DOM.nextSibling(node); + if (DOM.isElementNode(node)) { + var childCompileElement = new CompileElement(node, compilationCtxtDescription); + childCompileElement.inheritedProtoView = current.inheritedProtoView; + childCompileElement.inheritedElementBinder = current.inheritedElementBinder; + childCompileElement.distanceToInheritedBinder = current.distanceToInheritedBinder + 1; + this._processElement(results, current, childCompileElement); + } + node = nextNode; + } + } + if (isPresent(additionalChildren)) { + for (var i = 0; i < additionalChildren.length; i++) { + this._processElement(results, current, additionalChildren[i]); + } + } + } + }, {}); + }()); + $__export("CompilePipeline", CompilePipeline); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/compile_step_factory", ["angular2/src/render/dom/compiler/property_binding_parser", "angular2/src/render/dom/compiler/text_interpolation_parser", "angular2/src/render/dom/compiler/directive_parser", "angular2/src/render/dom/compiler/view_splitter", "angular2/src/render/dom/compiler/style_encapsulator"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/compile_step_factory"; + var PropertyBindingParser, + TextInterpolationParser, + DirectiveParser, + ViewSplitter, + StyleEncapsulator, + CompileStepFactory, + DefaultStepFactory; + return { + setters: [function($__m) { + PropertyBindingParser = $__m.PropertyBindingParser; + }, function($__m) { + TextInterpolationParser = $__m.TextInterpolationParser; + }, function($__m) { + DirectiveParser = $__m.DirectiveParser; + }, function($__m) { + ViewSplitter = $__m.ViewSplitter; + }, function($__m) { + StyleEncapsulator = $__m.StyleEncapsulator; + }], + execute: function() { + CompileStepFactory = (function() { + function CompileStepFactory() {} + return ($traceurRuntime.createClass)(CompileStepFactory, {createSteps: function(view) { + return null; + }}, {}); + }()); + $__export("CompileStepFactory", CompileStepFactory); + DefaultStepFactory = (function($__super) { + function DefaultStepFactory(_parser, _appId) { + $traceurRuntime.superConstructor(DefaultStepFactory).call(this); + this._parser = _parser; + this._appId = _appId; + this._componentUIDsCache = new Map(); + } + return ($traceurRuntime.createClass)(DefaultStepFactory, {createSteps: function(view) { + return [new ViewSplitter(this._parser), new PropertyBindingParser(this._parser), new DirectiveParser(this._parser, view.directives), new TextInterpolationParser(this._parser), new StyleEncapsulator(this._appId, view, this._componentUIDsCache)]; + }}, {}, $__super); + }(CompileStepFactory)); + $__export("DefaultStepFactory", DefaultStepFactory); + } + }; +}); + +System.register("angular2/src/http/http", ["angular2/src/facade/lang", "angular2/src/di/decorators", "angular2/src/http/interfaces", "angular2/src/http/static_request", "angular2/src/http/base_request_options", "angular2/src/http/enums"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/http"; + var __decorate, + __metadata, + isString, + isPresent, + makeTypeError, + Injectable, + ConnectionBackend, + Request, + RequestOptions, + RequestMethods, + Http, + Jsonp; + function httpRequest(backend, request) { + return backend.createConnection(request).response; + } + function mergeOptions(defaultOpts, providedOpts, method, url) { + var newOptions = defaultOpts; + if (isPresent(providedOpts)) { + newOptions = newOptions.merge(new RequestOptions({ + method: providedOpts.method, + url: providedOpts.url, + headers: providedOpts.headers, + body: providedOpts.body, + mode: providedOpts.mode, + credentials: providedOpts.credentials, + cache: providedOpts.cache + })); + } + if (isPresent(method)) { + return newOptions.merge(new RequestOptions({ + method: method, + url: url + })); + } else { + return newOptions.merge(new RequestOptions({url: url})); + } + } + return { + setters: [function($__m) { + isString = $__m.isString; + isPresent = $__m.isPresent; + makeTypeError = $__m.makeTypeError; + }, function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + ConnectionBackend = $__m.ConnectionBackend; + }, function($__m) { + Request = $__m.Request; + }, function($__m) { + RequestOptions = $__m.RequestOptions; + }, function($__m) { + RequestMethods = $__m.RequestMethods; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Http = (($traceurRuntime.createClass)(function(_backend, _defaultOptions) { + this._backend = _backend; + this._defaultOptions = _defaultOptions; + }, { + request: function(url, options) { + var responseObservable; + if (isString(url)) { + responseObservable = httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions, options, RequestMethods.GET, url))); + } else if (url instanceof Request) { + responseObservable = httpRequest(this._backend, url); + } + return responseObservable; + }, + get: function(url, options) { + return httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions, options, RequestMethods.GET, url))); + }, + post: function(url, body, options) { + return httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions.merge(new RequestOptions({body: body})), options, RequestMethods.POST, url))); + }, + put: function(url, body, options) { + return httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions.merge(new RequestOptions({body: body})), options, RequestMethods.PUT, url))); + }, + delete: function(url, options) { + return httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions, options, RequestMethods.DELETE, url))); + }, + patch: function(url, body, options) { + return httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions.merge(new RequestOptions({body: body})), options, RequestMethods.PATCH, url))); + }, + head: function(url, options) { + return httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions, options, RequestMethods.HEAD, url))); + } + }, {})); + $__export("Http", Http); + $__export("Http", Http = __decorate([Injectable(), __metadata('design:paramtypes', [ConnectionBackend, RequestOptions])], Http)); + Jsonp = (function($__super) { + function $__0(backend, defaultOptions) { + $traceurRuntime.superConstructor($__0).call(this, backend, defaultOptions); + } + return ($traceurRuntime.createClass)($__0, {request: function(url, options) { + var responseObservable; + if (isString(url)) { + url = new Request(mergeOptions(this._defaultOptions, options, RequestMethods.GET, url)); + } + if (url instanceof Request) { + if (url.method !== RequestMethods.GET) { + makeTypeError('JSONP requests must use GET request method.'); + } + responseObservable = httpRequest(this._backend, url); + } + return responseObservable; + }}, {}, $__super); + }(Http)); + $__export("Jsonp", Jsonp); + $__export("Jsonp", Jsonp = __decorate([Injectable(), __metadata('design:paramtypes', [ConnectionBackend, RequestOptions])], Jsonp)); + } + }; +}); + +System.register("angular2/src/http/backends/xhr_backend", ["angular2/src/http/enums", "angular2/src/http/static_response", "angular2/src/http/base_response_options", "angular2/di", "angular2/src/http/backends/browser_xhr", "angular2/src/facade/async", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/backends/xhr_backend"; + var __decorate, + __metadata, + RequestMethodsMap, + Response, + ResponseOptions, + Injectable, + BrowserXhr, + EventEmitter, + ObservableWrapper, + isPresent, + ENUM_INDEX, + XHRConnection, + XHRBackend; + return { + setters: [function($__m) { + RequestMethodsMap = $__m.RequestMethodsMap; + }, function($__m) { + Response = $__m.Response; + }, function($__m) { + ResponseOptions = $__m.ResponseOptions; + }, function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + BrowserXhr = $__m.BrowserXhr; + }, function($__m) { + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + ENUM_INDEX = $__m.ENUM_INDEX; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + XHRConnection = (function() { + function XHRConnection(req, browserXHR, baseResponseOptions) { + var $__0 = this; + var requestMethodsMap = new RequestMethodsMap(); + this.request = req; + this.response = new EventEmitter(); + this._xhr = browserXHR.build(); + this._xhr.open(requestMethodsMap.getMethod(ENUM_INDEX(req.method)), req.url); + this._xhr.addEventListener('load', (function(_) { + var responseOptions = new ResponseOptions({body: isPresent($__0._xhr.response) ? $__0._xhr.response : $__0._xhr.responseText}); + if (isPresent(baseResponseOptions)) { + responseOptions = baseResponseOptions.merge(responseOptions); + } + ObservableWrapper.callNext($__0.response, new Response(responseOptions)); + ObservableWrapper.callReturn($__0.response); + })); + if (isPresent(req.headers)) { + req.headers.forEach((function(value, name) { + $__0._xhr.setRequestHeader(name, value); + })); + } + this._xhr.send(this.request.text()); + } + return ($traceurRuntime.createClass)(XHRConnection, {dispose: function() { + this._xhr.abort(); + }}, {}); + }()); + $__export("XHRConnection", XHRConnection); + XHRBackend = (($traceurRuntime.createClass)(function(_browserXHR, _baseResponseOptions) { + this._browserXHR = _browserXHR; + this._baseResponseOptions = _baseResponseOptions; + }, {createConnection: function(request) { + return new XHRConnection(request, this._browserXHR, this._baseResponseOptions); + }}, {})); + $__export("XHRBackend", XHRBackend); + $__export("XHRBackend", XHRBackend = __decorate([Injectable(), __metadata('design:paramtypes', [BrowserXhr, ResponseOptions])], XHRBackend)); + } + }; +}); + +System.register("angular2/forms", ["angular2/src/forms/model", "angular2/src/forms/directives/abstract_control_directive", "angular2/src/forms/directives/control_container", "angular2/src/forms/directives/ng_control_name", "angular2/src/forms/directives/ng_form_control", "angular2/src/forms/directives/ng_model", "angular2/src/forms/directives/ng_control", "angular2/src/forms/directives/ng_control_group", "angular2/src/forms/directives/ng_form_model", "angular2/src/forms/directives/ng_form", "angular2/src/forms/directives/default_value_accessor", "angular2/src/forms/directives/checkbox_value_accessor", "angular2/src/forms/directives/select_control_value_accessor", "angular2/src/forms/directives", "angular2/src/forms/validators", "angular2/src/forms/directives/validators", "angular2/src/forms/form_builder", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/forms"; + var FormBuilder, + CONST_EXPR, + formInjectables; + return { + setters: [function($__m) { + $__export("AbstractControl", $__m.AbstractControl); + $__export("Control", $__m.Control); + $__export("ControlGroup", $__m.ControlGroup); + $__export("ControlArray", $__m.ControlArray); + }, function($__m) { + $__export("AbstractControlDirective", $__m.AbstractControlDirective); + }, function($__m) { + $__export("ControlContainer", $__m.ControlContainer); + }, function($__m) { + $__export("NgControlName", $__m.NgControlName); + }, function($__m) { + $__export("NgFormControl", $__m.NgFormControl); + }, function($__m) { + $__export("NgModel", $__m.NgModel); + }, function($__m) { + $__export("NgControl", $__m.NgControl); + }, function($__m) { + $__export("NgControlGroup", $__m.NgControlGroup); + }, function($__m) { + $__export("NgFormModel", $__m.NgFormModel); + }, function($__m) { + $__export("NgForm", $__m.NgForm); + }, function($__m) { + $__export("DefaultValueAccessor", $__m.DefaultValueAccessor); + }, function($__m) { + $__export("CheckboxControlValueAccessor", $__m.CheckboxControlValueAccessor); + }, function($__m) { + $__export("NgSelectOption", $__m.NgSelectOption); + $__export("SelectControlValueAccessor", $__m.SelectControlValueAccessor); + }, function($__m) { + $__export("formDirectives", $__m.formDirectives); + }, function($__m) { + $__export("Validators", $__m.Validators); + }, function($__m) { + $__export("NgValidator", $__m.NgValidator); + $__export("NgRequiredValidator", $__m.NgRequiredValidator); + }, function($__m) { + FormBuilder = $__m.FormBuilder; + $__export("FormBuilder", $__m.FormBuilder); + }, function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }], + execute: function() { + formInjectables = CONST_EXPR([FormBuilder]); + $__export("formInjectables", formInjectables); + } + }; +}); + +System.register("angular2/src/di/injector", ["angular2/src/facade/collection", "angular2/src/di/binding", "angular2/src/di/exceptions", "angular2/src/facade/lang", "angular2/src/di/key", "angular2/src/di/forward_ref", "angular2/src/di/metadata"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/injector"; + var Map, + List, + MapWrapper, + ListWrapper, + ResolvedBinding, + Binding, + BindingBuilder, + bind, + AbstractBindingError, + NoBindingError, + CyclicDependencyError, + InstantiationError, + InvalidBindingError, + OutOfBoundsError, + Type, + isPresent, + CONST_EXPR, + Key, + resolveForwardRef, + DEFAULT_VISIBILITY, + SelfMetadata, + AncestorMetadata, + _constructing, + _notFound, + _MAX_CONSTRUCTION_COUNTER, + undefinedValue, + PUBLIC, + PRIVATE, + PUBLIC_AND_PRIVATE, + ProtoInjectorInlineStrategy, + ProtoInjectorDynamicStrategy, + ProtoInjector, + InjectorInlineStrategy, + InjectorDynamicStrategy, + BindingWithVisibility, + Injector, + INJECTOR_KEY; + function _resolveBindings(bindings) { + var resolvedList = ListWrapper.createFixedSize(bindings.length); + for (var i = 0; i < bindings.length; i++) { + var unresolved = resolveForwardRef(bindings[i]); + var resolved = void 0; + if (unresolved instanceof ResolvedBinding) { + resolved = unresolved; + } else if (unresolved instanceof Type) { + resolved = bind(unresolved).toClass(unresolved).resolve(); + } else if (unresolved instanceof Binding) { + resolved = unresolved.resolve(); + } else if (unresolved instanceof List) { + resolved = _resolveBindings(unresolved); + } else if (unresolved instanceof BindingBuilder) { + throw new InvalidBindingError(unresolved.token); + } else { + throw new InvalidBindingError(unresolved); + } + resolvedList[i] = resolved; + } + return resolvedList; + } + function _createListOfBindings(flattenedBindings) { + return MapWrapper.values(flattenedBindings); + } + function _flattenBindings(bindings, res) { + ListWrapper.forEach(bindings, function(b) { + if (b instanceof ResolvedBinding) { + res.set(b.key.id, b); + } else if (b instanceof List) { + _flattenBindings(b, res); + } + }); + return res; + } + function _mapBindings(injector, fn) { + var res = []; + for (var i = 0; i < injector._proto.numberOfBindings; ++i) { + res.push(fn(injector._proto.getBindingAtIndex(i))); + } + return res; + } + return { + setters: [function($__m) { + Map = $__m.Map; + List = $__m.List; + MapWrapper = $__m.MapWrapper; + ListWrapper = $__m.ListWrapper; + }, function($__m) { + ResolvedBinding = $__m.ResolvedBinding; + Binding = $__m.Binding; + BindingBuilder = $__m.BindingBuilder; + bind = $__m.bind; + }, function($__m) { + AbstractBindingError = $__m.AbstractBindingError; + NoBindingError = $__m.NoBindingError; + CyclicDependencyError = $__m.CyclicDependencyError; + InstantiationError = $__m.InstantiationError; + InvalidBindingError = $__m.InvalidBindingError; + OutOfBoundsError = $__m.OutOfBoundsError; + }, function($__m) { + Type = $__m.Type; + isPresent = $__m.isPresent; + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + Key = $__m.Key; + }, function($__m) { + resolveForwardRef = $__m.resolveForwardRef; + }, function($__m) { + DEFAULT_VISIBILITY = $__m.DEFAULT_VISIBILITY; + SelfMetadata = $__m.SelfMetadata; + AncestorMetadata = $__m.AncestorMetadata; + }], + execute: function() { + _constructing = CONST_EXPR(new Object()); + _notFound = CONST_EXPR(new Object()); + _MAX_CONSTRUCTION_COUNTER = 10; + undefinedValue = CONST_EXPR(new Object()); + $__export("undefinedValue", undefinedValue); + PUBLIC = 1; + $__export("PUBLIC", PUBLIC); + PRIVATE = 2; + $__export("PRIVATE", PRIVATE); + PUBLIC_AND_PRIVATE = 3; + $__export("PUBLIC_AND_PRIVATE", PUBLIC_AND_PRIVATE); + ProtoInjectorInlineStrategy = (function() { + function ProtoInjectorInlineStrategy(protoEI, bwv) { + this.binding0 = null; + this.binding1 = null; + this.binding2 = null; + this.binding3 = null; + this.binding4 = null; + this.binding5 = null; + this.binding6 = null; + this.binding7 = null; + this.binding8 = null; + this.binding9 = null; + this.keyId0 = null; + this.keyId1 = null; + this.keyId2 = null; + this.keyId3 = null; + this.keyId4 = null; + this.keyId5 = null; + this.keyId6 = null; + this.keyId7 = null; + this.keyId8 = null; + this.keyId9 = null; + this.visibility0 = null; + this.visibility1 = null; + this.visibility2 = null; + this.visibility3 = null; + this.visibility4 = null; + this.visibility5 = null; + this.visibility6 = null; + this.visibility7 = null; + this.visibility8 = null; + this.visibility9 = null; + var length = bwv.length; + if (length > 0) { + this.binding0 = bwv[0].binding; + this.keyId0 = bwv[0].getKeyId(); + this.visibility0 = bwv[0].visibility; + } + if (length > 1) { + this.binding1 = bwv[1].binding; + this.keyId1 = bwv[1].getKeyId(); + this.visibility1 = bwv[1].visibility; + } + if (length > 2) { + this.binding2 = bwv[2].binding; + this.keyId2 = bwv[2].getKeyId(); + this.visibility2 = bwv[2].visibility; + } + if (length > 3) { + this.binding3 = bwv[3].binding; + this.keyId3 = bwv[3].getKeyId(); + this.visibility3 = bwv[3].visibility; + } + if (length > 4) { + this.binding4 = bwv[4].binding; + this.keyId4 = bwv[4].getKeyId(); + this.visibility4 = bwv[4].visibility; + } + if (length > 5) { + this.binding5 = bwv[5].binding; + this.keyId5 = bwv[5].getKeyId(); + this.visibility5 = bwv[5].visibility; + } + if (length > 6) { + this.binding6 = bwv[6].binding; + this.keyId6 = bwv[6].getKeyId(); + this.visibility6 = bwv[6].visibility; + } + if (length > 7) { + this.binding7 = bwv[7].binding; + this.keyId7 = bwv[7].getKeyId(); + this.visibility7 = bwv[7].visibility; + } + if (length > 8) { + this.binding8 = bwv[8].binding; + this.keyId8 = bwv[8].getKeyId(); + this.visibility8 = bwv[8].visibility; + } + if (length > 9) { + this.binding9 = bwv[9].binding; + this.keyId9 = bwv[9].getKeyId(); + this.visibility9 = bwv[9].visibility; + } + } + return ($traceurRuntime.createClass)(ProtoInjectorInlineStrategy, { + getBindingAtIndex: function(index) { + if (index == 0) + return this.binding0; + if (index == 1) + return this.binding1; + if (index == 2) + return this.binding2; + if (index == 3) + return this.binding3; + if (index == 4) + return this.binding4; + if (index == 5) + return this.binding5; + if (index == 6) + return this.binding6; + if (index == 7) + return this.binding7; + if (index == 8) + return this.binding8; + if (index == 9) + return this.binding9; + throw new OutOfBoundsError(index); + }, + createInjectorStrategy: function(injector) { + return new InjectorInlineStrategy(injector, this); + } + }, {}); + }()); + $__export("ProtoInjectorInlineStrategy", ProtoInjectorInlineStrategy); + ProtoInjectorDynamicStrategy = (function() { + function ProtoInjectorDynamicStrategy(protoInj, bwv) { + var len = bwv.length; + this.bindings = ListWrapper.createFixedSize(len); + this.keyIds = ListWrapper.createFixedSize(len); + this.visibilities = ListWrapper.createFixedSize(len); + for (var i = 0; i < len; i++) { + this.bindings[i] = bwv[i].binding; + this.keyIds[i] = bwv[i].getKeyId(); + this.visibilities[i] = bwv[i].visibility; + } + } + return ($traceurRuntime.createClass)(ProtoInjectorDynamicStrategy, { + getBindingAtIndex: function(index) { + if (index < 0 || index >= this.bindings.length) { + throw new OutOfBoundsError(index); + } + return this.bindings[index]; + }, + createInjectorStrategy: function(ei) { + return new InjectorDynamicStrategy(this, ei); + } + }, {}); + }()); + $__export("ProtoInjectorDynamicStrategy", ProtoInjectorDynamicStrategy); + ProtoInjector = (function() { + function ProtoInjector(bwv) { + this.numberOfBindings = bwv.length; + this._strategy = bwv.length > _MAX_CONSTRUCTION_COUNTER ? new ProtoInjectorDynamicStrategy(this, bwv) : new ProtoInjectorInlineStrategy(this, bwv); + } + return ($traceurRuntime.createClass)(ProtoInjector, {getBindingAtIndex: function(index) { + return this._strategy.getBindingAtIndex(index); + }}, {}); + }()); + $__export("ProtoInjector", ProtoInjector); + InjectorInlineStrategy = (function() { + function InjectorInlineStrategy(injector, protoStrategy) { + this.injector = injector; + this.protoStrategy = protoStrategy; + this.obj0 = undefinedValue; + this.obj1 = undefinedValue; + this.obj2 = undefinedValue; + this.obj3 = undefinedValue; + this.obj4 = undefinedValue; + this.obj5 = undefinedValue; + this.obj6 = undefinedValue; + this.obj7 = undefinedValue; + this.obj8 = undefinedValue; + this.obj9 = undefinedValue; + } + return ($traceurRuntime.createClass)(InjectorInlineStrategy, { + resetConstructionCounter: function() { + this.injector._constructionCounter = 0; + }, + instantiateBinding: function(binding, visibility) { + return this.injector._new(binding, visibility); + }, + attach: function(parent, isBoundary) { + var inj = this.injector; + inj._parent = parent; + inj._isBoundary = isBoundary; + }, + getObjByKeyId: function(keyId, visibility) { + var p = this.protoStrategy; + var inj = this.injector; + if (p.keyId0 === keyId && (p.visibility0 & visibility) > 0) { + if (this.obj0 === undefinedValue) { + this.obj0 = inj._new(p.binding0, p.visibility0); + } + return this.obj0; + } + if (p.keyId1 === keyId && (p.visibility1 & visibility) > 0) { + if (this.obj1 === undefinedValue) { + this.obj1 = inj._new(p.binding1, p.visibility1); + } + return this.obj1; + } + if (p.keyId2 === keyId && (p.visibility2 & visibility) > 0) { + if (this.obj2 === undefinedValue) { + this.obj2 = inj._new(p.binding2, p.visibility2); + } + return this.obj2; + } + if (p.keyId3 === keyId && (p.visibility3 & visibility) > 0) { + if (this.obj3 === undefinedValue) { + this.obj3 = inj._new(p.binding3, p.visibility3); + } + return this.obj3; + } + if (p.keyId4 === keyId && (p.visibility4 & visibility) > 0) { + if (this.obj4 === undefinedValue) { + this.obj4 = inj._new(p.binding4, p.visibility4); + } + return this.obj4; + } + if (p.keyId5 === keyId && (p.visibility5 & visibility) > 0) { + if (this.obj5 === undefinedValue) { + this.obj5 = inj._new(p.binding5, p.visibility5); + } + return this.obj5; + } + if (p.keyId6 === keyId && (p.visibility6 & visibility) > 0) { + if (this.obj6 === undefinedValue) { + this.obj6 = inj._new(p.binding6, p.visibility6); + } + return this.obj6; + } + if (p.keyId7 === keyId && (p.visibility7 & visibility) > 0) { + if (this.obj7 === undefinedValue) { + this.obj7 = inj._new(p.binding7, p.visibility7); + } + return this.obj7; + } + if (p.keyId8 === keyId && (p.visibility8 & visibility) > 0) { + if (this.obj8 === undefinedValue) { + this.obj8 = inj._new(p.binding8, p.visibility8); + } + return this.obj8; + } + if (p.keyId9 === keyId && (p.visibility9 & visibility) > 0) { + if (this.obj9 === undefinedValue) { + this.obj9 = inj._new(p.binding9, p.visibility9); + } + return this.obj9; + } + return undefinedValue; + }, + getObjAtIndex: function(index) { + if (index == 0) + return this.obj0; + if (index == 1) + return this.obj1; + if (index == 2) + return this.obj2; + if (index == 3) + return this.obj3; + if (index == 4) + return this.obj4; + if (index == 5) + return this.obj5; + if (index == 6) + return this.obj6; + if (index == 7) + return this.obj7; + if (index == 8) + return this.obj8; + if (index == 9) + return this.obj9; + throw new OutOfBoundsError(index); + }, + getMaxNumberOfObjects: function() { + return _MAX_CONSTRUCTION_COUNTER; + } + }, {}); + }()); + $__export("InjectorInlineStrategy", InjectorInlineStrategy); + InjectorDynamicStrategy = (function() { + function InjectorDynamicStrategy(protoStrategy, injector) { + this.protoStrategy = protoStrategy; + this.injector = injector; + this.objs = ListWrapper.createFixedSize(protoStrategy.bindings.length); + ListWrapper.fill(this.objs, undefinedValue); + } + return ($traceurRuntime.createClass)(InjectorDynamicStrategy, { + resetConstructionCounter: function() { + this.injector._constructionCounter = 0; + }, + instantiateBinding: function(binding, visibility) { + return this.injector._new(binding, visibility); + }, + attach: function(parent, isBoundary) { + var inj = this.injector; + inj._parent = parent; + inj._isBoundary = isBoundary; + }, + getObjByKeyId: function(keyId, visibility) { + var p = this.protoStrategy; + for (var i = 0; i < p.keyIds.length; i++) { + if (p.keyIds[i] === keyId && (p.visibilities[i] & visibility) > 0) { + if (this.objs[i] === undefinedValue) { + this.objs[i] = this.injector._new(p.bindings[i], p.visibilities[i]); + } + return this.objs[i]; + } + } + return undefinedValue; + }, + getObjAtIndex: function(index) { + if (index < 0 || index >= this.objs.length) { + throw new OutOfBoundsError(index); + } + return this.objs[index]; + }, + getMaxNumberOfObjects: function() { + return this.objs.length; + } + }, {}); + }()); + $__export("InjectorDynamicStrategy", InjectorDynamicStrategy); + BindingWithVisibility = (function() { + function BindingWithVisibility(binding, visibility) { + this.binding = binding; + this.visibility = visibility; + } + return ($traceurRuntime.createClass)(BindingWithVisibility, {getKeyId: function() { + return this.binding.key.id; + }}, {}); + }()); + $__export("BindingWithVisibility", BindingWithVisibility); + Injector = (function() { + function Injector(_proto) { + var _parent = arguments[1] !== (void 0) ? arguments[1] : null; + var _depProvider = arguments[2] !== (void 0) ? arguments[2] : null; + var _debugContext = arguments[3] !== (void 0) ? arguments[3] : null; + this._proto = _proto; + this._parent = _parent; + this._depProvider = _depProvider; + this._debugContext = _debugContext; + this._isBoundary = false; + this._constructionCounter = 0; + this._strategy = _proto._strategy.createInjectorStrategy(this); + } + return ($traceurRuntime.createClass)(Injector, { + debugContext: function() { + return this._debugContext(); + }, + get: function(token) { + return this._getByKey(Key.get(token), DEFAULT_VISIBILITY, false, PUBLIC_AND_PRIVATE); + }, + getOptional: function(token) { + return this._getByKey(Key.get(token), DEFAULT_VISIBILITY, true, PUBLIC_AND_PRIVATE); + }, + getAt: function(index) { + return this._strategy.getObjAtIndex(index); + }, + get parent() { + return this._parent; + }, + get internalStrategy() { + return this._strategy; + }, + resolveAndCreateChild: function(bindings) { + var depProvider = arguments[1] !== (void 0) ? arguments[1] : null; + var resovledBindings = Injector.resolve(bindings); + return this.createChildFromResolved(resovledBindings, depProvider); + }, + createChildFromResolved: function(bindings) { + var depProvider = arguments[1] !== (void 0) ? arguments[1] : null; + var bd = bindings.map((function(b) { + return new BindingWithVisibility(b, PUBLIC); + })); + var proto = new ProtoInjector(bd); + var inj = new Injector(proto, null, depProvider); + inj._parent = this; + return inj; + }, + _new: function(binding, visibility) { + if (this._constructionCounter++ > this._strategy.getMaxNumberOfObjects()) { + throw new CyclicDependencyError(this, binding.key); + } + var factory = binding.factory; + var deps = binding.dependencies; + var length = deps.length; + var d0, + d1, + d2, + d3, + d4, + d5, + d6, + d7, + d8, + d9, + d10, + d11, + d12, + d13, + d14, + d15, + d16, + d17, + d18, + d19; + try { + d0 = length > 0 ? this._getByDependency(binding, deps[0], visibility) : null; + d1 = length > 1 ? this._getByDependency(binding, deps[1], visibility) : null; + d2 = length > 2 ? this._getByDependency(binding, deps[2], visibility) : null; + d3 = length > 3 ? this._getByDependency(binding, deps[3], visibility) : null; + d4 = length > 4 ? this._getByDependency(binding, deps[4], visibility) : null; + d5 = length > 5 ? this._getByDependency(binding, deps[5], visibility) : null; + d6 = length > 6 ? this._getByDependency(binding, deps[6], visibility) : null; + d7 = length > 7 ? this._getByDependency(binding, deps[7], visibility) : null; + d8 = length > 8 ? this._getByDependency(binding, deps[8], visibility) : null; + d9 = length > 9 ? this._getByDependency(binding, deps[9], visibility) : null; + d10 = length > 10 ? this._getByDependency(binding, deps[10], visibility) : null; + d11 = length > 11 ? this._getByDependency(binding, deps[11], visibility) : null; + d12 = length > 12 ? this._getByDependency(binding, deps[12], visibility) : null; + d13 = length > 13 ? this._getByDependency(binding, deps[13], visibility) : null; + d14 = length > 14 ? this._getByDependency(binding, deps[14], visibility) : null; + d15 = length > 15 ? this._getByDependency(binding, deps[15], visibility) : null; + d16 = length > 16 ? this._getByDependency(binding, deps[16], visibility) : null; + d17 = length > 17 ? this._getByDependency(binding, deps[17], visibility) : null; + d18 = length > 18 ? this._getByDependency(binding, deps[18], visibility) : null; + d19 = length > 19 ? this._getByDependency(binding, deps[19], visibility) : null; + } catch (e) { + if (e instanceof AbstractBindingError) { + e.addKey(this, binding.key); + } + throw e; + } + var obj; + try { + switch (length) { + case 0: + obj = factory(); + break; + case 1: + obj = factory(d0); + break; + case 2: + obj = factory(d0, d1); + break; + case 3: + obj = factory(d0, d1, d2); + break; + case 4: + obj = factory(d0, d1, d2, d3); + break; + case 5: + obj = factory(d0, d1, d2, d3, d4); + break; + case 6: + obj = factory(d0, d1, d2, d3, d4, d5); + break; + case 7: + obj = factory(d0, d1, d2, d3, d4, d5, d6); + break; + case 8: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7); + break; + case 9: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8); + break; + case 10: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9); + break; + case 11: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10); + break; + case 12: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11); + break; + case 13: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12); + break; + case 14: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13); + break; + case 15: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14); + break; + case 16: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15); + break; + case 17: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16); + break; + case 18: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17); + break; + case 19: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18); + break; + case 20: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18, d19); + break; + } + } catch (e) { + throw new InstantiationError(this, e, e.stack, binding.key); + } + return obj; + }, + _getByDependency: function(binding, dep, bindingVisibility) { + var special = isPresent(this._depProvider) ? this._depProvider.getDependency(this, binding, dep) : undefinedValue; + if (special !== undefinedValue) { + return special; + } else { + return this._getByKey(dep.key, dep.visibility, dep.optional, bindingVisibility); + } + }, + _getByKey: function(key, depVisibility, optional, bindingVisibility) { + if (key === INJECTOR_KEY) { + return this; + } + if (depVisibility instanceof SelfMetadata) { + return this._getByKeySelf(key, optional, bindingVisibility); + } else if (depVisibility instanceof AncestorMetadata) { + return this._getByKeyAncestor(key, optional, bindingVisibility, depVisibility.includeSelf); + } else { + return this._getByKeyUnbounded(key, optional, bindingVisibility, depVisibility.includeSelf); + } + }, + _throwOrNull: function(key, optional) { + if (optional) { + return null; + } else { + throw new NoBindingError(this, key); + } + }, + _getByKeySelf: function(key, optional, bindingVisibility) { + var obj = this._strategy.getObjByKeyId(key.id, bindingVisibility); + return (obj !== undefinedValue) ? obj : this._throwOrNull(key, optional); + }, + _getByKeyAncestor: function(key, optional, bindingVisibility, includeSelf) { + var inj = this; + if (!includeSelf) { + if (inj._isBoundary) { + return this._getPrivateDependency(key, optional, inj); + } else { + inj = inj._parent; + } + } + while (inj != null) { + var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility); + if (obj !== undefinedValue) + return obj; + if (isPresent(inj._parent) && inj._isBoundary) { + return this._getPrivateDependency(key, optional, inj); + } else { + inj = inj._parent; + } + } + return this._throwOrNull(key, optional); + }, + _getPrivateDependency: function(key, optional, inj) { + var obj = inj._parent._strategy.getObjByKeyId(key.id, PRIVATE); + return (obj !== undefinedValue) ? obj : this._throwOrNull(key, optional); + }, + _getByKeyUnbounded: function(key, optional, bindingVisibility, includeSelf) { + var inj = this; + if (!includeSelf) { + bindingVisibility = inj._isBoundary ? PUBLIC_AND_PRIVATE : PUBLIC; + inj = inj._parent; + } + while (inj != null) { + var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility); + if (obj !== undefinedValue) + return obj; + bindingVisibility = inj._isBoundary ? PUBLIC_AND_PRIVATE : PUBLIC; + inj = inj._parent; + } + return this._throwOrNull(key, optional); + }, + get displayName() { + return ("Injector(bindings: [" + _mapBindings(this, (function(b) { + return (" \"" + b.key.displayName + "\" "); + })).join(", ") + "])"); + }, + toString: function() { + return this.displayName; + } + }, { + resolve: function(bindings) { + var resolvedBindings = _resolveBindings(bindings); + var flatten = _flattenBindings(resolvedBindings, new Map()); + return _createListOfBindings(flatten); + }, + resolveAndCreate: function(bindings) { + var depProvider = arguments[1] !== (void 0) ? arguments[1] : null; + var resolvedBindings = Injector.resolve(bindings); + return Injector.fromResolvedBindings(resolvedBindings, depProvider); + }, + fromResolvedBindings: function(bindings) { + var depProvider = arguments[1] !== (void 0) ? arguments[1] : null; + var bd = bindings.map((function(b) { + return new BindingWithVisibility(b, PUBLIC); + })); + var proto = new ProtoInjector(bd); + var inj = new Injector(proto, null, depProvider); + return inj; + } + }); + }()); + $__export("Injector", Injector); + INJECTOR_KEY = Key.get(Injector); + } + }; +}); + +System.register("angular2/src/change_detection/change_detection_jit_generator", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/abstract_change_detector", "angular2/src/change_detection/change_detection_util", "angular2/src/change_detection/proto_record", "angular2/src/change_detection/codegen_name_util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/change_detection_jit_generator"; + var BaseException, + ListWrapper, + AbstractChangeDetector, + ChangeDetectionUtil, + RecordType, + CodegenNameUtil, + sanitizeName, + ABSTRACT_CHANGE_DETECTOR, + UTIL, + DISPATCHER_ACCESSOR, + PIPES_ACCESSOR, + PROTOS_ACCESSOR, + DIRECTIVES_ACCESSOR, + IS_CHANGED_LOCAL, + CHANGES_LOCAL, + LOCALS_ACCESSOR, + MODE_ACCESSOR, + CURRENT_PROTO, + ALREADY_CHECKED_ACCESSOR, + ChangeDetectorJITGenerator; + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + AbstractChangeDetector = $__m.AbstractChangeDetector; + }, function($__m) { + ChangeDetectionUtil = $__m.ChangeDetectionUtil; + }, function($__m) { + RecordType = $__m.RecordType; + }, function($__m) { + CodegenNameUtil = $__m.CodegenNameUtil; + sanitizeName = $__m.sanitizeName; + }], + execute: function() { + ABSTRACT_CHANGE_DETECTOR = "AbstractChangeDetector"; + UTIL = "ChangeDetectionUtil"; + DISPATCHER_ACCESSOR = "this.dispatcher"; + PIPES_ACCESSOR = "this.pipes"; + PROTOS_ACCESSOR = "this.protos"; + DIRECTIVES_ACCESSOR = "this.directiveRecords"; + IS_CHANGED_LOCAL = "isChanged"; + CHANGES_LOCAL = "changes"; + LOCALS_ACCESSOR = "this.locals"; + MODE_ACCESSOR = "this.mode"; + CURRENT_PROTO = "this.currentProto"; + ALREADY_CHECKED_ACCESSOR = "this.alreadyChecked"; + ChangeDetectorJITGenerator = (function() { + function ChangeDetectorJITGenerator(id, changeDetectionStrategy, records, directiveRecords, generateCheckNoChanges) { + this.id = id; + this.changeDetectionStrategy = changeDetectionStrategy; + this.records = records; + this.directiveRecords = directiveRecords; + this.generateCheckNoChanges = generateCheckNoChanges; + this._names = new CodegenNameUtil(this.records, this.directiveRecords, 'this._', UTIL); + this._typeName = sanitizeName(("ChangeDetector_" + this.id)); + } + return ($traceurRuntime.createClass)(ChangeDetectorJITGenerator, { + generate: function() { + var $__0 = this; + var classDefinition = ("\n var " + this._typeName + " = function " + this._typeName + "(dispatcher, protos, directiveRecords) {\n " + ABSTRACT_CHANGE_DETECTOR + ".call(this, " + JSON.stringify(this.id) + ", dispatcher);\n " + PROTOS_ACCESSOR + " = protos;\n " + DIRECTIVES_ACCESSOR + " = directiveRecords;\n " + LOCALS_ACCESSOR + " = null;\n " + CURRENT_PROTO + " = null;\n " + PIPES_ACCESSOR + " = null;\n " + ALREADY_CHECKED_ACCESSOR + " = false;\n this.dehydrateDirectives(false);\n }\n\n " + this._typeName + ".prototype = Object.create(" + ABSTRACT_CHANGE_DETECTOR + ".prototype);\n\n " + this._typeName + ".prototype.detectChangesInRecords = function(throwOnChange) {\n if (!this.hydrated()) {\n " + UTIL + ".throwDehydrated();\n }\n try {\n this.__detectChangesInRecords(throwOnChange);\n } catch (e) {\n this.throwError(" + CURRENT_PROTO + ", e, e.stack);\n }\n }\n\n " + this._typeName + ".prototype.__detectChangesInRecords = function(throwOnChange) {\n " + CURRENT_PROTO + " = null;\n\n " + this._names.genInitLocals() + "\n var " + IS_CHANGED_LOCAL + " = false;\n var " + CHANGES_LOCAL + " = null;\n\n context = " + this._names.getContextName() + ";\n\n " + this.records.map((function(r) { + return $__0._genRecord(r); + })).join("\n") + "\n\n " + ALREADY_CHECKED_ACCESSOR + " = true;\n }\n\n " + this._genCheckNoChanges() + "\n\n " + this._typeName + ".prototype.callOnAllChangesDone = function() {\n " + this._genCallOnAllChangesDoneBody() + "\n }\n\n " + this._typeName + ".prototype.hydrate = function(context, locals, directives, pipes) {\n " + MODE_ACCESSOR + " = \"" + ChangeDetectionUtil.changeDetectionMode(this.changeDetectionStrategy) + "\";\n " + this._names.getContextName() + " = context;\n " + LOCALS_ACCESSOR + " = locals;\n this.hydrateDirectives(directives);\n " + PIPES_ACCESSOR + " = pipes;\n " + ALREADY_CHECKED_ACCESSOR + " = false;\n }\n\n " + this._maybeGenHydrateDirectives() + "\n\n " + this._typeName + ".prototype.dehydrate = function() {\n this.dehydrateDirectives(true);\n " + LOCALS_ACCESSOR + " = null;\n " + PIPES_ACCESSOR + " = null;\n }\n\n " + this._maybeGenDehydrateDirectives() + "\n\n " + this._typeName + ".prototype.hydrated = function() {\n return " + this._names.getContextName() + " !== null;\n }\n\n return function(dispatcher) {\n return new " + this._typeName + "(dispatcher, protos, directiveRecords);\n }\n "); + return new Function('AbstractChangeDetector', 'ChangeDetectionUtil', 'protos', 'directiveRecords', classDefinition)(AbstractChangeDetector, ChangeDetectionUtil, this.records, this.directiveRecords); + }, + _maybeGenDehydrateDirectives: function() { + var destroyPipesCode = this._names.genPipeOnDestroy(); + if (destroyPipesCode) { + destroyPipesCode = ("if (destroyPipes) { " + destroyPipesCode + " }"); + } + var dehydrateFieldsCode = this._names.genDehydrateFields(); + if (!destroyPipesCode && !dehydrateFieldsCode) + return ''; + return (this._typeName + ".prototype.dehydrateDirectives = function(destroyPipes) {\n " + destroyPipesCode + "\n " + dehydrateFieldsCode + "\n }"); + }, + _maybeGenHydrateDirectives: function() { + var hydrateDirectivesCode = this._genHydrateDirectives(); + var hydrateDetectorsCode = this._genHydrateDetectors(); + if (!hydrateDirectivesCode && !hydrateDetectorsCode) + return ''; + return (this._typeName + ".prototype.hydrateDirectives = function(directives) {\n " + hydrateDirectivesCode + "\n " + hydrateDetectorsCode + "\n }"); + }, + _genHydrateDirectives: function() { + var directiveFieldNames = this._names.getAllDirectiveNames(); + var lines = ListWrapper.createFixedSize(directiveFieldNames.length); + for (var i = 0, + iLen = directiveFieldNames.length; i < iLen; ++i) { + lines[i] = (directiveFieldNames[i] + " = directives.getDirectiveFor(" + DIRECTIVES_ACCESSOR + "[" + i + "].directiveIndex);"); + } + return lines.join('\n'); + }, + _genHydrateDetectors: function() { + var detectorFieldNames = this._names.getAllDetectorNames(); + var lines = ListWrapper.createFixedSize(detectorFieldNames.length); + for (var i = 0, + iLen = detectorFieldNames.length; i < iLen; ++i) { + lines[i] = (detectorFieldNames[i] + " =\n directives.getDetectorFor(" + DIRECTIVES_ACCESSOR + "[" + i + "].directiveIndex);"); + } + return lines.join('\n'); + }, + _genCallOnAllChangesDoneBody: function() { + var notifications = []; + var dirs = this.directiveRecords; + for (var i = dirs.length - 1; i >= 0; --i) { + var dir = dirs[i]; + if (dir.callOnAllChangesDone) { + notifications.push((this._names.getDirectiveName(dir.directiveIndex) + ".onAllChangesDone();")); + } + } + var directiveNotifications = notifications.join("\n"); + return ("\n this.dispatcher.notifyOnAllChangesDone();\n " + directiveNotifications + "\n "); + }, + _genRecord: function(r) { + var rec; + if (r.isLifeCycleRecord()) { + rec = this._genDirectiveLifecycle(r); + } else if (r.isPipeRecord()) { + rec = this._genPipeCheck(r); + } else { + rec = this._genReferenceCheck(r); + } + return ("" + rec + this._maybeGenLastInDirective(r)); + }, + _genDirectiveLifecycle: function(r) { + if (r.name === "onCheck") { + return this._genOnCheck(r); + } else if (r.name === "onInit") { + return this._genOnInit(r); + } else if (r.name === "onChange") { + return this._genOnChange(r); + } else { + throw new BaseException(("Unknown lifecycle event '" + r.name + "'")); + } + }, + _genPipeCheck: function(r) { + var $__0 = this; + var context = this._names.getLocalName(r.contextIndex); + var argString = r.args.map((function(arg) { + return $__0._names.getLocalName(arg); + })).join(", "); + var oldValue = this._names.getFieldName(r.selfIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var change = this._names.getChangeName(r.selfIndex); + var pipe = this._names.getPipeName(r.selfIndex); + var cdRef = "this.ref"; + var protoIndex = r.selfIndex - 1; + var pipeType = r.name; + return ("\n " + CURRENT_PROTO + " = " + PROTOS_ACCESSOR + "[" + protoIndex + "];\n if (" + pipe + " === " + UTIL + ".uninitialized) {\n " + pipe + " = " + PIPES_ACCESSOR + ".get('" + pipeType + "', " + context + ", " + cdRef + ");\n } else if (!" + pipe + ".supports(" + context + ")) {\n " + pipe + ".onDestroy();\n " + pipe + " = " + PIPES_ACCESSOR + ".get('" + pipeType + "', " + context + ", " + cdRef + ");\n }\n\n " + newValue + " = " + pipe + ".transform(" + context + ", [" + argString + "]);\n if (" + oldValue + " !== " + newValue + ") {\n " + newValue + " = " + UTIL + ".unwrapValue(" + newValue + ");\n " + change + " = true;\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n "); + }, + _genReferenceCheck: function(r) { + var $__0 = this; + var oldValue = this._names.getFieldName(r.selfIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var protoIndex = r.selfIndex - 1; + var check = ("\n " + CURRENT_PROTO + " = " + PROTOS_ACCESSOR + "[" + protoIndex + "];\n " + this._genUpdateCurrentValue(r) + "\n if (" + newValue + " !== " + oldValue + ") {\n " + this._names.getChangeName(r.selfIndex) + " = true;\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n "); + if (r.isPureFunction()) { + var condition = r.args.map((function(a) { + return $__0._names.getChangeName(a); + })).join(" || "); + return ("if (" + condition + ") { " + check + " } else { " + newValue + " = " + oldValue + "; }"); + } else { + return check; + } + }, + _genUpdateCurrentValue: function(r) { + var $__0 = this; + var context = (r.contextIndex == -1) ? this._names.getDirectiveName(r.directiveIndex) : this._names.getLocalName(r.contextIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var argString = r.args.map((function(arg) { + return $__0._names.getLocalName(arg); + })).join(", "); + var rhs; + switch (r.mode) { + case RecordType.SELF: + rhs = context; + break; + case RecordType.CONST: + rhs = JSON.stringify(r.funcOrValue); + break; + case RecordType.PROPERTY: + rhs = (context + "." + r.name); + break; + case RecordType.SAFE_PROPERTY: + rhs = (UTIL + ".isValueBlank(" + context + ") ? null : " + context + "." + r.name); + break; + case RecordType.LOCAL: + rhs = (LOCALS_ACCESSOR + ".get('" + r.name + "')"); + break; + case RecordType.INVOKE_METHOD: + rhs = (context + "." + r.name + "(" + argString + ")"); + break; + case RecordType.SAFE_INVOKE_METHOD: + rhs = (UTIL + ".isValueBlank(" + context + ") ? null : " + context + "." + r.name + "(" + argString + ")"); + break; + case RecordType.INVOKE_CLOSURE: + rhs = (context + "(" + argString + ")"); + break; + case RecordType.PRIMITIVE_OP: + rhs = (UTIL + "." + r.name + "(" + argString + ")"); + break; + case RecordType.INTERPOLATE: + rhs = this._genInterpolation(r); + break; + case RecordType.KEYED_ACCESS: + rhs = (context + "[" + this._names.getLocalName(r.args[0]) + "]"); + break; + default: + throw new BaseException(("Unknown operation " + r.mode)); + } + return (newValue + " = " + rhs); + }, + _genInterpolation: function(r) { + var res = ""; + for (var i = 0; i < r.args.length; ++i) { + res += JSON.stringify(r.fixedArgs[i]); + res += " + "; + res += (UTIL + ".s(" + this._names.getLocalName(r.args[i]) + ")"); + res += " + "; + } + res += JSON.stringify(r.fixedArgs[r.args.length]); + return res; + }, + _genUpdateDirectiveOrElement: function(r) { + if (!r.lastInBinding) + return ""; + var newValue = this._names.getLocalName(r.selfIndex); + var oldValue = this._names.getFieldName(r.selfIndex); + var br = r.bindingRecord; + if (br.isDirective()) { + var directiveProperty = (this._names.getDirectiveName(br.directiveRecord.directiveIndex) + "." + br.propertyName); + return ("\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n " + directiveProperty + " = " + newValue + ";\n " + IS_CHANGED_LOCAL + " = true;\n "); + } else { + return ("\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n " + DISPATCHER_ACCESSOR + ".notifyOnBinding(" + CURRENT_PROTO + ".bindingRecord, " + newValue + ");\n "); + } + }, + _genThrowOnChangeCheck: function(oldValue, newValue) { + if (this.generateCheckNoChanges) { + return ("\n if(throwOnChange) {\n " + UTIL + ".throwOnChange(" + CURRENT_PROTO + ", " + UTIL + ".simpleChange(" + oldValue + ", " + newValue + "));\n }\n "); + } else { + return ''; + } + }, + _genCheckNoChanges: function() { + if (this.generateCheckNoChanges) { + return (this._typeName + ".prototype.checkNoChanges = function() { this.runDetectChanges(true); }"); + } else { + return ''; + } + }, + _genAddToChanges: function(r) { + var newValue = this._names.getLocalName(r.selfIndex); + var oldValue = this._names.getFieldName(r.selfIndex); + if (!r.bindingRecord.callOnChange()) + return ""; + return ("\n " + CHANGES_LOCAL + " = " + UTIL + ".addChange(\n " + CHANGES_LOCAL + ", " + CURRENT_PROTO + ".bindingRecord.propertyName,\n " + UTIL + ".simpleChange(" + oldValue + ", " + newValue + "));\n "); + }, + _maybeGenLastInDirective: function(r) { + if (!r.lastInDirective) + return ""; + return ("\n " + CHANGES_LOCAL + " = null;\n " + this._genNotifyOnPushDetectors(r) + "\n " + IS_CHANGED_LOCAL + " = false;\n "); + }, + _genOnCheck: function(r) { + var br = r.bindingRecord; + return ("if (!throwOnChange) " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onCheck();"); + }, + _genOnInit: function(r) { + var br = r.bindingRecord; + return ("if (!throwOnChange && !" + ALREADY_CHECKED_ACCESSOR + ") " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onInit();"); + }, + _genOnChange: function(r) { + var br = r.bindingRecord; + return ("if (!throwOnChange && " + CHANGES_LOCAL + ") " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onChange(" + CHANGES_LOCAL + ");"); + }, + _genNotifyOnPushDetectors: function(r) { + var br = r.bindingRecord; + if (!r.lastInDirective || !br.isOnPushChangeDetection()) + return ""; + var retVal = ("\n if(" + IS_CHANGED_LOCAL + ") {\n " + this._names.getDetectorName(br.directiveRecord.directiveIndex) + ".markAsCheckOnce();\n }\n "); + return retVal; + } + }, {}); + }()); + $__export("ChangeDetectorJITGenerator", ChangeDetectorJITGenerator); + } + }; +}); + +System.register("angular2/src/core/compiler/element_injector", ["angular2/src/facade/lang", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/di", "angular2/src/di/injector", "angular2/src/core/annotations_impl/di", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/annotations_impl/annotations", "angular2/src/core/compiler/directive_lifecycle_reflector", "angular2/src/change_detection/change_detection", "angular2/src/core/compiler/query_list", "angular2/src/reflection/reflection", "angular2/src/render/api"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/element_injector"; + var isPresent, + isBlank, + BaseException, + stringify, + StringWrapper, + ObservableWrapper, + ListWrapper, + MapWrapper, + Injector, + ProtoInjector, + PUBLIC_AND_PRIVATE, + PUBLIC, + PRIVATE, + undefinedValue, + Key, + Dependency, + Binding, + ResolvedBinding, + NoBindingError, + InjectorInlineStrategy, + BindingWithVisibility, + Attribute, + Query, + avmModule, + ViewContainerRef, + ElementRef, + TemplateRef, + Directive, + Component, + LifecycleEvent, + hasLifecycleHook, + ChangeDetectorRef, + Pipes, + QueryList, + reflector, + DirectiveMetadata, + _staticKeys, + StaticKeys, + TreeNode, + DirectiveDependency, + DirectiveBinding, + PreBuiltObjects, + EventEmitterAccessor, + HostActionAccessor, + ProtoElementInjector, + _Context, + ElementInjector, + ElementInjectorInlineStrategy, + ElementInjectorDynamicStrategy, + QueryError, + QueryRef; + function _createEventEmitterAccessors(bwv) { + var binding = bwv.binding; + if (!(binding instanceof DirectiveBinding)) + return []; + var db = binding; + return ListWrapper.map(db.eventEmitters, (function(eventConfig) { + var fieldName; + var eventName; + var colonIdx = eventConfig.indexOf(':'); + if (colonIdx > -1) { + fieldName = StringWrapper.substring(eventConfig, 0, colonIdx).trim(); + eventName = StringWrapper.substring(eventConfig, colonIdx + 1).trim(); + } else { + fieldName = eventName = eventConfig; + } + return new EventEmitterAccessor(eventName, reflector.getter(fieldName)); + })); + } + function _createHostActionAccessors(bwv) { + var binding = bwv.binding; + if (!(binding instanceof DirectiveBinding)) + return []; + var res = []; + var db = binding; + MapWrapper.forEach(db.hostActions, (function(actionExpression, actionName) { + res.push(new HostActionAccessor(actionExpression, reflector.getter(actionName))); + })); + return res; + } + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + stringify = $__m.stringify; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + MapWrapper = $__m.MapWrapper; + }, function($__m) { + Injector = $__m.Injector; + ProtoInjector = $__m.ProtoInjector; + PUBLIC_AND_PRIVATE = $__m.PUBLIC_AND_PRIVATE; + PUBLIC = $__m.PUBLIC; + PRIVATE = $__m.PRIVATE; + undefinedValue = $__m.undefinedValue; + Key = $__m.Key; + Dependency = $__m.Dependency; + Binding = $__m.Binding; + ResolvedBinding = $__m.ResolvedBinding; + NoBindingError = $__m.NoBindingError; + }, function($__m) { + InjectorInlineStrategy = $__m.InjectorInlineStrategy; + BindingWithVisibility = $__m.BindingWithVisibility; + }, function($__m) { + Attribute = $__m.Attribute; + Query = $__m.Query; + }, function($__m) { + avmModule = $__m; + }, function($__m) { + ViewContainerRef = $__m.ViewContainerRef; + }, function($__m) { + ElementRef = $__m.ElementRef; + }, function($__m) { + TemplateRef = $__m.TemplateRef; + }, function($__m) { + Directive = $__m.Directive; + Component = $__m.Component; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + hasLifecycleHook = $__m.hasLifecycleHook; + }, function($__m) { + ChangeDetectorRef = $__m.ChangeDetectorRef; + Pipes = $__m.Pipes; + }, function($__m) { + QueryList = $__m.QueryList; + }, function($__m) { + reflector = $__m.reflector; + }, function($__m) { + DirectiveMetadata = $__m.DirectiveMetadata; + }], + execute: function() { + StaticKeys = (function() { + function StaticKeys() { + this.viewManagerId = Key.get(avmModule.AppViewManager).id; + this.templateRefId = Key.get(TemplateRef).id; + this.viewContainerId = Key.get(ViewContainerRef).id; + this.changeDetectorRefId = Key.get(ChangeDetectorRef).id; + this.elementRefId = Key.get(ElementRef).id; + this.pipesKey = Key.get(Pipes); + } + return ($traceurRuntime.createClass)(StaticKeys, {}, {instance: function() { + if (isBlank(_staticKeys)) + _staticKeys = new StaticKeys(); + return _staticKeys; + }}); + }()); + $__export("StaticKeys", StaticKeys); + TreeNode = (function() { + function TreeNode(parent) { + this._head = null; + this._tail = null; + this._next = null; + if (isPresent(parent)) + parent.addChild(this); + } + return ($traceurRuntime.createClass)(TreeNode, { + addChild: function(child) { + if (isPresent(this._tail)) { + this._tail._next = child; + this._tail = child; + } else { + this._tail = this._head = child; + } + child._next = null; + child._parent = this; + }, + addChildAfter: function(child, prevSibling) { + if (isBlank(prevSibling)) { + var prevHead = this._head; + this._head = child; + child._next = prevHead; + if (isBlank(this._tail)) + this._tail = child; + } else if (isBlank(prevSibling._next)) { + this.addChild(child); + return ; + } else { + child._next = prevSibling._next; + prevSibling._next = child; + } + child._parent = this; + }, + remove: function() { + if (isBlank(this.parent)) + return ; + var nextSibling = this._next; + var prevSibling = this._findPrev(); + if (isBlank(prevSibling)) { + this.parent._head = this._next; + } else { + prevSibling._next = this._next; + } + if (isBlank(nextSibling)) { + this._parent._tail = prevSibling; + } + this._parent = null; + this._next = null; + }, + _findPrev: function() { + var node = this.parent._head; + if (node == this) + return null; + while (node._next !== this) + node = node._next; + return node; + }, + get parent() { + return this._parent; + }, + get children() { + var res = []; + var child = this._head; + while (child != null) { + res.push(child); + child = child._next; + } + return res; + } + }, {}); + }()); + $__export("TreeNode", TreeNode); + DirectiveDependency = (function($__super) { + function DirectiveDependency(key, optional, visibility, properties, attributeName, queryDecorator) { + $traceurRuntime.superConstructor(DirectiveDependency).call(this, key, optional, visibility, properties); + this.attributeName = attributeName; + this.queryDecorator = queryDecorator; + this._verify(); + } + return ($traceurRuntime.createClass)(DirectiveDependency, {_verify: function() { + var count = 0; + if (isPresent(this.queryDecorator)) + count++; + if (isPresent(this.attributeName)) + count++; + if (count > 1) + throw new BaseException('A directive injectable can contain only one of the following @Attribute or @Query.'); + }}, { + createFrom: function(d) { + return new DirectiveDependency(d.key, d.optional, d.visibility, d.properties, DirectiveDependency._attributeName(d.properties), DirectiveDependency._query(d.properties)); + }, + _attributeName: function(properties) { + var p = ListWrapper.find(properties, (function(p) { + return p instanceof Attribute; + })); + return isPresent(p) ? p.attributeName : null; + }, + _query: function(properties) { + return ListWrapper.find(properties, (function(p) { + return p instanceof Query; + })); + } + }, $__super); + }(Dependency)); + $__export("DirectiveDependency", DirectiveDependency); + DirectiveBinding = (function($__super) { + function DirectiveBinding(key, factory, dependencies, resolvedHostInjectables, resolvedViewInjectables, metadata) { + $traceurRuntime.superConstructor(DirectiveBinding).call(this, key, factory, dependencies); + this.resolvedHostInjectables = resolvedHostInjectables; + this.resolvedViewInjectables = resolvedViewInjectables; + this.metadata = metadata; + } + return ($traceurRuntime.createClass)(DirectiveBinding, { + get callOnDestroy() { + return this.metadata.callOnDestroy; + }, + get callOnChange() { + return this.metadata.callOnChange; + }, + get callOnAllChangesDone() { + return this.metadata.callOnAllChangesDone; + }, + get displayName() { + return this.key.displayName; + }, + get eventEmitters() { + return isPresent(this.metadata) && isPresent(this.metadata.events) ? this.metadata.events : []; + }, + get hostActions() { + return isPresent(this.metadata) && isPresent(this.metadata.hostActions) ? this.metadata.hostActions : new Map(); + }, + get changeDetection() { + return this.metadata.changeDetection; + } + }, { + createFromBinding: function(binding, ann) { + if (isBlank(ann)) { + ann = new Directive(); + } + var rb = binding.resolve(); + var deps = ListWrapper.map(rb.dependencies, DirectiveDependency.createFrom); + var resolvedHostInjectables = isPresent(ann.hostInjector) ? Injector.resolve(ann.hostInjector) : []; + var resolvedViewInjectables = ann instanceof Component && isPresent(ann.viewInjector) ? Injector.resolve(ann.viewInjector) : []; + var metadata = DirectiveMetadata.create({ + id: stringify(rb.key.token), + type: ann instanceof Component ? DirectiveMetadata.COMPONENT_TYPE : DirectiveMetadata.DIRECTIVE_TYPE, + selector: ann.selector, + compileChildren: ann.compileChildren, + events: ann.events, + host: isPresent(ann.host) ? MapWrapper.createFromStringMap(ann.host) : null, + properties: ann.properties, + readAttributes: DirectiveBinding._readAttributes(deps), + callOnDestroy: hasLifecycleHook(LifecycleEvent.onDestroy, rb.key.token, ann), + callOnChange: hasLifecycleHook(LifecycleEvent.onChange, rb.key.token, ann), + callOnCheck: hasLifecycleHook(LifecycleEvent.onCheck, rb.key.token, ann), + callOnInit: hasLifecycleHook(LifecycleEvent.onInit, rb.key.token, ann), + callOnAllChangesDone: hasLifecycleHook(LifecycleEvent.onAllChangesDone, rb.key.token, ann), + changeDetection: ann instanceof Component ? ann.changeDetection : null, + exportAs: ann.exportAs + }); + return new DirectiveBinding(rb.key, rb.factory, deps, resolvedHostInjectables, resolvedViewInjectables, metadata); + }, + _readAttributes: function(deps) { + var readAttributes = []; + ListWrapper.forEach(deps, (function(dep) { + if (isPresent(dep.attributeName)) { + readAttributes.push(dep.attributeName); + } + })); + return readAttributes; + }, + createFromType: function(type, annotation) { + var binding = new Binding(type, {toClass: type}); + return DirectiveBinding.createFromBinding(binding, annotation); + } + }, $__super); + }(ResolvedBinding)); + $__export("DirectiveBinding", DirectiveBinding); + PreBuiltObjects = (function() { + function PreBuiltObjects(viewManager, view, elementRef, templateRef) { + this.viewManager = viewManager; + this.view = view; + this.elementRef = elementRef; + this.templateRef = templateRef; + } + return ($traceurRuntime.createClass)(PreBuiltObjects, {}, {}); + }()); + $__export("PreBuiltObjects", PreBuiltObjects); + EventEmitterAccessor = (function() { + function EventEmitterAccessor(eventName, getter) { + this.eventName = eventName; + this.getter = getter; + } + return ($traceurRuntime.createClass)(EventEmitterAccessor, {subscribe: function(view, boundElementIndex, directive) { + var $__0 = this; + var eventEmitter = this.getter(directive); + return ObservableWrapper.subscribe(eventEmitter, (function(eventObj) { + return view.triggerEventHandlers($__0.eventName, eventObj, boundElementIndex); + })); + }}, {}); + }()); + $__export("EventEmitterAccessor", EventEmitterAccessor); + HostActionAccessor = (function() { + function HostActionAccessor(methodName, getter) { + this.methodName = methodName; + this.getter = getter; + } + return ($traceurRuntime.createClass)(HostActionAccessor, {subscribe: function(view, boundElementIndex, directive) { + var $__0 = this; + var eventEmitter = this.getter(directive); + return ObservableWrapper.subscribe(eventEmitter, (function(actionArgs) { + return view.invokeElementMethod(boundElementIndex, $__0.methodName, actionArgs); + })); + }}, {}); + }()); + $__export("HostActionAccessor", HostActionAccessor); + ProtoElementInjector = (function() { + function ProtoElementInjector(parent, index, bwv, distanceToParent, _firstBindingIsComponent, directiveVariableBindings) { + this.parent = parent; + this.index = index; + this.distanceToParent = distanceToParent; + this._firstBindingIsComponent = _firstBindingIsComponent; + this.directiveVariableBindings = directiveVariableBindings; + var length = bwv.length; + this.protoInjector = new ProtoInjector(bwv); + this.eventEmitterAccessors = ListWrapper.createFixedSize(length); + this.hostActionAccessors = ListWrapper.createFixedSize(length); + for (var i = 0; i < length; ++i) { + this.eventEmitterAccessors[i] = _createEventEmitterAccessors(bwv[i]); + this.hostActionAccessors[i] = _createHostActionAccessors(bwv[i]); + } + } + return ($traceurRuntime.createClass)(ProtoElementInjector, { + instantiate: function(parent) { + return new ElementInjector(this, parent); + }, + directParent: function() { + return this.distanceToParent < 2 ? this.parent : null; + }, + get hasBindings() { + return this.eventEmitterAccessors.length > 0; + }, + getBindingAtIndex: function(index) { + return this.protoInjector.getBindingAtIndex(index); + } + }, { + create: function(parent, index, bindings, firstBindingIsComponent, distanceToParent, directiveVariableBindings) { + var bd = []; + ProtoElementInjector._createDirectiveBindingWithVisibility(bindings, bd, firstBindingIsComponent); + if (firstBindingIsComponent) { + ProtoElementInjector._createViewInjectorBindingWithVisibility(bindings, bd); + } + ProtoElementInjector._createHostInjectorBindingWithVisibility(bindings, bd, firstBindingIsComponent); + return new ProtoElementInjector(parent, index, bd, distanceToParent, firstBindingIsComponent, directiveVariableBindings); + }, + _createDirectiveBindingWithVisibility: function(dirBindings, bd, firstBindingIsComponent) { + ListWrapper.forEach(dirBindings, (function(dirBinding) { + bd.push(ProtoElementInjector._createBindingWithVisibility(firstBindingIsComponent, dirBinding, dirBindings, dirBinding)); + })); + }, + _createHostInjectorBindingWithVisibility: function(dirBindings, bd, firstBindingIsComponent) { + ListWrapper.forEach(dirBindings, (function(dirBinding) { + ListWrapper.forEach(dirBinding.resolvedHostInjectables, (function(b) { + bd.push(ProtoElementInjector._createBindingWithVisibility(firstBindingIsComponent, dirBinding, dirBindings, b)); + })); + })); + }, + _createBindingWithVisibility: function(firstBindingIsComponent, dirBinding, dirBindings, binding) { + var isComponent = firstBindingIsComponent && dirBindings[0] === dirBinding; + return new BindingWithVisibility(binding, isComponent ? PUBLIC_AND_PRIVATE : PUBLIC); + }, + _createViewInjectorBindingWithVisibility: function(bindings, bd) { + var db = bindings[0]; + ListWrapper.forEach(db.resolvedViewInjectables, (function(b) { + return bd.push(new BindingWithVisibility(b, PRIVATE)); + })); + } + }); + }()); + $__export("ProtoElementInjector", ProtoElementInjector); + _Context = (function() { + function _Context(element, componentElement, injector) { + this.element = element; + this.componentElement = componentElement; + this.injector = injector; + } + return ($traceurRuntime.createClass)(_Context, {}, {}); + }()); + ElementInjector = (function($__super) { + function ElementInjector(_proto, parent) { + var $__0; + $traceurRuntime.superConstructor(ElementInjector).call(this, parent); + this._proto = _proto; + this._preBuiltObjects = null; + this._injector = new Injector(this._proto.protoInjector, null, this, ($__0 = this, function() { + return $__0._debugContext(); + })); + var injectorStrategy = this._injector.internalStrategy; + this._strategy = injectorStrategy instanceof InjectorInlineStrategy ? new ElementInjectorInlineStrategy(injectorStrategy, this) : new ElementInjectorDynamicStrategy(injectorStrategy, this); + this.hydrated = false; + this._buildQueries(); + this._addParentQueries(); + } + return ($traceurRuntime.createClass)(ElementInjector, { + dehydrate: function() { + this.hydrated = false; + this._host = null; + this._preBuiltObjects = null; + this._strategy.callOnDestroy(); + this._strategy.dehydrate(); + }, + onAllChangesDone: function() { + if (isPresent(this._query0) && this._query0.originator === this) { + this._query0.list.fireCallbacks(); + } + if (isPresent(this._query1) && this._query1.originator === this) { + this._query1.list.fireCallbacks(); + } + if (isPresent(this._query2) && this._query2.originator === this) { + this._query2.list.fireCallbacks(); + } + }, + hydrate: function(imperativelyCreatedInjector, host, preBuiltObjects) { + this._host = host; + this._preBuiltObjects = preBuiltObjects; + this._reattachInjectors(imperativelyCreatedInjector); + this._strategy.hydrate(); + if (isPresent(host)) { + this._addViewQueries(host); + } + this._addDirectivesToQueries(); + this._addVarBindingsToQueries(); + this.hydrated = true; + }, + _debugContext: function() { + var p = this._preBuiltObjects; + var index = p.elementRef.boundElementIndex - p.view.elementOffset; + var c = this._preBuiltObjects.view.getDebugContext(index, null); + return isPresent(c) ? new _Context(c.element, c.componentElement, c.injector) : null; + }, + _reattachInjectors: function(imperativelyCreatedInjector) { + if (isPresent(this._parent)) { + if (isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, false); + this._reattachInjector(imperativelyCreatedInjector, this._parent._injector, false); + } else { + this._reattachInjector(this._injector, this._parent._injector, false); + } + } else if (isPresent(this._host)) { + if (isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, false); + this._reattachInjector(imperativelyCreatedInjector, this._host._injector, true); + } else { + this._reattachInjector(this._injector, this._host._injector, true); + } + } else { + if (isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, true); + } + } + }, + _reattachInjector: function(injector, parentInjector, isBoundary) { + injector.internalStrategy.attach(parentInjector, isBoundary); + }, + getPipes: function() { + var pipesKey = StaticKeys.instance().pipesKey; + return this._injector.getOptional(pipesKey); + }, + hasVariableBinding: function(name) { + var vb = this._proto.directiveVariableBindings; + return isPresent(vb) && vb.has(name); + }, + getVariableBinding: function(name) { + var index = this._proto.directiveVariableBindings.get(name); + return isPresent(index) ? this.getDirectiveAtIndex(index) : this.getElementRef(); + }, + get: function(token) { + return this._injector.get(token); + }, + hasDirective: function(type) { + return isPresent(this._injector.getOptional(type)); + }, + getEventEmitterAccessors: function() { + return this._proto.eventEmitterAccessors; + }, + getHostActionAccessors: function() { + return this._proto.hostActionAccessors; + }, + getDirectiveVariableBindings: function() { + return this._proto.directiveVariableBindings; + }, + getComponent: function() { + return this._strategy.getComponent(); + }, + getInjector: function() { + return this._injector; + }, + getElementRef: function() { + return this._preBuiltObjects.elementRef; + }, + getViewContainerRef: function() { + return new ViewContainerRef(this._preBuiltObjects.viewManager, this.getElementRef()); + }, + directParent: function() { + return this._proto.distanceToParent < 2 ? this.parent : null; + }, + isComponentKey: function(key) { + return this._strategy.isComponentKey(key); + }, + getDependency: function(injector, binding, dep) { + var key = dep.key; + if (!(dep instanceof DirectiveDependency)) + return undefinedValue; + if (!(binding instanceof DirectiveBinding)) + return undefinedValue; + var dirDep = dep; + var dirBin = binding; + var staticKeys = StaticKeys.instance(); + if (key.id === staticKeys.viewManagerId) + return this._preBuiltObjects.viewManager; + if (isPresent(dirDep.attributeName)) + return this._buildAttribute(dirDep); + if (isPresent(dirDep.queryDecorator)) + return this._findQuery(dirDep.queryDecorator).list; + if (dirDep.key.id === StaticKeys.instance().changeDetectorRefId) { + if (dirBin.metadata.type === DirectiveMetadata.COMPONENT_TYPE) { + var componentView = this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex); + return componentView.changeDetector.ref; + } else { + return this._preBuiltObjects.view.changeDetector.ref; + } + } + if (dirDep.key.id === StaticKeys.instance().elementRefId) { + return this.getElementRef(); + } + if (dirDep.key.id === StaticKeys.instance().viewContainerId) { + return this.getViewContainerRef(); + } + if (dirDep.key.id === StaticKeys.instance().templateRefId) { + if (isBlank(this._preBuiltObjects.templateRef)) { + if (dirDep.optional) { + return null; + } + throw new NoBindingError(null, dirDep.key); + } + return this._preBuiltObjects.templateRef; + } + return undefinedValue; + }, + _buildAttribute: function(dep) { + var attributes = this._proto.attributes; + if (isPresent(attributes) && attributes.has(dep.attributeName)) { + return attributes.get(dep.attributeName); + } else { + return null; + } + }, + _buildQueriesForDeps: function(deps) { + for (var i = 0; i < deps.length; i++) { + var dep = deps[i]; + if (isPresent(dep.queryDecorator)) { + this._createQueryRef(dep.queryDecorator); + } + } + }, + _addViewQueries: function(host) { + if (isPresent(host._query0) && host._query0.originator == host && host._query0.query.isViewQuery) + this._addViewQuery(host._query0); + if (isPresent(host._query1) && host._query1.originator == host && host._query1.query.isViewQuery) + this._addViewQuery(host._query1); + if (isPresent(host._query2) && host._query2.originator == host && host._query2.query.isViewQuery) + this._addViewQuery(host._query2); + }, + _addViewQuery: function(queryRef) { + if (!queryRef.query.descendants && isPresent(this.parent)) + return ; + this._assignQueryRef(queryRef); + }, + _addVarBindingsToQueries: function() { + this._addVarBindingsToQuery(this._query0); + this._addVarBindingsToQuery(this._query1); + this._addVarBindingsToQuery(this._query2); + }, + _addDirectivesToQueries: function() { + this._addDirectivesToQuery(this._query0); + this._addDirectivesToQuery(this._query1); + this._addDirectivesToQuery(this._query2); + }, + _addVarBindingsToQuery: function(queryRef) { + if (isBlank(queryRef) || !queryRef.query.isVarBindingQuery) + return ; + var vb = queryRef.query.varBindings; + for (var i = 0; i < vb.length; ++i) { + if (this.hasVariableBinding(vb[i])) { + queryRef.list.add(this.getVariableBinding(vb[i])); + } + } + }, + _addDirectivesToQuery: function(queryRef) { + if (isBlank(queryRef) || queryRef.query.isVarBindingQuery) + return ; + var matched = []; + this.addDirectivesMatchingQuery(queryRef.query, matched); + matched.forEach((function(s) { + return queryRef.list.add(s); + })); + }, + _createQueryRef: function(query) { + var queryList = new QueryList(); + if (isBlank(this._query0)) { + this._query0 = new QueryRef(query, queryList, this); + } else if (isBlank(this._query1)) { + this._query1 = new QueryRef(query, queryList, this); + } else if (isBlank(this._query2)) { + this._query2 = new QueryRef(query, queryList, this); + } else { + throw new QueryError(); + } + }, + addDirectivesMatchingQuery: function(query, list) { + this._strategy.addDirectivesMatchingQuery(query, list); + }, + _buildQueries: function() { + if (isPresent(this._proto)) { + this._strategy.buildQueries(); + } + }, + _findQuery: function(query) { + if (isPresent(this._query0) && this._query0.query === query) { + return this._query0; + } + if (isPresent(this._query1) && this._query1.query === query) { + return this._query1; + } + if (isPresent(this._query2) && this._query2.query === query) { + return this._query2; + } + throw new BaseException(("Cannot find query for directive " + query + ".")); + }, + _hasQuery: function(query) { + return this._query0 == query || this._query1 == query || this._query2 == query; + }, + link: function(parent) { + parent.addChild(this); + this._addParentQueries(); + }, + linkAfter: function(parent, prevSibling) { + parent.addChildAfter(this, prevSibling); + this._addParentQueries(); + }, + _addParentQueries: function() { + if (isBlank(this.parent)) + return ; + if (isPresent(this.parent._query0) && !this.parent._query0.query.isViewQuery) { + this._addQueryToTree(this.parent._query0); + if (this.hydrated) + this.parent._query0.update(); + } + if (isPresent(this.parent._query1) && !this.parent._query1.query.isViewQuery) { + this._addQueryToTree(this.parent._query1); + if (this.hydrated) + this.parent._query1.update(); + } + if (isPresent(this.parent._query2) && !this.parent._query2.query.isViewQuery) { + this._addQueryToTree(this.parent._query2); + if (this.hydrated) + this.parent._query2.update(); + } + }, + unlink: function() { + var queriesToUpdate = []; + if (isPresent(this.parent._query0)) { + this._pruneQueryFromTree(this.parent._query0); + queriesToUpdate.push(this.parent._query0); + } + if (isPresent(this.parent._query1)) { + this._pruneQueryFromTree(this.parent._query1); + queriesToUpdate.push(this.parent._query1); + } + if (isPresent(this.parent._query2)) { + this._pruneQueryFromTree(this.parent._query2); + queriesToUpdate.push(this.parent._query2); + } + this.remove(); + ListWrapper.forEach(queriesToUpdate, (function(q) { + return q.update(); + })); + }, + _pruneQueryFromTree: function(query) { + this._removeQueryRef(query); + var child = this._head; + while (isPresent(child)) { + child._pruneQueryFromTree(query); + child = child._next; + } + }, + _addQueryToTree: function(queryRef) { + if (queryRef.query.descendants == false) { + if (this == queryRef.originator) { + this._addQueryToTreeSelfAndRecurse(queryRef); + } else if (this.parent == queryRef.originator) { + this._assignQueryRef(queryRef); + } + } else { + this._addQueryToTreeSelfAndRecurse(queryRef); + } + }, + _addQueryToTreeSelfAndRecurse: function(queryRef) { + this._assignQueryRef(queryRef); + var child = this._head; + while (isPresent(child)) { + child._addQueryToTree(queryRef); + child = child._next; + } + }, + _assignQueryRef: function(query) { + if (isBlank(this._query0)) { + this._query0 = query; + return ; + } else if (isBlank(this._query1)) { + this._query1 = query; + return ; + } else if (isBlank(this._query2)) { + this._query2 = query; + return ; + } + throw new QueryError(); + }, + _removeQueryRef: function(query) { + if (this._query0 == query) + this._query0 = null; + if (this._query1 == query) + this._query1 = null; + if (this._query2 == query) + this._query2 = null; + }, + getDirectiveAtIndex: function(index) { + return this._injector.getAt(index); + }, + hasInstances: function() { + return this._proto.hasBindings && this.hydrated; + }, + getHost: function() { + return this._host; + }, + getBoundElementIndex: function() { + return this._proto.index; + } + }, {}, $__super); + }(TreeNode)); + $__export("ElementInjector", ElementInjector); + ElementInjectorInlineStrategy = (function() { + function ElementInjectorInlineStrategy(injectorStrategy, _ei) { + this.injectorStrategy = injectorStrategy; + this._ei = _ei; + } + return ($traceurRuntime.createClass)(ElementInjectorInlineStrategy, { + hydrate: function() { + var i = this.injectorStrategy; + var p = i.protoStrategy; + i.resetConstructionCounter(); + if (p.binding0 instanceof DirectiveBinding && isPresent(p.keyId0) && i.obj0 === undefinedValue) + i.obj0 = i.instantiateBinding(p.binding0, p.visibility0); + if (p.binding1 instanceof DirectiveBinding && isPresent(p.keyId1) && i.obj1 === undefinedValue) + i.obj1 = i.instantiateBinding(p.binding1, p.visibility1); + if (p.binding2 instanceof DirectiveBinding && isPresent(p.keyId2) && i.obj2 === undefinedValue) + i.obj2 = i.instantiateBinding(p.binding2, p.visibility2); + if (p.binding3 instanceof DirectiveBinding && isPresent(p.keyId3) && i.obj3 === undefinedValue) + i.obj3 = i.instantiateBinding(p.binding3, p.visibility3); + if (p.binding4 instanceof DirectiveBinding && isPresent(p.keyId4) && i.obj4 === undefinedValue) + i.obj4 = i.instantiateBinding(p.binding4, p.visibility4); + if (p.binding5 instanceof DirectiveBinding && isPresent(p.keyId5) && i.obj5 === undefinedValue) + i.obj5 = i.instantiateBinding(p.binding5, p.visibility5); + if (p.binding6 instanceof DirectiveBinding && isPresent(p.keyId6) && i.obj6 === undefinedValue) + i.obj6 = i.instantiateBinding(p.binding6, p.visibility6); + if (p.binding7 instanceof DirectiveBinding && isPresent(p.keyId7) && i.obj7 === undefinedValue) + i.obj7 = i.instantiateBinding(p.binding7, p.visibility7); + if (p.binding8 instanceof DirectiveBinding && isPresent(p.keyId8) && i.obj8 === undefinedValue) + i.obj8 = i.instantiateBinding(p.binding8, p.visibility8); + if (p.binding9 instanceof DirectiveBinding && isPresent(p.keyId9) && i.obj9 === undefinedValue) + i.obj9 = i.instantiateBinding(p.binding9, p.visibility9); + }, + dehydrate: function() { + var i = this.injectorStrategy; + i.obj0 = undefinedValue; + i.obj1 = undefinedValue; + i.obj2 = undefinedValue; + i.obj3 = undefinedValue; + i.obj4 = undefinedValue; + i.obj5 = undefinedValue; + i.obj6 = undefinedValue; + i.obj7 = undefinedValue; + i.obj8 = undefinedValue; + i.obj9 = undefinedValue; + }, + callOnDestroy: function() { + var i = this.injectorStrategy; + var p = i.protoStrategy; + if (p.binding0 instanceof DirectiveBinding && p.binding0.callOnDestroy) { + i.obj0.onDestroy(); + } + if (p.binding1 instanceof DirectiveBinding && p.binding1.callOnDestroy) { + i.obj1.onDestroy(); + } + if (p.binding2 instanceof DirectiveBinding && p.binding2.callOnDestroy) { + i.obj2.onDestroy(); + } + if (p.binding3 instanceof DirectiveBinding && p.binding3.callOnDestroy) { + i.obj3.onDestroy(); + } + if (p.binding4 instanceof DirectiveBinding && p.binding4.callOnDestroy) { + i.obj4.onDestroy(); + } + if (p.binding5 instanceof DirectiveBinding && p.binding5.callOnDestroy) { + i.obj5.onDestroy(); + } + if (p.binding6 instanceof DirectiveBinding && p.binding6.callOnDestroy) { + i.obj6.onDestroy(); + } + if (p.binding7 instanceof DirectiveBinding && p.binding7.callOnDestroy) { + i.obj7.onDestroy(); + } + if (p.binding8 instanceof DirectiveBinding && p.binding8.callOnDestroy) { + i.obj8.onDestroy(); + } + if (p.binding9 instanceof DirectiveBinding && p.binding9.callOnDestroy) { + i.obj9.onDestroy(); + } + }, + getComponent: function() { + return this.injectorStrategy.obj0; + }, + isComponentKey: function(key) { + return this._ei._proto._firstBindingIsComponent && isPresent(key) && key.id === this.injectorStrategy.protoStrategy.keyId0; + }, + buildQueries: function() { + var p = this.injectorStrategy.protoStrategy; + if (p.binding0 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding0.dependencies); + } + if (p.binding1 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding1.dependencies); + } + if (p.binding2 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding2.dependencies); + } + if (p.binding3 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding3.dependencies); + } + if (p.binding4 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding4.dependencies); + } + if (p.binding5 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding5.dependencies); + } + if (p.binding6 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding6.dependencies); + } + if (p.binding7 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding7.dependencies); + } + if (p.binding8 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding8.dependencies); + } + if (p.binding9 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding9.dependencies); + } + }, + addDirectivesMatchingQuery: function(query, list) { + var i = this.injectorStrategy; + var p = i.protoStrategy; + if (isPresent(p.binding0) && p.binding0.key.token === query.selector) { + if (i.obj0 === undefinedValue) + i.obj0 = i.instantiateBinding(p.binding0, p.visibility0); + list.push(i.obj0); + } + if (isPresent(p.binding1) && p.binding1.key.token === query.selector) { + if (i.obj1 === undefinedValue) + i.obj1 = i.instantiateBinding(p.binding1, p.visibility1); + list.push(i.obj1); + } + if (isPresent(p.binding2) && p.binding2.key.token === query.selector) { + if (i.obj2 === undefinedValue) + i.obj2 = i.instantiateBinding(p.binding2, p.visibility2); + list.push(i.obj2); + } + if (isPresent(p.binding3) && p.binding3.key.token === query.selector) { + if (i.obj3 === undefinedValue) + i.obj3 = i.instantiateBinding(p.binding3, p.visibility3); + list.push(i.obj3); + } + if (isPresent(p.binding4) && p.binding4.key.token === query.selector) { + if (i.obj4 === undefinedValue) + i.obj4 = i.instantiateBinding(p.binding4, p.visibility4); + list.push(i.obj4); + } + if (isPresent(p.binding5) && p.binding5.key.token === query.selector) { + if (i.obj5 === undefinedValue) + i.obj5 = i.instantiateBinding(p.binding5, p.visibility5); + list.push(i.obj5); + } + if (isPresent(p.binding6) && p.binding6.key.token === query.selector) { + if (i.obj6 === undefinedValue) + i.obj6 = i.instantiateBinding(p.binding6, p.visibility6); + list.push(i.obj6); + } + if (isPresent(p.binding7) && p.binding7.key.token === query.selector) { + if (i.obj7 === undefinedValue) + i.obj7 = i.instantiateBinding(p.binding7, p.visibility7); + list.push(i.obj7); + } + if (isPresent(p.binding8) && p.binding8.key.token === query.selector) { + if (i.obj8 === undefinedValue) + i.obj8 = i.instantiateBinding(p.binding8, p.visibility8); + list.push(i.obj8); + } + if (isPresent(p.binding9) && p.binding9.key.token === query.selector) { + if (i.obj9 === undefinedValue) + i.obj9 = i.instantiateBinding(p.binding9, p.visibility9); + list.push(i.obj9); + } + }, + getComponentBinding: function() { + var p = this.injectorStrategy.protoStrategy; + return p.binding0; + } + }, {}); + }()); + ElementInjectorDynamicStrategy = (function() { + function ElementInjectorDynamicStrategy(injectorStrategy, _ei) { + this.injectorStrategy = injectorStrategy; + this._ei = _ei; + } + return ($traceurRuntime.createClass)(ElementInjectorDynamicStrategy, { + hydrate: function() { + var inj = this.injectorStrategy; + var p = inj.protoStrategy; + for (var i = 0; i < p.keyIds.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding && isPresent(p.keyIds[i]) && inj.objs[i] === undefinedValue) { + inj.objs[i] = inj.instantiateBinding(p.bindings[i], p.visibilities[i]); + } + } + }, + dehydrate: function() { + var inj = this.injectorStrategy; + ListWrapper.fill(inj.objs, undefinedValue); + }, + callOnDestroy: function() { + var ist = this.injectorStrategy; + var p = ist.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding && p.bindings[i].callOnDestroy) { + ist.objs[i].onDestroy(); + } + } + }, + getComponent: function() { + return this.injectorStrategy.objs[0]; + }, + isComponentKey: function(key) { + var p = this.injectorStrategy.protoStrategy; + return this._ei._proto._firstBindingIsComponent && isPresent(key) && key.id === p.keyIds[0]; + }, + buildQueries: function() { + var inj = this.injectorStrategy; + var p = inj.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.bindings[i].dependencies); + } + } + }, + addDirectivesMatchingQuery: function(query, list) { + var ist = this.injectorStrategy; + var p = ist.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i].key.token === query.selector) { + if (ist.objs[i] === undefinedValue) { + ist.objs[i] = ist.instantiateBinding(p.bindings[i], p.visibilities[i]); + } + list.push(ist.objs[i]); + } + } + }, + getComponentBinding: function() { + var p = this.injectorStrategy.protoStrategy; + return p.bindings[0]; + } + }, {}); + }()); + QueryError = (function($__super) { + function QueryError() { + $traceurRuntime.superConstructor(QueryError).call(this); + this.message = 'Only 3 queries can be concurrently active in a template.'; + } + return ($traceurRuntime.createClass)(QueryError, {toString: function() { + return this.message; + }}, {}, $__super); + }(BaseException)); + $__export("QueryError", QueryError); + QueryRef = (function() { + function QueryRef(query, list, originator) { + this.query = query; + this.list = list; + this.originator = originator; + } + return ($traceurRuntime.createClass)(QueryRef, { + update: function() { + var aggregator = []; + this.visit(this.originator, aggregator); + this.list.reset(aggregator); + }, + visit: function(inj, aggregator) { + if (isBlank(inj) || !inj._hasQuery(this)) + return ; + if (this.query.isVarBindingQuery) { + this._aggregateVariableBindings(inj, aggregator); + } else { + this._aggregateDirective(inj, aggregator); + } + var child = inj._head; + while (isPresent(child)) { + this.visit(child, aggregator); + child = child._next; + } + }, + _aggregateVariableBindings: function(inj, aggregator) { + var vb = this.query.varBindings; + for (var i = 0; i < vb.length; ++i) { + if (inj.hasVariableBinding(vb[i])) { + aggregator.push(inj.getVariableBinding(vb[i])); + } + } + }, + _aggregateDirective: function(inj, aggregator) { + inj.addDirectivesMatchingQuery(this.query, aggregator); + } + }, {}); + }()); + $__export("QueryRef", QueryRef); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/compiler", ["angular2/di", "angular2/src/facade/async", "angular2/src/facade/lang", "angular2/src/dom/dom_adapter", "angular2/src/render/api", "angular2/src/render/dom/compiler/compile_pipeline", "angular2/src/render/dom/compiler/view_loader", "angular2/src/render/dom/compiler/compile_step_factory", "angular2/src/change_detection/change_detection", "angular2/src/render/dom/view/proto_view_merger", "angular2/src/render/dom/dom_tokens", "angular2/src/render/dom/view/shared_styles_host", "angular2/src/render/dom/util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/compiler"; + var __decorate, + __metadata, + __param, + Injectable, + PromiseWrapper, + BaseException, + DOM, + ViewDefinition, + ViewType, + RenderCompiler, + ViewEncapsulation, + CompilePipeline, + ViewLoader, + TemplateAndStyles, + DefaultStepFactory, + Parser, + pvm, + APP_ID_TOKEN, + Inject, + SharedStylesHost, + prependAll, + DomCompiler, + DefaultDomCompiler; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + Inject = $__m.Inject; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }, function($__m) { + BaseException = $__m.BaseException; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + ViewDefinition = $__m.ViewDefinition; + ViewType = $__m.ViewType; + RenderCompiler = $__m.RenderCompiler; + ViewEncapsulation = $__m.ViewEncapsulation; + }, function($__m) { + CompilePipeline = $__m.CompilePipeline; + }, function($__m) { + ViewLoader = $__m.ViewLoader; + TemplateAndStyles = $__m.TemplateAndStyles; + }, function($__m) { + DefaultStepFactory = $__m.DefaultStepFactory; + }, function($__m) { + Parser = $__m.Parser; + }, function($__m) { + pvm = $__m; + }, function($__m) { + APP_ID_TOKEN = $__m.APP_ID_TOKEN; + }, function($__m) { + SharedStylesHost = $__m.SharedStylesHost; + }, function($__m) { + prependAll = $__m.prependAll; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + DomCompiler = (function($__super) { + function DomCompiler(_stepFactory, _viewLoader, _sharedStylesHost) { + $traceurRuntime.superConstructor(DomCompiler).call(this); + this._stepFactory = _stepFactory; + this._viewLoader = _viewLoader; + this._sharedStylesHost = _sharedStylesHost; + } + return ($traceurRuntime.createClass)(DomCompiler, { + compile: function(view) { + var $__0 = this; + var tplPromise = this._viewLoader.load(view); + return PromiseWrapper.then(tplPromise, (function(tplAndStyles) { + return $__0._compileView(view, tplAndStyles, ViewType.COMPONENT); + }), (function(e) { + throw new BaseException(("Failed to load the template for \"" + view.componentId + "\" : " + e)); + return null; + })); + }, + compileHost: function(directiveMetadata) { + var hostViewDef = new ViewDefinition({ + componentId: directiveMetadata.id, + templateAbsUrl: null, + template: null, + styles: null, + styleAbsUrls: null, + directives: [directiveMetadata], + encapsulation: ViewEncapsulation.NONE + }); + return this._compileView(hostViewDef, new TemplateAndStyles(("<" + directiveMetadata.selector + ">"), []), ViewType.HOST); + }, + mergeProtoViewsRecursively: function(protoViewRefs) { + return PromiseWrapper.resolve(pvm.mergeProtoViewsRecursively(protoViewRefs)); + }, + _compileView: function(viewDef, templateAndStyles, protoViewType) { + if (viewDef.encapsulation === ViewEncapsulation.EMULATED && templateAndStyles.styles.length === 0) { + viewDef = this._normalizeViewEncapsulationIfThereAreNoStyles(viewDef); + } + var pipeline = new CompilePipeline(this._stepFactory.createSteps(viewDef)); + var compiledStyles = pipeline.processStyles(templateAndStyles.styles); + var compileElements = pipeline.processElements(DOM.createTemplate(templateAndStyles.template), protoViewType, viewDef); + if (viewDef.encapsulation === ViewEncapsulation.NATIVE) { + prependAll(DOM.content(compileElements[0].element), compiledStyles.map((function(style) { + return DOM.createStyleElement(style); + }))); + } else { + this._sharedStylesHost.addStyles(compiledStyles); + } + return PromiseWrapper.resolve(compileElements[0].inheritedProtoView.build()); + }, + _normalizeViewEncapsulationIfThereAreNoStyles: function(viewDef) { + if (viewDef.encapsulation === ViewEncapsulation.EMULATED) { + return new ViewDefinition({ + componentId: viewDef.componentId, + templateAbsUrl: viewDef.templateAbsUrl, + template: viewDef.template, + styleAbsUrls: viewDef.styleAbsUrls, + styles: viewDef.styles, + directives: viewDef.directives, + encapsulation: ViewEncapsulation.NONE + }); + } else { + return viewDef; + } + } + }, {}, $__super); + }(RenderCompiler)); + $__export("DomCompiler", DomCompiler); + DefaultDomCompiler = (function($__super) { + function $__1(parser, viewLoader, sharedStylesHost, appId) { + $traceurRuntime.superConstructor($__1).call(this, new DefaultStepFactory(parser, appId), viewLoader, sharedStylesHost); + } + return ($traceurRuntime.createClass)($__1, {}, {}, $__super); + }(DomCompiler)); + $__export("DefaultDomCompiler", DefaultDomCompiler); + $__export("DefaultDomCompiler", DefaultDomCompiler = __decorate([Injectable(), __param(3, Inject(APP_ID_TOKEN)), __metadata('design:paramtypes', [Parser, ViewLoader, SharedStylesHost, Object])], DefaultDomCompiler)); + } + }; +}); + +System.register("angular2/http", ["angular2/di", "angular2/src/http/http", "angular2/src/http/backends/xhr_backend", "angular2/src/http/backends/jsonp_backend", "angular2/src/http/backends/browser_xhr", "angular2/src/http/backends/browser_jsonp", "angular2/src/http/base_request_options", "angular2/src/http/interfaces", "angular2/src/http/base_response_options", "angular2/src/http/backends/mock_backend", "angular2/src/http/static_request", "angular2/src/http/static_response", "angular2/src/http/headers", "angular2/src/http/enums", "angular2/src/http/url_search_params"], function($__export) { + "use strict"; + var __moduleName = "angular2/http"; + var bind, + Http, + Jsonp, + XHRBackend, + JSONPBackend, + BrowserXhr, + BrowserJsonp, + BaseRequestOptions, + RequestOptions, + ConnectionBackend, + BaseResponseOptions, + ResponseOptions, + httpInjectables, + jsonpInjectables; + return { + setters: [function($__m) { + bind = $__m.bind; + }, function($__m) { + Http = $__m.Http; + Jsonp = $__m.Jsonp; + $__export("Http", $__m.Http); + $__export("Jsonp", $__m.Jsonp); + }, function($__m) { + XHRBackend = $__m.XHRBackend; + $__export("XHRBackend", $__m.XHRBackend); + $__export("XHRConnection", $__m.XHRConnection); + }, function($__m) { + JSONPBackend = $__m.JSONPBackend; + $__export("JSONPBackend", $__m.JSONPBackend); + $__export("JSONPConnection", $__m.JSONPConnection); + }, function($__m) { + BrowserXhr = $__m.BrowserXhr; + $__export("BrowserXhr", $__m.BrowserXhr); + }, function($__m) { + BrowserJsonp = $__m.BrowserJsonp; + }, function($__m) { + BaseRequestOptions = $__m.BaseRequestOptions; + RequestOptions = $__m.RequestOptions; + $__export("BaseRequestOptions", $__m.BaseRequestOptions); + $__export("RequestOptions", $__m.RequestOptions); + }, function($__m) { + ConnectionBackend = $__m.ConnectionBackend; + $__export("Connection", $__m.Connection); + $__export("ConnectionBackend", $__m.ConnectionBackend); + }, function($__m) { + BaseResponseOptions = $__m.BaseResponseOptions; + ResponseOptions = $__m.ResponseOptions; + $__export("BaseResponseOptions", $__m.BaseResponseOptions); + $__export("ResponseOptions", $__m.ResponseOptions); + }, function($__m) { + $__export("MockConnection", $__m.MockConnection); + $__export("MockBackend", $__m.MockBackend); + }, function($__m) { + $__export("Request", $__m.Request); + }, function($__m) { + $__export("Response", $__m.Response); + }, function($__m) { + $__export("Headers", $__m.Headers); + }, function($__m) { + $__export("ResponseTypes", $__m.ResponseTypes); + $__export("ReadyStates", $__m.ReadyStates); + $__export("RequestMethods", $__m.RequestMethods); + $__export("RequestCredentialsOpts", $__m.RequestCredentialsOpts); + $__export("RequestCacheOpts", $__m.RequestCacheOpts); + $__export("RequestModesOpts", $__m.RequestModesOpts); + }, function($__m) { + $__export("URLSearchParams", $__m.URLSearchParams); + }], + execute: function() { + httpInjectables = [bind(ConnectionBackend).toClass(XHRBackend), BrowserXhr, bind(RequestOptions).toClass(BaseRequestOptions), bind(ResponseOptions).toClass(BaseResponseOptions), Http]; + $__export("httpInjectables", httpInjectables); + jsonpInjectables = [bind(ConnectionBackend).toClass(JSONPBackend), BrowserJsonp, bind(RequestOptions).toClass(BaseRequestOptions), bind(ResponseOptions).toClass(BaseResponseOptions), Jsonp]; + $__export("jsonpInjectables", jsonpInjectables); + } + }; +}); + +System.register("angular2/di", ["angular2/src/di/metadata", "angular2/src/di/decorators", "angular2/src/di/forward_ref", "angular2/src/di/injector", "angular2/src/di/binding", "angular2/src/di/key", "angular2/src/di/exceptions", "angular2/src/di/opaque_token"], function($__export) { + "use strict"; + var __moduleName = "angular2/di"; + var $__exportNames = {undefined: true}; + return { + setters: [function($__m) { + $__export("InjectMetadata", $__m.InjectMetadata); + $__export("OptionalMetadata", $__m.OptionalMetadata); + $__export("InjectableMetadata", $__m.InjectableMetadata); + $__export("VisibilityMetadata", $__m.VisibilityMetadata); + $__export("SelfMetadata", $__m.SelfMetadata); + $__export("AncestorMetadata", $__m.AncestorMetadata); + $__export("UnboundedMetadata", $__m.UnboundedMetadata); + $__export("DependencyMetadata", $__m.DependencyMetadata); + $__export("DEFAULT_VISIBILITY", $__m.DEFAULT_VISIBILITY); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + $__export("forwardRef", $__m.forwardRef); + $__export("resolveForwardRef", $__m.resolveForwardRef); + }, function($__m) { + $__export("Injector", $__m.Injector); + $__export("ProtoInjector", $__m.ProtoInjector); + $__export("BindingWithVisibility", $__m.BindingWithVisibility); + $__export("PUBLIC_AND_PRIVATE", $__m.PUBLIC_AND_PRIVATE); + $__export("PUBLIC", $__m.PUBLIC); + $__export("PRIVATE", $__m.PRIVATE); + $__export("undefinedValue", $__m.undefinedValue); + }, function($__m) { + $__export("Binding", $__m.Binding); + $__export("BindingBuilder", $__m.BindingBuilder); + $__export("ResolvedBinding", $__m.ResolvedBinding); + $__export("Dependency", $__m.Dependency); + $__export("bind", $__m.bind); + }, function($__m) { + $__export("Key", $__m.Key); + $__export("KeyRegistry", $__m.KeyRegistry); + $__export("TypeLiteral", $__m.TypeLiteral); + }, function($__m) { + $__export("NoBindingError", $__m.NoBindingError); + $__export("AbstractBindingError", $__m.AbstractBindingError); + $__export("CyclicDependencyError", $__m.CyclicDependencyError); + $__export("InstantiationError", $__m.InstantiationError); + $__export("InvalidBindingError", $__m.InvalidBindingError); + $__export("NoAnnotationError", $__m.NoAnnotationError); + $__export("OutOfBoundsError", $__m.OutOfBoundsError); + }, function($__m) { + $__export("OpaqueToken", $__m.OpaqueToken); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/change_detection/jit_proto_change_detector", ["angular2/src/facade/collection", "angular2/src/change_detection/change_detection_jit_generator", "angular2/src/change_detection/coalesce", "angular2/src/change_detection/proto_change_detector"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/jit_proto_change_detector"; + var ListWrapper, + ChangeDetectorJITGenerator, + coalesce, + ProtoRecordBuilder, + JitProtoChangeDetector; + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + ChangeDetectorJITGenerator = $__m.ChangeDetectorJITGenerator; + }, function($__m) { + coalesce = $__m.coalesce; + }, function($__m) { + ProtoRecordBuilder = $__m.ProtoRecordBuilder; + }], + execute: function() { + JitProtoChangeDetector = (function() { + function JitProtoChangeDetector(definition) { + this.definition = definition; + this._factory = this._createFactory(definition); + } + return ($traceurRuntime.createClass)(JitProtoChangeDetector, { + instantiate: function(dispatcher) { + return this._factory(dispatcher); + }, + _createFactory: function(definition) { + var recordBuilder = new ProtoRecordBuilder(); + ListWrapper.forEach(definition.bindingRecords, (function(b) { + recordBuilder.add(b, definition.variableNames); + })); + var records = coalesce(recordBuilder.records); + return new ChangeDetectorJITGenerator(definition.id, definition.strategy, records, this.definition.directiveRecords, this.definition.generateCheckNoChanges).generate(); + } + }, {isSupported: function() { + return true; + }}); + }()); + $__export("JitProtoChangeDetector", JitProtoChangeDetector); + } + }; +}); + +System.register("angular2/src/render/render", ["angular2/src/render/dom/compiler/view_loader", "angular2/src/render/dom/view/shared_styles_host", "angular2/src/render/dom/compiler/compiler", "angular2/src/render/dom/dom_renderer", "angular2/src/render/dom/dom_tokens", "angular2/src/render/api"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/render"; + var $__exportNames = {}; + var $__exportNames = {}; + var $__exportNames = {}; + var $__exportNames = {}; + var $__exportNames = {}; + var $__exportNames = {}; + return { + setters: [function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/change_detection/change_detection", ["angular2/src/change_detection/jit_proto_change_detector", "angular2/src/change_detection/pregen_proto_change_detector", "angular2/src/change_detection/proto_change_detector", "angular2/src/change_detection/pipes/pipes", "angular2/src/change_detection/pipes/iterable_changes", "angular2/src/change_detection/pipes/keyvalue_changes", "angular2/src/change_detection/pipes/observable_pipe", "angular2/src/change_detection/pipes/promise_pipe", "angular2/src/change_detection/pipes/uppercase_pipe", "angular2/src/change_detection/pipes/lowercase_pipe", "angular2/src/change_detection/pipes/json_pipe", "angular2/src/change_detection/pipes/limit_to_pipe", "angular2/src/change_detection/pipes/date_pipe", "angular2/src/change_detection/pipes/number_pipe", "angular2/src/change_detection/pipes/null_pipe", "angular2/src/change_detection/interfaces", "angular2/di", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/change_detection/parser/ast", "angular2/src/change_detection/parser/lexer", "angular2/src/change_detection/parser/parser", "angular2/src/change_detection/parser/locals", "angular2/src/change_detection/exceptions", "angular2/src/change_detection/constants", "angular2/src/change_detection/binding_record", "angular2/src/change_detection/directive_record", "angular2/src/change_detection/dynamic_change_detector", "angular2/src/change_detection/change_detector_ref", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/change_detection"; + var __decorate, + __metadata, + __param, + JitProtoChangeDetector, + PregenProtoChangeDetector, + DynamicProtoChangeDetector, + Pipes, + IterableChangesFactory, + KeyValueChangesFactory, + ObservablePipeFactory, + PromisePipeFactory, + UpperCasePipe, + LowerCasePipe, + JsonPipe, + LimitToPipeFactory, + DatePipe, + DecimalPipe, + PercentPipe, + CurrencyPipe, + NullPipeFactory, + ChangeDetection, + Inject, + Injectable, + OpaqueToken, + Optional, + StringMapWrapper, + CONST, + CONST_EXPR, + isPresent, + keyValDiff, + iterableDiff, + async, + uppercase, + lowercase, + json, + limitTo, + decimal, + percent, + currency, + date, + defaultPipes, + preGeneratedProtoDetectors, + PROTO_CHANGE_DETECTOR_KEY, + PreGeneratedChangeDetection, + DynamicChangeDetection, + JitChangeDetection; + return { + setters: [function($__m) { + JitProtoChangeDetector = $__m.JitProtoChangeDetector; + }, function($__m) { + PregenProtoChangeDetector = $__m.PregenProtoChangeDetector; + }, function($__m) { + DynamicProtoChangeDetector = $__m.DynamicProtoChangeDetector; + $__export("DynamicProtoChangeDetector", $__m.DynamicProtoChangeDetector); + }, function($__m) { + Pipes = $__m.Pipes; + $__export("Pipes", $__m.Pipes); + }, function($__m) { + IterableChangesFactory = $__m.IterableChangesFactory; + }, function($__m) { + KeyValueChangesFactory = $__m.KeyValueChangesFactory; + }, function($__m) { + ObservablePipeFactory = $__m.ObservablePipeFactory; + }, function($__m) { + PromisePipeFactory = $__m.PromisePipeFactory; + }, function($__m) { + UpperCasePipe = $__m.UpperCasePipe; + }, function($__m) { + LowerCasePipe = $__m.LowerCasePipe; + }, function($__m) { + JsonPipe = $__m.JsonPipe; + }, function($__m) { + LimitToPipeFactory = $__m.LimitToPipeFactory; + }, function($__m) { + DatePipe = $__m.DatePipe; + }, function($__m) { + DecimalPipe = $__m.DecimalPipe; + PercentPipe = $__m.PercentPipe; + CurrencyPipe = $__m.CurrencyPipe; + }, function($__m) { + NullPipeFactory = $__m.NullPipeFactory; + $__export("NullPipe", $__m.NullPipe); + $__export("NullPipeFactory", $__m.NullPipeFactory); + }, function($__m) { + ChangeDetection = $__m.ChangeDetection; + $__export("ChangeDetection", $__m.ChangeDetection); + $__export("ChangeDetectorDefinition", $__m.ChangeDetectorDefinition); + }, function($__m) { + Inject = $__m.Inject; + Injectable = $__m.Injectable; + OpaqueToken = $__m.OpaqueToken; + Optional = $__m.Optional; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + CONST = $__m.CONST; + CONST_EXPR = $__m.CONST_EXPR; + isPresent = $__m.isPresent; + }, function($__m) { + $__export("ASTWithSource", $__m.ASTWithSource); + $__export("AST", $__m.AST); + $__export("AstTransformer", $__m.AstTransformer); + $__export("AccessMember", $__m.AccessMember); + $__export("LiteralArray", $__m.LiteralArray); + $__export("ImplicitReceiver", $__m.ImplicitReceiver); + }, function($__m) { + $__export("Lexer", $__m.Lexer); + }, function($__m) { + $__export("Parser", $__m.Parser); + }, function($__m) { + $__export("Locals", $__m.Locals); + }, function($__m) { + $__export("DehydratedException", $__m.DehydratedException); + $__export("ExpressionChangedAfterItHasBeenCheckedException", $__m.ExpressionChangedAfterItHasBeenCheckedException); + $__export("ChangeDetectionError", $__m.ChangeDetectionError); + }, function($__m) { + $__export("CHECK_ONCE", $__m.CHECK_ONCE); + $__export("CHECK_ALWAYS", $__m.CHECK_ALWAYS); + $__export("DETACHED", $__m.DETACHED); + $__export("CHECKED", $__m.CHECKED); + $__export("ON_PUSH", $__m.ON_PUSH); + $__export("DEFAULT", $__m.DEFAULT); + }, function($__m) { + $__export("BindingRecord", $__m.BindingRecord); + }, function($__m) { + $__export("DirectiveIndex", $__m.DirectiveIndex); + $__export("DirectiveRecord", $__m.DirectiveRecord); + }, function($__m) { + $__export("DynamicChangeDetector", $__m.DynamicChangeDetector); + }, function($__m) { + $__export("ChangeDetectorRef", $__m.ChangeDetectorRef); + }, function($__m) { + $__export("WrappedValue", $__m.WrappedValue); + $__export("BasePipe", $__m.BasePipe); + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + keyValDiff = CONST_EXPR([CONST_EXPR(new KeyValueChangesFactory()), CONST_EXPR(new NullPipeFactory())]); + $__export("keyValDiff", keyValDiff); + iterableDiff = CONST_EXPR([CONST_EXPR(new IterableChangesFactory()), CONST_EXPR(new NullPipeFactory())]); + $__export("iterableDiff", iterableDiff); + async = CONST_EXPR([CONST_EXPR(new ObservablePipeFactory()), CONST_EXPR(new PromisePipeFactory()), CONST_EXPR(new NullPipeFactory())]); + $__export("async", async); + uppercase = CONST_EXPR([CONST_EXPR(new UpperCasePipe()), CONST_EXPR(new NullPipeFactory())]); + $__export("uppercase", uppercase); + lowercase = CONST_EXPR([CONST_EXPR(new LowerCasePipe()), CONST_EXPR(new NullPipeFactory())]); + $__export("lowercase", lowercase); + json = CONST_EXPR([CONST_EXPR(new JsonPipe()), CONST_EXPR(new NullPipeFactory())]); + $__export("json", json); + limitTo = CONST_EXPR([CONST_EXPR(new LimitToPipeFactory()), CONST_EXPR(new NullPipeFactory())]); + $__export("limitTo", limitTo); + decimal = CONST_EXPR([CONST_EXPR(new DecimalPipe()), CONST_EXPR(new NullPipeFactory())]); + $__export("decimal", decimal); + percent = CONST_EXPR([CONST_EXPR(new PercentPipe()), CONST_EXPR(new NullPipeFactory())]); + $__export("percent", percent); + currency = CONST_EXPR([CONST_EXPR(new CurrencyPipe()), CONST_EXPR(new NullPipeFactory())]); + $__export("currency", currency); + date = CONST_EXPR([CONST_EXPR(new DatePipe()), CONST_EXPR(new NullPipeFactory())]); + $__export("date", date); + defaultPipes = CONST_EXPR(new Pipes({ + "iterableDiff": iterableDiff, + "keyValDiff": keyValDiff, + "async": async, + "uppercase": uppercase, + "lowercase": lowercase, + "json": json, + "limitTo": limitTo, + "number": decimal, + "percent": percent, + "currency": currency, + "date": date + })); + $__export("defaultPipes", defaultPipes); + preGeneratedProtoDetectors = {}; + $__export("preGeneratedProtoDetectors", preGeneratedProtoDetectors); + PROTO_CHANGE_DETECTOR_KEY = CONST_EXPR(new OpaqueToken('ProtoChangeDetectors')); + $__export("PROTO_CHANGE_DETECTOR_KEY", PROTO_CHANGE_DETECTOR_KEY); + PreGeneratedChangeDetection = (function($__super) { + function $__0(protoChangeDetectorsForTest) { + $traceurRuntime.superConstructor($__0).call(this); + this._dynamicChangeDetection = new DynamicChangeDetection(); + this._protoChangeDetectorFactories = isPresent(protoChangeDetectorsForTest) ? protoChangeDetectorsForTest : preGeneratedProtoDetectors; + } + return ($traceurRuntime.createClass)($__0, {createProtoChangeDetector: function(definition) { + var id = definition.id; + if (StringMapWrapper.contains(this._protoChangeDetectorFactories, id)) { + return StringMapWrapper.get(this._protoChangeDetectorFactories, id)(definition); + } + return this._dynamicChangeDetection.createProtoChangeDetector(definition); + }}, {isSupported: function() { + return PregenProtoChangeDetector.isSupported(); + }}, $__super); + }(ChangeDetection)); + $__export("PreGeneratedChangeDetection", PreGeneratedChangeDetection); + $__export("PreGeneratedChangeDetection", PreGeneratedChangeDetection = __decorate([Injectable(), __param(0, Inject(PROTO_CHANGE_DETECTOR_KEY)), __param(0, Optional()), __metadata('design:paramtypes', [Object])], PreGeneratedChangeDetection)); + DynamicChangeDetection = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, {createProtoChangeDetector: function(definition) { + return new DynamicProtoChangeDetector(definition); + }}, {}, $__super); + }(ChangeDetection)); + $__export("DynamicChangeDetection", DynamicChangeDetection); + $__export("DynamicChangeDetection", DynamicChangeDetection = __decorate([Injectable(), __metadata('design:paramtypes', [])], DynamicChangeDetection)); + JitChangeDetection = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, {createProtoChangeDetector: function(definition) { + return new JitProtoChangeDetector(definition); + }}, {isSupported: function() { + return JitProtoChangeDetector.isSupported(); + }}, $__super); + }(ChangeDetection)); + $__export("JitChangeDetection", JitChangeDetection); + $__export("JitChangeDetection", JitChangeDetection = __decorate([Injectable(), CONST(), __metadata('design:paramtypes', [])], JitChangeDetection)); + } + }; +}); + +System.register("angular2/change_detection", ["angular2/src/change_detection/change_detection"], function($__export) { + "use strict"; + var __moduleName = "angular2/change_detection"; + return { + setters: [function($__m) { + $__export("CHECK_ONCE", $__m.CHECK_ONCE); + $__export("CHECK_ALWAYS", $__m.CHECK_ALWAYS); + $__export("DETACHED", $__m.DETACHED); + $__export("CHECKED", $__m.CHECKED); + $__export("ON_PUSH", $__m.ON_PUSH); + $__export("DEFAULT", $__m.DEFAULT); + $__export("ExpressionChangedAfterItHasBeenCheckedException", $__m.ExpressionChangedAfterItHasBeenCheckedException); + $__export("ChangeDetectionError", $__m.ChangeDetectionError); + $__export("ChangeDetectorRef", $__m.ChangeDetectorRef); + $__export("WrappedValue", $__m.WrappedValue); + $__export("Pipes", $__m.Pipes); + $__export("BasePipe", $__m.BasePipe); + $__export("NullPipe", $__m.NullPipe); + $__export("NullPipeFactory", $__m.NullPipeFactory); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/core/annotations_impl/annotations", ["angular2/src/facade/lang", "angular2/src/di/metadata", "angular2/change_detection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/annotations_impl/annotations"; + var __decorate, + __metadata, + CONST, + InjectableMetadata, + DEFAULT, + Directive, + Component, + LifecycleEvent; + return { + setters: [function($__m) { + CONST = $__m.CONST; + }, function($__m) { + InjectableMetadata = $__m.InjectableMetadata; + }, function($__m) { + DEFAULT = $__m.DEFAULT; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Directive = (function($__super) { + function $__0() { + var $__3; + var $__2 = arguments[0] !== (void 0) ? arguments[0] : {}, + selector = $__2.selector, + properties = $__2.properties, + events = $__2.events, + host = $__2.host, + lifecycle = $__2.lifecycle, + hostInjector = $__2.hostInjector, + exportAs = $__2.exportAs, + compileChildren = ($__3 = $__2.compileChildren) === void 0 ? true : $__3; + $traceurRuntime.superConstructor($__0).call(this); + this.selector = selector; + this.properties = properties; + this.events = events; + this.host = host; + this.exportAs = exportAs; + this.lifecycle = lifecycle; + this.compileChildren = compileChildren; + this.hostInjector = hostInjector; + } + return ($traceurRuntime.createClass)($__0, {}, {}, $__super); + }(InjectableMetadata)); + $__export("Directive", Directive); + $__export("Directive", Directive = __decorate([CONST(), __metadata('design:paramtypes', [Object])], Directive)); + Component = (function($__super) { + function $__0() { + var $__3, + $__4; + var $__2 = arguments[0] !== (void 0) ? arguments[0] : {}, + selector = $__2.selector, + properties = $__2.properties, + events = $__2.events, + host = $__2.host, + exportAs = $__2.exportAs, + lifecycle = $__2.lifecycle, + hostInjector = $__2.hostInjector, + viewInjector = $__2.viewInjector, + changeDetection = ($__3 = $__2.changeDetection) === void 0 ? DEFAULT : $__3, + compileChildren = ($__4 = $__2.compileChildren) === void 0 ? true : $__4; + $traceurRuntime.superConstructor($__0).call(this, { + selector: selector, + properties: properties, + events: events, + host: host, + exportAs: exportAs, + hostInjector: hostInjector, + lifecycle: lifecycle, + compileChildren: compileChildren + }); + this.changeDetection = changeDetection; + this.viewInjector = viewInjector; + } + return ($traceurRuntime.createClass)($__0, {}, {}, $__super); + }(Directive)); + $__export("Component", Component); + $__export("Component", Component = __decorate([CONST(), __metadata('design:paramtypes', [Object])], Component)); + $__export("LifecycleEvent", LifecycleEvent); + (function(LifecycleEvent) { + LifecycleEvent[LifecycleEvent["onDestroy"] = 0] = "onDestroy"; + LifecycleEvent[LifecycleEvent["onChange"] = 1] = "onChange"; + LifecycleEvent[LifecycleEvent["onCheck"] = 2] = "onCheck"; + LifecycleEvent[LifecycleEvent["onInit"] = 3] = "onInit"; + LifecycleEvent[LifecycleEvent["onAllChangesDone"] = 4] = "onAllChangesDone"; + })(LifecycleEvent || ($__export("LifecycleEvent", LifecycleEvent = {}))); + } + }; +}); + +System.register("angular2/src/core/compiler/directive_resolver", ["angular2/di", "angular2/src/facade/lang", "angular2/src/core/annotations_impl/annotations", "angular2/src/reflection/reflection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/directive_resolver"; + var __decorate, + __metadata, + resolveForwardRef, + Injectable, + isPresent, + BaseException, + stringify, + Directive, + reflector, + DirectiveResolver; + return { + setters: [function($__m) { + resolveForwardRef = $__m.resolveForwardRef; + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + stringify = $__m.stringify; + }, function($__m) { + Directive = $__m.Directive; + }, function($__m) { + reflector = $__m.reflector; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + DirectiveResolver = (($traceurRuntime.createClass)(function() {}, {resolve: function(type) { + var annotations = reflector.annotations(resolveForwardRef(type)); + if (isPresent(annotations)) { + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + if (annotation instanceof Directive) { + return annotation; + } + } + } + throw new BaseException(("No Directive annotation found on " + stringify(type))); + }}, {})); + $__export("DirectiveResolver", DirectiveResolver); + $__export("DirectiveResolver", DirectiveResolver = __decorate([Injectable(), __metadata('design:paramtypes', [])], DirectiveResolver)); + } + }; +}); + +System.register("angular2/src/core/compiler/compiler", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/view", "angular2/src/core/compiler/element_injector", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/proto_view_factory", "angular2/src/services/url_resolver", "angular2/src/services/app_root_url", "angular2/src/render/api"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/compiler"; + var __decorate, + __metadata, + Binding, + resolveForwardRef, + Injectable, + Type, + isBlank, + isType, + isPresent, + BaseException, + normalizeBlank, + stringify, + isArray, + isPromise, + PromiseWrapper, + ListWrapper, + Map, + MapWrapper, + DirectiveResolver, + AppProtoViewMergeMapping, + DirectiveBinding, + ViewResolver, + ComponentUrlMapper, + ProtoViewFactory, + UrlResolver, + AppRootUrl, + renderApi, + CompilerCache, + Compiler; + return { + setters: [function($__m) { + Binding = $__m.Binding; + resolveForwardRef = $__m.resolveForwardRef; + Injectable = $__m.Injectable; + }, function($__m) { + Type = $__m.Type; + isBlank = $__m.isBlank; + isType = $__m.isType; + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + normalizeBlank = $__m.normalizeBlank; + stringify = $__m.stringify; + isArray = $__m.isArray; + isPromise = $__m.isPromise; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + Map = $__m.Map; + MapWrapper = $__m.MapWrapper; + }, function($__m) { + DirectiveResolver = $__m.DirectiveResolver; + }, function($__m) { + AppProtoViewMergeMapping = $__m.AppProtoViewMergeMapping; + }, function($__m) { + DirectiveBinding = $__m.DirectiveBinding; + }, function($__m) { + ViewResolver = $__m.ViewResolver; + }, function($__m) { + ComponentUrlMapper = $__m.ComponentUrlMapper; + }, function($__m) { + ProtoViewFactory = $__m.ProtoViewFactory; + }, function($__m) { + UrlResolver = $__m.UrlResolver; + }, function($__m) { + AppRootUrl = $__m.AppRootUrl; + }, function($__m) { + renderApi = $__m; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + CompilerCache = (($traceurRuntime.createClass)(function() { + this._cache = new Map(); + this._hostCache = new Map(); + }, { + set: function(component, protoView) { + this._cache.set(component, protoView); + }, + get: function(component) { + var result = this._cache.get(component); + return normalizeBlank(result); + }, + setHost: function(component, protoView) { + this._hostCache.set(component, protoView); + }, + getHost: function(component) { + var result = this._hostCache.get(component); + return normalizeBlank(result); + }, + clear: function() { + this._cache.clear(); + this._hostCache.clear(); + } + }, {})); + $__export("CompilerCache", CompilerCache); + $__export("CompilerCache", CompilerCache = __decorate([Injectable(), __metadata('design:paramtypes', [])], CompilerCache)); + Compiler = (($traceurRuntime.createClass)(function(reader, cache, viewResolver, componentUrlMapper, urlResolver, render, protoViewFactory, appUrl) { + this._reader = reader; + this._compilerCache = cache; + this._compiling = new Map(); + this._viewResolver = viewResolver; + this._componentUrlMapper = componentUrlMapper; + this._urlResolver = urlResolver; + this._appUrl = appUrl.value; + this._render = render; + this._protoViewFactory = protoViewFactory; + }, { + _bindDirective: function(directiveTypeOrBinding) { + if (directiveTypeOrBinding instanceof DirectiveBinding) { + return directiveTypeOrBinding; + } else if (directiveTypeOrBinding instanceof Binding) { + var annotation = this._reader.resolve(directiveTypeOrBinding.token); + return DirectiveBinding.createFromBinding(directiveTypeOrBinding, annotation); + } else { + var annotation$__3 = this._reader.resolve(directiveTypeOrBinding); + return DirectiveBinding.createFromType(directiveTypeOrBinding, annotation$__3); + } + }, + compileInHost: function(componentTypeOrBinding) { + var $__0 = this; + var componentType = isType(componentTypeOrBinding) ? componentTypeOrBinding : componentTypeOrBinding.token; + var hostAppProtoView = this._compilerCache.getHost(componentType); + var hostPvPromise; + if (isPresent(hostAppProtoView)) { + hostPvPromise = PromiseWrapper.resolve(hostAppProtoView); + } else { + var componentBinding = this._bindDirective(componentTypeOrBinding); + Compiler._assertTypeIsComponent(componentBinding); + var directiveMetadata = componentBinding.metadata; + hostPvPromise = this._render.compileHost(directiveMetadata).then((function(hostRenderPv) { + var protoViews = $__0._protoViewFactory.createAppProtoViews(componentBinding, hostRenderPv, [componentBinding]); + return $__0._compileNestedProtoViews(protoViews, componentType, new Map()); + })).then((function(appProtoView) { + $__0._compilerCache.setHost(componentType, appProtoView); + return appProtoView; + })); + } + return hostPvPromise.then((function(hostAppProtoView) { + return hostAppProtoView.ref; + })); + }, + _compile: function(componentBinding, componentPath) { + var $__0 = this; + var component = componentBinding.key.token; + var protoView = this._compilerCache.get(component); + if (isPresent(protoView)) { + return protoView; + } + var resultPromise = this._compiling.get(component); + if (isPresent(resultPromise)) { + return resultPromise; + } + var view = this._viewResolver.resolve(component); + var directives = this._flattenDirectives(view); + for (var i = 0; i < directives.length; i++) { + if (!Compiler._isValidDirective(directives[i])) { + throw new BaseException(("Unexpected directive value '" + stringify(directives[i]) + "' on the View of component '" + stringify(component) + "'")); + } + } + var boundDirectives = this._removeDuplicatedDirectives(ListWrapper.map(directives, (function(directive) { + return $__0._bindDirective(directive); + }))); + var renderTemplate = this._buildRenderTemplate(component, view, boundDirectives); + resultPromise = this._render.compile(renderTemplate).then((function(renderPv) { + var protoViews = $__0._protoViewFactory.createAppProtoViews(componentBinding, renderPv, boundDirectives); + return $__0._compileNestedProtoViews(protoViews, component, componentPath); + })).then((function(appProtoView) { + $__0._compilerCache.set(component, appProtoView); + MapWrapper.delete($__0._compiling, component); + return appProtoView; + })); + this._compiling.set(component, resultPromise); + return resultPromise; + }, + _removeDuplicatedDirectives: function(directives) { + var directivesMap = new Map(); + directives.forEach((function(dirBinding) { + directivesMap.set(dirBinding.key.id, dirBinding); + })); + return MapWrapper.values(directivesMap); + }, + _compileNestedProtoViews: function(appProtoViews, componentType, componentPath) { + var $__0 = this; + var nestedPVPromises = []; + componentPath = MapWrapper.clone(componentPath); + if (appProtoViews[0].type === renderApi.ViewType.COMPONENT) { + componentPath.set(componentType, appProtoViews[0]); + } + appProtoViews.forEach((function(appProtoView) { + $__0._collectComponentElementBinders(appProtoView).forEach((function(elementBinder) { + var nestedComponent = elementBinder.componentDirective; + var nestedComponentType = nestedComponent.key.token; + var elementBinderDone = (function(nestedPv) { + elementBinder.nestedProtoView = nestedPv; + }); + if (componentPath.has(nestedComponentType)) { + if (appProtoView.isEmbeddedFragment) { + throw new BaseException((" is used within the recursive path of " + stringify(nestedComponentType))); + } else if (appProtoView.type === renderApi.ViewType.COMPONENT) { + throw new BaseException(("Unconditional component cycle in " + stringify(nestedComponentType))); + } else { + elementBinderDone(componentPath.get(nestedComponentType)); + } + } else { + var nestedCall = $__0._compile(nestedComponent, componentPath); + if (isPromise(nestedCall)) { + nestedPVPromises.push(nestedCall.then(elementBinderDone)); + } else { + elementBinderDone(nestedCall); + } + } + })); + })); + return PromiseWrapper.all(nestedPVPromises).then((function(_) { + return PromiseWrapper.all(appProtoViews.map((function(appProtoView) { + return $__0._mergeProtoView(appProtoView); + }))); + })).then((function(_) { + return appProtoViews[0]; + })); + }, + _mergeProtoView: function(appProtoView) { + if (appProtoView.type !== renderApi.ViewType.HOST && appProtoView.type !== renderApi.ViewType.EMBEDDED) { + return null; + } + return this._render.mergeProtoViewsRecursively(this._collectMergeRenderProtoViews(appProtoView)).then((function(mergeResult) { + appProtoView.mergeMapping = new AppProtoViewMergeMapping(mergeResult); + })); + }, + _collectMergeRenderProtoViews: function(appProtoView) { + var result = [appProtoView.render]; + for (var i = 0; i < appProtoView.elementBinders.length; i++) { + var binder = appProtoView.elementBinders[i]; + if (isPresent(binder.nestedProtoView)) { + if (binder.hasStaticComponent() || (binder.hasEmbeddedProtoView() && binder.nestedProtoView.isEmbeddedFragment)) { + result.push(this._collectMergeRenderProtoViews(binder.nestedProtoView)); + } else { + result.push(null); + } + } + } + return result; + }, + _collectComponentElementBinders: function(appProtoView) { + var componentElementBinders = []; + appProtoView.elementBinders.forEach((function(elementBinder) { + if (isPresent(elementBinder.componentDirective)) { + componentElementBinders.push(elementBinder); + } + })); + return componentElementBinders; + }, + _buildRenderTemplate: function(component, view, directives) { + var $__0 = this; + var componentUrl = this._urlResolver.resolve(this._appUrl, this._componentUrlMapper.getUrl(component)); + var templateAbsUrl = null; + var styleAbsUrls = null; + if (isPresent(view.templateUrl)) { + templateAbsUrl = this._urlResolver.resolve(componentUrl, view.templateUrl); + } else if (isPresent(view.template)) { + templateAbsUrl = componentUrl; + } + if (isPresent(view.styleUrls)) { + styleAbsUrls = ListWrapper.map(view.styleUrls, (function(url) { + return $__0._urlResolver.resolve(componentUrl, url); + })); + } + return new renderApi.ViewDefinition({ + componentId: stringify(component), + templateAbsUrl: templateAbsUrl, + template: view.template, + styleAbsUrls: styleAbsUrls, + styles: view.styles, + directives: ListWrapper.map(directives, (function(directiveBinding) { + return directiveBinding.metadata; + })), + encapsulation: view.encapsulation + }); + }, + _flattenDirectives: function(template) { + if (isBlank(template.directives)) + return []; + var directives = []; + this._flattenList(template.directives, directives); + return directives; + }, + _flattenList: function(tree, out) { + for (var i = 0; i < tree.length; i++) { + var item = resolveForwardRef(tree[i]); + if (isArray(item)) { + this._flattenList(item, out); + } else { + out.push(item); + } + } + } + }, { + _isValidDirective: function(value) { + return isPresent(value) && (value instanceof Type || value instanceof Binding); + }, + _assertTypeIsComponent: function(directiveBinding) { + if (directiveBinding.metadata.type !== renderApi.DirectiveMetadata.COMPONENT_TYPE) { + throw new BaseException(("Could not load '" + stringify(directiveBinding.key.token) + "' because it is not a component.")); + } + } + })); + $__export("Compiler", Compiler); + $__export("Compiler", Compiler = __decorate([Injectable(), __metadata('design:paramtypes', [DirectiveResolver, CompilerCache, ViewResolver, ComponentUrlMapper, UrlResolver, renderApi.RenderCompiler, ProtoViewFactory, AppRootUrl])], Compiler)); + } + }; +}); + +System.register("angular2/src/core/application_common", ["angular2/di", "angular2/src/facade/lang", "angular2/src/dom/browser_adapter", "angular2/src/dom/dom_adapter", "angular2/src/core/compiler/compiler", "angular2/src/reflection/reflection", "angular2/src/change_detection/change_detection", "angular2/src/core/exception_handler", "angular2/src/render/dom/compiler/view_loader", "angular2/src/render/dom/compiler/style_url_resolver", "angular2/src/render/dom/compiler/style_inliner", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/directive_resolver", "angular2/src/facade/collection", "angular2/src/facade/async", "angular2/src/core/zone/ng_zone", "angular2/src/core/life_cycle/life_cycle", "angular2/src/render/xhr", "angular2/src/render/xhr_impl", "angular2/src/render/dom/events/event_manager", "angular2/src/render/dom/events/key_events", "angular2/src/render/dom/events/hammer_gestures", "angular2/src/core/compiler/component_url_mapper", "angular2/src/services/url_resolver", "angular2/src/services/app_root_url", "angular2/src/services/anchor_based_app_root_url", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/testability/testability", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_listener", "angular2/src/core/compiler/proto_view_factory", "angular2/src/render/api", "angular2/src/render/render", "angular2/src/render/dom/view/shared_styles_host", "angular2/src/core/compiler/view_ref", "angular2/src/core/application_tokens"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/application_common"; + var Injector, + bind, + isBlank, + isPresent, + assertionsEnabled, + isDart, + BrowserDomAdapter, + DOM, + Compiler, + CompilerCache, + Reflector, + reflector, + Parser, + Lexer, + ChangeDetection, + DynamicChangeDetection, + JitChangeDetection, + PreGeneratedChangeDetection, + Pipes, + defaultPipes, + ExceptionHandler, + ViewLoader, + StyleUrlResolver, + StyleInliner, + ViewResolver, + DirectiveResolver, + ListWrapper, + PromiseWrapper, + NgZone, + LifeCycle, + XHR, + XHRImpl, + EventManager, + DomEventsPlugin, + KeyEventsPlugin, + HammerGesturesPlugin, + ComponentUrlMapper, + UrlResolver, + AppRootUrl, + AnchorBasedAppRootUrl, + DynamicComponentLoader, + TestabilityRegistry, + Testability, + AppViewPool, + APP_VIEW_POOL_CAPACITY, + AppViewManager, + AppViewManagerUtils, + AppViewListener, + ProtoViewFactory, + Renderer, + RenderCompiler, + DomRenderer, + DOCUMENT_TOKEN, + DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES, + DefaultDomCompiler, + APP_ID_RANDOM_BINDING, + SharedStylesHost, + DomSharedStylesHost, + internalView, + appComponentRefPromiseToken, + appComponentTypeToken, + _rootInjector, + _rootBindings, + ApplicationRef; + function _injectorBindings(appComponentType) { + var bestChangeDetection = DynamicChangeDetection; + if (PreGeneratedChangeDetection.isSupported()) { + bestChangeDetection = PreGeneratedChangeDetection; + } else if (JitChangeDetection.isSupported()) { + bestChangeDetection = JitChangeDetection; + } + return [bind(DOCUMENT_TOKEN).toValue(DOM.defaultDoc()), bind(DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES).toValue(false), bind(appComponentTypeToken).toValue(appComponentType), bind(appComponentRefPromiseToken).toFactory((function(dynamicComponentLoader, injector, testability, registry) { + return dynamicComponentLoader.loadAsRoot(appComponentType, null, injector).then((function(componentRef) { + registry.registerApplication(componentRef.location.nativeElement, testability); + return componentRef; + })); + }), [DynamicComponentLoader, Injector, Testability, TestabilityRegistry]), bind(appComponentType).toFactory((function(p) { + return p.then((function(ref) { + return ref.instance; + })); + }), [appComponentRefPromiseToken]), bind(LifeCycle).toFactory((function(exceptionHandler) { + return new LifeCycle(null, assertionsEnabled()); + }), [ExceptionHandler]), bind(EventManager).toFactory((function(ngZone) { + var plugins = [new HammerGesturesPlugin(), new KeyEventsPlugin(), new DomEventsPlugin()]; + return new EventManager(plugins, ngZone); + }), [NgZone]), DomRenderer, bind(Renderer).toAlias(DomRenderer), APP_ID_RANDOM_BINDING, DefaultDomCompiler, bind(RenderCompiler).toAlias(DefaultDomCompiler), DomSharedStylesHost, bind(SharedStylesHost).toAlias(DomSharedStylesHost), ProtoViewFactory, AppViewPool, bind(APP_VIEW_POOL_CAPACITY).toValue(10000), AppViewManager, AppViewManagerUtils, AppViewListener, Compiler, CompilerCache, ViewResolver, bind(Pipes).toValue(defaultPipes), bind(ChangeDetection).toClass(bestChangeDetection), ViewLoader, DirectiveResolver, Parser, Lexer, bind(ExceptionHandler).toFactory((function() { + return new ExceptionHandler(DOM, isDart ? false : true); + }), []), bind(XHR).toValue(new XHRImpl()), ComponentUrlMapper, UrlResolver, StyleUrlResolver, StyleInliner, DynamicComponentLoader, Testability, AnchorBasedAppRootUrl, bind(AppRootUrl).toAlias(AnchorBasedAppRootUrl)]; + } + function createNgZone(handler) { + var bootstrapErrorReporter = (function(exception, stackTrace) { + return handler.call(exception, stackTrace); + }); + var zone = new NgZone({enableLongStackTrace: assertionsEnabled()}); + zone.overrideOnErrorHandler(bootstrapErrorReporter); + return zone; + } + function commonBootstrap(appComponentType) { + var componentInjectableBindings = arguments[1] !== (void 0) ? arguments[1] : null; + BrowserDomAdapter.makeCurrent(); + var bootstrapProcess = PromiseWrapper.completer(); + var zone = createNgZone(new ExceptionHandler(DOM, isDart ? false : true)); + zone.run((function() { + var appInjector = _createAppInjector(appComponentType, componentInjectableBindings, zone); + var exceptionHandler = appInjector.get(ExceptionHandler); + zone.overrideOnErrorHandler((function(e, s) { + return exceptionHandler.call(e, s); + })); + try { + var compRefToken = appInjector.get(appComponentRefPromiseToken); + var tick = (function(componentRef) { + var appChangeDetector = internalView(componentRef.hostView).changeDetector; + var lc = appInjector.get(LifeCycle); + lc.registerWith(zone, appChangeDetector); + lc.tick(); + bootstrapProcess.resolve(new ApplicationRef(componentRef, appComponentType, appInjector)); + }); + var tickResult = PromiseWrapper.then(compRefToken, tick); + PromiseWrapper.then(tickResult, (function(_) {})); + PromiseWrapper.then(tickResult, null, (function(err, stackTrace) { + bootstrapProcess.reject(err, stackTrace); + })); + } catch (e) { + bootstrapProcess.reject(e, e.stack); + } + })); + return bootstrapProcess.promise; + } + function _createAppInjector(appComponentType, bindings, zone) { + if (isBlank(_rootInjector)) + _rootInjector = Injector.resolveAndCreate(_rootBindings); + var mergedBindings = isPresent(bindings) ? ListWrapper.concat(_injectorBindings(appComponentType), bindings) : _injectorBindings(appComponentType); + mergedBindings.push(bind(NgZone).toValue(zone)); + return _rootInjector.resolveAndCreateChild(mergedBindings); + } + $__export("createNgZone", createNgZone); + $__export("commonBootstrap", commonBootstrap); + return { + setters: [function($__m) { + Injector = $__m.Injector; + bind = $__m.bind; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + assertionsEnabled = $__m.assertionsEnabled; + isDart = $__m.isDart; + }, function($__m) { + BrowserDomAdapter = $__m.BrowserDomAdapter; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + Compiler = $__m.Compiler; + CompilerCache = $__m.CompilerCache; + }, function($__m) { + Reflector = $__m.Reflector; + reflector = $__m.reflector; + }, function($__m) { + Parser = $__m.Parser; + Lexer = $__m.Lexer; + ChangeDetection = $__m.ChangeDetection; + DynamicChangeDetection = $__m.DynamicChangeDetection; + JitChangeDetection = $__m.JitChangeDetection; + PreGeneratedChangeDetection = $__m.PreGeneratedChangeDetection; + Pipes = $__m.Pipes; + defaultPipes = $__m.defaultPipes; + }, function($__m) { + ExceptionHandler = $__m.ExceptionHandler; + }, function($__m) { + ViewLoader = $__m.ViewLoader; + }, function($__m) { + StyleUrlResolver = $__m.StyleUrlResolver; + }, function($__m) { + StyleInliner = $__m.StyleInliner; + }, function($__m) { + ViewResolver = $__m.ViewResolver; + }, function($__m) { + DirectiveResolver = $__m.DirectiveResolver; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }, function($__m) { + NgZone = $__m.NgZone; + }, function($__m) { + LifeCycle = $__m.LifeCycle; + }, function($__m) { + XHR = $__m.XHR; + }, function($__m) { + XHRImpl = $__m.XHRImpl; + }, function($__m) { + EventManager = $__m.EventManager; + DomEventsPlugin = $__m.DomEventsPlugin; + }, function($__m) { + KeyEventsPlugin = $__m.KeyEventsPlugin; + }, function($__m) { + HammerGesturesPlugin = $__m.HammerGesturesPlugin; + }, function($__m) { + ComponentUrlMapper = $__m.ComponentUrlMapper; + }, function($__m) { + UrlResolver = $__m.UrlResolver; + }, function($__m) { + AppRootUrl = $__m.AppRootUrl; + }, function($__m) { + AnchorBasedAppRootUrl = $__m.AnchorBasedAppRootUrl; + }, function($__m) { + DynamicComponentLoader = $__m.DynamicComponentLoader; + }, function($__m) { + TestabilityRegistry = $__m.TestabilityRegistry; + Testability = $__m.Testability; + }, function($__m) { + AppViewPool = $__m.AppViewPool; + APP_VIEW_POOL_CAPACITY = $__m.APP_VIEW_POOL_CAPACITY; + }, function($__m) { + AppViewManager = $__m.AppViewManager; + }, function($__m) { + AppViewManagerUtils = $__m.AppViewManagerUtils; + }, function($__m) { + AppViewListener = $__m.AppViewListener; + }, function($__m) { + ProtoViewFactory = $__m.ProtoViewFactory; + }, function($__m) { + Renderer = $__m.Renderer; + RenderCompiler = $__m.RenderCompiler; + }, function($__m) { + DomRenderer = $__m.DomRenderer; + DOCUMENT_TOKEN = $__m.DOCUMENT_TOKEN; + DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES = $__m.DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES; + DefaultDomCompiler = $__m.DefaultDomCompiler; + APP_ID_RANDOM_BINDING = $__m.APP_ID_RANDOM_BINDING; + }, function($__m) { + SharedStylesHost = $__m.SharedStylesHost; + DomSharedStylesHost = $__m.DomSharedStylesHost; + }, function($__m) { + internalView = $__m.internalView; + }, function($__m) { + appComponentRefPromiseToken = $__m.appComponentRefPromiseToken; + appComponentTypeToken = $__m.appComponentTypeToken; + }], + execute: function() { + _rootBindings = [bind(Reflector).toValue(reflector), TestabilityRegistry]; + ApplicationRef = (function() { + function ApplicationRef(hostComponent, hostComponentType, injector) { + this._hostComponent = hostComponent; + this._injector = injector; + this._hostComponentType = hostComponentType; + } + return ($traceurRuntime.createClass)(ApplicationRef, { + get hostComponentType() { + return this._hostComponentType; + }, + get hostComponent() { + return this._hostComponent.instance; + }, + dispose: function() { + this._hostComponent.dispose(); + }, + get injector() { + return this._injector; + } + }, {}); + }()); + $__export("ApplicationRef", ApplicationRef); + } + }; +}); + +System.register("angular2/angular2", ["angular2/src/core/application_common", "angular2/annotations", "angular2/change_detection", "angular2/core", "angular2/di", "angular2/directives", "angular2/http", "angular2/forms", "angular2/render"], function($__export) { + "use strict"; + var __moduleName = "angular2/angular2"; + var $__exportNames = {undefined: true}; + var $__exportNames = {undefined: true}; + var $__exportNames = {undefined: true}; + var $__exportNames = {undefined: true}; + var $__exportNames = {undefined: true}; + var $__exportNames = {undefined: true}; + var $__exportNames = {undefined: true}; + var $__exportNames = {undefined: true}; + return { + setters: [function($__m) { + $__export("bootstrap", $__m.commonBootstrap); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }], + execute: function() {} + }; +}); + +//# sourceMappingURLDisabled=angular2.dev.js.map +System.config({"paths":{"*":"*.js","angular2/*":"angular2/*"}}); diff --git a/2.0.0-alpha.33/angular2.js b/2.0.0-alpha.33/angular2.js new file mode 100644 index 0000000000..82901c00d5 --- /dev/null +++ b/2.0.0-alpha.33/angular2.js @@ -0,0 +1,30476 @@ +(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 -1; + +// TODO(vicb): remove '!isFirefox' when the bug gets fixed: +// https://bugzilla.mozilla.org/show_bug.cgi?id=1162013 +if (hasNativePromise && !isFirefox) { + // When available use a native Promise to schedule microtasks. + // When not available, es6-promise fallback will be used + var resolvedPromise = Promise.resolve(); + es6Promise._setScheduler(function(fn) { + resolvedPromise.then(fn); + }); +} + + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"es6-promise":15}],4:[function(require,module,exports){ +(function (global){ +'use strict'; + +var fnPatch = require('./functions'); +var promisePatch = require('./promise'); +var mutationObserverPatch = require('./mutation-observer'); +var definePropertyPatch = require('./define-property'); +var registerElementPatch = require('./register-element'); +var webSocketPatch = require('./websocket'); +var eventTargetPatch = require('./event-target'); +var propertyDescriptorPatch = require('./property-descriptor'); +var geolocationPatch = require('./geolocation'); + +function apply() { + fnPatch.patchSetClearFunction(global, [ + 'timeout', + 'interval', + 'immediate' + ]); + + fnPatch.patchSetFunction(global, [ + 'requestAnimationFrame', + 'mozRequestAnimationFrame', + 'webkitRequestAnimationFrame' + ]); + + fnPatch.patchFunction(global, [ + 'alert', + 'prompt' + ]); + + eventTargetPatch.apply(); + + propertyDescriptorPatch.apply(); + + promisePatch.apply(); + + mutationObserverPatch.patchClass('MutationObserver'); + mutationObserverPatch.patchClass('WebKitMutationObserver'); + + definePropertyPatch.apply(); + + registerElementPatch.apply(); + + geolocationPatch.apply(); +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./define-property":5,"./event-target":6,"./functions":7,"./geolocation":8,"./mutation-observer":9,"./promise":10,"./property-descriptor":11,"./register-element":12,"./websocket":13}],5:[function(require,module,exports){ +'use strict'; + +// might need similar for object.freeze +// i regret nothing + +var _defineProperty = Object.defineProperty; +var _getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; +var _create = Object.create; + +function apply() { + Object.defineProperty = function (obj, prop, desc) { + if (isUnconfigurable(obj, prop)) { + throw new TypeError('Cannot assign to read only property \'' + prop + '\' of ' + obj); + } + if (prop !== 'prototype') { + desc = rewriteDescriptor(obj, prop, desc); + } + return _defineProperty(obj, prop, desc); + }; + + Object.defineProperties = function (obj, props) { + Object.keys(props).forEach(function (prop) { + Object.defineProperty(obj, prop, props[prop]); + }); + return obj; + }; + + Object.create = function (obj, proto) { + if (typeof proto === 'object') { + Object.keys(proto).forEach(function (prop) { + proto[prop] = rewriteDescriptor(obj, prop, proto[prop]); + }); + } + return _create(obj, proto); + }; + + Object.getOwnPropertyDescriptor = function (obj, prop) { + var desc = _getOwnPropertyDescriptor(obj, prop); + if (isUnconfigurable(obj, prop)) { + desc.configurable = false; + } + return desc; + }; +}; + +function _redefineProperty(obj, prop, desc) { + desc = rewriteDescriptor(obj, prop, desc); + return _defineProperty(obj, prop, desc); +}; + +function isUnconfigurable (obj, prop) { + return obj && obj.__unconfigurables && obj.__unconfigurables[prop]; +} + +function rewriteDescriptor (obj, prop, desc) { + desc.configurable = true; + if (!desc.configurable) { + if (!obj.__unconfigurables) { + _defineProperty(obj, '__unconfigurables', { writable: true, value: {} }); + } + obj.__unconfigurables[prop] = true; + } + return desc; +} + +module.exports = { + apply: apply, + _redefineProperty: _redefineProperty +}; + + + +},{}],6:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function apply() { + // patched properties depend on addEventListener, so this needs to come first + if (global.EventTarget) { + utils.patchEventTargetMethods(global.EventTarget.prototype); + + // Note: EventTarget is not available in all browsers, + // if it's not available, we instead patch the APIs in the IDL that inherit from EventTarget + } else { + var apis = [ 'ApplicationCache', + 'EventSource', + 'FileReader', + 'InputMethodContext', + 'MediaController', + 'MessagePort', + 'Node', + 'Performance', + 'SVGElementInstance', + 'SharedWorker', + 'TextTrack', + 'TextTrackCue', + 'TextTrackList', + 'WebKitNamedFlow', + 'Window', + 'Worker', + 'WorkerGlobalScope', + 'XMLHttpRequest', + 'XMLHttpRequestEventTarget', + 'XMLHttpRequestUpload' + ]; + + apis.forEach(function(thing) { + global[thing] && utils.patchEventTargetMethods(global[thing].prototype); + }); + } +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],7:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function patchSetClearFunction(obj, fnNames) { + fnNames.map(function (name) { + return name[0].toUpperCase() + name.substr(1); + }).forEach(function (name) { + var setName = 'set' + name; + var delegate = obj[setName]; + + if (delegate) { + var clearName = 'clear' + name; + var ids = {}; + + var bindArgs = setName === 'setInterval' ? utils.bindArguments : utils.bindArgumentsOnce; + + global.zone[setName] = function (fn) { + var id, fnRef = fn; + arguments[0] = function () { + delete ids[id]; + return fnRef.apply(this, arguments); + }; + var args = bindArgs(arguments); + id = delegate.apply(obj, args); + ids[id] = true; + return id; + }; + + obj[setName] = function () { + return global.zone[setName].apply(this, arguments); + }; + + var clearDelegate = obj[clearName]; + + global.zone[clearName] = function (id) { + if (ids[id]) { + delete ids[id]; + global.zone.dequeueTask(); + } + return clearDelegate.apply(this, arguments); + }; + + obj[clearName] = function () { + return global.zone[clearName].apply(this, arguments); + }; + } + }); +}; + +function patchSetFunction(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + + if (delegate) { + global.zone[name] = function (fn) { + var fnRef = fn; + arguments[0] = function () { + return fnRef.apply(this, arguments); + }; + var args = utils.bindArgumentsOnce(arguments); + return delegate.apply(obj, args); + }; + + obj[name] = function () { + return zone[name].apply(this, arguments); + }; + } + }); +}; + +function patchFunction(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + global.zone[name] = function () { + return delegate.apply(obj, arguments); + }; + + obj[name] = function () { + return global.zone[name].apply(this, arguments); + }; + }); +}; + + +module.exports = { + patchSetClearFunction: patchSetClearFunction, + patchSetFunction: patchSetFunction, + patchFunction: patchFunction +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],8:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function apply() { + if (global.navigator && global.navigator.geolocation) { + utils.patchPrototype(global.navigator.geolocation, [ + 'getCurrentPosition', + 'watchPosition' + ]); + } +} + +module.exports = { + apply: apply +} + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],9:[function(require,module,exports){ +(function (global){ +'use strict'; + +// wrap some native API on `window` +function patchClass(className) { + var OriginalClass = global[className]; + if (!OriginalClass) return; + + global[className] = function (fn) { + this._o = new OriginalClass(global.zone.bind(fn, true)); + // Remember where the class was instantiate to execute the enqueueTask and dequeueTask hooks + this._creationZone = global.zone; + }; + + var instance = new OriginalClass(function () {}); + + global[className].prototype.disconnect = function () { + var result = this._o.disconnect.apply(this._o, arguments); + if (this._active) { + this._creationZone.dequeueTask(); + this._active = false; + } + return result; + }; + + global[className].prototype.observe = function () { + if (!this._active) { + this._creationZone.enqueueTask(); + this._active = true; + } + return this._o.observe.apply(this._o, arguments); + }; + + var prop; + for (prop in instance) { + (function (prop) { + if (typeof global[className].prototype !== undefined) { + return; + } + if (typeof instance[prop] === 'function') { + global[className].prototype[prop] = function () { + return this._o[prop].apply(this._o, arguments); + }; + } else { + Object.defineProperty(global[className].prototype, prop, { + set: function (fn) { + if (typeof fn === 'function') { + this._o[prop] = global.zone.bind(fn); + } else { + this._o[prop] = fn; + } + }, + get: function () { + return this._o[prop]; + } + }); + } + }(prop)); + } +}; + +module.exports = { + patchClass: patchClass +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],10:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +/* + * Patches a function that returns a Promise-like instance. + * + * This function must be used when either: + * - Native Promises are not available, + * - The function returns a Promise-like object. + * + * This is required because zones rely on a Promise monkey patch that could not be applied when + * Promise is not natively available or when the returned object is not an instance of Promise. + * + * Note that calling `bindPromiseFn` on a function that returns a native Promise will also work + * with minimal overhead. + * + * ``` + * var boundFunction = bindPromiseFn(FunctionReturningAPromise); + * + * boundFunction.then(successHandler, errorHandler); + * ``` + */ +var bindPromiseFn; + +if (global.Promise) { + bindPromiseFn = function (delegate) { + return function() { + var delegatePromise = delegate.apply(this, arguments); + + // if the delegate returned an instance of Promise, forward it. + if (delegatePromise instanceof Promise) { + return delegatePromise; + } + + // Otherwise wrap the Promise-like in a global Promise + return new Promise(function(resolve, reject) { + delegatePromise.then(resolve, reject); + }); + }; + }; +} else { + bindPromiseFn = function (delegate) { + return function () { + return _patchThenable(delegate.apply(this, arguments)); + }; + }; +} + + +function _patchPromiseFnsOnObject(objectPath, fnNames) { + var obj = global; + + var exists = objectPath.every(function (segment) { + obj = obj[segment]; + return obj; + }); + + if (!exists) { + return; + } + + fnNames.forEach(function (name) { + var fn = obj[name]; + if (fn) { + obj[name] = bindPromiseFn(fn); + } + }); +} + +function _patchThenable(thenable) { + var then = thenable.then; + thenable.then = function () { + var args = utils.bindArguments(arguments); + var nextThenable = then.apply(thenable, args); + return _patchThenable(nextThenable); + }; + + var ocatch = thenable.catch; + thenable.catch = function () { + var args = utils.bindArguments(arguments); + var nextThenable = ocatch.apply(thenable, args); + return _patchThenable(nextThenable); + }; + + return thenable; +} + + +function apply() { + // Patch .then() and .catch() on native Promises to execute callbacks in the zone where + // those functions are called. + if (global.Promise) { + utils.patchPrototype(Promise.prototype, [ + 'then', + 'catch' + ]); + + // Patch browser APIs that return a Promise + var patchFns = [ + // fetch + [[], ['fetch']], + [['Response', 'prototype'], ['arrayBuffer', 'blob', 'json', 'text']] + ]; + + patchFns.forEach(function(objPathAndFns) { + _patchPromiseFnsOnObject(objPathAndFns[0], objPathAndFns[1]); + }); + } +} + +module.exports = { + apply: apply, + bindPromiseFn: bindPromiseFn +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],11:[function(require,module,exports){ +(function (global){ +'use strict'; + +var webSocketPatch = require('./websocket'); +var utils = require('../utils'); + +var eventNames = 'copy cut paste abort blur focus canplay canplaythrough change click contextmenu dblclick drag dragend dragenter dragleave dragover dragstart drop durationchange emptied ended input invalid keydown keypress keyup load loadeddata loadedmetadata loadstart message mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup pause play playing progress ratechange reset scroll seeked seeking select show stalled submit suspend timeupdate volumechange waiting mozfullscreenchange mozfullscreenerror mozpointerlockchange mozpointerlockerror error webglcontextrestored webglcontextlost webglcontextcreationerror'.split(' '); + +function apply() { + if (canPatchViaPropertyDescriptor()) { + // for browsers that we can patch the descriptor: Chrome & Firefox + var onEventNames = eventNames.map(function (property) { + return 'on' + property; + }); + utils.patchProperties(HTMLElement.prototype, onEventNames); + utils.patchProperties(XMLHttpRequest.prototype); + if (typeof WebSocket !== 'undefined') { + utils.patchProperties(WebSocket.prototype); + } + } else { + // Safari + patchViaCapturingAllTheEvents(); + utils.patchClass('XMLHttpRequest'); + webSocketPatch.apply(); + } +} + +function canPatchViaPropertyDescriptor() { + if (!Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'onclick') && typeof Element !== 'undefined') { + // WebKit https://bugs.webkit.org/show_bug.cgi?id=134364 + // IDL interface attributes are not configurable + var desc = Object.getOwnPropertyDescriptor(Element.prototype, 'onclick'); + if (desc && !desc.configurable) return false; + } + + Object.defineProperty(HTMLElement.prototype, 'onclick', { + get: function () { + return true; + } + }); + var elt = document.createElement('div'); + var result = !!elt.onclick; + Object.defineProperty(HTMLElement.prototype, 'onclick', {}); + return result; +}; + +// Whenever any event fires, we check the event target and all parents +// for `onwhatever` properties and replace them with zone-bound functions +// - Chrome (for now) +function patchViaCapturingAllTheEvents() { + eventNames.forEach(function (property) { + var onproperty = 'on' + property; + document.addEventListener(property, function (event) { + var elt = event.target, bound; + while (elt) { + if (elt[onproperty] && !elt[onproperty]._unbound) { + bound = global.zone.bind(elt[onproperty]); + bound._unbound = elt[onproperty]; + elt[onproperty] = bound; + } + elt = elt.parentElement; + } + }, true); + }); +}; + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14,"./websocket":13}],12:[function(require,module,exports){ +(function (global){ +'use strict'; + +var _redefineProperty = require('./define-property')._redefineProperty; + +function apply() { + if (!('registerElement' in global.document)) { + return; + } + + var _registerElement = document.registerElement; + var callbacks = [ + 'createdCallback', + 'attachedCallback', + 'detachedCallback', + 'attributeChangedCallback' + ]; + + document.registerElement = function (name, opts) { + if (opts && opts.prototype) { + callbacks.forEach(function (callback) { + if (opts.prototype.hasOwnProperty(callback)) { + var descriptor = Object.getOwnPropertyDescriptor(opts.prototype, callback); + if (descriptor.value) { + descriptor.value = global.zone.bind(descriptor.value); + _redefineProperty(opts.prototype, callback, descriptor); + } else { + opts.prototype[callback] = global.zone.bind(opts.prototype[callback]); + } + } else if (opts.prototype[callback]) { + opts.prototype[callback] = global.zone.bind(opts.prototype[callback]); + } + }); + } + + return _registerElement.apply(document, [name, opts]); + }; +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./define-property":5}],13:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +// we have to patch the instance since the proto is non-configurable +function apply() { + var WS = global.WebSocket; + utils.patchEventTargetMethods(WS.prototype); + global.WebSocket = function(a, b) { + var socket = arguments.length > 1 ? new WS(a, b) : new WS(a); + var proxySocket; + + // Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance + var onmessageDesc = Object.getOwnPropertyDescriptor(socket, 'onmessage'); + if (onmessageDesc && onmessageDesc.configurable === false) { + proxySocket = Object.create(socket); + ['addEventListener', 'removeEventListener', 'send', 'close'].forEach(function(propName) { + proxySocket[propName] = function() { + return socket[propName].apply(socket, arguments); + }; + }); + } else { + // we can patch the real socket + proxySocket = socket; + } + + utils.patchProperties(proxySocket, ['onclose', 'onerror', 'onmessage', 'onopen']); + + return proxySocket; + }; +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],14:[function(require,module,exports){ +(function (global){ +'use strict'; + +function bindArguments(args) { + for (var i = args.length - 1; i >= 0; i--) { + if (typeof args[i] === 'function') { + args[i] = global.zone.bind(args[i]); + } + } + return args; +}; + +function bindArgumentsOnce(args) { + for (var i = args.length - 1; i >= 0; i--) { + if (typeof args[i] === 'function') { + args[i] = global.zone.bindOnce(args[i]); + } + } + return args; +}; + +function patchPrototype(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + if (delegate) { + obj[name] = function () { + return delegate.apply(this, bindArguments(arguments)); + }; + } + }); +}; + +function patchProperty(obj, prop) { + var desc = Object.getOwnPropertyDescriptor(obj, prop) || { + enumerable: true, + configurable: true + }; + + // A property descriptor cannot have getter/setter and be writable + // deleting the writable and value properties avoids this error: + // + // TypeError: property descriptors must not specify a value or be writable when a + // getter or setter has been specified + delete desc.writable; + delete desc.value; + + // substr(2) cuz 'onclick' -> 'click', etc + var eventName = prop.substr(2); + var _prop = '_' + prop; + + desc.set = function (fn) { + if (this[_prop]) { + this.removeEventListener(eventName, this[_prop]); + } + + if (typeof fn === 'function') { + this[_prop] = fn; + this.addEventListener(eventName, fn, false); + } else { + this[_prop] = null; + } + }; + + desc.get = function () { + return this[_prop]; + }; + + Object.defineProperty(obj, prop, desc); +}; + +function patchProperties(obj, properties) { + + (properties || (function () { + var props = []; + for (var prop in obj) { + props.push(prop); + } + return props; + }()). + filter(function (propertyName) { + return propertyName.substr(0,2) === 'on'; + })). + forEach(function (eventName) { + patchProperty(obj, eventName); + }); +}; + +function patchEventTargetMethods(obj) { + var addDelegate = obj.addEventListener; + obj.addEventListener = function (eventName, fn) { + fn._bound = fn._bound || {}; + arguments[1] = fn._bound[eventName] = zone.bind(fn); + return addDelegate.apply(this, arguments); + }; + + var removeDelegate = obj.removeEventListener; + obj.removeEventListener = function (eventName, fn) { + if(arguments[1]._bound && arguments[1]._bound[eventName]) { + var _bound = arguments[1]._bound; + arguments[1] = _bound[eventName]; + delete _bound[eventName]; + } + var result = removeDelegate.apply(this, arguments); + global.zone.dequeueTask(fn); + return result; + }; +}; + +// wrap some native API on `window` +function patchClass(className) { + var OriginalClass = global[className]; + if (!OriginalClass) return; + + global[className] = function () { + var a = bindArguments(arguments); + switch (a.length) { + case 0: this._o = new OriginalClass(); break; + case 1: this._o = new OriginalClass(a[0]); break; + case 2: this._o = new OriginalClass(a[0], a[1]); break; + case 3: this._o = new OriginalClass(a[0], a[1], a[2]); break; + case 4: this._o = new OriginalClass(a[0], a[1], a[2], a[3]); break; + default: throw new Error('what are you even doing?'); + } + }; + + var instance = new OriginalClass(); + + var prop; + for (prop in instance) { + (function (prop) { + if (typeof instance[prop] === 'function') { + global[className].prototype[prop] = function () { + return this._o[prop].apply(this._o, arguments); + }; + } else { + Object.defineProperty(global[className].prototype, prop, { + set: function (fn) { + if (typeof fn === 'function') { + this._o[prop] = global.zone.bind(fn); + } else { + this._o[prop] = fn; + } + }, + get: function () { + return this._o[prop]; + } + }); + } + }(prop)); + } + + for (prop in OriginalClass) { + if (prop !== 'prototype' && OriginalClass.hasOwnProperty(prop)) { + global[className][prop] = OriginalClass[prop]; + } + } +}; + +module.exports = { + bindArguments: bindArguments, + bindArgumentsOnce: bindArgumentsOnce, + patchPrototype: patchPrototype, + patchProperty: patchProperty, + patchProperties: patchProperties, + patchEventTargetMethods: patchEventTargetMethods, + patchClass: patchClass +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],15:[function(require,module,exports){ +(function (process,global){ +/*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE + * @version 2.3.0 + */ + +(function() { + "use strict"; + function lib$es6$promise$utils$$objectOrFunction(x) { + return typeof x === 'function' || (typeof x === 'object' && x !== null); + } + + function lib$es6$promise$utils$$isFunction(x) { + return typeof x === 'function'; + } + + function lib$es6$promise$utils$$isMaybeThenable(x) { + return typeof x === 'object' && x !== null; + } + + var lib$es6$promise$utils$$_isArray; + if (!Array.isArray) { + lib$es6$promise$utils$$_isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; + } else { + lib$es6$promise$utils$$_isArray = Array.isArray; + } + + var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray; + var lib$es6$promise$asap$$len = 0; + var lib$es6$promise$asap$$toString = {}.toString; + var lib$es6$promise$asap$$vertxNext; + var lib$es6$promise$asap$$customSchedulerFn; + + var lib$es6$promise$asap$$asap = function asap(callback, arg) { + lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback; + lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg; + lib$es6$promise$asap$$len += 2; + if (lib$es6$promise$asap$$len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + if (lib$es6$promise$asap$$customSchedulerFn) { + lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush); + } else { + lib$es6$promise$asap$$scheduleFlush(); + } + } + } + + function lib$es6$promise$asap$$setScheduler(scheduleFn) { + lib$es6$promise$asap$$customSchedulerFn = scheduleFn; + } + + function lib$es6$promise$asap$$setAsap(asapFn) { + lib$es6$promise$asap$$asap = asapFn; + } + + var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined; + var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {}; + var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver; + var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + + // test for web worker but not in IE10 + var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' && + typeof importScripts !== 'undefined' && + typeof MessageChannel !== 'undefined'; + + // node + function lib$es6$promise$asap$$useNextTick() { + var nextTick = process.nextTick; + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // setImmediate should be used instead instead + var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/); + if (Array.isArray(version) && version[1] === '0' && version[2] === '10') { + nextTick = setImmediate; + } + return function() { + nextTick(lib$es6$promise$asap$$flush); + }; + } + + // vertx + function lib$es6$promise$asap$$useVertxTimer() { + return function() { + lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush); + }; + } + + function lib$es6$promise$asap$$useMutationObserver() { + var iterations = 0; + var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return function() { + node.data = (iterations = ++iterations % 2); + }; + } + + // web worker + function lib$es6$promise$asap$$useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = lib$es6$promise$asap$$flush; + return function () { + channel.port2.postMessage(0); + }; + } + + function lib$es6$promise$asap$$useSetTimeout() { + return function() { + setTimeout(lib$es6$promise$asap$$flush, 1); + }; + } + + var lib$es6$promise$asap$$queue = new Array(1000); + function lib$es6$promise$asap$$flush() { + for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) { + var callback = lib$es6$promise$asap$$queue[i]; + var arg = lib$es6$promise$asap$$queue[i+1]; + + callback(arg); + + lib$es6$promise$asap$$queue[i] = undefined; + lib$es6$promise$asap$$queue[i+1] = undefined; + } + + lib$es6$promise$asap$$len = 0; + } + + function lib$es6$promise$asap$$attemptVertex() { + try { + var r = require; + var vertx = r('vertx'); + lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext; + return lib$es6$promise$asap$$useVertxTimer(); + } catch(e) { + return lib$es6$promise$asap$$useSetTimeout(); + } + } + + var lib$es6$promise$asap$$scheduleFlush; + // Decide what async method to use to triggering processing of queued callbacks: + if (lib$es6$promise$asap$$isNode) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick(); + } else if (lib$es6$promise$asap$$BrowserMutationObserver) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver(); + } else if (lib$es6$promise$asap$$isWorker) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel(); + } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertex(); + } else { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout(); + } + + function lib$es6$promise$$internal$$noop() {} + + var lib$es6$promise$$internal$$PENDING = void 0; + var lib$es6$promise$$internal$$FULFILLED = 1; + var lib$es6$promise$$internal$$REJECTED = 2; + + var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject(); + + function lib$es6$promise$$internal$$selfFullfillment() { + return new TypeError("You cannot resolve a promise with itself"); + } + + function lib$es6$promise$$internal$$cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); + } + + function lib$es6$promise$$internal$$getThen(promise) { + try { + return promise.then; + } catch(error) { + lib$es6$promise$$internal$$GET_THEN_ERROR.error = error; + return lib$es6$promise$$internal$$GET_THEN_ERROR; + } + } + + function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) { + try { + then.call(value, fulfillmentHandler, rejectionHandler); + } catch(e) { + return e; + } + } + + function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) { + lib$es6$promise$asap$$asap(function(promise) { + var sealed = false; + var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) { + if (sealed) { return; } + sealed = true; + if (thenable !== value) { + lib$es6$promise$$internal$$resolve(promise, value); + } else { + lib$es6$promise$$internal$$fulfill(promise, value); + } + }, function(reason) { + if (sealed) { return; } + sealed = true; + + lib$es6$promise$$internal$$reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + lib$es6$promise$$internal$$reject(promise, error); + } + }, promise); + } + + function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) { + if (thenable._state === lib$es6$promise$$internal$$FULFILLED) { + lib$es6$promise$$internal$$fulfill(promise, thenable._result); + } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, thenable._result); + } else { + lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) { + lib$es6$promise$$internal$$resolve(promise, value); + }, function(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + }); + } + } + + function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) { + if (maybeThenable.constructor === promise.constructor) { + lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable); + } else { + var then = lib$es6$promise$$internal$$getThen(maybeThenable); + + if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error); + } else if (then === undefined) { + lib$es6$promise$$internal$$fulfill(promise, maybeThenable); + } else if (lib$es6$promise$utils$$isFunction(then)) { + lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then); + } else { + lib$es6$promise$$internal$$fulfill(promise, maybeThenable); + } + } + } + + function lib$es6$promise$$internal$$resolve(promise, value) { + if (promise === value) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment()); + } else if (lib$es6$promise$utils$$objectOrFunction(value)) { + lib$es6$promise$$internal$$handleMaybeThenable(promise, value); + } else { + lib$es6$promise$$internal$$fulfill(promise, value); + } + } + + function lib$es6$promise$$internal$$publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + + lib$es6$promise$$internal$$publish(promise); + } + + function lib$es6$promise$$internal$$fulfill(promise, value) { + if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } + + promise._result = value; + promise._state = lib$es6$promise$$internal$$FULFILLED; + + if (promise._subscribers.length !== 0) { + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise); + } + } + + function lib$es6$promise$$internal$$reject(promise, reason) { + if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } + promise._state = lib$es6$promise$$internal$$REJECTED; + promise._result = reason; + + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise); + } + + function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) { + var subscribers = parent._subscribers; + var length = subscribers.length; + + parent._onerror = null; + + subscribers[length] = child; + subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment; + subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection; + + if (length === 0 && parent._state) { + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent); + } + } + + function lib$es6$promise$$internal$$publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + + if (subscribers.length === 0) { return; } + + var child, callback, detail = promise._result; + + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + + promise._subscribers.length = 0; + } + + function lib$es6$promise$$internal$$ErrorObject() { + this.error = null; + } + + var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject(); + + function lib$es6$promise$$internal$$tryCatch(callback, detail) { + try { + return callback(detail); + } catch(e) { + lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e; + return lib$es6$promise$$internal$$TRY_CATCH_ERROR; + } + } + + function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) { + var hasCallback = lib$es6$promise$utils$$isFunction(callback), + value, error, succeeded, failed; + + if (hasCallback) { + value = lib$es6$promise$$internal$$tryCatch(callback, detail); + + if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) { + failed = true; + error = value.error; + value = null; + } else { + succeeded = true; + } + + if (promise === value) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn()); + return; + } + + } else { + value = detail; + succeeded = true; + } + + if (promise._state !== lib$es6$promise$$internal$$PENDING) { + // noop + } else if (hasCallback && succeeded) { + lib$es6$promise$$internal$$resolve(promise, value); + } else if (failed) { + lib$es6$promise$$internal$$reject(promise, error); + } else if (settled === lib$es6$promise$$internal$$FULFILLED) { + lib$es6$promise$$internal$$fulfill(promise, value); + } else if (settled === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } + } + + function lib$es6$promise$$internal$$initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value){ + lib$es6$promise$$internal$$resolve(promise, value); + }, function rejectPromise(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + }); + } catch(e) { + lib$es6$promise$$internal$$reject(promise, e); + } + } + + function lib$es6$promise$enumerator$$Enumerator(Constructor, input) { + var enumerator = this; + + enumerator._instanceConstructor = Constructor; + enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (enumerator._validateInput(input)) { + enumerator._input = input; + enumerator.length = input.length; + enumerator._remaining = input.length; + + enumerator._init(); + + if (enumerator.length === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } else { + enumerator.length = enumerator.length || 0; + enumerator._enumerate(); + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } + } + } else { + lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError()); + } + } + + lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) { + return lib$es6$promise$utils$$isArray(input); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() { + return new Error('Array Methods must be provided an Array'); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._init = function() { + this._result = new Array(this.length); + }; + + var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator; + + lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() { + var enumerator = this; + + var length = enumerator.length; + var promise = enumerator.promise; + var input = enumerator._input; + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + enumerator._eachEntry(input[i], i); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) { + var enumerator = this; + var c = enumerator._instanceConstructor; + + if (lib$es6$promise$utils$$isMaybeThenable(entry)) { + if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) { + entry._onerror = null; + enumerator._settledAt(entry._state, i, entry._result); + } else { + enumerator._willSettleAt(c.resolve(entry), i); + } + } else { + enumerator._remaining--; + enumerator._result[i] = entry; + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) { + var enumerator = this; + var promise = enumerator.promise; + + if (promise._state === lib$es6$promise$$internal$$PENDING) { + enumerator._remaining--; + + if (state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } else { + enumerator._result[i] = value; + } + } + + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(promise, enumerator._result); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) { + var enumerator = this; + + lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) { + enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value); + }, function(reason) { + enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason); + }); + }; + function lib$es6$promise$promise$all$$all(entries) { + return new lib$es6$promise$enumerator$$default(this, entries).promise; + } + var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all; + function lib$es6$promise$promise$race$$race(entries) { + /*jshint validthis:true */ + var Constructor = this; + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (!lib$es6$promise$utils$$isArray(entries)) { + lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.')); + return promise; + } + + var length = entries.length; + + function onFulfillment(value) { + lib$es6$promise$$internal$$resolve(promise, value); + } + + function onRejection(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + } + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); + } + + return promise; + } + var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race; + function lib$es6$promise$promise$resolve$$resolve(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$resolve(promise, object); + return promise; + } + var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve; + function lib$es6$promise$promise$reject$$reject(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$reject(promise, reason); + return promise; + } + var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject; + + var lib$es6$promise$promise$$counter = 0; + + function lib$es6$promise$promise$$needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); + } + + function lib$es6$promise$promise$$needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); + } + + var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise; + /** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + var promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + var xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {function} resolver + Useful for tooling. + @constructor + */ + function lib$es6$promise$promise$$Promise(resolver) { + this._id = lib$es6$promise$promise$$counter++; + this._state = undefined; + this._result = undefined; + this._subscribers = []; + + if (lib$es6$promise$$internal$$noop !== resolver) { + if (!lib$es6$promise$utils$$isFunction(resolver)) { + lib$es6$promise$promise$$needsResolver(); + } + + if (!(this instanceof lib$es6$promise$promise$$Promise)) { + lib$es6$promise$promise$$needsNew(); + } + + lib$es6$promise$$internal$$initializePromise(this, resolver); + } + } + + lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default; + lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default; + lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default; + lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default; + lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler; + lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap; + lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap; + + lib$es6$promise$promise$$Promise.prototype = { + constructor: lib$es6$promise$promise$$Promise, + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + + Chaining + -------- + + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + + Assimilation + ------------ + + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + + If the assimliated promise rejects, then the downstream promise will also reject. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + + Simple Example + -------------- + + Synchronous Example + + ```javascript + var result; + + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + + Promise Example; + + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + + Advanced Example + -------------- + + Synchronous Example + + ```javascript + var author, books; + + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + + function foundBooks(books) { + + } + + function failure(reason) { + + } + + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + + Promise Example; + + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + then: function(onFulfillment, onRejection) { + var parent = this; + var state = parent._state; + + if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) { + return this; + } + + var child = new this.constructor(lib$es6$promise$$internal$$noop); + var result = parent._result; + + if (state) { + var callback = arguments[state - 1]; + lib$es6$promise$asap$$asap(function(){ + lib$es6$promise$$internal$$invokeCallback(state, child, callback, result); + }); + } else { + lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection); + } + + return child; + }, + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + 'catch': function(onRejection) { + return this.then(null, onRejection); + } + }; + function lib$es6$promise$polyfill$$polyfill() { + var local; + + if (typeof global !== 'undefined') { + local = global; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + + var P = local.Promise; + + if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) { + return; + } + + local.Promise = lib$es6$promise$promise$$default; + } + var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill; + + var lib$es6$promise$umd$$ES6Promise = { + 'Promise': lib$es6$promise$promise$$default, + 'polyfill': lib$es6$promise$polyfill$$default + }; + + /* global define:true module:true window: true */ + if (typeof define === 'function' && define['amd']) { + define(function() { return lib$es6$promise$umd$$ES6Promise; }); + } else if (typeof module !== 'undefined' && module['exports']) { + module['exports'] = lib$es6$promise$umd$$ES6Promise; + } else if (typeof this !== 'undefined') { + this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise; + } + + lib$es6$promise$polyfill$$default(); +}).call(this); + + +}).call(this,{},typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}]},{},[1]); + +/*! ***************************************************************************** +Copyright (C) Microsoft. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + +See the License for the specific language governing permissions and +limitations under the License. +***************************************************************************** */ +"use strict"; +var Reflect; +(function (Reflect) { + // Load global or shim versions of Map, Set, and WeakMap + var functionPrototype = Object.getPrototypeOf(Function); + var _Map = typeof Map === "function" ? Map : CreateMapPolyfill(); + var _Set = typeof Set === "function" ? Set : CreateSetPolyfill(); + var _WeakMap = typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill(); + // [[Metadata]] internal slot + var __Metadata__ = new _WeakMap(); + /** + * Applies a set of decorators to a property of a target object. + * @param decorators An array of decorators. + * @param target The target object. + * @param targetKey (Optional) The property key to decorate. + * @param targetDescriptor (Optional) The property descriptor for the target key + * @remarks Decorators are applied in reverse order. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * C = Reflect.decorate(decoratorsArray, C); + * + * // property (on constructor) + * Reflect.decorate(decoratorsArray, C, "staticProperty"); + * + * // property (on prototype) + * Reflect.decorate(decoratorsArray, C.prototype, "property"); + * + * // method (on constructor) + * Object.defineProperty(C, "staticMethod", + * Reflect.decorate(decoratorsArray, C, "staticMethod", + * Object.getOwnPropertyDescriptor(C, "staticMethod"))); + * + * // method (on prototype) + * Object.defineProperty(C.prototype, "method", + * Reflect.decorate(decoratorsArray, C.prototype, "method", + * Object.getOwnPropertyDescriptor(C.prototype, "method"))); + * + */ + function decorate(decorators, target, targetKey, targetDescriptor) { + if (!IsUndefined(targetDescriptor)) { + if (!IsArray(decorators)) { + throw new TypeError(); + } + else if (!IsObject(target)) { + throw new TypeError(); + } + else if (IsUndefined(targetKey)) { + throw new TypeError(); + } + else if (!IsObject(targetDescriptor)) { + throw new TypeError(); + } + targetKey = ToPropertyKey(targetKey); + return DecoratePropertyWithDescriptor(decorators, target, targetKey, targetDescriptor); + } + else if (!IsUndefined(targetKey)) { + if (!IsArray(decorators)) { + throw new TypeError(); + } + else if (!IsObject(target)) { + throw new TypeError(); + } + targetKey = ToPropertyKey(targetKey); + return DecoratePropertyWithoutDescriptor(decorators, target, targetKey); + } + else { + if (!IsArray(decorators)) { + throw new TypeError(); + } + else if (!IsConstructor(target)) { + throw new TypeError(); + } + return DecorateConstructor(decorators, target); + } + } + Reflect.decorate = decorate; + /** + * A default metadata decorator factory that can be used on a class, class member, or parameter. + * @param metadataKey The key for the metadata entry. + * @param metadataValue The value for the metadata entry. + * @returns A decorator function. + * @remarks + * If `metadataKey` is already defined for the target and target key, the + * metadataValue for that key will be overwritten. + * @example + * + * // constructor + * @Reflect.metadata(key, value) + * class C { + * } + * + * // property (on constructor, TypeScript only) + * class C { + * @Reflect.metadata(key, value) + * static staticProperty; + * } + * + * // property (on prototype, TypeScript only) + * class C { + * @Reflect.metadata(key, value) + * property; + * } + * + * // method (on constructor) + * class C { + * @Reflect.metadata(key, value) + * static staticMethod() { } + * } + * + * // method (on prototype) + * class C { + * @Reflect.metadata(key, value) + * method() { } + * } + * + */ + function metadata(metadataKey, metadataValue) { + function decorator(target, targetKey) { + if (!IsUndefined(targetKey)) { + if (!IsObject(target)) { + throw new TypeError(); + } + targetKey = ToPropertyKey(targetKey); + OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey); + } + else { + if (!IsConstructor(target)) { + throw new TypeError(); + } + OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, undefined); + } + } + return decorator; + } + Reflect.metadata = metadata; + /** + * Define a unique metadata entry on the target. + * @param metadataKey A key used to store and retrieve metadata. + * @param metadataValue A value that contains attached metadata. + * @param target The target object on which to define metadata. + * @param targetKey (Optional) The property key for the target. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * Reflect.defineMetadata("custom:annotation", options, C); + * + * // property (on constructor) + * Reflect.defineMetadata("custom:annotation", options, C, "staticProperty"); + * + * // property (on prototype) + * Reflect.defineMetadata("custom:annotation", options, C.prototype, "property"); + * + * // method (on constructor) + * Reflect.defineMetadata("custom:annotation", options, C, "staticMethod"); + * + * // method (on prototype) + * Reflect.defineMetadata("custom:annotation", options, C.prototype, "method"); + * + * // decorator factory as metadata-producing annotation. + * function MyAnnotation(options): Decorator { + * return (target, key?) => Reflect.defineMetadata("custom:annotation", options, target, key); + * } + * + */ + function defineMetadata(metadataKey, metadataValue, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey); + } + Reflect.defineMetadata = defineMetadata; + /** + * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.hasMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasMetadata("custom:annotation", C.prototype, "method"); + * + */ + function hasMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryHasMetadata(metadataKey, target, targetKey); + } + Reflect.hasMetadata = hasMetadata; + /** + * Gets a value indicating whether the target object has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasOwnMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "method"); + * + */ + function hasOwnMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryHasOwnMetadata(metadataKey, target, targetKey); + } + Reflect.hasOwnMetadata = hasOwnMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object or its prototype chain. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.getMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadata("custom:annotation", C.prototype, "method"); + * + */ + function getMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryGetMetadata(metadataKey, target, targetKey); + } + Reflect.getMetadata = getMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "method"); + * + */ + function getOwnMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryGetOwnMetadata(metadataKey, target, targetKey); + } + Reflect.getOwnMetadata = getOwnMetadata; + /** + * Gets the metadata keys defined on the target object or its prototype chain. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadataKeys(C); + * + * // property (on constructor) + * result = Reflect.getMetadataKeys(C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadataKeys(C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadataKeys(C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadataKeys(C.prototype, "method"); + * + */ + function getMetadataKeys(target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryMetadataKeys(target, targetKey); + } + Reflect.getMetadataKeys = getMetadataKeys; + /** + * Gets the unique metadata keys defined on the target object. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadataKeys(C); + * + * // property (on constructor) + * result = Reflect.getOwnMetadataKeys(C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadataKeys(C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadataKeys(C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadataKeys(C.prototype, "method"); + * + */ + function getOwnMetadataKeys(target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryOwnMetadataKeys(target, targetKey); + } + Reflect.getOwnMetadataKeys = getOwnMetadataKeys; + /** + * Deletes the metadata entry from the target object with the provided key. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata entry was found and deleted; otherwise, false. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.deleteMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "method"); + * + */ + function deleteMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#deletemetadata-metadatakey-p- + var metadataMap = GetOrCreateMetadataMap(target, targetKey, false); + if (IsUndefined(metadataMap)) { + return false; + } + if (!metadataMap.delete(metadataKey)) { + return false; + } + if (metadataMap.size > 0) { + return true; + } + var targetMetadata = __Metadata__.get(target); + targetMetadata.delete(targetKey); + if (targetMetadata.size > 0) { + return true; + } + __Metadata__.delete(target); + return true; + } + Reflect.deleteMetadata = deleteMetadata; + function DecorateConstructor(decorators, target) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target); + if (!IsUndefined(decorated)) { + if (!IsConstructor(decorated)) { + throw new TypeError(); + } + target = decorated; + } + } + return target; + } + function DecoratePropertyWithDescriptor(decorators, target, propertyKey, descriptor) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target, propertyKey, descriptor); + if (!IsUndefined(decorated)) { + if (!IsObject(decorated)) { + throw new TypeError(); + } + descriptor = decorated; + } + } + return descriptor; + } + function DecoratePropertyWithoutDescriptor(decorators, target, propertyKey) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + decorator(target, propertyKey); + } + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#getorcreatemetadatamap--o-p-create- + function GetOrCreateMetadataMap(target, targetKey, create) { + var targetMetadata = __Metadata__.get(target); + if (!targetMetadata) { + if (!create) { + return undefined; + } + targetMetadata = new _Map(); + __Metadata__.set(target, targetMetadata); + } + var keyMetadata = targetMetadata.get(targetKey); + if (!keyMetadata) { + if (!create) { + return undefined; + } + keyMetadata = new _Map(); + targetMetadata.set(targetKey, keyMetadata); + } + return keyMetadata; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasmetadata--metadatakey-o-p- + function OrdinaryHasMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) { + return true; + } + var parent = GetPrototypeOf(O); + if (parent !== null) { + return OrdinaryHasMetadata(MetadataKey, parent, P); + } + return false; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasownmetadata--metadatakey-o-p- + function OrdinaryHasOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, false); + if (metadataMap === undefined) { + return false; + } + return Boolean(metadataMap.has(MetadataKey)); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetmetadata--metadatakey-o-p- + function OrdinaryGetMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) { + return OrdinaryGetOwnMetadata(MetadataKey, O, P); + } + var parent = GetPrototypeOf(O); + if (parent !== null) { + return OrdinaryGetMetadata(MetadataKey, parent, P); + } + return undefined; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetownmetadata--metadatakey-o-p- + function OrdinaryGetOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, false); + if (metadataMap === undefined) { + return undefined; + } + return metadataMap.get(MetadataKey); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarydefineownmetadata--metadatakey-metadatavalue-o-p- + function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, true); + metadataMap.set(MetadataKey, MetadataValue); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarymetadatakeys--o-p- + function OrdinaryMetadataKeys(O, P) { + var ownKeys = OrdinaryOwnMetadataKeys(O, P); + var parent = GetPrototypeOf(O); + if (parent === null) { + return ownKeys; + } + var parentKeys = OrdinaryMetadataKeys(parent, P); + if (parentKeys.length <= 0) { + return ownKeys; + } + if (ownKeys.length <= 0) { + return parentKeys; + } + var set = new _Set(); + var keys = []; + for (var _i = 0; _i < ownKeys.length; _i++) { + var key = ownKeys[_i]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + for (var _a = 0; _a < parentKeys.length; _a++) { + var key = parentKeys[_a]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + return keys; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryownmetadatakeys--o-p- + function OrdinaryOwnMetadataKeys(target, targetKey) { + var metadataMap = GetOrCreateMetadataMap(target, targetKey, false); + var keys = []; + if (metadataMap) { + metadataMap.forEach(function (_, key) { return keys.push(key); }); + } + return keys; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-undefined-type + function IsUndefined(x) { + return x === undefined; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isarray + function IsArray(x) { + return Array.isArray(x); + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type + function IsObject(x) { + return typeof x === "object" ? x !== null : typeof x === "function"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor + function IsConstructor(x) { + return typeof x === "function"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-symbol-type + function IsSymbol(x) { + return typeof x === "symbol"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey + function ToPropertyKey(value) { + if (IsSymbol(value)) { + return value; + } + return String(value); + } + function GetPrototypeOf(O) { + var proto = Object.getPrototypeOf(O); + if (typeof O !== "function" || O === functionPrototype) { + return proto; + } + // TypeScript doesn't set __proto__ in ES5, as it's non-standard. + // Try to determine the superclass constructor. Compatible implementations + // must either set __proto__ on a subclass constructor to the superclass constructor, + // or ensure each class has a valid `constructor` property on its prototype that + // points back to the constructor. + // If this is not the same as Function.[[Prototype]], then this is definately inherited. + // This is the case when in ES6 or when using __proto__ in a compatible browser. + if (proto !== functionPrototype) { + return proto; + } + // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage. + var prototype = O.prototype; + var prototypeProto = Object.getPrototypeOf(prototype); + if (prototypeProto == null || prototypeProto === Object.prototype) { + return proto; + } + // if the constructor was not a function, then we cannot determine the heritage. + var constructor = prototypeProto.constructor; + if (typeof constructor !== "function") { + return proto; + } + // if we have some kind of self-reference, then we cannot determine the heritage. + if (constructor === O) { + return proto; + } + // we have a pretty good guess at the heritage. + return constructor; + } + // naive Map shim + function CreateMapPolyfill() { + var cacheSentinel = {}; + function Map() { + this._keys = []; + this._values = []; + this._cache = cacheSentinel; + } + Map.prototype = { + get size() { + return this._keys.length; + }, + has: function (key) { + if (key === this._cache) { + return true; + } + if (this._find(key) >= 0) { + this._cache = key; + return true; + } + return false; + }, + get: function (key) { + var index = this._find(key); + if (index >= 0) { + this._cache = key; + return this._values[index]; + } + return undefined; + }, + set: function (key, value) { + this.delete(key); + this._keys.push(key); + this._values.push(value); + this._cache = key; + return this; + }, + delete: function (key) { + var index = this._find(key); + if (index >= 0) { + this._keys.splice(index, 1); + this._values.splice(index, 1); + this._cache = cacheSentinel; + return true; + } + return false; + }, + clear: function () { + this._keys.length = 0; + this._values.length = 0; + this._cache = cacheSentinel; + }, + forEach: function (callback, thisArg) { + var size = this.size; + for (var i = 0; i < size; ++i) { + var key = this._keys[i]; + var value = this._values[i]; + this._cache = key; + callback.call(this, value, key, this); + } + }, + _find: function (key) { + var keys = this._keys; + var size = keys.length; + for (var i = 0; i < size; ++i) { + if (keys[i] === key) { + return i; + } + } + return -1; + } + }; + return Map; + } + // naive Set shim + function CreateSetPolyfill() { + var cacheSentinel = {}; + function Set() { + this._map = new _Map(); + } + Set.prototype = { + get size() { + return this._map.length; + }, + has: function (value) { + return this._map.has(value); + }, + add: function (value) { + this._map.set(value, value); + return this; + }, + delete: function (value) { + return this._map.delete(value); + }, + clear: function () { + this._map.clear(); + }, + forEach: function (callback, thisArg) { + this._map.forEach(callback, thisArg); + } + }; + return Set; + } + // naive WeakMap shim + function CreateWeakMapPolyfill() { + var UUID_SIZE = 16; + var isNode = typeof global !== "undefined" && + typeof module === "object" && + typeof module.exports === "object" && + typeof require === "function"; + var nodeCrypto = isNode && require("crypto"); + var hasOwn = Object.prototype.hasOwnProperty; + var keys = {}; + var rootKey = CreateUniqueKey(); + function WeakMap() { + this._key = CreateUniqueKey(); + } + WeakMap.prototype = { + has: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table) { + return this._key in table; + } + return false; + }, + get: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table) { + return table[this._key]; + } + return undefined; + }, + set: function (target, value) { + var table = GetOrCreateWeakMapTable(target, true); + table[this._key] = value; + return this; + }, + delete: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table && this._key in table) { + return delete table[this._key]; + } + return false; + }, + clear: function () { + // NOTE: not a real clear, just makes the previous data unreachable + this._key = CreateUniqueKey(); + } + }; + function FillRandomBytes(buffer, size) { + for (var i = 0; i < size; ++i) { + buffer[i] = Math.random() * 255 | 0; + } + } + function GenRandomBytes(size) { + if (nodeCrypto) { + var data = nodeCrypto.randomBytes(size); + return data; + } + else if (typeof Uint8Array === "function") { + var data = new Uint8Array(size); + if (typeof crypto !== "undefined") { + crypto.getRandomValues(data); + } + else if (typeof msCrypto !== "undefined") { + msCrypto.getRandomValues(data); + } + else { + FillRandomBytes(data, size); + } + return data; + } + else { + var data = new Array(size); + FillRandomBytes(data, size); + return data; + } + } + function CreateUUID() { + var data = GenRandomBytes(UUID_SIZE); + // mark as random - RFC 4122 § 4.4 + data[6] = data[6] & 0x4f | 0x40; + data[8] = data[8] & 0xbf | 0x80; + var result = ""; + for (var offset = 0; offset < UUID_SIZE; ++offset) { + var byte = data[offset]; + if (offset === 4 || offset === 6 || offset === 8) { + result += "-"; + } + if (byte < 16) { + result += "0"; + } + result += byte.toString(16).toLowerCase(); + } + return result; + } + function CreateUniqueKey() { + var key; + do { + key = "@@WeakMap@@" + CreateUUID(); + } while (hasOwn.call(keys, key)); + keys[key] = true; + return key; + } + function GetOrCreateWeakMapTable(target, create) { + if (!hasOwn.call(target, rootKey)) { + if (!create) { + return undefined; + } + Object.defineProperty(target, rootKey, { value: Object.create(null) }); + } + return target[rootKey]; + } + return WeakMap; + } + // hook global Reflect + (function (__global) { + if (typeof __global.Reflect !== "undefined") { + if (__global.Reflect !== Reflect) { + for (var p in Reflect) { + __global.Reflect[p] = Reflect[p]; + } + } + } + else { + __global.Reflect = Reflect; + } + })(typeof window !== "undefined" ? window : + typeof WorkerGlobalScope !== "undefined" ? self : + typeof global !== "undefined" ? global : + Function("return this;")()); +})(Reflect || (Reflect = {})); +//# sourceMappingURLDisabled=Reflect.js.map +"format register"; +System.register("rx", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + ; + (function(undefined) { + var objectTypes = { + 'boolean': false, + 'function': true, + 'object': true, + 'number': false, + 'string': false, + 'undefined': false + }; + var root = (objectTypes[typeof window] && window) || this, + freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports, + freeModule = objectTypes[typeof module] && module && !module.nodeType && module, + moduleExports = freeModule && freeModule.exports === freeExports && freeExports, + freeGlobal = objectTypes[typeof global] && global; + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { + root = freeGlobal; + } + var Rx = { + internals: {}, + config: {Promise: root.Promise}, + helpers: {} + }; + var noop = Rx.helpers.noop = function() {}, + notDefined = Rx.helpers.notDefined = function(x) { + return typeof x === 'undefined'; + }, + isScheduler = Rx.helpers.isScheduler = function(x) { + return x instanceof Rx.Scheduler; + }, + identity = Rx.helpers.identity = function(x) { + return x; + }, + pluck = Rx.helpers.pluck = function(property) { + return function(x) { + return x[property]; + }; + }, + just = Rx.helpers.just = function(value) { + return function() { + return value; + }; + }, + defaultNow = Rx.helpers.defaultNow = Date.now, + defaultComparer = Rx.helpers.defaultComparer = function(x, y) { + return isEqual(x, y); + }, + defaultSubComparer = Rx.helpers.defaultSubComparer = function(x, y) { + return x > y ? 1 : (x < y ? -1 : 0); + }, + defaultKeySerializer = Rx.helpers.defaultKeySerializer = function(x) { + return x.toString(); + }, + defaultError = Rx.helpers.defaultError = function(err) { + throw err; + }, + isPromise = Rx.helpers.isPromise = function(p) { + return !!p && typeof p.then === 'function'; + }, + asArray = Rx.helpers.asArray = function() { + return Array.prototype.slice.call(arguments); + }, + not = Rx.helpers.not = function(a) { + return !a; + }, + isFunction = Rx.helpers.isFunction = (function() { + var isFn = function(value) { + return typeof value == 'function' || false; + }; + if (isFn(/x/)) { + isFn = function(value) { + return typeof value == 'function' && toString.call(value) == '[object Function]'; + }; + } + return isFn; + }()); + function cloneArray(arr) { + for (var a = [], + i = 0, + len = arr.length; i < len; i++) { + a.push(arr[i]); + } + return a; + } + Rx.config.longStackSupport = false; + var hasStacks = false; + try { + throw new Error(); + } catch (e) { + hasStacks = !!e.stack; + } + var rStartingLine = captureLine(), + rFileName; + var STACK_JUMP_SEPARATOR = "From previous event:"; + function makeStackTraceLong(error, observable) { + if (hasStacks && observable.stack && typeof error === "object" && error !== null && error.stack && error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1) { + var stacks = []; + for (var o = observable; !!o; o = o.source) { + if (o.stack) { + stacks.unshift(o.stack); + } + } + stacks.unshift(error.stack); + var concatedStacks = stacks.join("\n" + STACK_JUMP_SEPARATOR + "\n"); + error.stack = filterStackString(concatedStacks); + } + } + function filterStackString(stackString) { + var lines = stackString.split("\n"), + desiredLines = []; + for (var i = 0, + len = lines.length; i < len; i++) { + var line = lines[i]; + if (!isInternalFrame(line) && !isNodeFrame(line) && line) { + desiredLines.push(line); + } + } + return desiredLines.join("\n"); + } + function isInternalFrame(stackLine) { + var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine); + if (!fileNameAndLineNumber) { + return false; + } + var fileName = fileNameAndLineNumber[0], + lineNumber = fileNameAndLineNumber[1]; + return fileName === rFileName && lineNumber >= rStartingLine && lineNumber <= rEndingLine; + } + function isNodeFrame(stackLine) { + return stackLine.indexOf("(module.js:") !== -1 || stackLine.indexOf("(node.js:") !== -1; + } + function captureLine() { + if (!hasStacks) { + return ; + } + try { + throw new Error(); + } catch (e) { + var lines = e.stack.split("\n"); + var firstLine = lines[0].indexOf("@") > 0 ? lines[1] : lines[2]; + var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine); + if (!fileNameAndLineNumber) { + return ; + } + rFileName = fileNameAndLineNumber[0]; + return fileNameAndLineNumber[1]; + } + } + function getFileNameAndLineNumber(stackLine) { + var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine); + if (attempt1) { + return [attempt1[1], Number(attempt1[2])]; + } + var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine); + if (attempt2) { + return [attempt2[1], Number(attempt2[2])]; + } + var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine); + if (attempt3) { + return [attempt3[1], Number(attempt3[2])]; + } + } + var EmptyError = Rx.EmptyError = function() { + this.message = 'Sequence contains no elements.'; + Error.call(this); + }; + EmptyError.prototype = Error.prototype; + var ObjectDisposedError = Rx.ObjectDisposedError = function() { + this.message = 'Object has been disposed'; + Error.call(this); + }; + ObjectDisposedError.prototype = Error.prototype; + var ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError = function() { + this.message = 'Argument out of range'; + Error.call(this); + }; + ArgumentOutOfRangeError.prototype = Error.prototype; + var NotSupportedError = Rx.NotSupportedError = function(message) { + this.message = message || 'This operation is not supported'; + Error.call(this); + }; + NotSupportedError.prototype = Error.prototype; + var NotImplementedError = Rx.NotImplementedError = function(message) { + this.message = message || 'This operation is not implemented'; + Error.call(this); + }; + NotImplementedError.prototype = Error.prototype; + var notImplemented = Rx.helpers.notImplemented = function() { + throw new NotImplementedError(); + }; + var notSupported = Rx.helpers.notSupported = function() { + throw new NotSupportedError(); + }; + var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) || '_es6shim_iterator_'; + if (root.Set && typeof new root.Set()['@@iterator'] === 'function') { + $iterator$ = '@@iterator'; + } + var doneEnumerator = Rx.doneEnumerator = { + done: true, + value: undefined + }; + var isIterable = Rx.helpers.isIterable = function(o) { + return o[$iterator$] !== undefined; + }; + var isArrayLike = Rx.helpers.isArrayLike = function(o) { + return o && o.length !== undefined; + }; + Rx.helpers.iterator = $iterator$; + var bindCallback = Rx.internals.bindCallback = function(func, thisArg, argCount) { + if (typeof thisArg === 'undefined') { + return func; + } + switch (argCount) { + case 0: + return function() { + return func.call(thisArg); + }; + case 1: + return function(arg) { + return func.call(thisArg, arg); + }; + case 2: + return function(value, index) { + return func.call(thisArg, value, index); + }; + case 3: + return function(value, index, collection) { + return func.call(thisArg, value, index, collection); + }; + } + return function() { + return func.apply(thisArg, arguments); + }; + }; + var dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor'], + dontEnumsLength = dontEnums.length; + var argsClass = '[object Arguments]', + arrayClass = '[object Array]', + boolClass = '[object Boolean]', + dateClass = '[object Date]', + errorClass = '[object Error]', + funcClass = '[object Function]', + numberClass = '[object Number]', + objectClass = '[object Object]', + regexpClass = '[object RegExp]', + stringClass = '[object String]'; + var toString = Object.prototype.toString, + hasOwnProperty = Object.prototype.hasOwnProperty, + supportsArgsClass = toString.call(arguments) == argsClass, + supportNodeClass, + errorProto = Error.prototype, + objectProto = Object.prototype, + stringProto = String.prototype, + propertyIsEnumerable = objectProto.propertyIsEnumerable; + try { + supportNodeClass = !(toString.call(document) == objectClass && !({'toString': 0} + '')); + } catch (e) { + supportNodeClass = true; + } + var nonEnumProps = {}; + nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { + 'constructor': true, + 'toLocaleString': true, + 'toString': true, + 'valueOf': true + }; + nonEnumProps[boolClass] = nonEnumProps[stringClass] = { + 'constructor': true, + 'toString': true, + 'valueOf': true + }; + nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { + 'constructor': true, + 'toString': true + }; + nonEnumProps[objectClass] = {'constructor': true}; + var support = {}; + (function() { + var ctor = function() { + this.x = 1; + }, + props = []; + ctor.prototype = { + 'valueOf': 1, + 'y': 1 + }; + for (var key in new ctor) { + props.push(key); + } + for (key in arguments) {} + support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name'); + support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype'); + support.nonEnumArgs = key != 0; + support.nonEnumShadows = !/valueOf/.test(props); + }(1)); + var isObject = Rx.internals.isObject = function(value) { + var type = typeof value; + return value && (type == 'function' || type == 'object') || false; + }; + function keysIn(object) { + var result = []; + if (!isObject(object)) { + return result; + } + if (support.nonEnumArgs && object.length && isArguments(object)) { + object = slice.call(object); + } + var skipProto = support.enumPrototypes && typeof object == 'function', + skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error); + for (var key in object) { + if (!(skipProto && key == 'prototype') && !(skipErrorProps && (key == 'message' || key == 'name'))) { + result.push(key); + } + } + if (support.nonEnumShadows && object !== objectProto) { + var ctor = object.constructor, + index = -1, + length = dontEnumsLength; + if (object === (ctor && ctor.prototype)) { + var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object), + nonEnum = nonEnumProps[className]; + } + while (++index < length) { + key = dontEnums[index]; + if (!(nonEnum && nonEnum[key]) && hasOwnProperty.call(object, key)) { + result.push(key); + } + } + } + return result; + } + function internalFor(object, callback, keysFunc) { + var index = -1, + props = keysFunc(object), + length = props.length; + while (++index < length) { + var key = props[index]; + if (callback(object[key], key, object) === false) { + break; + } + } + return object; + } + function internalForIn(object, callback) { + return internalFor(object, callback, keysIn); + } + function isNode(value) { + return typeof value.toString != 'function' && typeof(value + '') == 'string'; + } + var isArguments = function(value) { + return (value && typeof value == 'object') ? toString.call(value) == argsClass : false; + }; + if (!supportsArgsClass) { + isArguments = function(value) { + return (value && typeof value == 'object') ? hasOwnProperty.call(value, 'callee') : false; + }; + } + var isEqual = Rx.internals.isEqual = function(x, y) { + return deepEquals(x, y, [], []); + }; + function deepEquals(a, b, stackA, stackB) { + if (a === b) { + return a !== 0 || (1 / a == 1 / b); + } + var type = typeof a, + otherType = typeof b; + if (a === a && (a == null || b == null || (type != 'function' && type != 'object' && otherType != 'function' && otherType != 'object'))) { + return false; + } + var className = toString.call(a), + otherClass = toString.call(b); + if (className == argsClass) { + className = objectClass; + } + if (otherClass == argsClass) { + otherClass = objectClass; + } + if (className != otherClass) { + return false; + } + switch (className) { + case boolClass: + case dateClass: + return +a == +b; + case numberClass: + return (a != +a) ? b != +b : (a == 0 ? (1 / a == 1 / b) : a == +b); + case regexpClass: + case stringClass: + return a == String(b); + } + var isArr = className == arrayClass; + if (!isArr) { + if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) { + return false; + } + var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor, + ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor; + if (ctorA != ctorB && !(hasOwnProperty.call(a, 'constructor') && hasOwnProperty.call(b, 'constructor')) && !(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) && ('constructor' in a && 'constructor' in b)) { + return false; + } + } + var initedStack = !stackA; + stackA || (stackA = []); + stackB || (stackB = []); + var length = stackA.length; + while (length--) { + if (stackA[length] == a) { + return stackB[length] == b; + } + } + var size = 0; + var result = true; + stackA.push(a); + stackB.push(b); + if (isArr) { + length = a.length; + size = b.length; + result = size == length; + if (result) { + while (size--) { + var index = length, + value = b[size]; + if (!(result = deepEquals(a[size], value, stackA, stackB))) { + break; + } + } + } + } else { + internalForIn(b, function(value, key, b) { + if (hasOwnProperty.call(b, key)) { + size++; + return (result = hasOwnProperty.call(a, key) && deepEquals(a[key], value, stackA, stackB)); + } + }); + if (result) { + internalForIn(a, function(value, key, a) { + if (hasOwnProperty.call(a, key)) { + return (result = --size > -1); + } + }); + } + } + stackA.pop(); + stackB.pop(); + return result; + } + var hasProp = {}.hasOwnProperty, + slice = Array.prototype.slice; + var inherits = this.inherits = Rx.internals.inherits = function(child, parent) { + function __() { + this.constructor = child; + } + __.prototype = parent.prototype; + child.prototype = new __(); + }; + var addProperties = Rx.internals.addProperties = function(obj) { + for (var sources = [], + i = 1, + len = arguments.length; i < len; i++) { + sources.push(arguments[i]); + } + for (var idx = 0, + ln = sources.length; idx < ln; idx++) { + var source = sources[idx]; + for (var prop in source) { + obj[prop] = source[prop]; + } + } + }; + var addRef = Rx.internals.addRef = function(xs, r) { + return new AnonymousObservable(function(observer) { + return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer)); + }); + }; + function arrayInitialize(count, factory) { + var a = new Array(count); + for (var i = 0; i < count; i++) { + a[i] = factory(); + } + return a; + } + var errorObj = {e: {}}; + var tryCatchTarget; + function tryCatcher() { + try { + return tryCatchTarget.apply(this, arguments); + } catch (e) { + errorObj.e = e; + return errorObj; + } + } + function tryCatch(fn) { + if (!isFunction(fn)) { + throw new TypeError('fn must be a function'); + } + tryCatchTarget = fn; + return tryCatcher; + } + function thrower(e) { + throw e; + } + function IndexedItem(id, value) { + this.id = id; + this.value = value; + } + IndexedItem.prototype.compareTo = function(other) { + var c = this.value.compareTo(other.value); + c === 0 && (c = this.id - other.id); + return c; + }; + var PriorityQueue = Rx.internals.PriorityQueue = function(capacity) { + this.items = new Array(capacity); + this.length = 0; + }; + var priorityProto = PriorityQueue.prototype; + priorityProto.isHigherPriority = function(left, right) { + return this.items[left].compareTo(this.items[right]) < 0; + }; + priorityProto.percolate = function(index) { + if (index >= this.length || index < 0) { + return ; + } + var parent = index - 1 >> 1; + if (parent < 0 || parent === index) { + return ; + } + if (this.isHigherPriority(index, parent)) { + var temp = this.items[index]; + this.items[index] = this.items[parent]; + this.items[parent] = temp; + this.percolate(parent); + } + }; + priorityProto.heapify = function(index) { + +index || (index = 0); + if (index >= this.length || index < 0) { + return ; + } + var left = 2 * index + 1, + right = 2 * index + 2, + first = index; + if (left < this.length && this.isHigherPriority(left, first)) { + first = left; + } + if (right < this.length && this.isHigherPriority(right, first)) { + first = right; + } + if (first !== index) { + var temp = this.items[index]; + this.items[index] = this.items[first]; + this.items[first] = temp; + this.heapify(first); + } + }; + priorityProto.peek = function() { + return this.items[0].value; + }; + priorityProto.removeAt = function(index) { + this.items[index] = this.items[--this.length]; + this.items[this.length] = undefined; + this.heapify(); + }; + priorityProto.dequeue = function() { + var result = this.peek(); + this.removeAt(0); + return result; + }; + priorityProto.enqueue = function(item) { + var index = this.length++; + this.items[index] = new IndexedItem(PriorityQueue.count++, item); + this.percolate(index); + }; + priorityProto.remove = function(item) { + for (var i = 0; i < this.length; i++) { + if (this.items[i].value === item) { + this.removeAt(i); + return true; + } + } + return false; + }; + PriorityQueue.count = 0; + var CompositeDisposable = Rx.CompositeDisposable = function() { + var args = [], + i, + len; + if (Array.isArray(arguments[0])) { + args = arguments[0]; + len = args.length; + } else { + len = arguments.length; + args = new Array(len); + for (i = 0; i < len; i++) { + args[i] = arguments[i]; + } + } + for (i = 0; i < len; i++) { + if (!isDisposable(args[i])) { + throw new TypeError('Not a disposable'); + } + } + this.disposables = args; + this.isDisposed = false; + this.length = args.length; + }; + var CompositeDisposablePrototype = CompositeDisposable.prototype; + CompositeDisposablePrototype.add = function(item) { + if (this.isDisposed) { + item.dispose(); + } else { + this.disposables.push(item); + this.length++; + } + }; + CompositeDisposablePrototype.remove = function(item) { + var shouldDispose = false; + if (!this.isDisposed) { + var idx = this.disposables.indexOf(item); + if (idx !== -1) { + shouldDispose = true; + this.disposables.splice(idx, 1); + this.length--; + item.dispose(); + } + } + return shouldDispose; + }; + CompositeDisposablePrototype.dispose = function() { + if (!this.isDisposed) { + this.isDisposed = true; + var len = this.disposables.length, + currentDisposables = new Array(len); + for (var i = 0; i < len; i++) { + currentDisposables[i] = this.disposables[i]; + } + this.disposables = []; + this.length = 0; + for (i = 0; i < len; i++) { + currentDisposables[i].dispose(); + } + } + }; + var Disposable = Rx.Disposable = function(action) { + this.isDisposed = false; + this.action = action || noop; + }; + Disposable.prototype.dispose = function() { + if (!this.isDisposed) { + this.action(); + this.isDisposed = true; + } + }; + var disposableCreate = Disposable.create = function(action) { + return new Disposable(action); + }; + var disposableEmpty = Disposable.empty = {dispose: noop}; + var isDisposable = Disposable.isDisposable = function(d) { + return d && isFunction(d.dispose); + }; + var checkDisposed = Disposable.checkDisposed = function(disposable) { + if (disposable.isDisposed) { + throw new ObjectDisposedError(); + } + }; + var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = (function() { + function BooleanDisposable() { + this.isDisposed = false; + this.current = null; + } + var booleanDisposablePrototype = BooleanDisposable.prototype; + booleanDisposablePrototype.getDisposable = function() { + return this.current; + }; + booleanDisposablePrototype.setDisposable = function(value) { + var shouldDispose = this.isDisposed; + if (!shouldDispose) { + var old = this.current; + this.current = value; + } + old && old.dispose(); + shouldDispose && value && value.dispose(); + }; + booleanDisposablePrototype.dispose = function() { + if (!this.isDisposed) { + this.isDisposed = true; + var old = this.current; + this.current = null; + } + old && old.dispose(); + }; + return BooleanDisposable; + }()); + var SerialDisposable = Rx.SerialDisposable = SingleAssignmentDisposable; + var RefCountDisposable = Rx.RefCountDisposable = (function() { + function InnerDisposable(disposable) { + this.disposable = disposable; + this.disposable.count++; + this.isInnerDisposed = false; + } + InnerDisposable.prototype.dispose = function() { + if (!this.disposable.isDisposed && !this.isInnerDisposed) { + this.isInnerDisposed = true; + this.disposable.count--; + if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) { + this.disposable.isDisposed = true; + this.disposable.underlyingDisposable.dispose(); + } + } + }; + function RefCountDisposable(disposable) { + this.underlyingDisposable = disposable; + this.isDisposed = false; + this.isPrimaryDisposed = false; + this.count = 0; + } + RefCountDisposable.prototype.dispose = function() { + if (!this.isDisposed && !this.isPrimaryDisposed) { + this.isPrimaryDisposed = true; + if (this.count === 0) { + this.isDisposed = true; + this.underlyingDisposable.dispose(); + } + } + }; + RefCountDisposable.prototype.getDisposable = function() { + return this.isDisposed ? disposableEmpty : new InnerDisposable(this); + }; + return RefCountDisposable; + })(); + function ScheduledDisposable(scheduler, disposable) { + this.scheduler = scheduler; + this.disposable = disposable; + this.isDisposed = false; + } + function scheduleItem(s, self) { + if (!self.isDisposed) { + self.isDisposed = true; + self.disposable.dispose(); + } + } + ScheduledDisposable.prototype.dispose = function() { + this.scheduler.scheduleWithState(this, scheduleItem); + }; + var ScheduledItem = Rx.internals.ScheduledItem = function(scheduler, state, action, dueTime, comparer) { + this.scheduler = scheduler; + this.state = state; + this.action = action; + this.dueTime = dueTime; + this.comparer = comparer || defaultSubComparer; + this.disposable = new SingleAssignmentDisposable(); + }; + ScheduledItem.prototype.invoke = function() { + this.disposable.setDisposable(this.invokeCore()); + }; + ScheduledItem.prototype.compareTo = function(other) { + return this.comparer(this.dueTime, other.dueTime); + }; + ScheduledItem.prototype.isCancelled = function() { + return this.disposable.isDisposed; + }; + ScheduledItem.prototype.invokeCore = function() { + return this.action(this.scheduler, this.state); + }; + var Scheduler = Rx.Scheduler = (function() { + function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) { + this.now = now; + this._schedule = schedule; + this._scheduleRelative = scheduleRelative; + this._scheduleAbsolute = scheduleAbsolute; + } + function invokeAction(scheduler, action) { + action(); + return disposableEmpty; + } + var schedulerProto = Scheduler.prototype; + schedulerProto.schedule = function(action) { + return this._schedule(action, invokeAction); + }; + schedulerProto.scheduleWithState = function(state, action) { + return this._schedule(state, action); + }; + schedulerProto.scheduleWithRelative = function(dueTime, action) { + return this._scheduleRelative(action, dueTime, invokeAction); + }; + schedulerProto.scheduleWithRelativeAndState = function(state, dueTime, action) { + return this._scheduleRelative(state, dueTime, action); + }; + schedulerProto.scheduleWithAbsolute = function(dueTime, action) { + return this._scheduleAbsolute(action, dueTime, invokeAction); + }; + schedulerProto.scheduleWithAbsoluteAndState = function(state, dueTime, action) { + return this._scheduleAbsolute(state, dueTime, action); + }; + Scheduler.now = defaultNow; + Scheduler.normalize = function(timeSpan) { + timeSpan < 0 && (timeSpan = 0); + return timeSpan; + }; + return Scheduler; + }()); + var normalizeTime = Scheduler.normalize; + (function(schedulerProto) { + function invokeRecImmediate(scheduler, pair) { + var state = pair[0], + action = pair[1], + group = new CompositeDisposable(); + function recursiveAction(state1) { + action(state1, function(state2) { + var isAdded = false, + isDone = false, + d = scheduler.scheduleWithState(state2, function(scheduler1, state3) { + if (isAdded) { + group.remove(d); + } else { + isDone = true; + } + recursiveAction(state3); + return disposableEmpty; + }); + if (!isDone) { + group.add(d); + isAdded = true; + } + }); + } + recursiveAction(state); + return group; + } + function invokeRecDate(scheduler, pair, method) { + var state = pair[0], + action = pair[1], + group = new CompositeDisposable(); + function recursiveAction(state1) { + action(state1, function(state2, dueTime1) { + var isAdded = false, + isDone = false, + d = scheduler[method](state2, dueTime1, function(scheduler1, state3) { + if (isAdded) { + group.remove(d); + } else { + isDone = true; + } + recursiveAction(state3); + return disposableEmpty; + }); + if (!isDone) { + group.add(d); + isAdded = true; + } + }); + } + ; + recursiveAction(state); + return group; + } + function scheduleInnerRecursive(action, self) { + action(function(dt) { + self(action, dt); + }); + } + schedulerProto.scheduleRecursive = function(action) { + return this.scheduleRecursiveWithState(action, function(_action, self) { + _action(function() { + self(_action); + }); + }); + }; + schedulerProto.scheduleRecursiveWithState = function(state, action) { + return this.scheduleWithState([state, action], invokeRecImmediate); + }; + schedulerProto.scheduleRecursiveWithRelative = function(dueTime, action) { + return this.scheduleRecursiveWithRelativeAndState(action, dueTime, scheduleInnerRecursive); + }; + schedulerProto.scheduleRecursiveWithRelativeAndState = function(state, dueTime, action) { + return this._scheduleRelative([state, action], dueTime, function(s, p) { + return invokeRecDate(s, p, 'scheduleWithRelativeAndState'); + }); + }; + schedulerProto.scheduleRecursiveWithAbsolute = function(dueTime, action) { + return this.scheduleRecursiveWithAbsoluteAndState(action, dueTime, scheduleInnerRecursive); + }; + schedulerProto.scheduleRecursiveWithAbsoluteAndState = function(state, dueTime, action) { + return this._scheduleAbsolute([state, action], dueTime, function(s, p) { + return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState'); + }); + }; + }(Scheduler.prototype)); + (function(schedulerProto) { + Scheduler.prototype.schedulePeriodic = function(period, action) { + return this.schedulePeriodicWithState(null, period, action); + }; + Scheduler.prototype.schedulePeriodicWithState = function(state, period, action) { + if (typeof root.setInterval === 'undefined') { + throw new NotSupportedError(); + } + period = normalizeTime(period); + var s = state, + id = root.setInterval(function() { + s = action(s); + }, period); + return disposableCreate(function() { + root.clearInterval(id); + }); + }; + }(Scheduler.prototype)); + (function(schedulerProto) { + schedulerProto.catchError = schedulerProto['catch'] = function(handler) { + return new CatchScheduler(this, handler); + }; + }(Scheduler.prototype)); + var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function() { + function tick(command, recurse) { + recurse(0, this._period); + try { + this._state = this._action(this._state); + } catch (e) { + this._cancel.dispose(); + throw e; + } + } + function SchedulePeriodicRecursive(scheduler, state, period, action) { + this._scheduler = scheduler; + this._state = state; + this._period = period; + this._action = action; + } + SchedulePeriodicRecursive.prototype.start = function() { + var d = new SingleAssignmentDisposable(); + this._cancel = d; + d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this))); + return d; + }; + return SchedulePeriodicRecursive; + }()); + var immediateScheduler = Scheduler.immediate = (function() { + function scheduleNow(state, action) { + return action(this, state); + } + return new Scheduler(defaultNow, scheduleNow, notSupported, notSupported); + }()); + var currentThreadScheduler = Scheduler.currentThread = (function() { + var queue; + function runTrampoline() { + while (queue.length > 0) { + var item = queue.dequeue(); + !item.isCancelled() && item.invoke(); + } + } + function scheduleNow(state, action) { + var si = new ScheduledItem(this, state, action, this.now()); + if (!queue) { + queue = new PriorityQueue(4); + queue.enqueue(si); + var result = tryCatch(runTrampoline)(); + queue = null; + if (result === errorObj) { + return thrower(result.e); + } + } else { + queue.enqueue(si); + } + return si.disposable; + } + var currentScheduler = new Scheduler(defaultNow, scheduleNow, notSupported, notSupported); + currentScheduler.scheduleRequired = function() { + return !queue; + }; + return currentScheduler; + }()); + var scheduleMethod, + clearMethod; + var localTimer = (function() { + var localSetTimeout, + localClearTimeout = noop; + if (!!root.WScript) { + localSetTimeout = function(fn, time) { + root.WScript.Sleep(time); + fn(); + }; + } else if (!!root.setTimeout) { + localSetTimeout = root.setTimeout; + localClearTimeout = root.clearTimeout; + } else { + throw new NotSupportedError(); + } + return { + setTimeout: localSetTimeout, + clearTimeout: localClearTimeout + }; + }()); + var localSetTimeout = localTimer.setTimeout, + localClearTimeout = localTimer.clearTimeout; + (function() { + var nextHandle = 1, + tasksByHandle = {}, + currentlyRunning = false; + clearMethod = function(handle) { + delete tasksByHandle[handle]; + }; + function runTask(handle) { + if (currentlyRunning) { + localSetTimeout(function() { + runTask(handle); + }, 0); + } else { + var task = tasksByHandle[handle]; + if (task) { + currentlyRunning = true; + var result = tryCatch(task)(); + clearMethod(handle); + currentlyRunning = false; + if (result === errorObj) { + return thrower(result.e); + } + } + } + } + var reNative = RegExp('^' + String(toString).replace(/[.*+?^${}()|[\]\\]/g, '\\$&').replace(/toString| for [^\]]+/g, '.*?') + '$'); + var setImmediate = typeof(setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' && !reNative.test(setImmediate) && setImmediate; + function postMessageSupported() { + if (!root.postMessage || root.importScripts) { + return false; + } + var isAsync = false, + oldHandler = root.onmessage; + root.onmessage = function() { + isAsync = true; + }; + root.postMessage('', '*'); + root.onmessage = oldHandler; + return isAsync; + } + if (isFunction(setImmediate)) { + scheduleMethod = function(action) { + var id = nextHandle++; + tasksByHandle[id] = action; + setImmediate(function() { + runTask(id); + }); + return id; + }; + } else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') { + scheduleMethod = function(action) { + var id = nextHandle++; + tasksByHandle[id] = action; + process.nextTick(function() { + runTask(id); + }); + return id; + }; + } else if (postMessageSupported()) { + var MSG_PREFIX = 'ms.rx.schedule' + Math.random(); + function onGlobalPostMessage(event) { + if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) { + runTask(event.data.substring(MSG_PREFIX.length)); + } + } + if (root.addEventListener) { + root.addEventListener('message', onGlobalPostMessage, false); + } else { + root.attachEvent('onmessage', onGlobalPostMessage, false); + } + scheduleMethod = function(action) { + var id = nextHandle++; + tasksByHandle[id] = action; + root.postMessage(MSG_PREFIX + currentId, '*'); + return id; + }; + } else if (!!root.MessageChannel) { + var channel = new root.MessageChannel(); + channel.port1.onmessage = function(e) { + runTask(e.data); + }; + scheduleMethod = function(action) { + var id = nextHandle++; + tasksByHandle[id] = action; + channel.port2.postMessage(id); + return id; + }; + } else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) { + scheduleMethod = function(action) { + var scriptElement = root.document.createElement('script'); + var id = nextHandle++; + tasksByHandle[id] = action; + scriptElement.onreadystatechange = function() { + runTask(id); + scriptElement.onreadystatechange = null; + scriptElement.parentNode.removeChild(scriptElement); + scriptElement = null; + }; + root.document.documentElement.appendChild(scriptElement); + return id; + }; + } else { + scheduleMethod = function(action) { + var id = nextHandle++; + tasksByHandle[id] = action; + localSetTimeout(function() { + runTask(id); + }, 0); + return id; + }; + } + }()); + var timeoutScheduler = Scheduler.timeout = Scheduler.default = (function() { + function scheduleNow(state, action) { + var scheduler = this, + disposable = new SingleAssignmentDisposable(); + var id = scheduleMethod(function() { + if (!disposable.isDisposed) { + disposable.setDisposable(action(scheduler, state)); + } + }); + return new CompositeDisposable(disposable, disposableCreate(function() { + clearMethod(id); + })); + } + function scheduleRelative(state, dueTime, action) { + var scheduler = this, + dt = Scheduler.normalize(dueTime); + if (dt === 0) { + return scheduler.scheduleWithState(state, action); + } + var disposable = new SingleAssignmentDisposable(); + var id = localSetTimeout(function() { + if (!disposable.isDisposed) { + disposable.setDisposable(action(scheduler, state)); + } + }, dt); + return new CompositeDisposable(disposable, disposableCreate(function() { + localClearTimeout(id); + })); + } + function scheduleAbsolute(state, dueTime, action) { + return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action); + } + return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute); + })(); + var CatchScheduler = (function(__super__) { + function scheduleNow(state, action) { + return this._scheduler.scheduleWithState(state, this._wrap(action)); + } + function scheduleRelative(state, dueTime, action) { + return this._scheduler.scheduleWithRelativeAndState(state, dueTime, this._wrap(action)); + } + function scheduleAbsolute(state, dueTime, action) { + return this._scheduler.scheduleWithAbsoluteAndState(state, dueTime, this._wrap(action)); + } + inherits(CatchScheduler, __super__); + function CatchScheduler(scheduler, handler) { + this._scheduler = scheduler; + this._handler = handler; + this._recursiveOriginal = null; + this._recursiveWrapper = null; + __super__.call(this, this._scheduler.now.bind(this._scheduler), scheduleNow, scheduleRelative, scheduleAbsolute); + } + CatchScheduler.prototype._clone = function(scheduler) { + return new CatchScheduler(scheduler, this._handler); + }; + CatchScheduler.prototype._wrap = function(action) { + var parent = this; + return function(self, state) { + try { + return action(parent._getRecursiveWrapper(self), state); + } catch (e) { + if (!parent._handler(e)) { + throw e; + } + return disposableEmpty; + } + }; + }; + CatchScheduler.prototype._getRecursiveWrapper = function(scheduler) { + if (this._recursiveOriginal !== scheduler) { + this._recursiveOriginal = scheduler; + var wrapper = this._clone(scheduler); + wrapper._recursiveOriginal = scheduler; + wrapper._recursiveWrapper = wrapper; + this._recursiveWrapper = wrapper; + } + return this._recursiveWrapper; + }; + CatchScheduler.prototype.schedulePeriodicWithState = function(state, period, action) { + var self = this, + failed = false, + d = new SingleAssignmentDisposable(); + d.setDisposable(this._scheduler.schedulePeriodicWithState(state, period, function(state1) { + if (failed) { + return null; + } + try { + return action(state1); + } catch (e) { + failed = true; + if (!self._handler(e)) { + throw e; + } + d.dispose(); + return null; + } + })); + return d; + }; + return CatchScheduler; + }(Scheduler)); + var Notification = Rx.Notification = (function() { + function Notification(kind, value, exception, accept, acceptObservable, toString) { + this.kind = kind; + this.value = value; + this.exception = exception; + this._accept = accept; + this._acceptObservable = acceptObservable; + this.toString = toString; + } + Notification.prototype.accept = function(observerOrOnNext, onError, onCompleted) { + return observerOrOnNext && typeof observerOrOnNext === 'object' ? this._acceptObservable(observerOrOnNext) : this._accept(observerOrOnNext, onError, onCompleted); + }; + Notification.prototype.toObservable = function(scheduler) { + var self = this; + isScheduler(scheduler) || (scheduler = immediateScheduler); + return new AnonymousObservable(function(observer) { + return scheduler.scheduleWithState(self, function(_, notification) { + notification._acceptObservable(observer); + notification.kind === 'N' && observer.onCompleted(); + }); + }); + }; + return Notification; + })(); + var notificationCreateOnNext = Notification.createOnNext = (function() { + function _accept(onNext) { + return onNext(this.value); + } + function _acceptObservable(observer) { + return observer.onNext(this.value); + } + function toString() { + return 'OnNext(' + this.value + ')'; + } + return function(value) { + return new Notification('N', value, null, _accept, _acceptObservable, toString); + }; + }()); + var notificationCreateOnError = Notification.createOnError = (function() { + function _accept(onNext, onError) { + return onError(this.exception); + } + function _acceptObservable(observer) { + return observer.onError(this.exception); + } + function toString() { + return 'OnError(' + this.exception + ')'; + } + return function(e) { + return new Notification('E', null, e, _accept, _acceptObservable, toString); + }; + }()); + var notificationCreateOnCompleted = Notification.createOnCompleted = (function() { + function _accept(onNext, onError, onCompleted) { + return onCompleted(); + } + function _acceptObservable(observer) { + return observer.onCompleted(); + } + function toString() { + return 'OnCompleted()'; + } + return function() { + return new Notification('C', null, null, _accept, _acceptObservable, toString); + }; + }()); + var Enumerator = Rx.internals.Enumerator = function(next) { + this._next = next; + }; + Enumerator.prototype.next = function() { + return this._next(); + }; + Enumerator.prototype[$iterator$] = function() { + return this; + }; + var Enumerable = Rx.internals.Enumerable = function(iterator) { + this._iterator = iterator; + }; + Enumerable.prototype[$iterator$] = function() { + return this._iterator(); + }; + Enumerable.prototype.concat = function() { + var sources = this; + return new AnonymousObservable(function(o) { + var e = sources[$iterator$](); + var isDisposed, + subscription = new SerialDisposable(); + var cancelable = immediateScheduler.scheduleRecursive(function(self) { + if (isDisposed) { + return ; + } + try { + var currentItem = e.next(); + } catch (ex) { + return o.onError(ex); + } + if (currentItem.done) { + return o.onCompleted(); + } + var currentValue = currentItem.value; + isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); + var d = new SingleAssignmentDisposable(); + subscription.setDisposable(d); + d.setDisposable(currentValue.subscribe(function(x) { + o.onNext(x); + }, function(err) { + o.onError(err); + }, self)); + }); + return new CompositeDisposable(subscription, cancelable, disposableCreate(function() { + isDisposed = true; + })); + }); + }; + Enumerable.prototype.catchError = function() { + var sources = this; + return new AnonymousObservable(function(o) { + var e = sources[$iterator$](); + var isDisposed, + subscription = new SerialDisposable(); + var cancelable = immediateScheduler.scheduleRecursiveWithState(null, function(lastException, self) { + if (isDisposed) { + return ; + } + try { + var currentItem = e.next(); + } catch (ex) { + return observer.onError(ex); + } + if (currentItem.done) { + if (lastException !== null) { + o.onError(lastException); + } else { + o.onCompleted(); + } + return ; + } + var currentValue = currentItem.value; + isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); + var d = new SingleAssignmentDisposable(); + subscription.setDisposable(d); + d.setDisposable(currentValue.subscribe(function(x) { + o.onNext(x); + }, self, function() { + o.onCompleted(); + })); + }); + return new CompositeDisposable(subscription, cancelable, disposableCreate(function() { + isDisposed = true; + })); + }); + }; + Enumerable.prototype.catchErrorWhen = function(notificationHandler) { + var sources = this; + return new AnonymousObservable(function(o) { + var exceptions = new Subject(), + notifier = new Subject(), + handled = notificationHandler(exceptions), + notificationDisposable = handled.subscribe(notifier); + var e = sources[$iterator$](); + var isDisposed, + lastException, + subscription = new SerialDisposable(); + var cancelable = immediateScheduler.scheduleRecursive(function(self) { + if (isDisposed) { + return ; + } + try { + var currentItem = e.next(); + } catch (ex) { + return o.onError(ex); + } + if (currentItem.done) { + if (lastException) { + o.onError(lastException); + } else { + o.onCompleted(); + } + return ; + } + var currentValue = currentItem.value; + isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); + var outer = new SingleAssignmentDisposable(); + var inner = new SingleAssignmentDisposable(); + subscription.setDisposable(new CompositeDisposable(inner, outer)); + outer.setDisposable(currentValue.subscribe(function(x) { + o.onNext(x); + }, function(exn) { + inner.setDisposable(notifier.subscribe(self, function(ex) { + o.onError(ex); + }, function() { + o.onCompleted(); + })); + exceptions.onNext(exn); + }, function() { + o.onCompleted(); + })); + }); + return new CompositeDisposable(notificationDisposable, subscription, cancelable, disposableCreate(function() { + isDisposed = true; + })); + }); + }; + var enumerableRepeat = Enumerable.repeat = function(value, repeatCount) { + if (repeatCount == null) { + repeatCount = -1; + } + return new Enumerable(function() { + var left = repeatCount; + return new Enumerator(function() { + if (left === 0) { + return doneEnumerator; + } + if (left > 0) { + left--; + } + return { + done: false, + value: value + }; + }); + }); + }; + var enumerableOf = Enumerable.of = function(source, selector, thisArg) { + if (selector) { + var selectorFn = bindCallback(selector, thisArg, 3); + } + return new Enumerable(function() { + var index = -1; + return new Enumerator(function() { + return ++index < source.length ? { + done: false, + value: !selector ? source[index] : selectorFn(source[index], index, source) + } : doneEnumerator; + }); + }); + }; + var Observer = Rx.Observer = function() {}; + Observer.prototype.toNotifier = function() { + var observer = this; + return function(n) { + return n.accept(observer); + }; + }; + Observer.prototype.asObserver = function() { + return new AnonymousObserver(this.onNext.bind(this), this.onError.bind(this), this.onCompleted.bind(this)); + }; + Observer.prototype.checked = function() { + return new CheckedObserver(this); + }; + var observerCreate = Observer.create = function(onNext, onError, onCompleted) { + onNext || (onNext = noop); + onError || (onError = defaultError); + onCompleted || (onCompleted = noop); + return new AnonymousObserver(onNext, onError, onCompleted); + }; + Observer.fromNotifier = function(handler, thisArg) { + return new AnonymousObserver(function(x) { + return handler.call(thisArg, notificationCreateOnNext(x)); + }, function(e) { + return handler.call(thisArg, notificationCreateOnError(e)); + }, function() { + return handler.call(thisArg, notificationCreateOnCompleted()); + }); + }; + Observer.prototype.notifyOn = function(scheduler) { + return new ObserveOnObserver(scheduler, this); + }; + Observer.prototype.makeSafe = function(disposable) { + return new AnonymousSafeObserver(this._onNext, this._onError, this._onCompleted, disposable); + }; + var AbstractObserver = Rx.internals.AbstractObserver = (function(__super__) { + inherits(AbstractObserver, __super__); + function AbstractObserver() { + this.isStopped = false; + __super__.call(this); + } + AbstractObserver.prototype.next = notImplemented; + AbstractObserver.prototype.error = notImplemented; + AbstractObserver.prototype.completed = notImplemented; + AbstractObserver.prototype.onNext = function(value) { + if (!this.isStopped) { + this.next(value); + } + }; + AbstractObserver.prototype.onError = function(error) { + if (!this.isStopped) { + this.isStopped = true; + this.error(error); + } + }; + AbstractObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + this.isStopped = true; + this.completed(); + } + }; + AbstractObserver.prototype.dispose = function() { + this.isStopped = true; + }; + AbstractObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.error(e); + return true; + } + return false; + }; + return AbstractObserver; + }(Observer)); + var AnonymousObserver = Rx.AnonymousObserver = (function(__super__) { + inherits(AnonymousObserver, __super__); + function AnonymousObserver(onNext, onError, onCompleted) { + __super__.call(this); + this._onNext = onNext; + this._onError = onError; + this._onCompleted = onCompleted; + } + AnonymousObserver.prototype.next = function(value) { + this._onNext(value); + }; + AnonymousObserver.prototype.error = function(error) { + this._onError(error); + }; + AnonymousObserver.prototype.completed = function() { + this._onCompleted(); + }; + return AnonymousObserver; + }(AbstractObserver)); + var CheckedObserver = (function(__super__) { + inherits(CheckedObserver, __super__); + function CheckedObserver(observer) { + __super__.call(this); + this._observer = observer; + this._state = 0; + } + var CheckedObserverPrototype = CheckedObserver.prototype; + CheckedObserverPrototype.onNext = function(value) { + this.checkAccess(); + var res = tryCatch(this._observer.onNext).call(this._observer, value); + this._state = 0; + res === errorObj && thrower(res.e); + }; + CheckedObserverPrototype.onError = function(err) { + this.checkAccess(); + var res = tryCatch(this._observer.onError).call(this._observer, err); + this._state = 2; + res === errorObj && thrower(res.e); + }; + CheckedObserverPrototype.onCompleted = function() { + this.checkAccess(); + var res = tryCatch(this._observer.onCompleted).call(this._observer); + this._state = 2; + res === errorObj && thrower(res.e); + }; + CheckedObserverPrototype.checkAccess = function() { + if (this._state === 1) { + throw new Error('Re-entrancy detected'); + } + if (this._state === 2) { + throw new Error('Observer completed'); + } + if (this._state === 0) { + this._state = 1; + } + }; + return CheckedObserver; + }(Observer)); + var ScheduledObserver = Rx.internals.ScheduledObserver = (function(__super__) { + inherits(ScheduledObserver, __super__); + function ScheduledObserver(scheduler, observer) { + __super__.call(this); + this.scheduler = scheduler; + this.observer = observer; + this.isAcquired = false; + this.hasFaulted = false; + this.queue = []; + this.disposable = new SerialDisposable(); + } + ScheduledObserver.prototype.next = function(value) { + var self = this; + this.queue.push(function() { + self.observer.onNext(value); + }); + }; + ScheduledObserver.prototype.error = function(e) { + var self = this; + this.queue.push(function() { + self.observer.onError(e); + }); + }; + ScheduledObserver.prototype.completed = function() { + var self = this; + this.queue.push(function() { + self.observer.onCompleted(); + }); + }; + ScheduledObserver.prototype.ensureActive = function() { + var isOwner = false, + parent = this; + if (!this.hasFaulted && this.queue.length > 0) { + isOwner = !this.isAcquired; + this.isAcquired = true; + } + if (isOwner) { + this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(self) { + var work; + if (parent.queue.length > 0) { + work = parent.queue.shift(); + } else { + parent.isAcquired = false; + return ; + } + try { + work(); + } catch (ex) { + parent.queue = []; + parent.hasFaulted = true; + throw ex; + } + self(); + })); + } + }; + ScheduledObserver.prototype.dispose = function() { + __super__.prototype.dispose.call(this); + this.disposable.dispose(); + }; + return ScheduledObserver; + }(AbstractObserver)); + var ObserveOnObserver = (function(__super__) { + inherits(ObserveOnObserver, __super__); + function ObserveOnObserver(scheduler, observer, cancel) { + __super__.call(this, scheduler, observer); + this._cancel = cancel; + } + ObserveOnObserver.prototype.next = function(value) { + __super__.prototype.next.call(this, value); + this.ensureActive(); + }; + ObserveOnObserver.prototype.error = function(e) { + __super__.prototype.error.call(this, e); + this.ensureActive(); + }; + ObserveOnObserver.prototype.completed = function() { + __super__.prototype.completed.call(this); + this.ensureActive(); + }; + ObserveOnObserver.prototype.dispose = function() { + __super__.prototype.dispose.call(this); + this._cancel && this._cancel.dispose(); + this._cancel = null; + }; + return ObserveOnObserver; + })(ScheduledObserver); + var observableProto; + var Observable = Rx.Observable = (function() { + function Observable(subscribe) { + if (Rx.config.longStackSupport && hasStacks) { + try { + throw new Error(); + } catch (e) { + this.stack = e.stack.substring(e.stack.indexOf("\n") + 1); + } + var self = this; + this._subscribe = function(observer) { + var oldOnError = observer.onError.bind(observer); + observer.onError = function(err) { + makeStackTraceLong(err, self); + oldOnError(err); + }; + return subscribe.call(self, observer); + }; + } else { + this._subscribe = subscribe; + } + } + observableProto = Observable.prototype; + observableProto.subscribe = observableProto.forEach = function(observerOrOnNext, onError, onCompleted) { + return this._subscribe(typeof observerOrOnNext === 'object' ? observerOrOnNext : observerCreate(observerOrOnNext, onError, onCompleted)); + }; + observableProto.subscribeOnNext = function(onNext, thisArg) { + return this._subscribe(observerCreate(typeof thisArg !== 'undefined' ? function(x) { + onNext.call(thisArg, x); + } : onNext)); + }; + observableProto.subscribeOnError = function(onError, thisArg) { + return this._subscribe(observerCreate(null, typeof thisArg !== 'undefined' ? function(e) { + onError.call(thisArg, e); + } : onError)); + }; + observableProto.subscribeOnCompleted = function(onCompleted, thisArg) { + return this._subscribe(observerCreate(null, null, typeof thisArg !== 'undefined' ? function() { + onCompleted.call(thisArg); + } : onCompleted)); + }; + return Observable; + })(); + var ObservableBase = Rx.ObservableBase = (function(__super__) { + inherits(ObservableBase, __super__); + function fixSubscriber(subscriber) { + return subscriber && isFunction(subscriber.dispose) ? subscriber : isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty; + } + function setDisposable(s, state) { + var ado = state[0], + self = state[1]; + var sub = tryCatch(self.subscribeCore).call(self, ado); + if (sub === errorObj) { + if (!ado.fail(errorObj.e)) { + return thrower(errorObj.e); + } + } + ado.setDisposable(fixSubscriber(sub)); + } + function subscribe(observer) { + var ado = new AutoDetachObserver(observer), + state = [ado, this]; + if (currentThreadScheduler.scheduleRequired()) { + currentThreadScheduler.scheduleWithState(state, setDisposable); + } else { + setDisposable(null, state); + } + return ado; + } + function ObservableBase() { + __super__.call(this, subscribe); + } + ObservableBase.prototype.subscribeCore = notImplemented; + return ObservableBase; + }(Observable)); + observableProto.observeOn = function(scheduler) { + var source = this; + return new AnonymousObservable(function(observer) { + return source.subscribe(new ObserveOnObserver(scheduler, observer)); + }, source); + }; + observableProto.subscribeOn = function(scheduler) { + var source = this; + return new AnonymousObservable(function(observer) { + var m = new SingleAssignmentDisposable(), + d = new SerialDisposable(); + d.setDisposable(m); + m.setDisposable(scheduler.schedule(function() { + d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(observer))); + })); + return d; + }, source); + }; + var observableFromPromise = Observable.fromPromise = function(promise) { + return observableDefer(function() { + var subject = new Rx.AsyncSubject(); + promise.then(function(value) { + subject.onNext(value); + subject.onCompleted(); + }, subject.onError.bind(subject)); + return subject; + }); + }; + observableProto.toPromise = function(promiseCtor) { + promiseCtor || (promiseCtor = Rx.config.Promise); + if (!promiseCtor) { + throw new NotSupportedError('Promise type not provided nor in Rx.config.Promise'); + } + var source = this; + return new promiseCtor(function(resolve, reject) { + var value, + hasValue = false; + source.subscribe(function(v) { + value = v; + hasValue = true; + }, reject, function() { + hasValue && resolve(value); + }); + }); + }; + var ToArrayObservable = (function(__super__) { + inherits(ToArrayObservable, __super__); + function ToArrayObservable(source) { + this.source = source; + __super__.call(this); + } + ToArrayObservable.prototype.subscribeCore = function(observer) { + return this.source.subscribe(new ToArrayObserver(observer)); + }; + return ToArrayObservable; + }(ObservableBase)); + function ToArrayObserver(observer) { + this.observer = observer; + this.a = []; + this.isStopped = false; + } + ToArrayObserver.prototype.onNext = function(x) { + if (!this.isStopped) { + this.a.push(x); + } + }; + ToArrayObserver.prototype.onError = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onError(e); + } + }; + ToArrayObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onNext(this.a); + this.observer.onCompleted(); + } + }; + ToArrayObserver.prototype.dispose = function() { + this.isStopped = true; + }; + ToArrayObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onError(e); + return true; + } + return false; + }; + observableProto.toArray = function() { + return new ToArrayObservable(this); + }; + Observable.create = Observable.createWithDisposable = function(subscribe, parent) { + return new AnonymousObservable(subscribe, parent); + }; + var observableDefer = Observable.defer = function(observableFactory) { + return new AnonymousObservable(function(observer) { + var result; + try { + result = observableFactory(); + } catch (e) { + return observableThrow(e).subscribe(observer); + } + isPromise(result) && (result = observableFromPromise(result)); + return result.subscribe(observer); + }); + }; + var observableEmpty = Observable.empty = function(scheduler) { + isScheduler(scheduler) || (scheduler = immediateScheduler); + return new AnonymousObservable(function(observer) { + return scheduler.scheduleWithState(null, function() { + observer.onCompleted(); + }); + }); + }; + var FromObservable = (function(__super__) { + inherits(FromObservable, __super__); + function FromObservable(iterable, mapper, scheduler) { + this.iterable = iterable; + this.mapper = mapper; + this.scheduler = scheduler; + __super__.call(this); + } + FromObservable.prototype.subscribeCore = function(observer) { + var sink = new FromSink(observer, this); + return sink.run(); + }; + return FromObservable; + }(ObservableBase)); + var FromSink = (function() { + function FromSink(observer, parent) { + this.observer = observer; + this.parent = parent; + } + FromSink.prototype.run = function() { + var list = Object(this.parent.iterable), + it = getIterable(list), + observer = this.observer, + mapper = this.parent.mapper; + function loopRecursive(i, recurse) { + try { + var next = it.next(); + } catch (e) { + return observer.onError(e); + } + if (next.done) { + return observer.onCompleted(); + } + var result = next.value; + if (mapper) { + try { + result = mapper(result, i); + } catch (e) { + return observer.onError(e); + } + } + observer.onNext(result); + recurse(i + 1); + } + return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive); + }; + return FromSink; + }()); + var maxSafeInteger = Math.pow(2, 53) - 1; + function StringIterable(str) { + this._s = s; + } + StringIterable.prototype[$iterator$] = function() { + return new StringIterator(this._s); + }; + function StringIterator(str) { + this._s = s; + this._l = s.length; + this._i = 0; + } + StringIterator.prototype[$iterator$] = function() { + return this; + }; + StringIterator.prototype.next = function() { + return this._i < this._l ? { + done: false, + value: this._s.charAt(this._i++) + } : doneEnumerator; + }; + function ArrayIterable(a) { + this._a = a; + } + ArrayIterable.prototype[$iterator$] = function() { + return new ArrayIterator(this._a); + }; + function ArrayIterator(a) { + this._a = a; + this._l = toLength(a); + this._i = 0; + } + ArrayIterator.prototype[$iterator$] = function() { + return this; + }; + ArrayIterator.prototype.next = function() { + return this._i < this._l ? { + done: false, + value: this._a[this._i++] + } : doneEnumerator; + }; + function numberIsFinite(value) { + return typeof value === 'number' && root.isFinite(value); + } + function isNan(n) { + return n !== n; + } + function getIterable(o) { + var i = o[$iterator$], + it; + if (!i && typeof o === 'string') { + it = new StringIterable(o); + return it[$iterator$](); + } + if (!i && o.length !== undefined) { + it = new ArrayIterable(o); + return it[$iterator$](); + } + if (!i) { + throw new TypeError('Object is not iterable'); + } + return o[$iterator$](); + } + function sign(value) { + var number = +value; + if (number === 0) { + return number; + } + if (isNaN(number)) { + return number; + } + return number < 0 ? -1 : 1; + } + function toLength(o) { + var len = +o.length; + if (isNaN(len)) { + return 0; + } + if (len === 0 || !numberIsFinite(len)) { + return len; + } + len = sign(len) * Math.floor(Math.abs(len)); + if (len <= 0) { + return 0; + } + if (len > maxSafeInteger) { + return maxSafeInteger; + } + return len; + } + var observableFrom = Observable.from = function(iterable, mapFn, thisArg, scheduler) { + if (iterable == null) { + throw new Error('iterable cannot be null.'); + } + if (mapFn && !isFunction(mapFn)) { + throw new Error('mapFn when provided must be a function'); + } + if (mapFn) { + var mapper = bindCallback(mapFn, thisArg, 2); + } + isScheduler(scheduler) || (scheduler = currentThreadScheduler); + return new FromObservable(iterable, mapper, scheduler); + }; + var FromArrayObservable = (function(__super__) { + inherits(FromArrayObservable, __super__); + function FromArrayObservable(args, scheduler) { + this.args = args; + this.scheduler = scheduler; + __super__.call(this); + } + FromArrayObservable.prototype.subscribeCore = function(observer) { + var sink = new FromArraySink(observer, this); + return sink.run(); + }; + return FromArrayObservable; + }(ObservableBase)); + function FromArraySink(observer, parent) { + this.observer = observer; + this.parent = parent; + } + FromArraySink.prototype.run = function() { + var observer = this.observer, + args = this.parent.args, + len = args.length; + function loopRecursive(i, recurse) { + if (i < len) { + observer.onNext(args[i]); + recurse(i + 1); + } else { + observer.onCompleted(); + } + } + return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive); + }; + var observableFromArray = Observable.fromArray = function(array, scheduler) { + isScheduler(scheduler) || (scheduler = currentThreadScheduler); + return new FromArrayObservable(array, scheduler); + }; + Observable.generate = function(initialState, condition, iterate, resultSelector, scheduler) { + isScheduler(scheduler) || (scheduler = currentThreadScheduler); + return new AnonymousObservable(function(o) { + var first = true; + return scheduler.scheduleRecursiveWithState(initialState, function(state, self) { + var hasResult, + result; + try { + if (first) { + first = false; + } else { + state = iterate(state); + } + hasResult = condition(state); + hasResult && (result = resultSelector(state)); + } catch (e) { + return o.onError(e); + } + if (hasResult) { + o.onNext(result); + self(state); + } else { + o.onCompleted(); + } + }); + }); + }; + var observableNever = Observable.never = function() { + return new AnonymousObservable(function() { + return disposableEmpty; + }); + }; + function observableOf(scheduler, array) { + isScheduler(scheduler) || (scheduler = currentThreadScheduler); + return new FromArrayObservable(array, scheduler); + } + Observable.of = function() { + var len = arguments.length, + args = new Array(len); + for (var i = 0; i < len; i++) { + args[i] = arguments[i]; + } + return new FromArrayObservable(args, currentThreadScheduler); + }; + Observable.ofWithScheduler = function(scheduler) { + var len = arguments.length, + args = new Array(len - 1); + for (var i = 1; i < len; i++) { + args[i - 1] = arguments[i]; + } + return new FromArrayObservable(args, scheduler); + }; + Observable.pairs = function(obj, scheduler) { + scheduler || (scheduler = Rx.Scheduler.currentThread); + return new AnonymousObservable(function(observer) { + var keys = Object.keys(obj), + len = keys.length; + return scheduler.scheduleRecursiveWithState(0, function(idx, self) { + if (idx < len) { + var key = keys[idx]; + observer.onNext([key, obj[key]]); + self(idx + 1); + } else { + observer.onCompleted(); + } + }); + }); + }; + var RangeObservable = (function(__super__) { + inherits(RangeObservable, __super__); + function RangeObservable(start, count, scheduler) { + this.start = start; + this.count = count; + this.scheduler = scheduler; + __super__.call(this); + } + RangeObservable.prototype.subscribeCore = function(observer) { + var sink = new RangeSink(observer, this); + return sink.run(); + }; + return RangeObservable; + }(ObservableBase)); + var RangeSink = (function() { + function RangeSink(observer, parent) { + this.observer = observer; + this.parent = parent; + } + RangeSink.prototype.run = function() { + var start = this.parent.start, + count = this.parent.count, + observer = this.observer; + function loopRecursive(i, recurse) { + if (i < count) { + observer.onNext(start + i); + recurse(i + 1); + } else { + observer.onCompleted(); + } + } + return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive); + }; + return RangeSink; + }()); + Observable.range = function(start, count, scheduler) { + isScheduler(scheduler) || (scheduler = currentThreadScheduler); + return new RangeObservable(start, count, scheduler); + }; + Observable.repeat = function(value, repeatCount, scheduler) { + isScheduler(scheduler) || (scheduler = currentThreadScheduler); + return observableReturn(value, scheduler).repeat(repeatCount == null ? -1 : repeatCount); + }; + var observableReturn = Observable['return'] = Observable.just = Observable.returnValue = function(value, scheduler) { + isScheduler(scheduler) || (scheduler = immediateScheduler); + return new AnonymousObservable(function(o) { + return scheduler.scheduleWithState(value, function(_, v) { + o.onNext(v); + o.onCompleted(); + }); + }); + }; + var observableThrow = Observable['throw'] = Observable.throwError = function(error, scheduler) { + isScheduler(scheduler) || (scheduler = immediateScheduler); + return new AnonymousObservable(function(observer) { + return scheduler.schedule(function() { + observer.onError(error); + }); + }); + }; + Observable.throwException = function() { + return Observable.throwError.apply(null, arguments); + }; + Observable.using = function(resourceFactory, observableFactory) { + return new AnonymousObservable(function(observer) { + var disposable = disposableEmpty, + resource, + source; + try { + resource = resourceFactory(); + resource && (disposable = resource); + source = observableFactory(resource); + } catch (exception) { + return new CompositeDisposable(observableThrow(exception).subscribe(observer), disposable); + } + return new CompositeDisposable(source.subscribe(observer), disposable); + }); + }; + observableProto.amb = function(rightSource) { + var leftSource = this; + return new AnonymousObservable(function(observer) { + var choice, + leftChoice = 'L', + rightChoice = 'R', + leftSubscription = new SingleAssignmentDisposable(), + rightSubscription = new SingleAssignmentDisposable(); + isPromise(rightSource) && (rightSource = observableFromPromise(rightSource)); + function choiceL() { + if (!choice) { + choice = leftChoice; + rightSubscription.dispose(); + } + } + function choiceR() { + if (!choice) { + choice = rightChoice; + leftSubscription.dispose(); + } + } + leftSubscription.setDisposable(leftSource.subscribe(function(left) { + choiceL(); + if (choice === leftChoice) { + observer.onNext(left); + } + }, function(err) { + choiceL(); + if (choice === leftChoice) { + observer.onError(err); + } + }, function() { + choiceL(); + if (choice === leftChoice) { + observer.onCompleted(); + } + })); + rightSubscription.setDisposable(rightSource.subscribe(function(right) { + choiceR(); + if (choice === rightChoice) { + observer.onNext(right); + } + }, function(err) { + choiceR(); + if (choice === rightChoice) { + observer.onError(err); + } + }, function() { + choiceR(); + if (choice === rightChoice) { + observer.onCompleted(); + } + })); + return new CompositeDisposable(leftSubscription, rightSubscription); + }); + }; + Observable.amb = function() { + var acc = observableNever(), + items = []; + if (Array.isArray(arguments[0])) { + items = arguments[0]; + } else { + for (var i = 0, + len = arguments.length; i < len; i++) { + items.push(arguments[i]); + } + } + function func(previous, current) { + return previous.amb(current); + } + for (var i = 0, + len = items.length; i < len; i++) { + acc = func(acc, items[i]); + } + return acc; + }; + function observableCatchHandler(source, handler) { + return new AnonymousObservable(function(o) { + var d1 = new SingleAssignmentDisposable(), + subscription = new SerialDisposable(); + subscription.setDisposable(d1); + d1.setDisposable(source.subscribe(function(x) { + o.onNext(x); + }, function(e) { + try { + var result = handler(e); + } catch (ex) { + return o.onError(ex); + } + isPromise(result) && (result = observableFromPromise(result)); + var d = new SingleAssignmentDisposable(); + subscription.setDisposable(d); + d.setDisposable(result.subscribe(o)); + }, function(x) { + o.onCompleted(x); + })); + return subscription; + }, source); + } + observableProto['catch'] = observableProto.catchError = observableProto.catchException = function(handlerOrSecond) { + return typeof handlerOrSecond === 'function' ? observableCatchHandler(this, handlerOrSecond) : observableCatch([this, handlerOrSecond]); + }; + var observableCatch = Observable.catchError = Observable['catch'] = Observable.catchException = function() { + var items = []; + if (Array.isArray(arguments[0])) { + items = arguments[0]; + } else { + for (var i = 0, + len = arguments.length; i < len; i++) { + items.push(arguments[i]); + } + } + return enumerableOf(items).catchError(); + }; + observableProto.combineLatest = function() { + var len = arguments.length, + args = new Array(len); + for (var i = 0; i < len; i++) { + args[i] = arguments[i]; + } + if (Array.isArray(args[0])) { + args[0].unshift(this); + } else { + args.unshift(this); + } + return combineLatest.apply(this, args); + }; + var combineLatest = Observable.combineLatest = function() { + var len = arguments.length, + args = new Array(len); + for (var i = 0; i < len; i++) { + args[i] = arguments[i]; + } + var resultSelector = args.pop(); + Array.isArray(args[0]) && (args = args[0]); + return new AnonymousObservable(function(o) { + var n = args.length, + falseFactory = function() { + return false; + }, + hasValue = arrayInitialize(n, falseFactory), + hasValueAll = false, + isDone = arrayInitialize(n, falseFactory), + values = new Array(n); + function next(i) { + hasValue[i] = true; + if (hasValueAll || (hasValueAll = hasValue.every(identity))) { + try { + var res = resultSelector.apply(null, values); + } catch (e) { + return o.onError(e); + } + o.onNext(res); + } else if (isDone.filter(function(x, j) { + return j !== i; + }).every(identity)) { + o.onCompleted(); + } + } + function done(i) { + isDone[i] = true; + isDone.every(identity) && o.onCompleted(); + } + var subscriptions = new Array(n); + for (var idx = 0; idx < n; idx++) { + (function(i) { + var source = args[i], + sad = new SingleAssignmentDisposable(); + isPromise(source) && (source = observableFromPromise(source)); + sad.setDisposable(source.subscribe(function(x) { + values[i] = x; + next(i); + }, function(e) { + o.onError(e); + }, function() { + done(i); + })); + subscriptions[i] = sad; + }(idx)); + } + return new CompositeDisposable(subscriptions); + }, this); + }; + observableProto.concat = function() { + for (var args = [], + i = 0, + len = arguments.length; i < len; i++) { + args.push(arguments[i]); + } + args.unshift(this); + return observableConcat.apply(null, args); + }; + var observableConcat = Observable.concat = function() { + var args; + if (Array.isArray(arguments[0])) { + args = arguments[0]; + } else { + args = new Array(arguments.length); + for (var i = 0, + len = arguments.length; i < len; i++) { + args[i] = arguments[i]; + } + } + return enumerableOf(args).concat(); + }; + observableProto.concatAll = observableProto.concatObservable = function() { + return this.merge(1); + }; + var MergeObservable = (function(__super__) { + inherits(MergeObservable, __super__); + function MergeObservable(source, maxConcurrent) { + this.source = source; + this.maxConcurrent = maxConcurrent; + __super__.call(this); + } + MergeObservable.prototype.subscribeCore = function(observer) { + var g = new CompositeDisposable(); + g.add(this.source.subscribe(new MergeObserver(observer, this.maxConcurrent, g))); + return g; + }; + return MergeObservable; + }(ObservableBase)); + var MergeObserver = (function() { + function MergeObserver(o, max, g) { + this.o = o; + this.max = max; + this.g = g; + this.done = false; + this.q = []; + this.activeCount = 0; + this.isStopped = false; + } + MergeObserver.prototype.handleSubscribe = function(xs) { + var sad = new SingleAssignmentDisposable(); + this.g.add(sad); + isPromise(xs) && (xs = observableFromPromise(xs)); + sad.setDisposable(xs.subscribe(new InnerObserver(this, sad))); + }; + MergeObserver.prototype.onNext = function(innerSource) { + if (this.isStopped) { + return ; + } + if (this.activeCount < this.max) { + this.activeCount++; + this.handleSubscribe(innerSource); + } else { + this.q.push(innerSource); + } + }; + MergeObserver.prototype.onError = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.o.onError(e); + } + }; + MergeObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + this.isStopped = true; + this.done = true; + this.activeCount === 0 && this.o.onCompleted(); + } + }; + MergeObserver.prototype.dispose = function() { + this.isStopped = true; + }; + MergeObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.o.onError(e); + return true; + } + return false; + }; + function InnerObserver(parent, sad) { + this.parent = parent; + this.sad = sad; + this.isStopped = false; + } + InnerObserver.prototype.onNext = function(x) { + if (!this.isStopped) { + this.parent.o.onNext(x); + } + }; + InnerObserver.prototype.onError = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.parent.o.onError(e); + } + }; + InnerObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + this.isStopped = true; + var parent = this.parent; + parent.g.remove(this.sad); + if (parent.q.length > 0) { + parent.handleSubscribe(parent.q.shift()); + } else { + parent.activeCount--; + parent.done && parent.activeCount === 0 && parent.o.onCompleted(); + } + } + }; + InnerObserver.prototype.dispose = function() { + this.isStopped = true; + }; + InnerObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.parent.o.onError(e); + return true; + } + return false; + }; + return MergeObserver; + }()); + observableProto.merge = function(maxConcurrentOrOther) { + return typeof maxConcurrentOrOther !== 'number' ? observableMerge(this, maxConcurrentOrOther) : new MergeObservable(this, maxConcurrentOrOther); + }; + var observableMerge = Observable.merge = function() { + var scheduler, + sources = [], + i, + len = arguments.length; + if (!arguments[0]) { + scheduler = immediateScheduler; + for (i = 1; i < len; i++) { + sources.push(arguments[i]); + } + } else if (isScheduler(arguments[0])) { + scheduler = arguments[0]; + for (i = 1; i < len; i++) { + sources.push(arguments[i]); + } + } else { + scheduler = immediateScheduler; + for (i = 0; i < len; i++) { + sources.push(arguments[i]); + } + } + if (Array.isArray(sources[0])) { + sources = sources[0]; + } + return observableOf(scheduler, sources).mergeAll(); + }; + var CompositeError = Rx.CompositeError = function(errors) { + this.name = "NotImplementedError"; + this.innerErrors = errors; + this.message = 'This contains multiple errors. Check the innerErrors'; + Error.call(this); + }; + CompositeError.prototype = Error.prototype; + Observable.mergeDelayError = function() { + var args; + if (Array.isArray(arguments[0])) { + args = arguments[0]; + } else { + var len = arguments.length; + args = new Array(len); + for (var i = 0; i < len; i++) { + args[i] = arguments[i]; + } + } + var source = observableOf(null, args); + return new AnonymousObservable(function(o) { + var group = new CompositeDisposable(), + m = new SingleAssignmentDisposable(), + isStopped = false, + errors = []; + function setCompletion() { + if (errors.length === 0) { + o.onCompleted(); + } else if (errors.length === 1) { + o.onError(errors[0]); + } else { + o.onError(new CompositeError(errors)); + } + } + group.add(m); + m.setDisposable(source.subscribe(function(innerSource) { + var innerSubscription = new SingleAssignmentDisposable(); + group.add(innerSubscription); + isPromise(innerSource) && (innerSource = observableFromPromise(innerSource)); + innerSubscription.setDisposable(innerSource.subscribe(function(x) { + o.onNext(x); + }, function(e) { + errors.push(e); + group.remove(innerSubscription); + isStopped && group.length === 1 && setCompletion(); + }, function() { + group.remove(innerSubscription); + isStopped && group.length === 1 && setCompletion(); + })); + }, function(e) { + errors.push(e); + isStopped = true; + group.length === 1 && setCompletion(); + }, function() { + isStopped = true; + group.length === 1 && setCompletion(); + })); + return group; + }); + }; + var MergeAllObservable = (function(__super__) { + inherits(MergeAllObservable, __super__); + function MergeAllObservable(source) { + this.source = source; + __super__.call(this); + } + MergeAllObservable.prototype.subscribeCore = function(observer) { + var g = new CompositeDisposable(), + m = new SingleAssignmentDisposable(); + g.add(m); + m.setDisposable(this.source.subscribe(new MergeAllObserver(observer, g))); + return g; + }; + return MergeAllObservable; + }(ObservableBase)); + var MergeAllObserver = (function() { + function MergeAllObserver(o, g) { + this.o = o; + this.g = g; + this.isStopped = false; + this.done = false; + } + MergeAllObserver.prototype.onNext = function(innerSource) { + if (this.isStopped) { + return ; + } + var sad = new SingleAssignmentDisposable(); + this.g.add(sad); + isPromise(innerSource) && (innerSource = observableFromPromise(innerSource)); + sad.setDisposable(innerSource.subscribe(new InnerObserver(this, this.g, sad))); + }; + MergeAllObserver.prototype.onError = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.o.onError(e); + } + }; + MergeAllObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + this.isStopped = true; + this.done = true; + this.g.length === 1 && this.o.onCompleted(); + } + }; + MergeAllObserver.prototype.dispose = function() { + this.isStopped = true; + }; + MergeAllObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.o.onError(e); + return true; + } + return false; + }; + function InnerObserver(parent, g, sad) { + this.parent = parent; + this.g = g; + this.sad = sad; + this.isStopped = false; + } + InnerObserver.prototype.onNext = function(x) { + if (!this.isStopped) { + this.parent.o.onNext(x); + } + }; + InnerObserver.prototype.onError = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.parent.o.onError(e); + } + }; + InnerObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + var parent = this.parent; + this.isStopped = true; + parent.g.remove(this.sad); + parent.done && parent.g.length === 1 && parent.o.onCompleted(); + } + }; + InnerObserver.prototype.dispose = function() { + this.isStopped = true; + }; + InnerObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.parent.o.onError(e); + return true; + } + return false; + }; + return MergeAllObserver; + }()); + observableProto.mergeAll = observableProto.mergeObservable = function() { + return new MergeAllObservable(this); + }; + observableProto.onErrorResumeNext = function(second) { + if (!second) { + throw new Error('Second observable is required'); + } + return onErrorResumeNext([this, second]); + }; + var onErrorResumeNext = Observable.onErrorResumeNext = function() { + var sources = []; + if (Array.isArray(arguments[0])) { + sources = arguments[0]; + } else { + for (var i = 0, + len = arguments.length; i < len; i++) { + sources.push(arguments[i]); + } + } + return new AnonymousObservable(function(observer) { + var pos = 0, + subscription = new SerialDisposable(), + cancelable = immediateScheduler.scheduleRecursive(function(self) { + var current, + d; + if (pos < sources.length) { + current = sources[pos++]; + isPromise(current) && (current = observableFromPromise(current)); + d = new SingleAssignmentDisposable(); + subscription.setDisposable(d); + d.setDisposable(current.subscribe(observer.onNext.bind(observer), self, self)); + } else { + observer.onCompleted(); + } + }); + return new CompositeDisposable(subscription, cancelable); + }); + }; + observableProto.skipUntil = function(other) { + var source = this; + return new AnonymousObservable(function(o) { + var isOpen = false; + var disposables = new CompositeDisposable(source.subscribe(function(left) { + isOpen && o.onNext(left); + }, function(e) { + o.onError(e); + }, function() { + isOpen && o.onCompleted(); + })); + isPromise(other) && (other = observableFromPromise(other)); + var rightSubscription = new SingleAssignmentDisposable(); + disposables.add(rightSubscription); + rightSubscription.setDisposable(other.subscribe(function() { + isOpen = true; + rightSubscription.dispose(); + }, function(e) { + o.onError(e); + }, function() { + rightSubscription.dispose(); + })); + return disposables; + }, source); + }; + observableProto['switch'] = observableProto.switchLatest = function() { + var sources = this; + return new AnonymousObservable(function(observer) { + var hasLatest = false, + innerSubscription = new SerialDisposable(), + isStopped = false, + latest = 0, + subscription = sources.subscribe(function(innerSource) { + var d = new SingleAssignmentDisposable(), + id = ++latest; + hasLatest = true; + innerSubscription.setDisposable(d); + isPromise(innerSource) && (innerSource = observableFromPromise(innerSource)); + d.setDisposable(innerSource.subscribe(function(x) { + latest === id && observer.onNext(x); + }, function(e) { + latest === id && observer.onError(e); + }, function() { + if (latest === id) { + hasLatest = false; + isStopped && observer.onCompleted(); + } + })); + }, function(e) { + observer.onError(e); + }, function() { + isStopped = true; + !hasLatest && observer.onCompleted(); + }); + return new CompositeDisposable(subscription, innerSubscription); + }, sources); + }; + observableProto.takeUntil = function(other) { + var source = this; + return new AnonymousObservable(function(o) { + isPromise(other) && (other = observableFromPromise(other)); + return new CompositeDisposable(source.subscribe(o), other.subscribe(function() { + o.onCompleted(); + }, function(e) { + o.onError(e); + }, noop)); + }, source); + }; + observableProto.withLatestFrom = function() { + var len = arguments.length, + args = new Array(len); + for (var i = 0; i < len; i++) { + args[i] = arguments[i]; + } + var resultSelector = args.pop(), + source = this; + if (typeof source === 'undefined') { + throw new Error('Source observable not found for withLatestFrom().'); + } + if (typeof resultSelector !== 'function') { + throw new Error('withLatestFrom() expects a resultSelector function.'); + } + if (Array.isArray(args[0])) { + args = args[0]; + } + return new AnonymousObservable(function(observer) { + var falseFactory = function() { + return false; + }, + n = args.length, + hasValue = arrayInitialize(n, falseFactory), + hasValueAll = false, + values = new Array(n); + var subscriptions = new Array(n + 1); + for (var idx = 0; idx < n; idx++) { + (function(i) { + var other = args[i], + sad = new SingleAssignmentDisposable(); + isPromise(other) && (other = observableFromPromise(other)); + sad.setDisposable(other.subscribe(function(x) { + values[i] = x; + hasValue[i] = true; + hasValueAll = hasValue.every(identity); + }, observer.onError.bind(observer), function() {})); + subscriptions[i] = sad; + }(idx)); + } + var sad = new SingleAssignmentDisposable(); + sad.setDisposable(source.subscribe(function(x) { + var res; + var allValues = [x].concat(values); + if (!hasValueAll) + return ; + try { + res = resultSelector.apply(null, allValues); + } catch (ex) { + observer.onError(ex); + return ; + } + observer.onNext(res); + }, observer.onError.bind(observer), function() { + observer.onCompleted(); + })); + subscriptions[n] = sad; + return new CompositeDisposable(subscriptions); + }, this); + }; + function zipArray(second, resultSelector) { + var first = this; + return new AnonymousObservable(function(observer) { + var index = 0, + len = second.length; + return first.subscribe(function(left) { + if (index < len) { + var right = second[index++], + result; + try { + result = resultSelector(left, right); + } catch (e) { + return observer.onError(e); + } + observer.onNext(result); + } else { + observer.onCompleted(); + } + }, function(e) { + observer.onError(e); + }, function() { + observer.onCompleted(); + }); + }, first); + } + function falseFactory() { + return false; + } + function emptyArrayFactory() { + return []; + } + observableProto.zip = function() { + if (Array.isArray(arguments[0])) { + return zipArray.apply(this, arguments); + } + var len = arguments.length, + args = new Array(len); + for (var i = 0; i < len; i++) { + args[i] = arguments[i]; + } + var parent = this, + resultSelector = args.pop(); + args.unshift(parent); + return new AnonymousObservable(function(observer) { + var n = args.length, + queues = arrayInitialize(n, emptyArrayFactory), + isDone = arrayInitialize(n, falseFactory); + function next(i) { + var res, + queuedValues; + if (queues.every(function(x) { + return x.length > 0; + })) { + try { + queuedValues = queues.map(function(x) { + return x.shift(); + }); + res = resultSelector.apply(parent, queuedValues); + } catch (ex) { + observer.onError(ex); + return ; + } + observer.onNext(res); + } else if (isDone.filter(function(x, j) { + return j !== i; + }).every(identity)) { + observer.onCompleted(); + } + } + ; + function done(i) { + isDone[i] = true; + if (isDone.every(function(x) { + return x; + })) { + observer.onCompleted(); + } + } + var subscriptions = new Array(n); + for (var idx = 0; idx < n; idx++) { + (function(i) { + var source = args[i], + sad = new SingleAssignmentDisposable(); + isPromise(source) && (source = observableFromPromise(source)); + sad.setDisposable(source.subscribe(function(x) { + queues[i].push(x); + next(i); + }, function(e) { + observer.onError(e); + }, function() { + done(i); + })); + subscriptions[i] = sad; + })(idx); + } + return new CompositeDisposable(subscriptions); + }, parent); + }; + Observable.zip = function() { + var len = arguments.length, + args = new Array(len); + for (var i = 0; i < len; i++) { + args[i] = arguments[i]; + } + var first = args.shift(); + return first.zip.apply(first, args); + }; + Observable.zipArray = function() { + var sources; + if (Array.isArray(arguments[0])) { + sources = arguments[0]; + } else { + var len = arguments.length; + sources = new Array(len); + for (var i = 0; i < len; i++) { + sources[i] = arguments[i]; + } + } + return new AnonymousObservable(function(observer) { + var n = sources.length, + queues = arrayInitialize(n, function() { + return []; + }), + isDone = arrayInitialize(n, function() { + return false; + }); + function next(i) { + if (queues.every(function(x) { + return x.length > 0; + })) { + var res = queues.map(function(x) { + return x.shift(); + }); + observer.onNext(res); + } else if (isDone.filter(function(x, j) { + return j !== i; + }).every(identity)) { + observer.onCompleted(); + return ; + } + } + ; + function done(i) { + isDone[i] = true; + if (isDone.every(identity)) { + observer.onCompleted(); + return ; + } + } + var subscriptions = new Array(n); + for (var idx = 0; idx < n; idx++) { + (function(i) { + subscriptions[i] = new SingleAssignmentDisposable(); + subscriptions[i].setDisposable(sources[i].subscribe(function(x) { + queues[i].push(x); + next(i); + }, function(e) { + observer.onError(e); + }, function() { + done(i); + })); + })(idx); + } + return new CompositeDisposable(subscriptions); + }); + }; + observableProto.asObservable = function() { + var source = this; + return new AnonymousObservable(function(o) { + return source.subscribe(o); + }, this); + }; + observableProto.bufferWithCount = function(count, skip) { + if (typeof skip !== 'number') { + skip = count; + } + return this.windowWithCount(count, skip).selectMany(function(x) { + return x.toArray(); + }).where(function(x) { + return x.length > 0; + }); + }; + observableProto.dematerialize = function() { + var source = this; + return new AnonymousObservable(function(o) { + return source.subscribe(function(x) { + return x.accept(o); + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, this); + }; + observableProto.distinctUntilChanged = function(keySelector, comparer) { + var source = this; + comparer || (comparer = defaultComparer); + return new AnonymousObservable(function(o) { + var hasCurrentKey = false, + currentKey; + return source.subscribe(function(value) { + var key = value; + if (keySelector) { + try { + key = keySelector(value); + } catch (e) { + o.onError(e); + return ; + } + } + if (hasCurrentKey) { + try { + var comparerEquals = comparer(currentKey, key); + } catch (e) { + o.onError(e); + return ; + } + } + if (!hasCurrentKey || !comparerEquals) { + hasCurrentKey = true; + currentKey = key; + o.onNext(value); + } + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, this); + }; + observableProto['do'] = observableProto.tap = observableProto.doAction = function(observerOrOnNext, onError, onCompleted) { + var source = this; + return new AnonymousObservable(function(observer) { + var tapObserver = !observerOrOnNext || isFunction(observerOrOnNext) ? observerCreate(observerOrOnNext || noop, onError || noop, onCompleted || noop) : observerOrOnNext; + return source.subscribe(function(x) { + try { + tapObserver.onNext(x); + } catch (e) { + observer.onError(e); + } + observer.onNext(x); + }, function(err) { + try { + tapObserver.onError(err); + } catch (e) { + observer.onError(e); + } + observer.onError(err); + }, function() { + try { + tapObserver.onCompleted(); + } catch (e) { + observer.onError(e); + } + observer.onCompleted(); + }); + }, this); + }; + observableProto.doOnNext = observableProto.tapOnNext = function(onNext, thisArg) { + return this.tap(typeof thisArg !== 'undefined' ? function(x) { + onNext.call(thisArg, x); + } : onNext); + }; + observableProto.doOnError = observableProto.tapOnError = function(onError, thisArg) { + return this.tap(noop, typeof thisArg !== 'undefined' ? function(e) { + onError.call(thisArg, e); + } : onError); + }; + observableProto.doOnCompleted = observableProto.tapOnCompleted = function(onCompleted, thisArg) { + return this.tap(noop, null, typeof thisArg !== 'undefined' ? function() { + onCompleted.call(thisArg); + } : onCompleted); + }; + observableProto['finally'] = observableProto.ensure = function(action) { + var source = this; + return new AnonymousObservable(function(observer) { + var subscription; + try { + subscription = source.subscribe(observer); + } catch (e) { + action(); + throw e; + } + return disposableCreate(function() { + try { + subscription.dispose(); + } catch (e) { + throw e; + } finally { + action(); + } + }); + }, this); + }; + observableProto.finallyAction = function(action) { + return this.ensure(action); + }; + observableProto.ignoreElements = function() { + var source = this; + return new AnonymousObservable(function(o) { + return source.subscribe(noop, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, source); + }; + observableProto.materialize = function() { + var source = this; + return new AnonymousObservable(function(observer) { + return source.subscribe(function(value) { + observer.onNext(notificationCreateOnNext(value)); + }, function(e) { + observer.onNext(notificationCreateOnError(e)); + observer.onCompleted(); + }, function() { + observer.onNext(notificationCreateOnCompleted()); + observer.onCompleted(); + }); + }, source); + }; + observableProto.repeat = function(repeatCount) { + return enumerableRepeat(this, repeatCount).concat(); + }; + observableProto.retry = function(retryCount) { + return enumerableRepeat(this, retryCount).catchError(); + }; + observableProto.retryWhen = function(notifier) { + return enumerableRepeat(this).catchErrorWhen(notifier); + }; + observableProto.scan = function() { + var hasSeed = false, + seed, + accumulator, + source = this; + if (arguments.length === 2) { + hasSeed = true; + seed = arguments[0]; + accumulator = arguments[1]; + } else { + accumulator = arguments[0]; + } + return new AnonymousObservable(function(o) { + var hasAccumulation, + accumulation, + hasValue; + return source.subscribe(function(x) { + !hasValue && (hasValue = true); + try { + if (hasAccumulation) { + accumulation = accumulator(accumulation, x); + } else { + accumulation = hasSeed ? accumulator(seed, x) : x; + hasAccumulation = true; + } + } catch (e) { + o.onError(e); + return ; + } + o.onNext(accumulation); + }, function(e) { + o.onError(e); + }, function() { + !hasValue && hasSeed && o.onNext(seed); + o.onCompleted(); + }); + }, source); + }; + observableProto.skipLast = function(count) { + if (count < 0) { + throw new ArgumentOutOfRangeError(); + } + var source = this; + return new AnonymousObservable(function(o) { + var q = []; + return source.subscribe(function(x) { + q.push(x); + q.length > count && o.onNext(q.shift()); + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, source); + }; + observableProto.startWith = function() { + var values, + scheduler, + start = 0; + if (!!arguments.length && isScheduler(arguments[0])) { + scheduler = arguments[0]; + start = 1; + } else { + scheduler = immediateScheduler; + } + for (var args = [], + i = start, + len = arguments.length; i < len; i++) { + args.push(arguments[i]); + } + return enumerableOf([observableFromArray(args, scheduler), this]).concat(); + }; + observableProto.takeLast = function(count) { + if (count < 0) { + throw new ArgumentOutOfRangeError(); + } + var source = this; + return new AnonymousObservable(function(o) { + var q = []; + return source.subscribe(function(x) { + q.push(x); + q.length > count && q.shift(); + }, function(e) { + o.onError(e); + }, function() { + while (q.length > 0) { + o.onNext(q.shift()); + } + o.onCompleted(); + }); + }, source); + }; + observableProto.takeLastBuffer = function(count) { + var source = this; + return new AnonymousObservable(function(o) { + var q = []; + return source.subscribe(function(x) { + q.push(x); + q.length > count && q.shift(); + }, function(e) { + o.onError(e); + }, function() { + o.onNext(q); + o.onCompleted(); + }); + }, source); + }; + observableProto.windowWithCount = function(count, skip) { + var source = this; + +count || (count = 0); + Math.abs(count) === Infinity && (count = 0); + if (count <= 0) { + throw new ArgumentOutOfRangeError(); + } + skip == null && (skip = count); + +skip || (skip = 0); + Math.abs(skip) === Infinity && (skip = 0); + if (skip <= 0) { + throw new ArgumentOutOfRangeError(); + } + return new AnonymousObservable(function(observer) { + var m = new SingleAssignmentDisposable(), + refCountDisposable = new RefCountDisposable(m), + n = 0, + q = []; + function createWindow() { + var s = new Subject(); + q.push(s); + observer.onNext(addRef(s, refCountDisposable)); + } + createWindow(); + m.setDisposable(source.subscribe(function(x) { + for (var i = 0, + len = q.length; i < len; i++) { + q[i].onNext(x); + } + var c = n - count + 1; + c >= 0 && c % skip === 0 && q.shift().onCompleted(); + ++n % skip === 0 && createWindow(); + }, function(e) { + while (q.length > 0) { + q.shift().onError(e); + } + observer.onError(e); + }, function() { + while (q.length > 0) { + q.shift().onCompleted(); + } + observer.onCompleted(); + })); + return refCountDisposable; + }, source); + }; + function concatMap(source, selector, thisArg) { + var selectorFunc = bindCallback(selector, thisArg, 3); + return source.map(function(x, i) { + var result = selectorFunc(x, i, source); + isPromise(result) && (result = observableFromPromise(result)); + (isArrayLike(result) || isIterable(result)) && (result = observableFrom(result)); + return result; + }).concatAll(); + } + observableProto.selectConcat = observableProto.concatMap = function(selector, resultSelector, thisArg) { + if (isFunction(selector) && isFunction(resultSelector)) { + return this.concatMap(function(x, i) { + var selectorResult = selector(x, i); + isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult)); + (isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult)); + return selectorResult.map(function(y, i2) { + return resultSelector(x, y, i, i2); + }); + }); + } + return isFunction(selector) ? concatMap(this, selector, thisArg) : concatMap(this, function() { + return selector; + }); + }; + observableProto.concatMapObserver = observableProto.selectConcatObserver = function(onNext, onError, onCompleted, thisArg) { + var source = this, + onNextFunc = bindCallback(onNext, thisArg, 2), + onErrorFunc = bindCallback(onError, thisArg, 1), + onCompletedFunc = bindCallback(onCompleted, thisArg, 0); + return new AnonymousObservable(function(observer) { + var index = 0; + return source.subscribe(function(x) { + var result; + try { + result = onNextFunc(x, index++); + } catch (e) { + observer.onError(e); + return ; + } + isPromise(result) && (result = observableFromPromise(result)); + observer.onNext(result); + }, function(err) { + var result; + try { + result = onErrorFunc(err); + } catch (e) { + observer.onError(e); + return ; + } + isPromise(result) && (result = observableFromPromise(result)); + observer.onNext(result); + observer.onCompleted(); + }, function() { + var result; + try { + result = onCompletedFunc(); + } catch (e) { + observer.onError(e); + return ; + } + isPromise(result) && (result = observableFromPromise(result)); + observer.onNext(result); + observer.onCompleted(); + }); + }, this).concatAll(); + }; + observableProto.defaultIfEmpty = function(defaultValue) { + var source = this; + defaultValue === undefined && (defaultValue = null); + return new AnonymousObservable(function(observer) { + var found = false; + return source.subscribe(function(x) { + found = true; + observer.onNext(x); + }, function(e) { + observer.onError(e); + }, function() { + !found && observer.onNext(defaultValue); + observer.onCompleted(); + }); + }, source); + }; + function arrayIndexOfComparer(array, item, comparer) { + for (var i = 0, + len = array.length; i < len; i++) { + if (comparer(array[i], item)) { + return i; + } + } + return -1; + } + function HashSet(comparer) { + this.comparer = comparer; + this.set = []; + } + HashSet.prototype.push = function(value) { + var retValue = arrayIndexOfComparer(this.set, value, this.comparer) === -1; + retValue && this.set.push(value); + return retValue; + }; + observableProto.distinct = function(keySelector, comparer) { + var source = this; + comparer || (comparer = defaultComparer); + return new AnonymousObservable(function(o) { + var hashSet = new HashSet(comparer); + return source.subscribe(function(x) { + var key = x; + if (keySelector) { + try { + key = keySelector(x); + } catch (e) { + o.onError(e); + return ; + } + } + hashSet.push(key) && o.onNext(x); + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, this); + }; + var MapObservable = (function(__super__) { + inherits(MapObservable, __super__); + function MapObservable(source, selector, thisArg) { + this.source = source; + this.selector = bindCallback(selector, thisArg, 3); + __super__.call(this); + } + MapObservable.prototype.internalMap = function(selector, thisArg) { + var self = this; + return new MapObservable(this.source, function(x, i, o) { + return selector.call(this, self.selector(x, i, o), i, o); + }, thisArg); + }; + MapObservable.prototype.subscribeCore = function(observer) { + return this.source.subscribe(new MapObserver(observer, this.selector, this)); + }; + return MapObservable; + }(ObservableBase)); + function MapObserver(observer, selector, source) { + this.observer = observer; + this.selector = selector; + this.source = source; + this.i = 0; + this.isStopped = false; + } + MapObserver.prototype.onNext = function(x) { + if (this.isStopped) { + return ; + } + var result = tryCatch(this.selector).call(this, x, this.i++, this.source); + if (result === errorObj) { + return this.observer.onError(result.e); + } + this.observer.onNext(result); + }; + MapObserver.prototype.onError = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onError(e); + } + }; + MapObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onCompleted(); + } + }; + MapObserver.prototype.dispose = function() { + this.isStopped = true; + }; + MapObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onError(e); + return true; + } + return false; + }; + observableProto.map = observableProto.select = function(selector, thisArg) { + var selectorFn = typeof selector === 'function' ? selector : function() { + return selector; + }; + return this instanceof MapObservable ? this.internalMap(selectorFn, thisArg) : new MapObservable(this, selectorFn, thisArg); + }; + observableProto.pluck = function() { + var args = arguments, + len = arguments.length; + if (len === 0) { + throw new Error('List of properties cannot be empty.'); + } + return this.map(function(x) { + var currentProp = x; + for (var i = 0; i < len; i++) { + var p = currentProp[args[i]]; + if (typeof p !== 'undefined') { + currentProp = p; + } else { + return undefined; + } + } + return currentProp; + }); + }; + observableProto.flatMapObserver = observableProto.selectManyObserver = function(onNext, onError, onCompleted, thisArg) { + var source = this; + return new AnonymousObservable(function(observer) { + var index = 0; + return source.subscribe(function(x) { + var result; + try { + result = onNext.call(thisArg, x, index++); + } catch (e) { + observer.onError(e); + return ; + } + isPromise(result) && (result = observableFromPromise(result)); + observer.onNext(result); + }, function(err) { + var result; + try { + result = onError.call(thisArg, err); + } catch (e) { + observer.onError(e); + return ; + } + isPromise(result) && (result = observableFromPromise(result)); + observer.onNext(result); + observer.onCompleted(); + }, function() { + var result; + try { + result = onCompleted.call(thisArg); + } catch (e) { + observer.onError(e); + return ; + } + isPromise(result) && (result = observableFromPromise(result)); + observer.onNext(result); + observer.onCompleted(); + }); + }, source).mergeAll(); + }; + function flatMap(source, selector, thisArg) { + var selectorFunc = bindCallback(selector, thisArg, 3); + return source.map(function(x, i) { + var result = selectorFunc(x, i, source); + isPromise(result) && (result = observableFromPromise(result)); + (isArrayLike(result) || isIterable(result)) && (result = observableFrom(result)); + return result; + }).mergeAll(); + } + observableProto.selectMany = observableProto.flatMap = function(selector, resultSelector, thisArg) { + if (isFunction(selector) && isFunction(resultSelector)) { + return this.flatMap(function(x, i) { + var selectorResult = selector(x, i); + isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult)); + (isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult)); + return selectorResult.map(function(y, i2) { + return resultSelector(x, y, i, i2); + }); + }, thisArg); + } + return isFunction(selector) ? flatMap(this, selector, thisArg) : flatMap(this, function() { + return selector; + }); + }; + observableProto.selectSwitch = observableProto.flatMapLatest = observableProto.switchMap = function(selector, thisArg) { + return this.select(selector, thisArg).switchLatest(); + }; + observableProto.skip = function(count) { + if (count < 0) { + throw new ArgumentOutOfRangeError(); + } + var source = this; + return new AnonymousObservable(function(o) { + var remaining = count; + return source.subscribe(function(x) { + if (remaining <= 0) { + o.onNext(x); + } else { + remaining--; + } + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, source); + }; + observableProto.skipWhile = function(predicate, thisArg) { + var source = this, + callback = bindCallback(predicate, thisArg, 3); + return new AnonymousObservable(function(o) { + var i = 0, + running = false; + return source.subscribe(function(x) { + if (!running) { + try { + running = !callback(x, i++, source); + } catch (e) { + o.onError(e); + return ; + } + } + running && o.onNext(x); + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, source); + }; + observableProto.take = function(count, scheduler) { + if (count < 0) { + throw new ArgumentOutOfRangeError(); + } + if (count === 0) { + return observableEmpty(scheduler); + } + var source = this; + return new AnonymousObservable(function(o) { + var remaining = count; + return source.subscribe(function(x) { + if (remaining-- > 0) { + o.onNext(x); + remaining === 0 && o.onCompleted(); + } + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, source); + }; + observableProto.takeWhile = function(predicate, thisArg) { + var source = this, + callback = bindCallback(predicate, thisArg, 3); + return new AnonymousObservable(function(o) { + var i = 0, + running = true; + return source.subscribe(function(x) { + if (running) { + try { + running = callback(x, i++, source); + } catch (e) { + o.onError(e); + return ; + } + if (running) { + o.onNext(x); + } else { + o.onCompleted(); + } + } + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, source); + }; + var FilterObservable = (function(__super__) { + inherits(FilterObservable, __super__); + function FilterObservable(source, predicate, thisArg) { + this.source = source; + this.predicate = bindCallback(predicate, thisArg, 3); + __super__.call(this); + } + FilterObservable.prototype.subscribeCore = function(observer) { + return this.source.subscribe(new FilterObserver(observer, this.predicate, this)); + }; + FilterObservable.prototype.internalFilter = function(predicate, thisArg) { + var self = this; + return new FilterObservable(this.source, function(x, i, o) { + return self.predicate(x, i, o) && predicate.call(this, x, i, o); + }, thisArg); + }; + return FilterObservable; + }(ObservableBase)); + function FilterObserver(observer, predicate, source) { + this.observer = observer; + this.predicate = predicate; + this.source = source; + this.i = 0; + this.isStopped = false; + } + FilterObserver.prototype.onNext = function(x) { + if (this.isStopped) { + return ; + } + var shouldYield = tryCatch(this.predicate).call(this, x, this.i++, this.source); + if (shouldYield === errorObj) { + return this.observer.onError(shouldYield.e); + } + shouldYield && this.observer.onNext(x); + }; + FilterObserver.prototype.onError = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onError(e); + } + }; + FilterObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onCompleted(); + } + }; + FilterObserver.prototype.dispose = function() { + this.isStopped = true; + }; + FilterObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onError(e); + return true; + } + return false; + }; + observableProto.filter = observableProto.where = function(predicate, thisArg) { + return this instanceof FilterObservable ? this.internalFilter(predicate, thisArg) : new FilterObservable(this, predicate, thisArg); + }; + observableProto.transduce = function(transducer) { + var source = this; + function transformForObserver(o) { + return { + '@@transducer/init': function() { + return o; + }, + '@@transducer/step': function(obs, input) { + return obs.onNext(input); + }, + '@@transducer/result': function(obs) { + return obs.onCompleted(); + } + }; + } + return new AnonymousObservable(function(o) { + var xform = transducer(transformForObserver(o)); + return source.subscribe(function(v) { + try { + xform['@@transducer/step'](o, v); + } catch (e) { + o.onError(e); + } + }, function(e) { + o.onError(e); + }, function() { + xform['@@transducer/result'](o); + }); + }, source); + }; + var AnonymousObservable = Rx.AnonymousObservable = (function(__super__) { + inherits(AnonymousObservable, __super__); + function fixSubscriber(subscriber) { + return subscriber && isFunction(subscriber.dispose) ? subscriber : isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty; + } + function setDisposable(s, state) { + var ado = state[0], + subscribe = state[1]; + var sub = tryCatch(subscribe)(ado); + if (sub === errorObj) { + if (!ado.fail(errorObj.e)) { + return thrower(errorObj.e); + } + } + ado.setDisposable(fixSubscriber(sub)); + } + function AnonymousObservable(subscribe, parent) { + this.source = parent; + function s(observer) { + var ado = new AutoDetachObserver(observer), + state = [ado, subscribe]; + if (currentThreadScheduler.scheduleRequired()) { + currentThreadScheduler.scheduleWithState(state, setDisposable); + } else { + setDisposable(null, state); + } + return ado; + } + __super__.call(this, s); + } + return AnonymousObservable; + }(Observable)); + var AutoDetachObserver = (function(__super__) { + inherits(AutoDetachObserver, __super__); + function AutoDetachObserver(observer) { + __super__.call(this); + this.observer = observer; + this.m = new SingleAssignmentDisposable(); + } + var AutoDetachObserverPrototype = AutoDetachObserver.prototype; + AutoDetachObserverPrototype.next = function(value) { + var result = tryCatch(this.observer.onNext).call(this.observer, value); + if (result === errorObj) { + this.dispose(); + thrower(result.e); + } + }; + AutoDetachObserverPrototype.error = function(err) { + var result = tryCatch(this.observer.onError).call(this.observer, err); + this.dispose(); + result === errorObj && thrower(result.e); + }; + AutoDetachObserverPrototype.completed = function() { + var result = tryCatch(this.observer.onCompleted).call(this.observer); + this.dispose(); + result === errorObj && thrower(result.e); + }; + AutoDetachObserverPrototype.setDisposable = function(value) { + this.m.setDisposable(value); + }; + AutoDetachObserverPrototype.getDisposable = function() { + return this.m.getDisposable(); + }; + AutoDetachObserverPrototype.dispose = function() { + __super__.prototype.dispose.call(this); + this.m.dispose(); + }; + return AutoDetachObserver; + }(AbstractObserver)); + var InnerSubscription = function(subject, observer) { + this.subject = subject; + this.observer = observer; + }; + InnerSubscription.prototype.dispose = function() { + if (!this.subject.isDisposed && this.observer !== null) { + var idx = this.subject.observers.indexOf(this.observer); + this.subject.observers.splice(idx, 1); + this.observer = null; + } + }; + var Subject = Rx.Subject = (function(__super__) { + function subscribe(observer) { + checkDisposed(this); + if (!this.isStopped) { + this.observers.push(observer); + return new InnerSubscription(this, observer); + } + if (this.hasError) { + observer.onError(this.error); + return disposableEmpty; + } + observer.onCompleted(); + return disposableEmpty; + } + inherits(Subject, __super__); + function Subject() { + __super__.call(this, subscribe); + this.isDisposed = false, this.isStopped = false, this.observers = []; + this.hasError = false; + } + addProperties(Subject.prototype, Observer.prototype, { + hasObservers: function() { + return this.observers.length > 0; + }, + onCompleted: function() { + checkDisposed(this); + if (!this.isStopped) { + this.isStopped = true; + for (var i = 0, + os = cloneArray(this.observers), + len = os.length; i < len; i++) { + os[i].onCompleted(); + } + this.observers.length = 0; + } + }, + onError: function(error) { + checkDisposed(this); + if (!this.isStopped) { + this.isStopped = true; + this.error = error; + this.hasError = true; + for (var i = 0, + os = cloneArray(this.observers), + len = os.length; i < len; i++) { + os[i].onError(error); + } + this.observers.length = 0; + } + }, + onNext: function(value) { + checkDisposed(this); + if (!this.isStopped) { + for (var i = 0, + os = cloneArray(this.observers), + len = os.length; i < len; i++) { + os[i].onNext(value); + } + } + }, + dispose: function() { + this.isDisposed = true; + this.observers = null; + } + }); + Subject.create = function(observer, observable) { + return new AnonymousSubject(observer, observable); + }; + return Subject; + }(Observable)); + var AsyncSubject = Rx.AsyncSubject = (function(__super__) { + function subscribe(observer) { + checkDisposed(this); + if (!this.isStopped) { + this.observers.push(observer); + return new InnerSubscription(this, observer); + } + if (this.hasError) { + observer.onError(this.error); + } else if (this.hasValue) { + observer.onNext(this.value); + observer.onCompleted(); + } else { + observer.onCompleted(); + } + return disposableEmpty; + } + inherits(AsyncSubject, __super__); + function AsyncSubject() { + __super__.call(this, subscribe); + this.isDisposed = false; + this.isStopped = false; + this.hasValue = false; + this.observers = []; + this.hasError = false; + } + addProperties(AsyncSubject.prototype, Observer, { + hasObservers: function() { + checkDisposed(this); + return this.observers.length > 0; + }, + onCompleted: function() { + var i, + len; + checkDisposed(this); + if (!this.isStopped) { + this.isStopped = true; + var os = cloneArray(this.observers), + len = os.length; + if (this.hasValue) { + for (i = 0; i < len; i++) { + var o = os[i]; + o.onNext(this.value); + o.onCompleted(); + } + } else { + for (i = 0; i < len; i++) { + os[i].onCompleted(); + } + } + this.observers.length = 0; + } + }, + onError: function(error) { + checkDisposed(this); + if (!this.isStopped) { + this.isStopped = true; + this.hasError = true; + this.error = error; + for (var i = 0, + os = cloneArray(this.observers), + len = os.length; i < len; i++) { + os[i].onError(error); + } + this.observers.length = 0; + } + }, + onNext: function(value) { + checkDisposed(this); + if (this.isStopped) { + return ; + } + this.value = value; + this.hasValue = true; + }, + dispose: function() { + this.isDisposed = true; + this.observers = null; + this.exception = null; + this.value = null; + } + }); + return AsyncSubject; + }(Observable)); + var AnonymousSubject = Rx.AnonymousSubject = (function(__super__) { + inherits(AnonymousSubject, __super__); + function subscribe(observer) { + return this.observable.subscribe(observer); + } + function AnonymousSubject(observer, observable) { + this.observer = observer; + this.observable = observable; + __super__.call(this, subscribe); + } + addProperties(AnonymousSubject.prototype, Observer.prototype, { + onCompleted: function() { + this.observer.onCompleted(); + }, + onError: function(error) { + this.observer.onError(error); + }, + onNext: function(value) { + this.observer.onNext(value); + } + }); + return AnonymousSubject; + }(Observable)); + if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { + root.Rx = Rx; + define(function() { + return Rx; + }); + } else if (freeExports && freeModule) { + if (moduleExports) { + (freeModule.exports = Rx).Rx = Rx; + } else { + freeExports.Rx = Rx; + } + } else { + root.Rx = Rx; + } + var rEndingLine = captureLine(); + }.call(this)); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/facade/lang", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/facade/lang"; + var _global, + Type, + isDart, + BaseException, + Math, + Date, + assertionsEnabled_, + StringWrapper, + StringJoiner, + NumberParseError, + NumberWrapper, + RegExp, + RegExpWrapper, + RegExpMatcherWrapper, + FunctionWrapper, + Json, + DateWrapper; + function getTypeNameForDebugging(type) { + return type['name']; + } + function makeTypeError(message) { + return new TypeError(message); + } + function assertionsEnabled() { + return assertionsEnabled_; + } + function ENUM_INDEX(value) { + return value; + } + function CONST_EXPR(expr) { + return expr; + } + function CONST() { + return (function(target) { + return target; + }); + } + function ABSTRACT() { + return (function(t) { + return t; + }); + } + function IMPLEMENTS(_) { + return (function(t) { + return t; + }); + } + function isPresent(obj) { + return obj !== undefined && obj !== null; + } + function isBlank(obj) { + return obj === undefined || obj === null; + } + function isString(obj) { + return typeof obj === "string"; + } + function isFunction(obj) { + return typeof obj === "function"; + } + function isType(obj) { + return isFunction(obj); + } + function isStringMap(obj) { + return typeof obj === 'object' && obj !== null; + } + function isPromise(obj) { + return obj instanceof _global.Promise; + } + function isArray(obj) { + return Array.isArray(obj); + } + function isNumber(obj) { + return typeof obj === 'number'; + } + function isDate(obj) { + return obj instanceof Date && !isNaN(obj.valueOf()); + } + function stringify(token) { + if (typeof token === 'string') { + return token; + } + if (token === undefined || token === null) { + return '' + token; + } + if (token.name) { + return token.name; + } + var res = token.toString(); + var newLineIndex = res.indexOf("\n"); + return (newLineIndex === -1) ? res : res.substring(0, newLineIndex); + } + function serializeEnum(val) { + return val; + } + function deserializeEnum(val, values) { + return val; + } + function looseIdentical(a, b) { + return a === b || typeof a === "number" && typeof b === "number" && isNaN(a) && isNaN(b); + } + function getMapKey(value) { + return value; + } + function normalizeBlank(obj) { + return isBlank(obj) ? null : obj; + } + function normalizeBool(obj) { + return isBlank(obj) ? false : obj; + } + function isJsObject(o) { + return o !== null && (typeof o === "function" || typeof o === "object"); + } + function print(obj) { + if (obj instanceof BaseException) { + console.log(obj.stack); + } else { + console.log(obj); + } + } + $__export("getTypeNameForDebugging", getTypeNameForDebugging); + $__export("makeTypeError", makeTypeError); + $__export("assertionsEnabled", assertionsEnabled); + $__export("ENUM_INDEX", ENUM_INDEX); + $__export("CONST_EXPR", CONST_EXPR); + $__export("CONST", CONST); + $__export("ABSTRACT", ABSTRACT); + $__export("IMPLEMENTS", IMPLEMENTS); + $__export("isPresent", isPresent); + $__export("isBlank", isBlank); + $__export("isString", isString); + $__export("isFunction", isFunction); + $__export("isType", isType); + $__export("isStringMap", isStringMap); + $__export("isPromise", isPromise); + $__export("isArray", isArray); + $__export("isNumber", isNumber); + $__export("isDate", isDate); + $__export("stringify", stringify); + $__export("serializeEnum", serializeEnum); + $__export("deserializeEnum", deserializeEnum); + $__export("looseIdentical", looseIdentical); + $__export("getMapKey", getMapKey); + $__export("normalizeBlank", normalizeBlank); + $__export("normalizeBool", normalizeBool); + $__export("isJsObject", isJsObject); + $__export("print", print); + return { + setters: [], + execute: function() { + _global = (typeof window === 'undefined' ? global : window); + $__export("global", _global); + Type = Function; + $__export("Type", Type); + isDart = false; + $__export("isDart", isDart); + BaseException = (function($__super) { + function BaseException(message, _originalException, _originalStack, _context) { + $traceurRuntime.superConstructor(BaseException).call(this, message); + this.message = message; + this._originalException = _originalException; + this._originalStack = _originalStack; + this._context = _context; + this.stack = (new Error(message)).stack; + } + return ($traceurRuntime.createClass)(BaseException, { + get originalException() { + return this._originalException; + }, + get originalStack() { + return this._originalStack; + }, + get context() { + return this._context; + }, + toString: function() { + return this.message; + } + }, {}, $__super); + }(Error)); + $__export("BaseException", BaseException); + Math = _global.Math; + $__export("Math", Math); + Date = _global.Date; + $__export("Date", Date); + assertionsEnabled_ = typeof _global['assert'] !== 'undefined'; + _global.assert = function assert(condition) { + if (assertionsEnabled_) { + _global['assert'].call(condition); + } + }; + StringWrapper = (function() { + function StringWrapper() {} + return ($traceurRuntime.createClass)(StringWrapper, {}, { + fromCharCode: function(code) { + return String.fromCharCode(code); + }, + charCodeAt: function(s, index) { + return s.charCodeAt(index); + }, + split: function(s, regExp) { + return s.split(regExp); + }, + equals: function(s, s2) { + return s === s2; + }, + replace: function(s, from, replace) { + return s.replace(from, replace); + }, + replaceAll: function(s, from, replace) { + return s.replace(from, replace); + }, + toUpperCase: function(s) { + return s.toUpperCase(); + }, + toLowerCase: function(s) { + return s.toLowerCase(); + }, + startsWith: function(s, start) { + return s.startsWith(start); + }, + substring: function(s, start) { + var end = arguments[2] !== (void 0) ? arguments[2] : null; + return s.substring(start, end === null ? undefined : end); + }, + replaceAllMapped: function(s, from, cb) { + return s.replace(from, function() { + for (var matches = [], + $__1 = 0; $__1 < arguments.length; $__1++) + matches[$__1] = arguments[$__1]; + matches.splice(-2, 2); + return cb(matches); + }); + }, + contains: function(s, substr) { + return s.indexOf(substr) != -1; + }, + compare: function(a, b) { + if (a < b) { + return -1; + } else if (a > b) { + return 1; + } else { + return 0; + } + } + }); + }()); + $__export("StringWrapper", StringWrapper); + StringJoiner = (function() { + function StringJoiner() { + var parts = arguments[0] !== (void 0) ? arguments[0] : []; + this.parts = parts; + } + return ($traceurRuntime.createClass)(StringJoiner, { + add: function(part) { + this.parts.push(part); + }, + toString: function() { + return this.parts.join(""); + } + }, {}); + }()); + $__export("StringJoiner", StringJoiner); + NumberParseError = (function($__super) { + function NumberParseError(message) { + $traceurRuntime.superConstructor(NumberParseError).call(this); + this.message = message; + } + return ($traceurRuntime.createClass)(NumberParseError, {toString: function() { + return this.message; + }}, {}, $__super); + }(BaseException)); + $__export("NumberParseError", NumberParseError); + NumberWrapper = (function() { + function NumberWrapper() {} + return ($traceurRuntime.createClass)(NumberWrapper, {}, { + toFixed: function(n, fractionDigits) { + return n.toFixed(fractionDigits); + }, + equal: function(a, b) { + return a === b; + }, + parseIntAutoRadix: function(text) { + var result = parseInt(text); + if (isNaN(result)) { + throw new NumberParseError("Invalid integer literal when parsing " + text); + } + return result; + }, + parseInt: function(text, radix) { + if (radix == 10) { + if (/^(\-|\+)?[0-9]+$/.test(text)) { + return parseInt(text, radix); + } + } else if (radix == 16) { + if (/^(\-|\+)?[0-9ABCDEFabcdef]+$/.test(text)) { + return parseInt(text, radix); + } + } else { + var result = parseInt(text, radix); + if (!isNaN(result)) { + return result; + } + } + throw new NumberParseError("Invalid integer literal when parsing " + text + " in base " + radix); + }, + parseFloat: function(text) { + return parseFloat(text); + }, + get NaN() { + return NaN; + }, + isNaN: function(value) { + return isNaN(value); + }, + isInteger: function(value) { + return Number.isInteger(value); + } + }); + }()); + $__export("NumberWrapper", NumberWrapper); + RegExp = _global.RegExp; + $__export("RegExp", RegExp); + RegExpWrapper = (function() { + function RegExpWrapper() {} + return ($traceurRuntime.createClass)(RegExpWrapper, {}, { + create: function(regExpStr) { + var flags = arguments[1] !== (void 0) ? arguments[1] : ''; + flags = flags.replace(/g/g, ''); + return new _global.RegExp(regExpStr, flags + 'g'); + }, + firstMatch: function(regExp, input) { + regExp.lastIndex = 0; + return regExp.exec(input); + }, + test: function(regExp, input) { + return regExp.test(input); + }, + matcher: function(regExp, input) { + regExp.lastIndex = 0; + return { + re: regExp, + input: input + }; + } + }); + }()); + $__export("RegExpWrapper", RegExpWrapper); + RegExpMatcherWrapper = (function() { + function RegExpMatcherWrapper() {} + return ($traceurRuntime.createClass)(RegExpMatcherWrapper, {}, {next: function(matcher) { + return matcher.re.exec(matcher.input); + }}); + }()); + $__export("RegExpMatcherWrapper", RegExpMatcherWrapper); + FunctionWrapper = (function() { + function FunctionWrapper() {} + return ($traceurRuntime.createClass)(FunctionWrapper, {}, {apply: function(fn, posArgs) { + return fn.apply(null, posArgs); + }}); + }()); + $__export("FunctionWrapper", FunctionWrapper); + Json = (function() { + function Json() {} + return ($traceurRuntime.createClass)(Json, {}, { + parse: function(s) { + return _global.JSON.parse(s); + }, + stringify: function(data) { + return _global.JSON.stringify(data, null, 2); + } + }); + }()); + $__export("Json", Json); + DateWrapper = (function() { + function DateWrapper() {} + return ($traceurRuntime.createClass)(DateWrapper, {}, { + create: function(year) { + var month = arguments[1] !== (void 0) ? arguments[1] : 1; + var day = arguments[2] !== (void 0) ? arguments[2] : 1; + var hour = arguments[3] !== (void 0) ? arguments[3] : 0; + var minutes = arguments[4] !== (void 0) ? arguments[4] : 0; + var seconds = arguments[5] !== (void 0) ? arguments[5] : 0; + var milliseconds = arguments[6] !== (void 0) ? arguments[6] : 0; + return new Date(year, month - 1, day, hour, minutes, seconds, milliseconds); + }, + fromMillis: function(ms) { + return new Date(ms); + }, + toMillis: function(date) { + return date.getTime(); + }, + now: function() { + return new Date(); + }, + toJson: function(date) { + return date.toJSON(); + } + }); + }()); + $__export("DateWrapper", DateWrapper); + } + }; +}); + +System.register("angular2/src/util/decorators", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/util/decorators"; + var global, + isFunction, + stringify, + Reflect; + function extractAnnotation(annotation) { + if (isFunction(annotation) && annotation.hasOwnProperty('annotation')) { + annotation = annotation.annotation; + } + return annotation; + } + function applyParams(fnOrArray, key) { + if (fnOrArray === Object || fnOrArray === String || fnOrArray === Function || fnOrArray === Number || fnOrArray === Array) { + throw new Error(("Can not use native " + stringify(fnOrArray) + " as constructor")); + } + if (isFunction(fnOrArray)) { + return fnOrArray; + } else if (fnOrArray instanceof Array) { + var annotations = fnOrArray; + var fn = fnOrArray[fnOrArray.length - 1]; + if (!isFunction(fn)) { + throw new Error(("Last position of Class method array must be Function in key " + key + " was '" + stringify(fn) + "'")); + } + var annoLength = annotations.length - 1; + if (annoLength != fn.length) { + throw new Error(("Number of annotations (" + annoLength + ") does not match number of arguments (" + fn.length + ") in the function: " + stringify(fn))); + } + var paramsAnnotations = []; + for (var i = 0, + ii = annotations.length - 1; i < ii; i++) { + var paramAnnotations = []; + paramsAnnotations.push(paramAnnotations); + var annotation = annotations[i]; + if (annotation instanceof Array) { + for (var j = 0; j < annotation.length; j++) { + paramAnnotations.push(extractAnnotation(annotation[j])); + } + } else if (isFunction(annotation)) { + paramAnnotations.push(extractAnnotation(annotation)); + } else { + paramAnnotations.push(annotation); + } + } + Reflect.defineMetadata('parameters', paramsAnnotations, fn); + return fn; + } else { + throw new Error(("Only Function or Array is supported in Class definition for key '" + key + "' is '" + stringify(fnOrArray) + "'")); + } + } + function Class(clsDef) { + var constructor = applyParams(clsDef.hasOwnProperty('constructor') ? clsDef.constructor : undefined, 'constructor'); + var proto = constructor.prototype; + if (clsDef.hasOwnProperty('extends')) { + if (isFunction(clsDef.extends)) { + constructor.prototype = proto = Object.create(clsDef.extends.prototype); + } else { + throw new Error(("Class definition 'extends' property must be a constructor function was: " + stringify(clsDef.extends))); + } + } + for (var key in clsDef) { + if (key != 'extends' && key != 'prototype' && clsDef.hasOwnProperty(key)) { + proto[key] = applyParams(clsDef[key], key); + } + } + if (this && this.annotations instanceof Array) { + Reflect.defineMetadata('annotations', this.annotations, constructor); + } + return constructor; + } + function makeDecorator(annotationCls) { + var chainFn = arguments[1] !== (void 0) ? arguments[1] : null; + function DecoratorFactory(objOrType) { + var annotationInstance = new annotationCls(objOrType); + if (this instanceof annotationCls) { + return annotationInstance; + } else { + var chainAnnotation = isFunction(this) && this.annotations instanceof Array ? this.annotations : []; + chainAnnotation.push(annotationInstance); + var TypeDecorator = function TypeDecorator(cls) { + var annotations = Reflect.getMetadata('annotations', cls); + annotations = annotations || []; + annotations.push(annotationInstance); + Reflect.defineMetadata('annotations', annotations, cls); + return cls; + }; + TypeDecorator.annotations = chainAnnotation; + TypeDecorator.Class = Class; + if (chainFn) + chainFn(TypeDecorator); + return TypeDecorator; + } + } + DecoratorFactory.prototype = Object.create(annotationCls.prototype); + return DecoratorFactory; + } + function makeParamDecorator(annotationCls) { + function ParamDecoratorFactory() { + for (var args = [], + $__0 = 0; $__0 < arguments.length; $__0++) + args[$__0] = arguments[$__0]; + var annotationInstance = Object.create(annotationCls.prototype); + annotationCls.apply(annotationInstance, args); + if (this instanceof annotationCls) { + return annotationInstance; + } else { + ParamDecorator.annotation = annotationInstance; + return ParamDecorator; + } + function ParamDecorator(cls, unusedKey, index) { + var parameters = Reflect.getMetadata('parameters', cls); + parameters = parameters || []; + while (parameters.length <= index) { + parameters.push(null); + } + parameters[index] = parameters[index] || []; + var annotationsForParam = parameters[index]; + annotationsForParam.push(annotationInstance); + Reflect.defineMetadata('parameters', parameters, cls); + return cls; + } + } + ParamDecoratorFactory.prototype = Object.create(annotationCls.prototype); + return ParamDecoratorFactory; + } + $__export("Class", Class); + $__export("makeDecorator", makeDecorator); + $__export("makeParamDecorator", makeParamDecorator); + return { + setters: [function($__m) { + global = $__m.global; + isFunction = $__m.isFunction; + stringify = $__m.stringify; + }], + execute: function() { + Reflect = global.Reflect; + if (!(Reflect && Reflect.getMetadata)) { + throw 'reflect-metadata shim is required when using class decorators'; + } + } + }; +}); + +System.register("angular2/src/di/forward_ref", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/forward_ref"; + var stringify, + isFunction; + function forwardRef(forwardRefFn) { + forwardRefFn.__forward_ref__ = forwardRef; + forwardRefFn.toString = function() { + return stringify(this()); + }; + return forwardRefFn; + } + function resolveForwardRef(type) { + if (isFunction(type) && type.hasOwnProperty('__forward_ref__') && type.__forward_ref__ === forwardRef) { + return type(); + } else { + return type; + } + } + $__export("forwardRef", forwardRef); + $__export("resolveForwardRef", resolveForwardRef); + return { + setters: [function($__m) { + stringify = $__m.stringify; + isFunction = $__m.isFunction; + }], + execute: function() { + } + }; +}); + +System.register("angular2/src/facade/collection", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/facade/collection"; + var isJsObject, + global, + isPresent, + isArray, + List, + Map, + Set, + StringMap, + createMapFromPairs, + createMapFromMap, + _clearValues, + MapWrapper, + StringMapWrapper, + ListWrapper, + createSetFromList, + SetWrapper; + function isListLikeIterable(obj) { + if (!isJsObject(obj)) + return false; + return isArray(obj) || (!(obj instanceof Map) && Symbol.iterator in obj); + } + function iterateListLike(obj, fn) { + if (isArray(obj)) { + for (var i = 0; i < obj.length; i++) { + fn(obj[i]); + } + } else { + var iterator = obj[Symbol.iterator](); + var item; + while (!((item = iterator.next()).done)) { + fn(item.value); + } + } + } + $__export("isListLikeIterable", isListLikeIterable); + $__export("iterateListLike", iterateListLike); + return { + setters: [function($__m) { + isJsObject = $__m.isJsObject; + global = $__m.global; + isPresent = $__m.isPresent; + isArray = $__m.isArray; + }], + execute: function() { + List = global.Array; + $__export("List", List); + Map = global.Map; + $__export("Map", Map); + Set = global.Set; + $__export("Set", Set); + StringMap = global.Object; + $__export("StringMap", StringMap); + createMapFromPairs = (function() { + try { + if (new Map([1, 2]).size === 2) { + return function createMapFromPairs(pairs) { + return new Map(pairs); + }; + } + } catch (e) {} + return function createMapAndPopulateFromPairs(pairs) { + var map = new Map(); + for (var i = 0; i < pairs.length; i++) { + var pair = pairs[i]; + map.set(pair[0], pair[1]); + } + return map; + }; + })(); + createMapFromMap = (function() { + try { + if (new Map(new Map())) { + return function createMapFromMap(m) { + return new Map(m); + }; + } + } catch (e) {} + return function createMapAndPopulateFromMap(m) { + var map = new Map(); + m.forEach((function(v, k) { + map.set(k, v); + })); + return map; + }; + })(); + _clearValues = (function() { + if ((new Map()).keys().next) { + return function _clearValues(m) { + var keyIterator = m.keys(); + var k; + while (!((k = keyIterator.next()).done)) { + m.set(k.value, null); + } + }; + } else { + return function _clearValuesWithForeEach(m) { + m.forEach((function(v, k) { + m.set(k, null); + })); + }; + } + })(); + MapWrapper = (function() { + function MapWrapper() {} + return ($traceurRuntime.createClass)(MapWrapper, {}, { + clone: function(m) { + return createMapFromMap(m); + }, + createFromStringMap: function(stringMap) { + var result = new Map(); + for (var prop in stringMap) { + result.set(prop, stringMap[prop]); + } + return result; + }, + toStringMap: function(m) { + var r = {}; + m.forEach((function(v, k) { + return r[k] = v; + })); + return r; + }, + createFromPairs: function(pairs) { + return createMapFromPairs(pairs); + }, + forEach: function(m, fn) { + m.forEach(fn); + }, + get: function(map, key) { + return map.get(key); + }, + size: function(m) { + return m.size; + }, + delete: function(m, k) { + m.delete(k); + }, + clearValues: function(m) { + _clearValues(m); + }, + iterable: function(m) { + return m; + }, + keys: function(m) { + return Array.from(m.keys()); + }, + values: function(m) { + return Array.from(m.values()); + } + }); + }()); + $__export("MapWrapper", MapWrapper); + StringMapWrapper = (function() { + function StringMapWrapper() {} + return ($traceurRuntime.createClass)(StringMapWrapper, {}, { + create: function() { + return {}; + }, + contains: function(map, key) { + return map.hasOwnProperty(key); + }, + get: function(map, key) { + return map.hasOwnProperty(key) ? map[key] : undefined; + }, + set: function(map, key, value) { + map[key] = value; + }, + keys: function(map) { + return Object.keys(map); + }, + isEmpty: function(map) { + for (var prop in map) { + return false; + } + return true; + }, + delete: function(map, key) { + delete map[key]; + }, + forEach: function(map, callback) { + for (var prop in map) { + if (map.hasOwnProperty(prop)) { + callback(map[prop], prop); + } + } + }, + merge: function(m1, m2) { + var m = {}; + for (var attr in m1) { + if (m1.hasOwnProperty(attr)) { + m[attr] = m1[attr]; + } + } + for (var attr in m2) { + if (m2.hasOwnProperty(attr)) { + m[attr] = m2[attr]; + } + } + return m; + }, + equals: function(m1, m2) { + var k1 = Object.keys(m1); + var k2 = Object.keys(m2); + if (k1.length != k2.length) { + return false; + } + var key; + for (var i = 0; i < k1.length; i++) { + key = k1[i]; + if (m1[key] !== m2[key]) { + return false; + } + } + return true; + } + }); + }()); + $__export("StringMapWrapper", StringMapWrapper); + ListWrapper = (function() { + function ListWrapper() {} + return ($traceurRuntime.createClass)(ListWrapper, {}, { + createFixedSize: function(size) { + return new List(size); + }, + createGrowableSize: function(size) { + return new List(size); + }, + get: function(m, k) { + return m[k]; + }, + set: function(m, k, v) { + m[k] = v; + }, + clone: function(array) { + return array.slice(0); + }, + map: function(array, fn) { + return array.map(fn); + }, + forEach: function(array, fn) { + for (var i = 0; i < array.length; i++) { + fn(array[i]); + } + }, + first: function(array) { + if (!array) + return null; + return array[0]; + }, + last: function(array) { + if (!array || array.length == 0) + return null; + return array[array.length - 1]; + }, + find: function(list, pred) { + for (var i = 0; i < list.length; ++i) { + if (pred(list[i])) + return list[i]; + } + return null; + }, + indexOf: function(array, value) { + var startIndex = arguments[2] !== (void 0) ? arguments[2] : 0; + return array.indexOf(value, startIndex); + }, + reduce: function(list, fn, init) { + return list.reduce(fn, init); + }, + filter: function(array, pred) { + return array.filter(pred); + }, + any: function(list, pred) { + for (var i = 0; i < list.length; ++i) { + if (pred(list[i])) + return true; + } + return false; + }, + contains: function(list, el) { + return list.indexOf(el) !== -1; + }, + reversed: function(array) { + var a = ListWrapper.clone(array); + return a.reverse(); + }, + concat: function(a, b) { + return a.concat(b); + }, + insert: function(list, index, value) { + list.splice(index, 0, value); + }, + removeAt: function(list, index) { + var res = list[index]; + list.splice(index, 1); + return res; + }, + removeAll: function(list, items) { + for (var i = 0; i < items.length; ++i) { + var index = list.indexOf(items[i]); + list.splice(index, 1); + } + }, + removeLast: function(list) { + return list.pop(); + }, + remove: function(list, el) { + var index = list.indexOf(el); + if (index > -1) { + list.splice(index, 1); + return true; + } + return false; + }, + clear: function(list) { + list.splice(0, list.length); + }, + join: function(list, s) { + return list.join(s); + }, + isEmpty: function(list) { + return list.length == 0; + }, + fill: function(list, value) { + var start = arguments[2] !== (void 0) ? arguments[2] : 0; + var end = arguments[3] !== (void 0) ? arguments[3] : null; + list.fill(value, start, end === null ? undefined : end); + }, + equals: function(a, b) { + if (a.length != b.length) + return false; + for (var i = 0; i < a.length; ++i) { + if (a[i] !== b[i]) + return false; + } + return true; + }, + slice: function(l) { + var from = arguments[1] !== (void 0) ? arguments[1] : 0; + var to = arguments[2] !== (void 0) ? arguments[2] : null; + return l.slice(from, to === null ? undefined : to); + }, + splice: function(l, from, length) { + return l.splice(from, length); + }, + sort: function(l, compareFn) { + if (isPresent(compareFn)) { + l.sort(compareFn); + } else { + l.sort(); + } + }, + toString: function(l) { + return l.toString(); + }, + toJSON: function(l) { + return JSON.stringify(l); + } + }); + }()); + $__export("ListWrapper", ListWrapper); + createSetFromList = (function() { + var test = new Set([1, 2, 3]); + if (test.size === 3) { + return function createSetFromList(lst) { + return new Set(lst); + }; + } else { + return function createSetAndPopulateFromList(lst) { + var res = new Set(lst); + if (res.size !== lst.length) { + for (var i = 0; i < lst.length; i++) { + res.add(lst[i]); + } + } + return res; + }; + } + })(); + SetWrapper = (function() { + function SetWrapper() {} + return ($traceurRuntime.createClass)(SetWrapper, {}, { + createFromList: function(lst) { + return createSetFromList(lst); + }, + has: function(s, key) { + return s.has(key); + }, + delete: function(m, k) { + m.delete(k); + } + }); + }()); + $__export("SetWrapper", SetWrapper); + } + }; +}); + +System.register("angular2/src/reflection/reflector", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/reflection/reflector"; + var isPresent, + Map, + StringMapWrapper, + ReflectionInfo, + Reflector; + function _mergeMaps(target, config) { + StringMapWrapper.forEach(config, (function(v, k) { + return target.set(k, v); + })); + } + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + Map = $__m.Map; + StringMapWrapper = $__m.StringMapWrapper; + }], + execute: function() { + ReflectionInfo = (function() { + function ReflectionInfo(annotations, parameters, factory, interfaces) { + this._annotations = annotations; + this._parameters = parameters; + this._factory = factory; + this._interfaces = interfaces; + } + return ($traceurRuntime.createClass)(ReflectionInfo, {}, {}); + }()); + $__export("ReflectionInfo", ReflectionInfo); + Reflector = (function() { + function Reflector(reflectionCapabilities) { + this._injectableInfo = new Map(); + this._getters = new Map(); + this._setters = new Map(); + this._methods = new Map(); + this.reflectionCapabilities = reflectionCapabilities; + } + return ($traceurRuntime.createClass)(Reflector, { + isReflectionEnabled: function() { + return this.reflectionCapabilities.isReflectionEnabled(); + }, + registerFunction: function(func, funcInfo) { + this._injectableInfo.set(func, funcInfo); + }, + registerType: function(type, typeInfo) { + this._injectableInfo.set(type, typeInfo); + }, + registerGetters: function(getters) { + _mergeMaps(this._getters, getters); + }, + registerSetters: function(setters) { + _mergeMaps(this._setters, setters); + }, + registerMethods: function(methods) { + _mergeMaps(this._methods, methods); + }, + factory: function(type) { + if (this._containsReflectionInfo(type)) { + var res = this._injectableInfo.get(type)._factory; + return isPresent(res) ? res : null; + } else { + return this.reflectionCapabilities.factory(type); + } + }, + parameters: function(typeOrFunc) { + if (this._injectableInfo.has(typeOrFunc)) { + var res = this._injectableInfo.get(typeOrFunc)._parameters; + return isPresent(res) ? res : []; + } else { + return this.reflectionCapabilities.parameters(typeOrFunc); + } + }, + annotations: function(typeOrFunc) { + if (this._injectableInfo.has(typeOrFunc)) { + var res = this._injectableInfo.get(typeOrFunc)._annotations; + return isPresent(res) ? res : []; + } else { + return this.reflectionCapabilities.annotations(typeOrFunc); + } + }, + interfaces: function(type) { + if (this._injectableInfo.has(type)) { + var res = this._injectableInfo.get(type)._interfaces; + return isPresent(res) ? res : []; + } else { + return this.reflectionCapabilities.interfaces(type); + } + }, + getter: function(name) { + if (this._getters.has(name)) { + return this._getters.get(name); + } else { + return this.reflectionCapabilities.getter(name); + } + }, + setter: function(name) { + if (this._setters.has(name)) { + return this._setters.get(name); + } else { + return this.reflectionCapabilities.setter(name); + } + }, + method: function(name) { + if (this._methods.has(name)) { + return this._methods.get(name); + } else { + return this.reflectionCapabilities.method(name); + } + }, + _containsReflectionInfo: function(typeOrFunc) { + return this._injectableInfo.has(typeOrFunc); + } + }, {}); + }()); + $__export("Reflector", Reflector); + } + }; +}); + +System.register("angular2/src/reflection/reflection_capabilities", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/reflection/reflection_capabilities"; + var isPresent, + isFunction, + global, + stringify, + BaseException, + ListWrapper, + ReflectionCapabilities; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + isFunction = $__m.isFunction; + global = $__m.global; + stringify = $__m.stringify; + BaseException = $__m.BaseException; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }], + execute: function() { + ReflectionCapabilities = (function() { + function ReflectionCapabilities(reflect) { + this._reflect = isPresent(reflect) ? reflect : global.Reflect; + } + return ($traceurRuntime.createClass)(ReflectionCapabilities, { + isReflectionEnabled: function() { + return true; + }, + factory: function(t) { + switch (t.length) { + case 0: + return (function() { + return new t(); + }); + case 1: + return (function(a1) { + return new t(a1); + }); + case 2: + return (function(a1, a2) { + return new t(a1, a2); + }); + case 3: + return (function(a1, a2, a3) { + return new t(a1, a2, a3); + }); + case 4: + return (function(a1, a2, a3, a4) { + return new t(a1, a2, a3, a4); + }); + case 5: + return (function(a1, a2, a3, a4, a5) { + return new t(a1, a2, a3, a4, a5); + }); + case 6: + return (function(a1, a2, a3, a4, a5, a6) { + return new t(a1, a2, a3, a4, a5, a6); + }); + case 7: + return (function(a1, a2, a3, a4, a5, a6, a7) { + return new t(a1, a2, a3, a4, a5, a6, a7); + }); + case 8: + return (function(a1, a2, a3, a4, a5, a6, a7, a8) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8); + }); + case 9: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9); + }); + case 10: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + }); + case 11: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + }); + case 12: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + }); + case 13: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + }); + case 14: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + }); + case 15: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + }); + case 16: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + }); + case 17: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); + }); + case 18: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); + }); + case 19: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); + }); + case 20: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + }); + } + ; + throw new Error(("Cannot create a factory for '" + stringify(t) + "' because its constructor has more than 20 arguments")); + }, + _zipTypesAndAnnotaions: function(paramTypes, paramAnnotations) { + var result; + if (typeof paramTypes === 'undefined') { + result = ListWrapper.createFixedSize(paramAnnotations.length); + } else { + result = ListWrapper.createFixedSize(paramTypes.length); + } + for (var i = 0; i < result.length; i++) { + if (typeof paramTypes === 'undefined') { + result[i] = []; + } else if (paramTypes[i] != Object) { + result[i] = [paramTypes[i]]; + } else { + result[i] = []; + } + if (isPresent(paramAnnotations) && isPresent(paramAnnotations[i])) { + result[i] = result[i].concat(paramAnnotations[i]); + } + } + return result; + }, + parameters: function(typeOfFunc) { + if (isPresent(typeOfFunc.parameters)) { + return typeOfFunc.parameters; + } + if (isPresent(this._reflect) && isPresent(this._reflect.getMetadata)) { + var paramAnnotations = this._reflect.getMetadata('parameters', typeOfFunc); + var paramTypes = this._reflect.getMetadata('design:paramtypes', typeOfFunc); + if (isPresent(paramTypes) || isPresent(paramAnnotations)) { + return this._zipTypesAndAnnotaions(paramTypes, paramAnnotations); + } + } + return ListWrapper.createFixedSize(typeOfFunc.length); + }, + annotations: function(typeOfFunc) { + if (isPresent(typeOfFunc.annotations)) { + var annotations = typeOfFunc.annotations; + if (isFunction(annotations) && annotations.annotations) { + annotations = annotations.annotations; + } + return annotations; + } + if (isPresent(this._reflect) && isPresent(this._reflect.getMetadata)) { + var annotations = this._reflect.getMetadata('annotations', typeOfFunc); + if (isPresent(annotations)) + return annotations; + } + return []; + }, + interfaces: function(type) { + throw new BaseException("JavaScript does not support interfaces"); + }, + getter: function(name) { + return new Function('o', 'return o.' + name + ';'); + }, + setter: function(name) { + return new Function('o', 'v', 'return o.' + name + ' = v;'); + }, + method: function(name) { + var functionBody = ("if (!o." + name + ") throw new Error('\"" + name + "\" is undefined');\n return o." + name + ".apply(o, args);"); + return new Function('o', 'args', functionBody); + } + }, {}); + }()); + $__export("ReflectionCapabilities", ReflectionCapabilities); + } + }; +}); + +System.register("angular2/src/di/type_literal", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/type_literal"; + var TypeLiteral; + return { + setters: [], + execute: function() { + TypeLiteral = (function() { + function TypeLiteral() {} + return ($traceurRuntime.createClass)(TypeLiteral, {get type() { + throw new Error("Type literals are only supported in Dart"); + }}, {}); + }()); + $__export("TypeLiteral", TypeLiteral); + } + }; +}); + +System.register("angular2/src/di/exceptions", ["angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/exceptions"; + var ListWrapper, + stringify, + BaseException, + isBlank, + AbstractBindingError, + NoBindingError, + CyclicDependencyError, + InstantiationError, + InvalidBindingError, + NoAnnotationError, + OutOfBoundsError; + function findFirstClosedCycle(keys) { + var res = []; + for (var i = 0; i < keys.length; ++i) { + if (ListWrapper.contains(res, keys[i])) { + res.push(keys[i]); + return res; + } else { + res.push(keys[i]); + } + } + return res; + } + function constructResolvingPath(keys) { + if (keys.length > 1) { + var reversed = findFirstClosedCycle(ListWrapper.reversed(keys)); + var tokenStrs = ListWrapper.map(reversed, (function(k) { + return stringify(k.token); + })); + return " (" + tokenStrs.join(' -> ') + ")"; + } else { + return ""; + } + } + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + stringify = $__m.stringify; + BaseException = $__m.BaseException; + isBlank = $__m.isBlank; + }], + execute: function() { + AbstractBindingError = (function($__super) { + function AbstractBindingError(injector, key, constructResolvingMessage, originalException, originalStack) { + $traceurRuntime.superConstructor(AbstractBindingError).call(this, "DI Exception", originalException, originalStack, null); + this.keys = [key]; + this.injectors = [injector]; + this.constructResolvingMessage = constructResolvingMessage; + this.message = this.constructResolvingMessage(this.keys); + } + return ($traceurRuntime.createClass)(AbstractBindingError, { + addKey: function(injector, key) { + this.injectors.push(injector); + this.keys.push(key); + this.message = this.constructResolvingMessage(this.keys); + }, + get context() { + return this.injectors[this.injectors.length - 1].debugContext(); + }, + toString: function() { + return this.message; + } + }, {}, $__super); + }(BaseException)); + $__export("AbstractBindingError", AbstractBindingError); + NoBindingError = (function($__super) { + function NoBindingError(injector, key) { + $traceurRuntime.superConstructor(NoBindingError).call(this, injector, key, function(keys) { + var first = stringify(ListWrapper.first(keys).token); + return ("No provider for " + first + "!" + constructResolvingPath(keys)); + }); + } + return ($traceurRuntime.createClass)(NoBindingError, {}, {}, $__super); + }(AbstractBindingError)); + $__export("NoBindingError", NoBindingError); + CyclicDependencyError = (function($__super) { + function CyclicDependencyError(injector, key) { + $traceurRuntime.superConstructor(CyclicDependencyError).call(this, injector, key, function(keys) { + return ("Cannot instantiate cyclic dependency!" + constructResolvingPath(keys)); + }); + } + return ($traceurRuntime.createClass)(CyclicDependencyError, {}, {}, $__super); + }(AbstractBindingError)); + $__export("CyclicDependencyError", CyclicDependencyError); + InstantiationError = (function($__super) { + function InstantiationError(injector, originalException, originalStack, key) { + $traceurRuntime.superConstructor(InstantiationError).call(this, injector, key, function(keys) { + var first = stringify(ListWrapper.first(keys).token); + return ("Error during instantiation of " + first + "!" + constructResolvingPath(keys) + "."); + }, originalException, originalStack); + this.causeKey = key; + } + return ($traceurRuntime.createClass)(InstantiationError, {}, {}, $__super); + }(AbstractBindingError)); + $__export("InstantiationError", InstantiationError); + InvalidBindingError = (function($__super) { + function InvalidBindingError(binding) { + $traceurRuntime.superConstructor(InvalidBindingError).call(this); + this.message = "Invalid binding - only instances of Binding and Type are allowed, got: " + binding.toString(); + } + return ($traceurRuntime.createClass)(InvalidBindingError, {toString: function() { + return this.message; + }}, {}, $__super); + }(BaseException)); + $__export("InvalidBindingError", InvalidBindingError); + NoAnnotationError = (function($__super) { + function NoAnnotationError(typeOrFunc, params) { + $traceurRuntime.superConstructor(NoAnnotationError).call(this); + var signature = []; + for (var i = 0, + ii = params.length; i < ii; i++) { + var parameter = params[i]; + if (isBlank(parameter) || parameter.length == 0) { + signature.push('?'); + } else { + signature.push(ListWrapper.map(parameter, stringify).join(' ')); + } + } + this.message = "Cannot resolve all parameters for " + stringify(typeOrFunc) + "(" + signature.join(', ') + "). " + 'Make sure they all have valid type or annotations.'; + } + return ($traceurRuntime.createClass)(NoAnnotationError, {toString: function() { + return this.message; + }}, {}, $__super); + }(BaseException)); + $__export("NoAnnotationError", NoAnnotationError); + OutOfBoundsError = (function($__super) { + function OutOfBoundsError(index) { + $traceurRuntime.superConstructor(OutOfBoundsError).call(this); + this.message = ("Index " + index + " is out-of-bounds."); + } + return ($traceurRuntime.createClass)(OutOfBoundsError, {toString: function() { + return this.message; + }}, {}, $__super); + }(BaseException)); + $__export("OutOfBoundsError", OutOfBoundsError); + } + }; +}); + +System.register("angular2/src/di/opaque_token", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/opaque_token"; + var __decorate, + __metadata, + CONST, + OpaqueToken; + return { + setters: [function($__m) { + CONST = $__m.CONST; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + OpaqueToken = (($traceurRuntime.createClass)(function(desc) { + this._desc = 'Token(' + desc + ')'; + }, {toString: function() { + return this._desc; + }}, {})); + $__export("OpaqueToken", OpaqueToken); + $__export("OpaqueToken", OpaqueToken = __decorate([CONST(), __metadata('design:paramtypes', [String])], OpaqueToken)); + } + }; +}); + +System.register("angular2/src/dom/dom_adapter", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/dom/dom_adapter"; + var BaseException, + isBlank, + DOM, + DomAdapter; + function setRootDomAdapter(adapter) { + if (isBlank(DOM)) { + $__export("DOM", DOM = adapter); + } + } + function _abstract() { + return new BaseException('This method is abstract'); + } + $__export("setRootDomAdapter", setRootDomAdapter); + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + isBlank = $__m.isBlank; + }], + execute: function() { + $__export("DOM", DOM); + DomAdapter = (function() { + function DomAdapter() {} + return ($traceurRuntime.createClass)(DomAdapter, { + hasProperty: function(element, name) { + throw _abstract(); + }, + setProperty: function(el, name, value) { + throw _abstract(); + }, + getProperty: function(el, name) { + throw _abstract(); + }, + invoke: function(el, methodName, args) { + throw _abstract(); + }, + logError: function(error) { + throw _abstract(); + }, + log: function(error) { + throw _abstract(); + }, + logGroup: function(error) { + throw _abstract(); + }, + logGroupEnd: function() { + throw _abstract(); + }, + get attrToPropMap() { + throw _abstract(); + }, + parse: function(templateHtml) { + throw _abstract(); + }, + query: function(selector) { + throw _abstract(); + }, + querySelector: function(el, selector) { + throw _abstract(); + }, + querySelectorAll: function(el, selector) { + throw _abstract(); + }, + on: function(el, evt, listener) { + throw _abstract(); + }, + onAndCancel: function(el, evt, listener) { + throw _abstract(); + }, + dispatchEvent: function(el, evt) { + throw _abstract(); + }, + createMouseEvent: function(eventType) { + throw _abstract(); + }, + createEvent: function(eventType) { + throw _abstract(); + }, + preventDefault: function(evt) { + throw _abstract(); + }, + getInnerHTML: function(el) { + throw _abstract(); + }, + getOuterHTML: function(el) { + throw _abstract(); + }, + nodeName: function(node) { + throw _abstract(); + }, + nodeValue: function(node) { + throw _abstract(); + }, + type: function(node) { + throw _abstract(); + }, + content: function(node) { + throw _abstract(); + }, + firstChild: function(el) { + throw _abstract(); + }, + nextSibling: function(el) { + throw _abstract(); + }, + parentElement: function(el) { + throw _abstract(); + }, + childNodes: function(el) { + throw _abstract(); + }, + childNodesAsList: function(el) { + throw _abstract(); + }, + clearNodes: function(el) { + throw _abstract(); + }, + appendChild: function(el, node) { + throw _abstract(); + }, + removeChild: function(el, node) { + throw _abstract(); + }, + replaceChild: function(el, newNode, oldNode) { + throw _abstract(); + }, + remove: function(el) { + throw _abstract(); + }, + insertBefore: function(el, node) { + throw _abstract(); + }, + insertAllBefore: function(el, nodes) { + throw _abstract(); + }, + insertAfter: function(el, node) { + throw _abstract(); + }, + setInnerHTML: function(el, value) { + throw _abstract(); + }, + getText: function(el) { + throw _abstract(); + }, + setText: function(el, value) { + throw _abstract(); + }, + getValue: function(el) { + throw _abstract(); + }, + setValue: function(el, value) { + throw _abstract(); + }, + getChecked: function(el) { + throw _abstract(); + }, + setChecked: function(el, value) { + throw _abstract(); + }, + createTemplate: function(html) { + throw _abstract(); + }, + createElement: function(tagName) { + var doc = arguments[1] !== (void 0) ? arguments[1] : null; + throw _abstract(); + }, + createTextNode: function(text) { + var doc = arguments[1] !== (void 0) ? arguments[1] : null; + throw _abstract(); + }, + createScriptTag: function(attrName, attrValue) { + var doc = arguments[2] !== (void 0) ? arguments[2] : null; + throw _abstract(); + }, + createStyleElement: function(css) { + var doc = arguments[1] !== (void 0) ? arguments[1] : null; + throw _abstract(); + }, + createShadowRoot: function(el) { + throw _abstract(); + }, + getShadowRoot: function(el) { + throw _abstract(); + }, + getHost: function(el) { + throw _abstract(); + }, + getDistributedNodes: function(el) { + throw _abstract(); + }, + clone: function(node) { + throw _abstract(); + }, + getElementsByClassName: function(element, name) { + throw _abstract(); + }, + getElementsByTagName: function(element, name) { + throw _abstract(); + }, + classList: function(element) { + throw _abstract(); + }, + addClass: function(element, classname) { + throw _abstract(); + }, + removeClass: function(element, classname) { + throw _abstract(); + }, + hasClass: function(element, classname) { + throw _abstract(); + }, + setStyle: function(element, stylename, stylevalue) { + throw _abstract(); + }, + removeStyle: function(element, stylename) { + throw _abstract(); + }, + getStyle: function(element, stylename) { + throw _abstract(); + }, + tagName: function(element) { + throw _abstract(); + }, + attributeMap: function(element) { + throw _abstract(); + }, + hasAttribute: function(element, attribute) { + throw _abstract(); + }, + getAttribute: function(element, attribute) { + throw _abstract(); + }, + setAttribute: function(element, name, value) { + throw _abstract(); + }, + removeAttribute: function(element, attribute) { + throw _abstract(); + }, + templateAwareRoot: function(el) { + throw _abstract(); + }, + createHtmlDocument: function() { + throw _abstract(); + }, + defaultDoc: function() { + throw _abstract(); + }, + getBoundingClientRect: function(el) { + throw _abstract(); + }, + getTitle: function() { + throw _abstract(); + }, + setTitle: function(newTitle) { + throw _abstract(); + }, + elementMatches: function(n, selector) { + throw _abstract(); + }, + isTemplateElement: function(el) { + throw _abstract(); + }, + isTextNode: function(node) { + throw _abstract(); + }, + isCommentNode: function(node) { + throw _abstract(); + }, + isElementNode: function(node) { + throw _abstract(); + }, + hasShadowRoot: function(node) { + throw _abstract(); + }, + isShadowRoot: function(node) { + throw _abstract(); + }, + importIntoDoc: function(node) { + throw _abstract(); + }, + isPageRule: function(rule) { + throw _abstract(); + }, + isStyleRule: function(rule) { + throw _abstract(); + }, + isMediaRule: function(rule) { + throw _abstract(); + }, + isKeyframesRule: function(rule) { + throw _abstract(); + }, + getHref: function(element) { + throw _abstract(); + }, + getEventKey: function(event) { + throw _abstract(); + }, + resolveAndSetHref: function(element, baseUrl, href) { + throw _abstract(); + }, + cssToRules: function(css) { + throw _abstract(); + }, + supportsDOMEvents: function() { + throw _abstract(); + }, + supportsNativeShadowDOM: function() { + throw _abstract(); + }, + getGlobalEventTarget: function(target) { + throw _abstract(); + }, + getHistory: function() { + throw _abstract(); + }, + getLocation: function() { + throw _abstract(); + }, + getBaseHref: function() { + throw _abstract(); + }, + getUserAgent: function() { + throw _abstract(); + }, + setData: function(element, name, value) { + throw _abstract(); + }, + getData: function(element, name) { + throw _abstract(); + }, + setGlobalVar: function(name, value) { + throw _abstract(); + } + }, {}); + }()); + $__export("DomAdapter", DomAdapter); + } + }; +}); + +System.register("angular2/src/dom/generic_browser_adapter", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/dom/dom_adapter"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/dom/generic_browser_adapter"; + var ListWrapper, + isPresent, + isFunction, + DomAdapter, + GenericBrowserDomAdapter; + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + isFunction = $__m.isFunction; + }, function($__m) { + DomAdapter = $__m.DomAdapter; + }], + execute: function() { + GenericBrowserDomAdapter = (function($__super) { + function GenericBrowserDomAdapter() { + $traceurRuntime.superConstructor(GenericBrowserDomAdapter).apply(this, arguments); + } + return ($traceurRuntime.createClass)(GenericBrowserDomAdapter, { + getDistributedNodes: function(el) { + return el.getDistributedNodes(); + }, + resolveAndSetHref: function(el, baseUrl, href) { + el.href = href == null ? baseUrl : baseUrl + '/../' + href; + }, + cssToRules: function(css) { + var style = this.createStyleElement(css); + this.appendChild(this.defaultDoc().head, style); + var rules = []; + if (isPresent(style.sheet)) { + try { + var rawRules = style.sheet.cssRules; + rules = ListWrapper.createFixedSize(rawRules.length); + for (var i = 0; i < rawRules.length; i++) { + rules[i] = rawRules[i]; + } + } catch (e) {} + } else {} + this.remove(style); + return rules; + }, + supportsDOMEvents: function() { + return true; + }, + supportsNativeShadowDOM: function() { + return isFunction(this.defaultDoc().body.createShadowRoot); + } + }, {}, $__super); + }(DomAdapter)); + $__export("GenericBrowserDomAdapter", GenericBrowserDomAdapter); + } + }; +}); + +System.register("angular2/src/change_detection/constants", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/constants"; + var CHECK_ONCE, + CHECKED, + CHECK_ALWAYS, + DETACHED, + ON_PUSH, + DEFAULT; + return { + setters: [], + execute: function() { + CHECK_ONCE = "CHECK_ONCE"; + $__export("CHECK_ONCE", CHECK_ONCE); + CHECKED = "CHECKED"; + $__export("CHECKED", CHECKED); + CHECK_ALWAYS = "ALWAYS_CHECK"; + $__export("CHECK_ALWAYS", CHECK_ALWAYS); + DETACHED = "DETACHED"; + $__export("DETACHED", DETACHED); + ON_PUSH = "ON_PUSH"; + $__export("ON_PUSH", ON_PUSH); + DEFAULT = "DEFAULT"; + $__export("DEFAULT", DEFAULT); + } + }; +}); + +System.register("angular2/src/change_detection/exceptions", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/exceptions"; + var BaseException, + ExpressionChangedAfterItHasBeenCheckedException, + ChangeDetectionError, + DehydratedException; + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + }], + execute: function() { + ExpressionChangedAfterItHasBeenCheckedException = (function($__super) { + function ExpressionChangedAfterItHasBeenCheckedException(proto, change, context) { + $traceurRuntime.superConstructor(ExpressionChangedAfterItHasBeenCheckedException).call(this, ("Expression '" + proto.expressionAsString + "' has changed after it was checked. ") + ("Previous value: '" + change.previousValue + "'. Current value: '" + change.currentValue + "'")); + } + return ($traceurRuntime.createClass)(ExpressionChangedAfterItHasBeenCheckedException, {}, {}, $__super); + }(BaseException)); + $__export("ExpressionChangedAfterItHasBeenCheckedException", ExpressionChangedAfterItHasBeenCheckedException); + ChangeDetectionError = (function($__super) { + function ChangeDetectionError(proto, originalException, originalStack, context) { + $traceurRuntime.superConstructor(ChangeDetectionError).call(this, (originalException + " in [" + proto.expressionAsString + "]"), originalException, originalStack, context); + this.location = proto.expressionAsString; + } + return ($traceurRuntime.createClass)(ChangeDetectionError, {}, {}, $__super); + }(BaseException)); + $__export("ChangeDetectionError", ChangeDetectionError); + DehydratedException = (function($__super) { + function DehydratedException() { + $traceurRuntime.superConstructor(DehydratedException).call(this, 'Attempt to detect changes on a dehydrated detector.'); + } + return ($traceurRuntime.createClass)(DehydratedException, {}, {}, $__super); + }(BaseException)); + $__export("DehydratedException", DehydratedException); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/pipe", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/pipe"; + var __decorate, + __metadata, + BaseException, + CONST, + WrappedValue, + _wrappedValues, + _wrappedIndex, + BasePipe; + function _abstract() { + throw new BaseException('This method is abstract'); + } + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + CONST = $__m.CONST; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + WrappedValue = (function() { + function WrappedValue(wrapped) { + this.wrapped = wrapped; + } + return ($traceurRuntime.createClass)(WrappedValue, {}, {wrap: function(value) { + var w = _wrappedValues[_wrappedIndex++ % 5]; + w.wrapped = value; + return w; + }}); + }()); + $__export("WrappedValue", WrappedValue); + _wrappedValues = [new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null)]; + _wrappedIndex = 0; + BasePipe = (($traceurRuntime.createClass)(function() {}, { + supports: function(obj) { + return true; + }, + onDestroy: function() {}, + transform: function(value, args) { + return _abstract(); + } + }, {})); + $__export("BasePipe", BasePipe); + $__export("BasePipe", BasePipe = __decorate([CONST(), __metadata('design:paramtypes', [])], BasePipe)); + } + }; +}); + +System.register("angular2/src/change_detection/proto_record", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/proto_record"; + var RecordType, + ProtoRecord; + return { + setters: [], + execute: function() { + $__export("RecordType", RecordType); + (function(RecordType) { + RecordType[RecordType["SELF"] = 0] = "SELF"; + RecordType[RecordType["CONST"] = 1] = "CONST"; + RecordType[RecordType["PRIMITIVE_OP"] = 2] = "PRIMITIVE_OP"; + RecordType[RecordType["PROPERTY"] = 3] = "PROPERTY"; + RecordType[RecordType["LOCAL"] = 4] = "LOCAL"; + RecordType[RecordType["INVOKE_METHOD"] = 5] = "INVOKE_METHOD"; + RecordType[RecordType["INVOKE_CLOSURE"] = 6] = "INVOKE_CLOSURE"; + RecordType[RecordType["KEYED_ACCESS"] = 7] = "KEYED_ACCESS"; + RecordType[RecordType["PIPE"] = 8] = "PIPE"; + RecordType[RecordType["INTERPOLATE"] = 9] = "INTERPOLATE"; + RecordType[RecordType["SAFE_PROPERTY"] = 10] = "SAFE_PROPERTY"; + RecordType[RecordType["SAFE_INVOKE_METHOD"] = 11] = "SAFE_INVOKE_METHOD"; + RecordType[RecordType["DIRECTIVE_LIFECYCLE"] = 12] = "DIRECTIVE_LIFECYCLE"; + })(RecordType || ($__export("RecordType", RecordType = {}))); + ProtoRecord = (function() { + function ProtoRecord(mode, name, funcOrValue, args, fixedArgs, contextIndex, directiveIndex, selfIndex, bindingRecord, expressionAsString, lastInBinding, lastInDirective) { + this.mode = mode; + this.name = name; + this.funcOrValue = funcOrValue; + this.args = args; + this.fixedArgs = fixedArgs; + this.contextIndex = contextIndex; + this.directiveIndex = directiveIndex; + this.selfIndex = selfIndex; + this.bindingRecord = bindingRecord; + this.expressionAsString = expressionAsString; + this.lastInBinding = lastInBinding; + this.lastInDirective = lastInDirective; + } + return ($traceurRuntime.createClass)(ProtoRecord, { + isPureFunction: function() { + return this.mode === RecordType.INTERPOLATE || this.mode === RecordType.PRIMITIVE_OP; + }, + isPipeRecord: function() { + return this.mode === RecordType.PIPE; + }, + isLifeCycleRecord: function() { + return this.mode === RecordType.DIRECTIVE_LIFECYCLE; + } + }, {}); + }()); + $__export("ProtoRecord", ProtoRecord); + } + }; +}); + +System.register("angular2/src/change_detection/codegen_name_util", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/codegen_name_util"; + var RegExpWrapper, + StringWrapper, + ListWrapper, + _CONTEXT_IDX, + _whiteSpaceRegExp, + CodegenNameUtil; + function sanitizeName(s) { + return StringWrapper.replaceAll(s, _whiteSpaceRegExp, ''); + } + $__export("sanitizeName", sanitizeName); + return { + setters: [function($__m) { + RegExpWrapper = $__m.RegExpWrapper; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }], + execute: function() { + _CONTEXT_IDX = 0; + _whiteSpaceRegExp = RegExpWrapper.create("\\W", "g"); + CodegenNameUtil = (function() { + function CodegenNameUtil(records, directiveRecords, fieldPrefix, utilName) { + this.records = records; + this.directiveRecords = directiveRecords; + this.fieldPrefix = fieldPrefix; + this.utilName = utilName; + this._sanitizedNames = ListWrapper.createFixedSize(this.records.length + 1); + this._sanitizedNames[_CONTEXT_IDX] = 'context'; + for (var i = 0, + iLen = this.records.length; i < iLen; ++i) { + this._sanitizedNames[i + 1] = sanitizeName(("" + this.records[i].name + i)); + } + } + return ($traceurRuntime.createClass)(CodegenNameUtil, { + getContextName: function() { + return this.getFieldName(_CONTEXT_IDX); + }, + getLocalName: function(idx) { + return this._sanitizedNames[idx]; + }, + getChangeName: function(idx) { + return ("c_" + this._sanitizedNames[idx]); + }, + genInitLocals: function() { + var declarations = []; + var assignments = []; + for (var i = 0, + iLen = this.getFieldCount(); i < iLen; ++i) { + var changeName = this.getChangeName(i); + declarations.push((this.getLocalName(i) + "," + changeName)); + assignments.push(changeName); + } + return ("var " + ListWrapper.join(declarations, ',') + ";") + (ListWrapper.join(assignments, '=') + " = false;"); + }, + getFieldCount: function() { + return this._sanitizedNames.length; + }, + getFieldName: function(idx) { + return ("" + this.fieldPrefix + this._sanitizedNames[idx]); + }, + getAllFieldNames: function() { + var fieldList = []; + for (var k = 0, + kLen = this.getFieldCount(); k < kLen; ++k) { + fieldList.push(this.getFieldName(k)); + } + for (var i = 0, + iLen = this.records.length; i < iLen; ++i) { + var rec = this.records[i]; + if (rec.isPipeRecord()) { + fieldList.push(this.getPipeName(rec.selfIndex)); + } + } + for (var j = 0, + jLen = this.directiveRecords.length; j < jLen; ++j) { + var dRec = this.directiveRecords[j]; + fieldList.push(this.getDirectiveName(dRec.directiveIndex)); + if (dRec.isOnPushChangeDetection()) { + fieldList.push(this.getDetectorName(dRec.directiveIndex)); + } + } + return fieldList; + }, + genDeclareFields: function() { + var fields = this.getAllFieldNames(); + ListWrapper.removeAt(fields, _CONTEXT_IDX); + return ListWrapper.isEmpty(fields) ? '' : ("var " + ListWrapper.join(fields, ', ') + ";"); + }, + genDehydrateFields: function() { + var fields = this.getAllFieldNames(); + ListWrapper.removeAt(fields, _CONTEXT_IDX); + if (!ListWrapper.isEmpty(fields)) { + fields.push((this.utilName + ".uninitialized;")); + } + return (this.getContextName() + " = null; " + ListWrapper.join(fields, ' = ')); + }, + genPipeOnDestroy: function() { + var $__0 = this; + return ListWrapper.join(ListWrapper.map(ListWrapper.filter(this.records, (function(r) { + return r.isPipeRecord(); + })), (function(r) { + return ($__0.getPipeName(r.selfIndex) + ".onDestroy();"); + })), '\n'); + }, + getPipeName: function(idx) { + return ("" + this.fieldPrefix + this._sanitizedNames[idx] + "_pipe"); + }, + getAllDirectiveNames: function() { + var $__0 = this; + return ListWrapper.map(this.directiveRecords, (function(d) { + return $__0.getDirectiveName(d.directiveIndex); + })); + }, + getDirectiveName: function(d) { + return (this.fieldPrefix + "directive_" + d.name); + }, + getAllDetectorNames: function() { + var $__0 = this; + return ListWrapper.map(ListWrapper.filter(this.directiveRecords, (function(r) { + return r.isOnPushChangeDetection(); + })), (function(d) { + return $__0.getDetectorName(d.directiveIndex); + })); + }, + getDetectorName: function(d) { + return (this.fieldPrefix + "detector_" + d.name); + } + }, {}); + }()); + $__export("CodegenNameUtil", CodegenNameUtil); + } + }; +}); + +System.register("angular2/src/change_detection/coalesce", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/proto_record"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/coalesce"; + var isPresent, + isBlank, + looseIdentical, + ListWrapper, + Map, + RecordType, + ProtoRecord; + function coalesce(records) { + var res = []; + var indexMap = new Map(); + for (var i = 0; i < records.length; ++i) { + var r = records[i]; + var record = _replaceIndices(r, res.length + 1, indexMap); + var matchingRecord = _findMatching(record, res); + if (isPresent(matchingRecord) && record.lastInBinding) { + res.push(_selfRecord(record, matchingRecord.selfIndex, res.length + 1)); + indexMap.set(r.selfIndex, matchingRecord.selfIndex); + } else if (isPresent(matchingRecord) && !record.lastInBinding) { + indexMap.set(r.selfIndex, matchingRecord.selfIndex); + } else { + res.push(record); + indexMap.set(r.selfIndex, record.selfIndex); + } + } + return res; + } + function _selfRecord(r, contextIndex, selfIndex) { + return new ProtoRecord(RecordType.SELF, "self", null, [], r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.expressionAsString, r.lastInBinding, r.lastInDirective); + } + function _findMatching(r, rs) { + return ListWrapper.find(rs, (function(rr) { + return rr.mode !== RecordType.DIRECTIVE_LIFECYCLE && _sameDirIndex(rr, r) && rr.mode === r.mode && looseIdentical(rr.funcOrValue, r.funcOrValue) && rr.contextIndex === r.contextIndex && looseIdentical(rr.name, r.name) && ListWrapper.equals(rr.args, r.args); + })); + } + function _sameDirIndex(a, b) { + var di1 = isBlank(a.directiveIndex) ? null : a.directiveIndex.directiveIndex; + var ei1 = isBlank(a.directiveIndex) ? null : a.directiveIndex.elementIndex; + var di2 = isBlank(b.directiveIndex) ? null : b.directiveIndex.directiveIndex; + var ei2 = isBlank(b.directiveIndex) ? null : b.directiveIndex.elementIndex; + return di1 === di2 && ei1 === ei2; + } + function _replaceIndices(r, selfIndex, indexMap) { + var args = ListWrapper.map(r.args, (function(a) { + return _map(indexMap, a); + })); + var contextIndex = _map(indexMap, r.contextIndex); + return new ProtoRecord(r.mode, r.name, r.funcOrValue, args, r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.expressionAsString, r.lastInBinding, r.lastInDirective); + } + function _map(indexMap, value) { + var r = indexMap.get(value); + return isPresent(r) ? r : value; + } + $__export("coalesce", coalesce); + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + looseIdentical = $__m.looseIdentical; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + Map = $__m.Map; + }, function($__m) { + RecordType = $__m.RecordType; + ProtoRecord = $__m.ProtoRecord; + }], + execute: function() { + } + }; +}); + +System.register("angular2/src/change_detection/parser/ast", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/parser/ast"; + var isBlank, + isPresent, + FunctionWrapper, + BaseException, + ListWrapper, + StringMapWrapper, + AST, + EmptyExpr, + ImplicitReceiver, + Chain, + Conditional, + If, + AccessMember, + SafeAccessMember, + KeyedAccess, + BindingPipe, + LiteralPrimitive, + LiteralArray, + LiteralMap, + Interpolation, + Binary, + PrefixNot, + Assignment, + MethodCall, + SafeMethodCall, + FunctionCall, + ASTWithSource, + TemplateBinding, + AstTransformer, + _evalListCache; + function evalList(context, locals, exps) { + var length = exps.length; + if (length > 10) { + throw new BaseException("Cannot have more than 10 argument"); + } + var result = _evalListCache[length]; + for (var i = 0; i < length; i++) { + result[i] = exps[i].eval(context, locals); + } + return result; + } + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + FunctionWrapper = $__m.FunctionWrapper; + BaseException = $__m.BaseException; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }], + execute: function() { + AST = (function() { + function AST() {} + return ($traceurRuntime.createClass)(AST, { + eval: function(context, locals) { + throw new BaseException("Not supported"); + }, + get isAssignable() { + return false; + }, + assign: function(context, locals, value) { + throw new BaseException("Not supported"); + }, + visit: function(visitor) { + return null; + }, + toString: function() { + return "AST"; + } + }, {}); + }()); + $__export("AST", AST); + EmptyExpr = (function($__super) { + function EmptyExpr() { + $traceurRuntime.superConstructor(EmptyExpr).apply(this, arguments); + } + return ($traceurRuntime.createClass)(EmptyExpr, { + eval: function(context, locals) { + return null; + }, + visit: function(visitor) {} + }, {}, $__super); + }(AST)); + $__export("EmptyExpr", EmptyExpr); + ImplicitReceiver = (function($__super) { + function ImplicitReceiver() { + $traceurRuntime.superConstructor(ImplicitReceiver).apply(this, arguments); + } + return ($traceurRuntime.createClass)(ImplicitReceiver, { + eval: function(context, locals) { + return context; + }, + visit: function(visitor) { + return visitor.visitImplicitReceiver(this); + } + }, {}, $__super); + }(AST)); + $__export("ImplicitReceiver", ImplicitReceiver); + Chain = (function($__super) { + function Chain(expressions) { + $traceurRuntime.superConstructor(Chain).call(this); + this.expressions = expressions; + } + return ($traceurRuntime.createClass)(Chain, { + eval: function(context, locals) { + var result; + for (var i = 0; i < this.expressions.length; i++) { + var last = this.expressions[i].eval(context, locals); + if (isPresent(last)) + result = last; + } + return result; + }, + visit: function(visitor) { + return visitor.visitChain(this); + } + }, {}, $__super); + }(AST)); + $__export("Chain", Chain); + Conditional = (function($__super) { + function Conditional(condition, trueExp, falseExp) { + $traceurRuntime.superConstructor(Conditional).call(this); + this.condition = condition; + this.trueExp = trueExp; + this.falseExp = falseExp; + } + return ($traceurRuntime.createClass)(Conditional, { + eval: function(context, locals) { + if (this.condition.eval(context, locals)) { + return this.trueExp.eval(context, locals); + } else { + return this.falseExp.eval(context, locals); + } + }, + visit: function(visitor) { + return visitor.visitConditional(this); + } + }, {}, $__super); + }(AST)); + $__export("Conditional", Conditional); + If = (function($__super) { + function If(condition, trueExp, falseExp) { + $traceurRuntime.superConstructor(If).call(this); + this.condition = condition; + this.trueExp = trueExp; + this.falseExp = falseExp; + } + return ($traceurRuntime.createClass)(If, { + eval: function(context, locals) { + if (this.condition.eval(context, locals)) { + this.trueExp.eval(context, locals); + } else if (isPresent(this.falseExp)) { + this.falseExp.eval(context, locals); + } + }, + visit: function(visitor) { + return visitor.visitIf(this); + } + }, {}, $__super); + }(AST)); + $__export("If", If); + AccessMember = (function($__super) { + function AccessMember(receiver, name, getter, setter) { + $traceurRuntime.superConstructor(AccessMember).call(this); + this.receiver = receiver; + this.name = name; + this.getter = getter; + this.setter = setter; + } + return ($traceurRuntime.createClass)(AccessMember, { + eval: function(context, locals) { + if (this.receiver instanceof ImplicitReceiver && isPresent(locals) && locals.contains(this.name)) { + return locals.get(this.name); + } else { + var evaluatedReceiver = this.receiver.eval(context, locals); + return this.getter(evaluatedReceiver); + } + }, + get isAssignable() { + return true; + }, + assign: function(context, locals, value) { + var evaluatedContext = this.receiver.eval(context, locals); + if (this.receiver instanceof ImplicitReceiver && isPresent(locals) && locals.contains(this.name)) { + throw new BaseException(("Cannot reassign a variable binding " + this.name)); + } else { + return this.setter(evaluatedContext, value); + } + }, + visit: function(visitor) { + return visitor.visitAccessMember(this); + } + }, {}, $__super); + }(AST)); + $__export("AccessMember", AccessMember); + SafeAccessMember = (function($__super) { + function SafeAccessMember(receiver, name, getter, setter) { + $traceurRuntime.superConstructor(SafeAccessMember).call(this); + this.receiver = receiver; + this.name = name; + this.getter = getter; + this.setter = setter; + } + return ($traceurRuntime.createClass)(SafeAccessMember, { + eval: function(context, locals) { + var evaluatedReceiver = this.receiver.eval(context, locals); + return isBlank(evaluatedReceiver) ? null : this.getter(evaluatedReceiver); + }, + visit: function(visitor) { + return visitor.visitSafeAccessMember(this); + } + }, {}, $__super); + }(AST)); + $__export("SafeAccessMember", SafeAccessMember); + KeyedAccess = (function($__super) { + function KeyedAccess(obj, key) { + $traceurRuntime.superConstructor(KeyedAccess).call(this); + this.obj = obj; + this.key = key; + } + return ($traceurRuntime.createClass)(KeyedAccess, { + eval: function(context, locals) { + var obj = this.obj.eval(context, locals); + var key = this.key.eval(context, locals); + return obj[key]; + }, + get isAssignable() { + return true; + }, + assign: function(context, locals, value) { + var obj = this.obj.eval(context, locals); + var key = this.key.eval(context, locals); + obj[key] = value; + return value; + }, + visit: function(visitor) { + return visitor.visitKeyedAccess(this); + } + }, {}, $__super); + }(AST)); + $__export("KeyedAccess", KeyedAccess); + BindingPipe = (function($__super) { + function BindingPipe(exp, name, args) { + $traceurRuntime.superConstructor(BindingPipe).call(this); + this.exp = exp; + this.name = name; + this.args = args; + } + return ($traceurRuntime.createClass)(BindingPipe, {visit: function(visitor) { + return visitor.visitPipe(this); + }}, {}, $__super); + }(AST)); + $__export("BindingPipe", BindingPipe); + LiteralPrimitive = (function($__super) { + function LiteralPrimitive(value) { + $traceurRuntime.superConstructor(LiteralPrimitive).call(this); + this.value = value; + } + return ($traceurRuntime.createClass)(LiteralPrimitive, { + eval: function(context, locals) { + return this.value; + }, + visit: function(visitor) { + return visitor.visitLiteralPrimitive(this); + } + }, {}, $__super); + }(AST)); + $__export("LiteralPrimitive", LiteralPrimitive); + LiteralArray = (function($__super) { + function LiteralArray(expressions) { + $traceurRuntime.superConstructor(LiteralArray).call(this); + this.expressions = expressions; + } + return ($traceurRuntime.createClass)(LiteralArray, { + eval: function(context, locals) { + return ListWrapper.map(this.expressions, (function(e) { + return e.eval(context, locals); + })); + }, + visit: function(visitor) { + return visitor.visitLiteralArray(this); + } + }, {}, $__super); + }(AST)); + $__export("LiteralArray", LiteralArray); + LiteralMap = (function($__super) { + function LiteralMap(keys, values) { + $traceurRuntime.superConstructor(LiteralMap).call(this); + this.keys = keys; + this.values = values; + } + return ($traceurRuntime.createClass)(LiteralMap, { + eval: function(context, locals) { + var res = StringMapWrapper.create(); + for (var i = 0; i < this.keys.length; ++i) { + StringMapWrapper.set(res, this.keys[i], this.values[i].eval(context, locals)); + } + return res; + }, + visit: function(visitor) { + return visitor.visitLiteralMap(this); + } + }, {}, $__super); + }(AST)); + $__export("LiteralMap", LiteralMap); + Interpolation = (function($__super) { + function Interpolation(strings, expressions) { + $traceurRuntime.superConstructor(Interpolation).call(this); + this.strings = strings; + this.expressions = expressions; + } + return ($traceurRuntime.createClass)(Interpolation, { + eval: function(context, locals) { + throw new BaseException("evaluating an Interpolation is not supported"); + }, + visit: function(visitor) { + visitor.visitInterpolation(this); + } + }, {}, $__super); + }(AST)); + $__export("Interpolation", Interpolation); + Binary = (function($__super) { + function Binary(operation, left, right) { + $traceurRuntime.superConstructor(Binary).call(this); + this.operation = operation; + this.left = left; + this.right = right; + } + return ($traceurRuntime.createClass)(Binary, { + eval: function(context, locals) { + var left = this.left.eval(context, locals); + switch (this.operation) { + case '&&': + return left && this.right.eval(context, locals); + case '||': + return left || this.right.eval(context, locals); + } + var right = this.right.eval(context, locals); + switch (this.operation) { + case '+': + return left + right; + case '-': + return left - right; + case '*': + return left * right; + case '/': + return left / right; + case '%': + return left % right; + case '==': + return left == right; + case '!=': + return left != right; + case '===': + return left === right; + case '!==': + return left !== right; + case '<': + return left < right; + case '>': + return left > right; + case '<=': + return left <= right; + case '>=': + return left >= right; + case '^': + return left ^ right; + case '&': + return left & right; + } + throw 'Internal error [$operation] not handled'; + }, + visit: function(visitor) { + return visitor.visitBinary(this); + } + }, {}, $__super); + }(AST)); + $__export("Binary", Binary); + PrefixNot = (function($__super) { + function PrefixNot(expression) { + $traceurRuntime.superConstructor(PrefixNot).call(this); + this.expression = expression; + } + return ($traceurRuntime.createClass)(PrefixNot, { + eval: function(context, locals) { + return !this.expression.eval(context, locals); + }, + visit: function(visitor) { + return visitor.visitPrefixNot(this); + } + }, {}, $__super); + }(AST)); + $__export("PrefixNot", PrefixNot); + Assignment = (function($__super) { + function Assignment(target, value) { + $traceurRuntime.superConstructor(Assignment).call(this); + this.target = target; + this.value = value; + } + return ($traceurRuntime.createClass)(Assignment, { + eval: function(context, locals) { + return this.target.assign(context, locals, this.value.eval(context, locals)); + }, + visit: function(visitor) { + return visitor.visitAssignment(this); + } + }, {}, $__super); + }(AST)); + $__export("Assignment", Assignment); + MethodCall = (function($__super) { + function MethodCall(receiver, name, fn, args) { + $traceurRuntime.superConstructor(MethodCall).call(this); + this.receiver = receiver; + this.name = name; + this.fn = fn; + this.args = args; + } + return ($traceurRuntime.createClass)(MethodCall, { + eval: function(context, locals) { + var evaluatedArgs = evalList(context, locals, this.args); + if (this.receiver instanceof ImplicitReceiver && isPresent(locals) && locals.contains(this.name)) { + var fn = locals.get(this.name); + return FunctionWrapper.apply(fn, evaluatedArgs); + } else { + var evaluatedReceiver = this.receiver.eval(context, locals); + return this.fn(evaluatedReceiver, evaluatedArgs); + } + }, + visit: function(visitor) { + return visitor.visitMethodCall(this); + } + }, {}, $__super); + }(AST)); + $__export("MethodCall", MethodCall); + SafeMethodCall = (function($__super) { + function SafeMethodCall(receiver, name, fn, args) { + $traceurRuntime.superConstructor(SafeMethodCall).call(this); + this.receiver = receiver; + this.name = name; + this.fn = fn; + this.args = args; + } + return ($traceurRuntime.createClass)(SafeMethodCall, { + eval: function(context, locals) { + var evaluatedReceiver = this.receiver.eval(context, locals); + if (isBlank(evaluatedReceiver)) + return null; + var evaluatedArgs = evalList(context, locals, this.args); + return this.fn(evaluatedReceiver, evaluatedArgs); + }, + visit: function(visitor) { + return visitor.visitSafeMethodCall(this); + } + }, {}, $__super); + }(AST)); + $__export("SafeMethodCall", SafeMethodCall); + FunctionCall = (function($__super) { + function FunctionCall(target, args) { + $traceurRuntime.superConstructor(FunctionCall).call(this); + this.target = target; + this.args = args; + } + return ($traceurRuntime.createClass)(FunctionCall, { + eval: function(context, locals) { + var obj = this.target.eval(context, locals); + if (!(obj instanceof Function)) { + throw new BaseException((obj + " is not a function")); + } + return FunctionWrapper.apply(obj, evalList(context, locals, this.args)); + }, + visit: function(visitor) { + return visitor.visitFunctionCall(this); + } + }, {}, $__super); + }(AST)); + $__export("FunctionCall", FunctionCall); + ASTWithSource = (function($__super) { + function ASTWithSource(ast, source, location) { + $traceurRuntime.superConstructor(ASTWithSource).call(this); + this.ast = ast; + this.source = source; + this.location = location; + } + return ($traceurRuntime.createClass)(ASTWithSource, { + eval: function(context, locals) { + return this.ast.eval(context, locals); + }, + get isAssignable() { + return this.ast.isAssignable; + }, + assign: function(context, locals, value) { + return this.ast.assign(context, locals, value); + }, + visit: function(visitor) { + return this.ast.visit(visitor); + }, + toString: function() { + return (this.source + " in " + this.location); + } + }, {}, $__super); + }(AST)); + $__export("ASTWithSource", ASTWithSource); + TemplateBinding = (function() { + function TemplateBinding(key, keyIsVar, name, expression) { + this.key = key; + this.keyIsVar = keyIsVar; + this.name = name; + this.expression = expression; + } + return ($traceurRuntime.createClass)(TemplateBinding, {}, {}); + }()); + $__export("TemplateBinding", TemplateBinding); + AstTransformer = (function() { + function AstTransformer() {} + return ($traceurRuntime.createClass)(AstTransformer, { + visitImplicitReceiver: function(ast) { + return ast; + }, + visitInterpolation: function(ast) { + return new Interpolation(ast.strings, this.visitAll(ast.expressions)); + }, + visitLiteralPrimitive: function(ast) { + return new LiteralPrimitive(ast.value); + }, + visitAccessMember: function(ast) { + return new AccessMember(ast.receiver.visit(this), ast.name, ast.getter, ast.setter); + }, + visitSafeAccessMember: function(ast) { + return new SafeAccessMember(ast.receiver.visit(this), ast.name, ast.getter, ast.setter); + }, + visitMethodCall: function(ast) { + return new MethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args)); + }, + visitSafeMethodCall: function(ast) { + return new SafeMethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args)); + }, + visitFunctionCall: function(ast) { + return new FunctionCall(ast.target.visit(this), this.visitAll(ast.args)); + }, + visitLiteralArray: function(ast) { + return new LiteralArray(this.visitAll(ast.expressions)); + }, + visitLiteralMap: function(ast) { + return new LiteralMap(ast.keys, this.visitAll(ast.values)); + }, + visitBinary: function(ast) { + return new Binary(ast.operation, ast.left.visit(this), ast.right.visit(this)); + }, + visitPrefixNot: function(ast) { + return new PrefixNot(ast.expression.visit(this)); + }, + visitConditional: function(ast) { + return new Conditional(ast.condition.visit(this), ast.trueExp.visit(this), ast.falseExp.visit(this)); + }, + visitPipe: function(ast) { + return new BindingPipe(ast.exp.visit(this), ast.name, this.visitAll(ast.args)); + }, + visitKeyedAccess: function(ast) { + return new KeyedAccess(ast.obj.visit(this), ast.key.visit(this)); + }, + visitAll: function(asts) { + var res = ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }, + visitChain: function(ast) { + return new Chain(this.visitAll(ast.expressions)); + }, + visitAssignment: function(ast) { + return new Assignment(ast.target.visit(this), ast.value.visit(this)); + }, + visitIf: function(ast) { + var falseExp = isPresent(ast.falseExp) ? ast.falseExp.visit(this) : null; + return new If(ast.condition.visit(this), ast.trueExp.visit(this), falseExp); + } + }, {}); + }()); + $__export("AstTransformer", AstTransformer); + _evalListCache = [[], [0], [0, 0], [0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]; + } + }; +}); + +System.register("angular2/src/change_detection/dynamic_change_detector", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/abstract_change_detector", "angular2/src/change_detection/change_detection_util", "angular2/src/change_detection/proto_record"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/dynamic_change_detector"; + var isPresent, + isBlank, + BaseException, + FunctionWrapper, + ListWrapper, + AbstractChangeDetector, + ChangeDetectionUtil, + RecordType, + DynamicChangeDetector; + function isSame(a, b) { + if (a === b) + return true; + if (a instanceof String && b instanceof String && a == b) + return true; + if ((a !== a) && (b !== b)) + return true; + return false; + } + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + FunctionWrapper = $__m.FunctionWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + AbstractChangeDetector = $__m.AbstractChangeDetector; + }, function($__m) { + ChangeDetectionUtil = $__m.ChangeDetectionUtil; + }, function($__m) { + RecordType = $__m.RecordType; + }], + execute: function() { + DynamicChangeDetector = (function($__super) { + function DynamicChangeDetector(id, changeControlStrategy, dispatcher, protos, directiveRecords) { + $traceurRuntime.superConstructor(DynamicChangeDetector).call(this, id, dispatcher); + this.changeControlStrategy = changeControlStrategy; + this.protos = protos; + this.directiveRecords = directiveRecords; + this.locals = null; + this.directives = null; + this.alreadyChecked = false; + this.pipes = null; + this.values = ListWrapper.createFixedSize(protos.length + 1); + this.localPipes = ListWrapper.createFixedSize(protos.length + 1); + this.prevContexts = ListWrapper.createFixedSize(protos.length + 1); + this.changes = ListWrapper.createFixedSize(protos.length + 1); + this.values[0] = null; + ListWrapper.fill(this.values, ChangeDetectionUtil.uninitialized, 1); + ListWrapper.fill(this.localPipes, null); + ListWrapper.fill(this.prevContexts, ChangeDetectionUtil.uninitialized); + ListWrapper.fill(this.changes, false); + } + return ($traceurRuntime.createClass)(DynamicChangeDetector, { + hydrate: function(context, locals, directives, pipes) { + this.mode = ChangeDetectionUtil.changeDetectionMode(this.changeControlStrategy); + this.values[0] = context; + this.locals = locals; + this.directives = directives; + this.alreadyChecked = false; + this.pipes = pipes; + }, + dehydrate: function() { + this._destroyPipes(); + this.values[0] = null; + ListWrapper.fill(this.values, ChangeDetectionUtil.uninitialized, 1); + ListWrapper.fill(this.changes, false); + ListWrapper.fill(this.localPipes, null); + ListWrapper.fill(this.prevContexts, ChangeDetectionUtil.uninitialized); + this.locals = null; + this.pipes = null; + }, + _destroyPipes: function() { + for (var i = 0; i < this.localPipes.length; ++i) { + if (isPresent(this.localPipes[i])) { + this.localPipes[i].onDestroy(); + } + } + }, + hydrated: function() { + return this.values[0] !== null; + }, + checkNoChanges: function() { + this.runDetectChanges(true); + }, + detectChangesInRecords: function(throwOnChange) { + if (!this.hydrated()) { + ChangeDetectionUtil.throwDehydrated(); + } + var protos = this.protos; + var changes = null; + var isChanged = false; + for (var i = 0; i < protos.length; ++i) { + var proto = protos[i]; + var bindingRecord = proto.bindingRecord; + var directiveRecord = bindingRecord.directiveRecord; + if (proto.isLifeCycleRecord()) { + if (proto.name === "onCheck" && !throwOnChange) { + this._getDirectiveFor(directiveRecord.directiveIndex).onCheck(); + } else if (proto.name === "onInit" && !throwOnChange && !this.alreadyChecked) { + this._getDirectiveFor(directiveRecord.directiveIndex).onInit(); + } else if (proto.name === "onChange" && isPresent(changes) && !throwOnChange) { + this._getDirectiveFor(directiveRecord.directiveIndex).onChange(changes); + } + } else { + var change = this._check(proto, throwOnChange); + if (isPresent(change)) { + this._updateDirectiveOrElement(change, bindingRecord); + isChanged = true; + changes = this._addChange(bindingRecord, change, changes); + } + } + if (proto.lastInDirective) { + changes = null; + if (isChanged && bindingRecord.isOnPushChangeDetection()) { + this._getDetectorFor(directiveRecord.directiveIndex).markAsCheckOnce(); + } + isChanged = false; + } + } + this.alreadyChecked = true; + }, + callOnAllChangesDone: function() { + this.dispatcher.notifyOnAllChangesDone(); + var dirs = this.directiveRecords; + for (var i = dirs.length - 1; i >= 0; --i) { + var dir = dirs[i]; + if (dir.callOnAllChangesDone) { + this._getDirectiveFor(dir.directiveIndex).onAllChangesDone(); + } + } + }, + _updateDirectiveOrElement: function(change, bindingRecord) { + if (isBlank(bindingRecord.directiveRecord)) { + this.dispatcher.notifyOnBinding(bindingRecord, change.currentValue); + } else { + var directiveIndex = bindingRecord.directiveRecord.directiveIndex; + bindingRecord.setter(this._getDirectiveFor(directiveIndex), change.currentValue); + } + }, + _addChange: function(bindingRecord, change, changes) { + if (bindingRecord.callOnChange()) { + return ChangeDetectionUtil.addChange(changes, bindingRecord.propertyName, change); + } else { + return changes; + } + }, + _getDirectiveFor: function(directiveIndex) { + return this.directives.getDirectiveFor(directiveIndex); + }, + _getDetectorFor: function(directiveIndex) { + return this.directives.getDetectorFor(directiveIndex); + }, + _check: function(proto, throwOnChange) { + try { + if (proto.isPipeRecord()) { + return this._pipeCheck(proto, throwOnChange); + } else { + return this._referenceCheck(proto, throwOnChange); + } + } catch (e) { + this.throwError(proto, e, e.stack); + } + }, + _referenceCheck: function(proto, throwOnChange) { + if (this._pureFuncAndArgsDidNotChange(proto)) { + this._setChanged(proto, false); + return null; + } + var prevValue = this._readSelf(proto); + var currValue = this._calculateCurrValue(proto); + if (!isSame(prevValue, currValue)) { + if (proto.lastInBinding) { + var change = ChangeDetectionUtil.simpleChange(prevValue, currValue); + if (throwOnChange) + ChangeDetectionUtil.throwOnChange(proto, change); + this._writeSelf(proto, currValue); + this._setChanged(proto, true); + return change; + } else { + this._writeSelf(proto, currValue); + this._setChanged(proto, true); + return null; + } + } else { + this._setChanged(proto, false); + return null; + } + }, + _calculateCurrValue: function(proto) { + switch (proto.mode) { + case RecordType.SELF: + return this._readContext(proto); + case RecordType.CONST: + return proto.funcOrValue; + case RecordType.PROPERTY: + var context = this._readContext(proto); + return proto.funcOrValue(context); + case RecordType.SAFE_PROPERTY: + var context = this._readContext(proto); + return isBlank(context) ? null : proto.funcOrValue(context); + case RecordType.LOCAL: + return this.locals.get(proto.name); + case RecordType.INVOKE_METHOD: + var context = this._readContext(proto); + var args = this._readArgs(proto); + return proto.funcOrValue(context, args); + case RecordType.SAFE_INVOKE_METHOD: + var context = this._readContext(proto); + if (isBlank(context)) { + return null; + } + var args = this._readArgs(proto); + return proto.funcOrValue(context, args); + case RecordType.KEYED_ACCESS: + var arg = this._readArgs(proto)[0]; + return this._readContext(proto)[arg]; + case RecordType.INVOKE_CLOSURE: + return FunctionWrapper.apply(this._readContext(proto), this._readArgs(proto)); + case RecordType.INTERPOLATE: + case RecordType.PRIMITIVE_OP: + return FunctionWrapper.apply(proto.funcOrValue, this._readArgs(proto)); + default: + throw new BaseException(("Unknown operation " + proto.mode)); + } + }, + _pipeCheck: function(proto, throwOnChange) { + var context = this._readContext(proto); + var args = this._readArgs(proto); + var pipe = this._pipeFor(proto, context); + var prevValue = this._readSelf(proto); + var currValue = pipe.transform(context, args); + if (!isSame(prevValue, currValue)) { + currValue = ChangeDetectionUtil.unwrapValue(currValue); + if (proto.lastInBinding) { + var change = ChangeDetectionUtil.simpleChange(prevValue, currValue); + if (throwOnChange) + ChangeDetectionUtil.throwOnChange(proto, change); + this._writeSelf(proto, currValue); + this._setChanged(proto, true); + return change; + } else { + this._writeSelf(proto, currValue); + this._setChanged(proto, true); + return null; + } + } else { + this._setChanged(proto, false); + return null; + } + }, + _pipeFor: function(proto, context) { + var storedPipe = this._readPipe(proto); + if (isPresent(storedPipe) && storedPipe.supports(context)) { + return storedPipe; + } + if (isPresent(storedPipe)) { + storedPipe.onDestroy(); + } + var pipe = this.pipes.get(proto.name, context, this.ref); + this._writePipe(proto, pipe); + return pipe; + }, + _readContext: function(proto) { + if (proto.contextIndex == -1) { + return this._getDirectiveFor(proto.directiveIndex); + } else { + return this.values[proto.contextIndex]; + } + return this.values[proto.contextIndex]; + }, + _readSelf: function(proto) { + return this.values[proto.selfIndex]; + }, + _writeSelf: function(proto, value) { + this.values[proto.selfIndex] = value; + }, + _readPipe: function(proto) { + return this.localPipes[proto.selfIndex]; + }, + _writePipe: function(proto, value) { + this.localPipes[proto.selfIndex] = value; + }, + _setChanged: function(proto, value) { + this.changes[proto.selfIndex] = value; + }, + _pureFuncAndArgsDidNotChange: function(proto) { + return proto.isPureFunction() && !this._argsChanged(proto); + }, + _argsChanged: function(proto) { + var args = proto.args; + for (var i = 0; i < args.length; ++i) { + if (this.changes[args[i]]) { + return true; + } + } + return false; + }, + _readArgs: function(proto) { + var res = ListWrapper.createFixedSize(proto.args.length); + var args = proto.args; + for (var i = 0; i < args.length; ++i) { + res[i] = this.values[args[i]]; + } + return res; + } + }, {}, $__super); + }(AbstractChangeDetector)); + $__export("DynamicChangeDetector", DynamicChangeDetector); + } + }; +}); + +System.register("angular2/src/change_detection/directive_record", ["angular2/src/change_detection/constants", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/directive_record"; + var ON_PUSH, + StringWrapper, + normalizeBool, + DirectiveIndex, + DirectiveRecord; + return { + setters: [function($__m) { + ON_PUSH = $__m.ON_PUSH; + }, function($__m) { + StringWrapper = $__m.StringWrapper; + normalizeBool = $__m.normalizeBool; + }], + execute: function() { + DirectiveIndex = (function() { + function DirectiveIndex(elementIndex, directiveIndex) { + this.elementIndex = elementIndex; + this.directiveIndex = directiveIndex; + } + return ($traceurRuntime.createClass)(DirectiveIndex, {get name() { + return (this.elementIndex + "_" + this.directiveIndex); + }}, {}); + }()); + $__export("DirectiveIndex", DirectiveIndex); + DirectiveRecord = (function() { + function DirectiveRecord() { + var $__1 = arguments[0] !== (void 0) ? arguments[0] : {}, + directiveIndex = $__1.directiveIndex, + callOnAllChangesDone = $__1.callOnAllChangesDone, + callOnChange = $__1.callOnChange, + callOnCheck = $__1.callOnCheck, + callOnInit = $__1.callOnInit, + changeDetection = $__1.changeDetection; + this.directiveIndex = directiveIndex; + this.callOnAllChangesDone = normalizeBool(callOnAllChangesDone); + this.callOnChange = normalizeBool(callOnChange); + this.callOnCheck = normalizeBool(callOnCheck); + this.callOnInit = normalizeBool(callOnInit); + this.changeDetection = changeDetection; + } + return ($traceurRuntime.createClass)(DirectiveRecord, {isOnPushChangeDetection: function() { + return StringWrapper.equals(this.changeDetection, ON_PUSH); + }}, {}); + }()); + $__export("DirectiveRecord", DirectiveRecord); + } + }; +}); + +System.register("angular2/src/change_detection/pregen_proto_change_detector", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pregen_proto_change_detector"; + var BaseException, + PregenProtoChangeDetector; + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + }], + execute: function() { + $__export("PregenProtoChangeDetectorFactory", Function); + PregenProtoChangeDetector = (function() { + function PregenProtoChangeDetector() {} + return ($traceurRuntime.createClass)(PregenProtoChangeDetector, {instantiate: function(dispatcher) { + throw new BaseException('Pregen change detection not supported in Js'); + }}, {isSupported: function() { + return false; + }}); + }()); + $__export("PregenProtoChangeDetector", PregenProtoChangeDetector); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/pipes", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/pipes"; + var __decorate, + __metadata, + ListWrapper, + StringMapWrapper, + isBlank, + isPresent, + BaseException, + CONST, + Injectable, + UnboundedMetadata, + OptionalMetadata, + Binding, + Pipes; + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + CONST = $__m.CONST; + }, function($__m) { + Injectable = $__m.Injectable; + UnboundedMetadata = $__m.UnboundedMetadata; + OptionalMetadata = $__m.OptionalMetadata; + Binding = $__m.Binding; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Pipes = (($traceurRuntime.createClass)(function(config) { + this.config = config; + }, { + get: function(type, obj, cdRef, existingPipe) { + if (isPresent(existingPipe) && existingPipe.supports(obj)) + return existingPipe; + if (isPresent(existingPipe)) + existingPipe.onDestroy(); + var factories = this._getListOfFactories(type, obj); + var factory = this._getMatchingFactory(factories, type, obj); + return factory.create(cdRef); + }, + _getListOfFactories: function(type, obj) { + var listOfFactories = this.config[type]; + if (isBlank(listOfFactories)) { + throw new BaseException(("Cannot find '" + type + "' pipe supporting object '" + obj + "'")); + } + return listOfFactories; + }, + _getMatchingFactory: function(listOfFactories, type, obj) { + var matchingFactory = ListWrapper.find(listOfFactories, (function(pipeFactory) { + return pipeFactory.supports(obj); + })); + if (isBlank(matchingFactory)) { + throw new BaseException(("Cannot find '" + type + "' pipe supporting object '" + obj + "'")); + } + return matchingFactory; + } + }, { + extend: function(config) { + return new Binding(Pipes, { + toFactory: (function(pipes) { + if (isBlank(pipes)) { + throw new BaseException('Cannot extend Pipes without a parent injector'); + } + return Pipes.create(config, pipes); + }), + deps: [[Pipes, new UnboundedMetadata(), new OptionalMetadata()]] + }); + }, + create: function(config) { + var pipes = arguments[1] !== (void 0) ? arguments[1] : null; + if (isPresent(pipes)) { + StringMapWrapper.forEach(pipes.config, (function(v, k) { + if (StringMapWrapper.contains(config, k)) { + var configFactories = config[k]; + config[k] = configFactories.concat(v); + } else { + config[k] = ListWrapper.clone(v); + } + })); + } + return new Pipes(config); + } + })); + $__export("Pipes", Pipes); + $__export("Pipes", Pipes = __decorate([Injectable(), CONST(), __metadata('design:paramtypes', [Object])], Pipes)); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/iterable_changes", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/iterable_changes"; + var __decorate, + __metadata, + CONST, + isListLikeIterable, + iterateListLike, + MapWrapper, + isBlank, + isPresent, + stringify, + getMapKey, + looseIdentical, + isArray, + WrappedValue, + BasePipe, + IterableChangesFactory, + IterableChanges, + CollectionChangeRecord, + _DuplicateItemRecordList, + _DuplicateMap; + return { + setters: [function($__m) { + CONST = $__m.CONST; + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + stringify = $__m.stringify; + getMapKey = $__m.getMapKey; + looseIdentical = $__m.looseIdentical; + isArray = $__m.isArray; + }, function($__m) { + isListLikeIterable = $__m.isListLikeIterable; + iterateListLike = $__m.iterateListLike; + MapWrapper = $__m.MapWrapper; + }, function($__m) { + WrappedValue = $__m.WrappedValue; + BasePipe = $__m.BasePipe; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + IterableChangesFactory = (($traceurRuntime.createClass)(function() {}, { + supports: function(obj) { + return IterableChanges.supportsObj(obj); + }, + create: function(cdRef) { + return new IterableChanges(); + } + }, {})); + $__export("IterableChangesFactory", IterableChangesFactory); + $__export("IterableChangesFactory", IterableChangesFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], IterableChangesFactory)); + IterableChanges = (function($__super) { + function IterableChanges() { + $traceurRuntime.superConstructor(IterableChanges).call(this); + this._collection = null; + this._length = null; + this._linkedRecords = null; + this._unlinkedRecords = null; + this._previousItHead = null; + this._itHead = null; + this._itTail = null; + this._additionsHead = null; + this._additionsTail = null; + this._movesHead = null; + this._movesTail = null; + this._removalsHead = null; + this._removalsTail = null; + } + return ($traceurRuntime.createClass)(IterableChanges, { + supports: function(obj) { + return IterableChanges.supportsObj(obj); + }, + get collection() { + return this._collection; + }, + get length() { + return this._length; + }, + forEachItem: function(fn) { + var record; + for (record = this._itHead; record !== null; record = record._next) { + fn(record); + } + }, + forEachPreviousItem: function(fn) { + var record; + for (record = this._previousItHead; record !== null; record = record._nextPrevious) { + fn(record); + } + }, + forEachAddedItem: function(fn) { + var record; + for (record = this._additionsHead; record !== null; record = record._nextAdded) { + fn(record); + } + }, + forEachMovedItem: function(fn) { + var record; + for (record = this._movesHead; record !== null; record = record._nextMoved) { + fn(record); + } + }, + forEachRemovedItem: function(fn) { + var record; + for (record = this._removalsHead; record !== null; record = record._nextRemoved) { + fn(record); + } + }, + transform: function(collection) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + if (this.check(collection)) { + return WrappedValue.wrap(this); + } else { + return null; + } + }, + check: function(collection) { + var $__0 = this; + this._reset(); + var record = this._itHead; + var mayBeDirty = false; + var index; + var item; + if (isArray(collection)) { + var list = collection; + this._length = collection.length; + for (index = 0; index < this._length; index++) { + item = list[index]; + if (record === null || !looseIdentical(record.item, item)) { + record = this._mismatch(record, item, index); + mayBeDirty = true; + } else if (mayBeDirty) { + record = this._verifyReinsertion(record, item, index); + } + record = record._next; + } + } else { + index = 0; + iterateListLike(collection, (function(item) { + if (record === null || !looseIdentical(record.item, item)) { + record = $__0._mismatch(record, item, index); + mayBeDirty = true; + } else if (mayBeDirty) { + record = $__0._verifyReinsertion(record, item, index); + } + record = record._next; + index++; + })); + this._length = index; + } + this._truncate(record); + this._collection = collection; + return this.isDirty; + }, + get isDirty() { + return this._additionsHead !== null || this._movesHead !== null || this._removalsHead !== null; + }, + _reset: function() { + if (this.isDirty) { + var record; + var nextRecord; + for (record = this._previousItHead = this._itHead; record !== null; record = record._next) { + record._nextPrevious = record._next; + } + for (record = this._additionsHead; record !== null; record = record._nextAdded) { + record.previousIndex = record.currentIndex; + } + this._additionsHead = this._additionsTail = null; + for (record = this._movesHead; record !== null; record = nextRecord) { + record.previousIndex = record.currentIndex; + nextRecord = record._nextMoved; + } + this._movesHead = this._movesTail = null; + this._removalsHead = this._removalsTail = null; + } + }, + _mismatch: function(record, item, index) { + var previousRecord; + if (record === null) { + previousRecord = this._itTail; + } else { + previousRecord = record._prev; + this._remove(record); + } + record = this._linkedRecords === null ? null : this._linkedRecords.get(item, index); + if (record !== null) { + this._moveAfter(record, previousRecord, index); + } else { + record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(item); + if (record !== null) { + this._reinsertAfter(record, previousRecord, index); + } else { + record = this._addAfter(new CollectionChangeRecord(item), previousRecord, index); + } + } + return record; + }, + _verifyReinsertion: function(record, item, index) { + var reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(item); + if (reinsertRecord !== null) { + record = this._reinsertAfter(reinsertRecord, record._prev, index); + } else if (record.currentIndex != index) { + record.currentIndex = index; + this._addToMoves(record, index); + } + return record; + }, + _truncate: function(record) { + while (record !== null) { + var nextRecord = record._next; + this._addToRemovals(this._unlink(record)); + record = nextRecord; + } + if (this._unlinkedRecords !== null) { + this._unlinkedRecords.clear(); + } + if (this._additionsTail !== null) { + this._additionsTail._nextAdded = null; + } + if (this._movesTail !== null) { + this._movesTail._nextMoved = null; + } + if (this._itTail !== null) { + this._itTail._next = null; + } + if (this._removalsTail !== null) { + this._removalsTail._nextRemoved = null; + } + }, + _reinsertAfter: function(record, prevRecord, index) { + if (this._unlinkedRecords !== null) { + this._unlinkedRecords.remove(record); + } + var prev = record._prevRemoved; + var next = record._nextRemoved; + if (prev === null) { + this._removalsHead = next; + } else { + prev._nextRemoved = next; + } + if (next === null) { + this._removalsTail = prev; + } else { + next._prevRemoved = prev; + } + this._insertAfter(record, prevRecord, index); + this._addToMoves(record, index); + return record; + }, + _moveAfter: function(record, prevRecord, index) { + this._unlink(record); + this._insertAfter(record, prevRecord, index); + this._addToMoves(record, index); + return record; + }, + _addAfter: function(record, prevRecord, index) { + this._insertAfter(record, prevRecord, index); + if (this._additionsTail === null) { + this._additionsTail = this._additionsHead = record; + } else { + this._additionsTail = this._additionsTail._nextAdded = record; + } + return record; + }, + _insertAfter: function(record, prevRecord, index) { + var next = prevRecord === null ? this._itHead : prevRecord._next; + record._next = next; + record._prev = prevRecord; + if (next === null) { + this._itTail = record; + } else { + next._prev = record; + } + if (prevRecord === null) { + this._itHead = record; + } else { + prevRecord._next = record; + } + if (this._linkedRecords === null) { + this._linkedRecords = new _DuplicateMap(); + } + this._linkedRecords.put(record); + record.currentIndex = index; + return record; + }, + _remove: function(record) { + return this._addToRemovals(this._unlink(record)); + }, + _unlink: function(record) { + if (this._linkedRecords !== null) { + this._linkedRecords.remove(record); + } + var prev = record._prev; + var next = record._next; + if (prev === null) { + this._itHead = next; + } else { + prev._next = next; + } + if (next === null) { + this._itTail = prev; + } else { + next._prev = prev; + } + return record; + }, + _addToMoves: function(record, toIndex) { + if (record.previousIndex === toIndex) { + return record; + } + if (this._movesTail === null) { + this._movesTail = this._movesHead = record; + } else { + this._movesTail = this._movesTail._nextMoved = record; + } + return record; + }, + _addToRemovals: function(record) { + if (this._unlinkedRecords === null) { + this._unlinkedRecords = new _DuplicateMap(); + } + this._unlinkedRecords.put(record); + record.currentIndex = null; + record._nextRemoved = null; + if (this._removalsTail === null) { + this._removalsTail = this._removalsHead = record; + record._prevRemoved = null; + } else { + record._prevRemoved = this._removalsTail; + this._removalsTail = this._removalsTail._nextRemoved = record; + } + return record; + }, + toString: function() { + var record; + var list = []; + for (record = this._itHead; record !== null; record = record._next) { + list.push(record); + } + var previous = []; + for (record = this._previousItHead; record !== null; record = record._nextPrevious) { + previous.push(record); + } + var additions = []; + for (record = this._additionsHead; record !== null; record = record._nextAdded) { + additions.push(record); + } + var moves = []; + for (record = this._movesHead; record !== null; record = record._nextMoved) { + moves.push(record); + } + var removals = []; + for (record = this._removalsHead; record !== null; record = record._nextRemoved) { + removals.push(record); + } + return "collection: " + list.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" + "additions: " + additions.join(', ') + "\n" + "moves: " + moves.join(', ') + "\n" + "removals: " + removals.join(', ') + "\n"; + } + }, {supportsObj: function(obj) { + return isListLikeIterable(obj); + }}, $__super); + }(BasePipe)); + $__export("IterableChanges", IterableChanges); + CollectionChangeRecord = (function() { + function CollectionChangeRecord(item) { + this.item = item; + this.currentIndex = null; + this.previousIndex = null; + this._nextPrevious = null; + this._prev = null; + this._next = null; + this._prevDup = null; + this._nextDup = null; + this._prevRemoved = null; + this._nextRemoved = null; + this._nextAdded = null; + this._nextMoved = null; + } + return ($traceurRuntime.createClass)(CollectionChangeRecord, {toString: function() { + return this.previousIndex === this.currentIndex ? stringify(this.item) : stringify(this.item) + '[' + stringify(this.previousIndex) + '->' + stringify(this.currentIndex) + ']'; + }}, {}); + }()); + $__export("CollectionChangeRecord", CollectionChangeRecord); + _DuplicateItemRecordList = (function() { + function _DuplicateItemRecordList() { + this._head = null; + this._tail = null; + } + return ($traceurRuntime.createClass)(_DuplicateItemRecordList, { + add: function(record) { + if (this._head === null) { + this._head = this._tail = record; + record._nextDup = null; + record._prevDup = null; + } else { + this._tail._nextDup = record; + record._prevDup = this._tail; + record._nextDup = null; + this._tail = record; + } + }, + get: function(item, afterIndex) { + var record; + for (record = this._head; record !== null; record = record._nextDup) { + if ((afterIndex === null || afterIndex < record.currentIndex) && looseIdentical(record.item, item)) { + return record; + } + } + return null; + }, + remove: function(record) { + var prev = record._prevDup; + var next = record._nextDup; + if (prev === null) { + this._head = next; + } else { + prev._nextDup = next; + } + if (next === null) { + this._tail = prev; + } else { + next._prevDup = prev; + } + return this._head === null; + } + }, {}); + }()); + _DuplicateMap = (function() { + function _DuplicateMap() { + this.map = new Map(); + } + return ($traceurRuntime.createClass)(_DuplicateMap, { + put: function(record) { + var key = getMapKey(record.item); + var duplicates = this.map.get(key); + if (!isPresent(duplicates)) { + duplicates = new _DuplicateItemRecordList(); + this.map.set(key, duplicates); + } + duplicates.add(record); + }, + get: function(value) { + var afterIndex = arguments[1] !== (void 0) ? arguments[1] : null; + var key = getMapKey(value); + var recordList = this.map.get(key); + return isBlank(recordList) ? null : recordList.get(value, afterIndex); + }, + remove: function(record) { + var key = getMapKey(record.item); + var recordList = this.map.get(key); + if (recordList.remove(record)) { + MapWrapper.delete(this.map, key); + } + return record; + }, + get isEmpty() { + return MapWrapper.size(this.map) === 0; + }, + clear: function() { + this.map.clear(); + }, + toString: function() { + return '_DuplicateMap(' + stringify(this.map) + ')'; + } + }, {}); + }()); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/keyvalue_changes", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/keyvalue_changes"; + var __decorate, + __metadata, + MapWrapper, + StringMapWrapper, + stringify, + looseIdentical, + isJsObject, + CONST, + WrappedValue, + BasePipe, + KeyValueChangesFactory, + KeyValueChanges, + KVChangeRecord; + return { + setters: [function($__m) { + MapWrapper = $__m.MapWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + stringify = $__m.stringify; + looseIdentical = $__m.looseIdentical; + isJsObject = $__m.isJsObject; + CONST = $__m.CONST; + }, function($__m) { + WrappedValue = $__m.WrappedValue; + BasePipe = $__m.BasePipe; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + KeyValueChangesFactory = (($traceurRuntime.createClass)(function() {}, { + supports: function(obj) { + return KeyValueChanges.supportsObj(obj); + }, + create: function(cdRef) { + return new KeyValueChanges(); + } + }, {})); + $__export("KeyValueChangesFactory", KeyValueChangesFactory); + $__export("KeyValueChangesFactory", KeyValueChangesFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], KeyValueChangesFactory)); + KeyValueChanges = (function($__super) { + function KeyValueChanges() { + var $__4; + for (var args = [], + $__3 = 0; $__3 < arguments.length; $__3++) + args[$__3] = arguments[$__3]; + ($__4 = $traceurRuntime.superConstructor(KeyValueChanges)).call.apply($__4, $traceurRuntime.spread([this], args)); + this._records = new Map(); + this._mapHead = null; + this._previousMapHead = null; + this._changesHead = null; + this._changesTail = null; + this._additionsHead = null; + this._additionsTail = null; + this._removalsHead = null; + this._removalsTail = null; + } + return ($traceurRuntime.createClass)(KeyValueChanges, { + supports: function(obj) { + return KeyValueChanges.supportsObj(obj); + }, + transform: function(map) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + if (this.check(map)) { + return WrappedValue.wrap(this); + } else { + return null; + } + }, + get isDirty() { + return this._additionsHead !== null || this._changesHead !== null || this._removalsHead !== null; + }, + forEachItem: function(fn) { + var record; + for (record = this._mapHead; record !== null; record = record._next) { + fn(record); + } + }, + forEachPreviousItem: function(fn) { + var record; + for (record = this._previousMapHead; record !== null; record = record._nextPrevious) { + fn(record); + } + }, + forEachChangedItem: function(fn) { + var record; + for (record = this._changesHead; record !== null; record = record._nextChanged) { + fn(record); + } + }, + forEachAddedItem: function(fn) { + var record; + for (record = this._additionsHead; record !== null; record = record._nextAdded) { + fn(record); + } + }, + forEachRemovedItem: function(fn) { + var record; + for (record = this._removalsHead; record !== null; record = record._nextRemoved) { + fn(record); + } + }, + check: function(map) { + var $__0 = this; + this._reset(); + var records = this._records; + var oldSeqRecord = this._mapHead; + var lastOldSeqRecord = null; + var lastNewSeqRecord = null; + var seqChanged = false; + this._forEach(map, (function(value, key) { + var newSeqRecord; + if (oldSeqRecord !== null && key === oldSeqRecord.key) { + newSeqRecord = oldSeqRecord; + if (!looseIdentical(value, oldSeqRecord.currentValue)) { + oldSeqRecord.previousValue = oldSeqRecord.currentValue; + oldSeqRecord.currentValue = value; + $__0._addToChanges(oldSeqRecord); + } + } else { + seqChanged = true; + if (oldSeqRecord !== null) { + oldSeqRecord._next = null; + $__0._removeFromSeq(lastOldSeqRecord, oldSeqRecord); + $__0._addToRemovals(oldSeqRecord); + } + if (records.has(key)) { + newSeqRecord = records.get(key); + } else { + newSeqRecord = new KVChangeRecord(key); + records.set(key, newSeqRecord); + newSeqRecord.currentValue = value; + $__0._addToAdditions(newSeqRecord); + } + } + if (seqChanged) { + if ($__0._isInRemovals(newSeqRecord)) { + $__0._removeFromRemovals(newSeqRecord); + } + if (lastNewSeqRecord == null) { + $__0._mapHead = newSeqRecord; + } else { + lastNewSeqRecord._next = newSeqRecord; + } + } + lastOldSeqRecord = oldSeqRecord; + lastNewSeqRecord = newSeqRecord; + oldSeqRecord = oldSeqRecord === null ? null : oldSeqRecord._next; + })); + this._truncate(lastOldSeqRecord, oldSeqRecord); + return this.isDirty; + }, + _reset: function() { + if (this.isDirty) { + var record; + for (record = this._previousMapHead = this._mapHead; record !== null; record = record._next) { + record._nextPrevious = record._next; + } + for (record = this._changesHead; record !== null; record = record._nextChanged) { + record.previousValue = record.currentValue; + } + for (record = this._additionsHead; record != null; record = record._nextAdded) { + record.previousValue = record.currentValue; + } + this._changesHead = this._changesTail = null; + this._additionsHead = this._additionsTail = null; + this._removalsHead = this._removalsTail = null; + } + }, + _truncate: function(lastRecord, record) { + while (record !== null) { + if (lastRecord === null) { + this._mapHead = null; + } else { + lastRecord._next = null; + } + var nextRecord = record._next; + this._addToRemovals(record); + lastRecord = record; + record = nextRecord; + } + for (var rec = this._removalsHead; rec !== null; rec = rec._nextRemoved) { + rec.previousValue = rec.currentValue; + rec.currentValue = null; + MapWrapper.delete(this._records, rec.key); + } + }, + _isInRemovals: function(record) { + return record === this._removalsHead || record._nextRemoved !== null || record._prevRemoved !== null; + }, + _addToRemovals: function(record) { + if (this._removalsHead === null) { + this._removalsHead = this._removalsTail = record; + } else { + this._removalsTail._nextRemoved = record; + record._prevRemoved = this._removalsTail; + this._removalsTail = record; + } + }, + _removeFromSeq: function(prev, record) { + var next = record._next; + if (prev === null) { + this._mapHead = next; + } else { + prev._next = next; + } + }, + _removeFromRemovals: function(record) { + var prev = record._prevRemoved; + var next = record._nextRemoved; + if (prev === null) { + this._removalsHead = next; + } else { + prev._nextRemoved = next; + } + if (next === null) { + this._removalsTail = prev; + } else { + next._prevRemoved = prev; + } + record._prevRemoved = record._nextRemoved = null; + }, + _addToAdditions: function(record) { + if (this._additionsHead === null) { + this._additionsHead = this._additionsTail = record; + } else { + this._additionsTail._nextAdded = record; + this._additionsTail = record; + } + }, + _addToChanges: function(record) { + if (this._changesHead === null) { + this._changesHead = this._changesTail = record; + } else { + this._changesTail._nextChanged = record; + this._changesTail = record; + } + }, + toString: function() { + var items = []; + var previous = []; + var changes = []; + var additions = []; + var removals = []; + var record; + for (record = this._mapHead; record !== null; record = record._next) { + items.push(stringify(record)); + } + for (record = this._previousMapHead; record !== null; record = record._nextPrevious) { + previous.push(stringify(record)); + } + for (record = this._changesHead; record !== null; record = record._nextChanged) { + changes.push(stringify(record)); + } + for (record = this._additionsHead; record !== null; record = record._nextAdded) { + additions.push(stringify(record)); + } + for (record = this._removalsHead; record !== null; record = record._nextRemoved) { + removals.push(stringify(record)); + } + return "map: " + items.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" + "additions: " + additions.join(', ') + "\n" + "changes: " + changes.join(', ') + "\n" + "removals: " + removals.join(', ') + "\n"; + }, + _forEach: function(obj, fn) { + if (obj instanceof Map) { + MapWrapper.forEach(obj, fn); + } else { + StringMapWrapper.forEach(obj, fn); + } + } + }, {supportsObj: function(obj) { + return obj instanceof Map || isJsObject(obj); + }}, $__super); + }(BasePipe)); + $__export("KeyValueChanges", KeyValueChanges); + KVChangeRecord = (function() { + function KVChangeRecord(key) { + this.key = key; + this.previousValue = null; + this.currentValue = null; + this._nextPrevious = null; + this._next = null; + this._nextAdded = null; + this._nextRemoved = null; + this._prevRemoved = null; + this._nextChanged = null; + } + return ($traceurRuntime.createClass)(KVChangeRecord, {toString: function() { + return looseIdentical(this.previousValue, this.currentValue) ? stringify(this.key) : (stringify(this.key) + '[' + stringify(this.previousValue) + '->' + stringify(this.currentValue) + ']'); + }}, {}); + }()); + $__export("KVChangeRecord", KVChangeRecord); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/observable_pipe", ["angular2/src/facade/async", "angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/observable_pipe"; + var __decorate, + __metadata, + ObservableWrapper, + isBlank, + isPresent, + CONST, + WrappedValue, + ObservablePipe, + ObservablePipeFactory; + return { + setters: [function($__m) { + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + CONST = $__m.CONST; + }, function($__m) { + WrappedValue = $__m.WrappedValue; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + ObservablePipe = (function() { + function ObservablePipe(_ref) { + this._ref = _ref; + this._latestValue = null; + this._latestReturnedValue = null; + this._subscription = null; + this._observable = null; + } + return ($traceurRuntime.createClass)(ObservablePipe, { + supports: function(obs) { + return ObservableWrapper.isObservable(obs); + }, + onDestroy: function() { + if (isPresent(this._subscription)) { + this._dispose(); + } + }, + transform: function(obs) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + if (isBlank(this._subscription)) { + this._subscribe(obs); + return null; + } + if (obs !== this._observable) { + this._dispose(); + return this.transform(obs); + } + if (this._latestValue === this._latestReturnedValue) { + return this._latestReturnedValue; + } else { + this._latestReturnedValue = this._latestValue; + return WrappedValue.wrap(this._latestValue); + } + }, + _subscribe: function(obs) { + var $__0 = this; + this._observable = obs; + this._subscription = ObservableWrapper.subscribe(obs, (function(value) { + return $__0._updateLatestValue(value); + }), (function(e) { + throw e; + })); + }, + _dispose: function() { + ObservableWrapper.dispose(this._subscription); + this._latestValue = null; + this._latestReturnedValue = null; + this._subscription = null; + this._observable = null; + }, + _updateLatestValue: function(value) { + this._latestValue = value; + this._ref.requestCheck(); + } + }, {}); + }()); + $__export("ObservablePipe", ObservablePipe); + ObservablePipeFactory = (($traceurRuntime.createClass)(function() {}, { + supports: function(obs) { + return ObservableWrapper.isObservable(obs); + }, + create: function(cdRef) { + return new ObservablePipe(cdRef); + } + }, {})); + $__export("ObservablePipeFactory", ObservablePipeFactory); + $__export("ObservablePipeFactory", ObservablePipeFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], ObservablePipeFactory)); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/promise_pipe", ["angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/promise_pipe"; + var __decorate, + __metadata, + isBlank, + isPresent, + isPromise, + CONST, + WrappedValue, + PromisePipe, + PromisePipeFactory; + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + isPromise = $__m.isPromise; + CONST = $__m.CONST; + }, function($__m) { + WrappedValue = $__m.WrappedValue; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + PromisePipe = (function() { + function PromisePipe(_ref) { + this._ref = _ref; + this._latestValue = null; + this._latestReturnedValue = null; + } + return ($traceurRuntime.createClass)(PromisePipe, { + supports: function(promise) { + return isPromise(promise); + }, + onDestroy: function() { + if (isPresent(this._sourcePromise)) { + this._latestValue = null; + this._latestReturnedValue = null; + this._sourcePromise = null; + } + }, + transform: function(promise) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + var $__0 = this; + if (isBlank(this._sourcePromise)) { + this._sourcePromise = promise; + promise.then((function(val) { + if ($__0._sourcePromise === promise) { + $__0._updateLatestValue(val); + } + })); + return null; + } + if (promise !== this._sourcePromise) { + this._sourcePromise = null; + return this.transform(promise); + } + if (this._latestValue === this._latestReturnedValue) { + return this._latestReturnedValue; + } else { + this._latestReturnedValue = this._latestValue; + return WrappedValue.wrap(this._latestValue); + } + }, + _updateLatestValue: function(value) { + this._latestValue = value; + this._ref.requestCheck(); + } + }, {}); + }()); + $__export("PromisePipe", PromisePipe); + PromisePipeFactory = (($traceurRuntime.createClass)(function() {}, { + supports: function(promise) { + return isPromise(promise); + }, + create: function(cdRef) { + return new PromisePipe(cdRef); + } + }, {})); + $__export("PromisePipeFactory", PromisePipeFactory); + $__export("PromisePipeFactory", PromisePipeFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], PromisePipeFactory)); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/uppercase_pipe", ["angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/uppercase_pipe"; + var __decorate, + __metadata, + isString, + StringWrapper, + CONST, + BasePipe, + UpperCasePipe; + return { + setters: [function($__m) { + isString = $__m.isString; + StringWrapper = $__m.StringWrapper; + CONST = $__m.CONST; + }, function($__m) { + BasePipe = $__m.BasePipe; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + UpperCasePipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, { + supports: function(str) { + return isString(str); + }, + transform: function(value) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + return StringWrapper.toUpperCase(value); + }, + create: function(cdRef) { + return this; + } + }, {}, $__super); + }(BasePipe)); + $__export("UpperCasePipe", UpperCasePipe); + $__export("UpperCasePipe", UpperCasePipe = __decorate([CONST(), __metadata('design:paramtypes', [])], UpperCasePipe)); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/lowercase_pipe", ["angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/lowercase_pipe"; + var __decorate, + __metadata, + isString, + StringWrapper, + CONST, + BasePipe, + LowerCasePipe; + return { + setters: [function($__m) { + isString = $__m.isString; + StringWrapper = $__m.StringWrapper; + CONST = $__m.CONST; + }, function($__m) { + BasePipe = $__m.BasePipe; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + LowerCasePipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, { + supports: function(str) { + return isString(str); + }, + transform: function(value) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + return StringWrapper.toLowerCase(value); + }, + create: function(cdRef) { + return this; + } + }, {}, $__super); + }(BasePipe)); + $__export("LowerCasePipe", LowerCasePipe); + $__export("LowerCasePipe", LowerCasePipe = __decorate([CONST(), __metadata('design:paramtypes', [])], LowerCasePipe)); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/json_pipe", ["angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/json_pipe"; + var __decorate, + __metadata, + Json, + CONST, + BasePipe, + JsonPipe; + return { + setters: [function($__m) { + Json = $__m.Json; + CONST = $__m.CONST; + }, function($__m) { + BasePipe = $__m.BasePipe; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + JsonPipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, { + transform: function(value) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + return Json.stringify(value); + }, + create: function(cdRef) { + return this; + } + }, {}, $__super); + }(BasePipe)); + $__export("JsonPipe", JsonPipe); + $__export("JsonPipe", JsonPipe = __decorate([CONST(), __metadata('design:paramtypes', [])], JsonPipe)); + } + }; +}); + +System.register("angular2/src/facade/math", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/facade/math"; + var global, + Math, + NaN; + return { + setters: [function($__m) { + global = $__m.global; + }], + execute: function() { + Math = global.Math; + $__export("Math", Math); + NaN = typeof NaN; + $__export("NaN", NaN); + } + }; +}); + +System.register("angular2/src/facade/intl", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/facade/intl"; + var NumberFormatStyle, + NumberFormatter, + dateFormatterCache, + DateFormatter; + function digitCondition(len) { + return len == 2 ? '2-digit' : 'numeric'; + } + function nameCondition(len) { + return len < 4 ? 'short' : 'long'; + } + function extractComponents(pattern) { + var ret = {}; + var i = 0, + j; + while (i < pattern.length) { + j = i; + while (j < pattern.length && pattern[j] == pattern[i]) + j++; + var len = j - i; + switch (pattern[i]) { + case 'G': + ret.era = nameCondition(len); + break; + case 'y': + ret.year = digitCondition(len); + break; + case 'M': + if (len >= 3) + ret.month = nameCondition(len); + else + ret.month = digitCondition(len); + break; + case 'd': + ret.day = digitCondition(len); + break; + case 'E': + ret.weekday = nameCondition(len); + break; + case 'j': + ret.hour = digitCondition(len); + break; + case 'h': + ret.hour = digitCondition(len); + ret.hour12 = true; + break; + case 'H': + ret.hour = digitCondition(len); + ret.hour12 = false; + break; + case 'm': + ret.minute = digitCondition(len); + break; + case 's': + ret.second = digitCondition(len); + break; + case 'z': + ret.timeZoneName = 'long'; + break; + case 'Z': + ret.timeZoneName = 'short'; + break; + } + i = j; + } + return ret; + } + return { + setters: [], + execute: function() { + $__export("NumberFormatStyle", NumberFormatStyle); + (function(NumberFormatStyle) { + NumberFormatStyle[NumberFormatStyle["DECIMAL"] = 0] = "DECIMAL"; + NumberFormatStyle[NumberFormatStyle["PERCENT"] = 1] = "PERCENT"; + NumberFormatStyle[NumberFormatStyle["CURRENCY"] = 2] = "CURRENCY"; + })(NumberFormatStyle || ($__export("NumberFormatStyle", NumberFormatStyle = {}))); + NumberFormatter = (function() { + function NumberFormatter() {} + return ($traceurRuntime.createClass)(NumberFormatter, {}, {format: function(number, locale, style) { + var $__2, + $__3, + $__4, + $__5; + var $__1 = arguments[3] !== (void 0) ? arguments[3] : {}, + minimumIntegerDigits = ($__2 = $__1.minimumIntegerDigits) === void 0 ? 1 : $__2, + minimumFractionDigits = ($__3 = $__1.minimumFractionDigits) === void 0 ? 0 : $__3, + maximumFractionDigits = ($__4 = $__1.maximumFractionDigits) === void 0 ? 3 : $__4, + currency = $__1.currency, + currencyAsSymbol = ($__5 = $__1.currencyAsSymbol) === void 0 ? false : $__5; + var intlOptions = { + minimumIntegerDigits: minimumIntegerDigits, + minimumFractionDigits: minimumFractionDigits, + maximumFractionDigits: maximumFractionDigits + }; + intlOptions.style = NumberFormatStyle[style].toLowerCase(); + if (style == NumberFormatStyle.CURRENCY) { + intlOptions.currency = currency; + intlOptions.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code'; + } + return new Intl.NumberFormat(locale, intlOptions).format(number); + }}); + }()); + $__export("NumberFormatter", NumberFormatter); + dateFormatterCache = new Map(); + DateFormatter = (function() { + function DateFormatter() {} + return ($traceurRuntime.createClass)(DateFormatter, {}, {format: function(date, locale, pattern) { + var key = locale + pattern; + if (dateFormatterCache.has(key)) { + return dateFormatterCache.get(key).format(date); + } + var formatter = new Intl.DateTimeFormat(locale, extractComponents(pattern)); + dateFormatterCache.set(key, formatter); + return formatter.format(date); + }}); + }()); + $__export("DateFormatter", DateFormatter); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/number_pipe", ["angular2/src/facade/lang", "angular2/src/facade/intl", "angular2/src/facade/collection", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/number_pipe"; + var __decorate, + __metadata, + isNumber, + isPresent, + isBlank, + NumberWrapper, + RegExpWrapper, + BaseException, + CONST, + NumberFormatter, + NumberFormatStyle, + ListWrapper, + BasePipe, + defaultLocale, + _re, + NumberPipe, + DecimalPipe, + PercentPipe, + CurrencyPipe; + return { + setters: [function($__m) { + isNumber = $__m.isNumber; + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + NumberWrapper = $__m.NumberWrapper; + RegExpWrapper = $__m.RegExpWrapper; + BaseException = $__m.BaseException; + CONST = $__m.CONST; + }, function($__m) { + NumberFormatter = $__m.NumberFormatter; + NumberFormatStyle = $__m.NumberFormatStyle; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + BasePipe = $__m.BasePipe; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + defaultLocale = 'en-US'; + _re = RegExpWrapper.create('^(\\d+)?\\.((\\d+)(\\-(\\d+))?)?$'); + NumberPipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, { + supports: function(obj) { + return isNumber(obj); + }, + create: function(cdRef) { + return this; + } + }, {_format: function(value, style, digits) { + var currency = arguments[3] !== (void 0) ? arguments[3] : null; + var currencyAsSymbol = arguments[4] !== (void 0) ? arguments[4] : false; + var minInt = 1, + minFraction = 0, + maxFraction = 3; + if (isPresent(digits)) { + var parts = RegExpWrapper.firstMatch(_re, digits); + if (isBlank(parts)) { + throw new BaseException((digits + " is not a valid digit info for number pipes")); + } + if (isPresent(parts[1])) { + minInt = NumberWrapper.parseIntAutoRadix(parts[1]); + } + if (isPresent(parts[3])) { + minFraction = NumberWrapper.parseIntAutoRadix(parts[3]); + } + if (isPresent(parts[5])) { + maxFraction = NumberWrapper.parseIntAutoRadix(parts[5]); + } + } + return NumberFormatter.format(value, defaultLocale, style, { + minimumIntegerDigits: minInt, + minimumFractionDigits: minFraction, + maximumFractionDigits: maxFraction, + currency: currency, + currencyAsSymbol: currencyAsSymbol + }); + }}, $__super); + }(BasePipe)); + $__export("NumberPipe", NumberPipe); + $__export("NumberPipe", NumberPipe = __decorate([CONST(), __metadata('design:paramtypes', [])], NumberPipe)); + DecimalPipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, {transform: function(value, args) { + var digits = ListWrapper.first(args); + return NumberPipe._format(value, NumberFormatStyle.DECIMAL, digits); + }}, {}, $__super); + }(NumberPipe)); + $__export("DecimalPipe", DecimalPipe); + $__export("DecimalPipe", DecimalPipe = __decorate([CONST(), __metadata('design:paramtypes', [])], DecimalPipe)); + PercentPipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, {transform: function(value, args) { + var digits = ListWrapper.first(args); + return NumberPipe._format(value, NumberFormatStyle.PERCENT, digits); + }}, {}, $__super); + }(NumberPipe)); + $__export("PercentPipe", PercentPipe); + $__export("PercentPipe", PercentPipe = __decorate([CONST(), __metadata('design:paramtypes', [])], PercentPipe)); + CurrencyPipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, {transform: function(value, args) { + var currencyCode = isPresent(args) && args.length > 0 ? args[0] : 'USD'; + var symbolDisplay = isPresent(args) && args.length > 1 ? args[1] : false; + var digits = isPresent(args) && args.length > 2 ? args[2] : null; + return NumberPipe._format(value, NumberFormatStyle.CURRENCY, digits, currencyCode, symbolDisplay); + }}, {}, $__super); + }(NumberPipe)); + $__export("CurrencyPipe", CurrencyPipe); + $__export("CurrencyPipe", CurrencyPipe = __decorate([CONST(), __metadata('design:paramtypes', [])], CurrencyPipe)); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/null_pipe", ["angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/null_pipe"; + var __decorate, + __metadata, + isBlank, + CONST, + BasePipe, + WrappedValue, + NullPipeFactory, + NullPipe; + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + CONST = $__m.CONST; + }, function($__m) { + BasePipe = $__m.BasePipe; + WrappedValue = $__m.WrappedValue; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + NullPipeFactory = (($traceurRuntime.createClass)(function() {}, { + supports: function(obj) { + return NullPipe.supportsObj(obj); + }, + create: function(cdRef) { + return new NullPipe(); + } + }, {})); + $__export("NullPipeFactory", NullPipeFactory); + $__export("NullPipeFactory", NullPipeFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], NullPipeFactory)); + NullPipe = (function($__super) { + function NullPipe() { + var $__3; + for (var args = [], + $__2 = 0; $__2 < arguments.length; $__2++) + args[$__2] = arguments[$__2]; + ($__3 = $traceurRuntime.superConstructor(NullPipe)).call.apply($__3, $traceurRuntime.spread([this], args)); + this.called = false; + } + return ($traceurRuntime.createClass)(NullPipe, { + supports: function(obj) { + return NullPipe.supportsObj(obj); + }, + transform: function(value) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + if (!this.called) { + this.called = true; + return WrappedValue.wrap(null); + } else { + return null; + } + } + }, {supportsObj: function(obj) { + return isBlank(obj); + }}, $__super); + }(BasePipe)); + $__export("NullPipe", NullPipe); + } + }; +}); + +System.register("angular2/src/change_detection/interfaces", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/interfaces"; + var __decorate, + __metadata, + CONST, + ChangeDetection, + ChangeDetectorDefinition; + return { + setters: [function($__m) { + CONST = $__m.CONST; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + ChangeDetection = (($traceurRuntime.createClass)(function() {}, {createProtoChangeDetector: function(definition) { + return null; + }}, {})); + $__export("ChangeDetection", ChangeDetection); + $__export("ChangeDetection", ChangeDetection = __decorate([CONST(), __metadata('design:paramtypes', [])], ChangeDetection)); + ChangeDetectorDefinition = (function() { + function ChangeDetectorDefinition(id, strategy, variableNames, bindingRecords, directiveRecords, generateCheckNoChanges) { + this.id = id; + this.strategy = strategy; + this.variableNames = variableNames; + this.bindingRecords = bindingRecords; + this.directiveRecords = directiveRecords; + this.generateCheckNoChanges = generateCheckNoChanges; + } + return ($traceurRuntime.createClass)(ChangeDetectorDefinition, {}, {}); + }()); + $__export("ChangeDetectorDefinition", ChangeDetectorDefinition); + } + }; +}); + +System.register("angular2/src/change_detection/parser/lexer", ["angular2/src/di/decorators", "angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/parser/lexer"; + var __decorate, + __metadata, + Injectable, + SetWrapper, + NumberWrapper, + StringJoiner, + StringWrapper, + BaseException, + isPresent, + TokenType, + Lexer, + Token, + EOF, + $EOF, + $TAB, + $LF, + $VTAB, + $FF, + $CR, + $SPACE, + $BANG, + $DQ, + $HASH, + $$, + $PERCENT, + $AMPERSAND, + $SQ, + $LPAREN, + $RPAREN, + $STAR, + $PLUS, + $COMMA, + $MINUS, + $PERIOD, + $SLASH, + $COLON, + $SEMICOLON, + $LT, + $EQ, + $GT, + $QUESTION, + $0, + $9, + $A, + $E, + $Z, + $LBRACKET, + $BACKSLASH, + $RBRACKET, + $CARET, + $_, + $a, + $e, + $f, + $n, + $r, + $t, + $u, + $v, + $z, + $LBRACE, + $BAR, + $RBRACE, + $NBSP, + ScannerError, + _Scanner, + OPERATORS, + KEYWORDS; + function newCharacterToken(index, code) { + return new Token(index, TokenType.CHARACTER, code, StringWrapper.fromCharCode(code)); + } + function newIdentifierToken(index, text) { + return new Token(index, TokenType.IDENTIFIER, 0, text); + } + function newKeywordToken(index, text) { + return new Token(index, TokenType.KEYWORD, 0, text); + } + function newOperatorToken(index, text) { + return new Token(index, TokenType.OPERATOR, 0, text); + } + function newStringToken(index, text) { + return new Token(index, TokenType.STRING, 0, text); + } + function newNumberToken(index, n) { + return new Token(index, TokenType.NUMBER, n, ""); + } + function isWhitespace(code) { + return (code >= $TAB && code <= $SPACE) || (code == $NBSP); + } + function isIdentifierStart(code) { + return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || (code == $_) || (code == $$); + } + function isIdentifierPart(code) { + return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || ($0 <= code && code <= $9) || (code == $_) || (code == $$); + } + function isDigit(code) { + return $0 <= code && code <= $9; + } + function isExponentStart(code) { + return code == $e || code == $E; + } + function isExponentSign(code) { + return code == $MINUS || code == $PLUS; + } + function unescape(code) { + switch (code) { + case $n: + return $LF; + case $f: + return $FF; + case $r: + return $CR; + case $t: + return $TAB; + case $v: + return $VTAB; + default: + return code; + } + } + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + SetWrapper = $__m.SetWrapper; + }, function($__m) { + NumberWrapper = $__m.NumberWrapper; + StringJoiner = $__m.StringJoiner; + StringWrapper = $__m.StringWrapper; + BaseException = $__m.BaseException; + isPresent = $__m.isPresent; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + $__export("TokenType", TokenType); + (function(TokenType) { + TokenType[TokenType["CHARACTER"] = 0] = "CHARACTER"; + TokenType[TokenType["IDENTIFIER"] = 1] = "IDENTIFIER"; + TokenType[TokenType["KEYWORD"] = 2] = "KEYWORD"; + TokenType[TokenType["STRING"] = 3] = "STRING"; + TokenType[TokenType["OPERATOR"] = 4] = "OPERATOR"; + TokenType[TokenType["NUMBER"] = 5] = "NUMBER"; + })(TokenType || ($__export("TokenType", TokenType = {}))); + Lexer = (($traceurRuntime.createClass)(function() {}, {tokenize: function(text) { + var scanner = new _Scanner(text); + var tokens = []; + var token = scanner.scanToken(); + while (token != null) { + tokens.push(token); + token = scanner.scanToken(); + } + return tokens; + }}, {})); + $__export("Lexer", Lexer); + $__export("Lexer", Lexer = __decorate([Injectable(), __metadata('design:paramtypes', [])], Lexer)); + Token = (function() { + function Token(index, type, numValue, strValue) { + this.index = index; + this.type = type; + this.numValue = numValue; + this.strValue = strValue; + } + return ($traceurRuntime.createClass)(Token, { + isCharacter: function(code) { + return (this.type == TokenType.CHARACTER && this.numValue == code); + }, + isNumber: function() { + return (this.type == TokenType.NUMBER); + }, + isString: function() { + return (this.type == TokenType.STRING); + }, + isOperator: function(operater) { + return (this.type == TokenType.OPERATOR && this.strValue == operater); + }, + isIdentifier: function() { + return (this.type == TokenType.IDENTIFIER); + }, + isKeyword: function() { + return (this.type == TokenType.KEYWORD); + }, + isKeywordVar: function() { + return (this.type == TokenType.KEYWORD && this.strValue == "var"); + }, + isKeywordNull: function() { + return (this.type == TokenType.KEYWORD && this.strValue == "null"); + }, + isKeywordUndefined: function() { + return (this.type == TokenType.KEYWORD && this.strValue == "undefined"); + }, + isKeywordTrue: function() { + return (this.type == TokenType.KEYWORD && this.strValue == "true"); + }, + isKeywordIf: function() { + return (this.type == TokenType.KEYWORD && this.strValue == "if"); + }, + isKeywordElse: function() { + return (this.type == TokenType.KEYWORD && this.strValue == "else"); + }, + isKeywordFalse: function() { + return (this.type == TokenType.KEYWORD && this.strValue == "false"); + }, + toNumber: function() { + return (this.type == TokenType.NUMBER) ? this.numValue : -1; + }, + toString: function() { + switch (this.type) { + case TokenType.CHARACTER: + case TokenType.STRING: + case TokenType.IDENTIFIER: + case TokenType.KEYWORD: + return this.strValue; + case TokenType.NUMBER: + return this.numValue.toString(); + default: + return null; + } + } + }, {}); + }()); + $__export("Token", Token); + EOF = new Token(-1, TokenType.CHARACTER, 0, ""); + $__export("EOF", EOF); + $EOF = 0; + $__export("$EOF", $EOF); + $TAB = 9; + $__export("$TAB", $TAB); + $LF = 10; + $__export("$LF", $LF); + $VTAB = 11; + $__export("$VTAB", $VTAB); + $FF = 12; + $__export("$FF", $FF); + $CR = 13; + $__export("$CR", $CR); + $SPACE = 32; + $__export("$SPACE", $SPACE); + $BANG = 33; + $__export("$BANG", $BANG); + $DQ = 34; + $__export("$DQ", $DQ); + $HASH = 35; + $__export("$HASH", $HASH); + $$ = 36; + $__export("$$", $$); + $PERCENT = 37; + $__export("$PERCENT", $PERCENT); + $AMPERSAND = 38; + $__export("$AMPERSAND", $AMPERSAND); + $SQ = 39; + $__export("$SQ", $SQ); + $LPAREN = 40; + $__export("$LPAREN", $LPAREN); + $RPAREN = 41; + $__export("$RPAREN", $RPAREN); + $STAR = 42; + $__export("$STAR", $STAR); + $PLUS = 43; + $__export("$PLUS", $PLUS); + $COMMA = 44; + $__export("$COMMA", $COMMA); + $MINUS = 45; + $__export("$MINUS", $MINUS); + $PERIOD = 46; + $__export("$PERIOD", $PERIOD); + $SLASH = 47; + $__export("$SLASH", $SLASH); + $COLON = 58; + $__export("$COLON", $COLON); + $SEMICOLON = 59; + $__export("$SEMICOLON", $SEMICOLON); + $LT = 60; + $__export("$LT", $LT); + $EQ = 61; + $__export("$EQ", $EQ); + $GT = 62; + $__export("$GT", $GT); + $QUESTION = 63; + $__export("$QUESTION", $QUESTION); + $0 = 48; + $9 = 57; + $A = 65, $E = 69, $Z = 90; + $LBRACKET = 91; + $__export("$LBRACKET", $LBRACKET); + $BACKSLASH = 92; + $__export("$BACKSLASH", $BACKSLASH); + $RBRACKET = 93; + $__export("$RBRACKET", $RBRACKET); + $CARET = 94; + $_ = 95; + $a = 97, $e = 101, $f = 102, $n = 110, $r = 114, $t = 116, $u = 117, $v = 118, $z = 122; + $LBRACE = 123; + $__export("$LBRACE", $LBRACE); + $BAR = 124; + $__export("$BAR", $BAR); + $RBRACE = 125; + $__export("$RBRACE", $RBRACE); + $NBSP = 160; + ScannerError = (function($__super) { + function ScannerError(message) { + $traceurRuntime.superConstructor(ScannerError).call(this); + this.message = message; + } + return ($traceurRuntime.createClass)(ScannerError, {toString: function() { + return this.message; + }}, {}, $__super); + }(BaseException)); + $__export("ScannerError", ScannerError); + _Scanner = (function() { + function _Scanner(input) { + this.input = input; + this.peek = 0; + this.index = -1; + this.length = input.length; + this.advance(); + } + return ($traceurRuntime.createClass)(_Scanner, { + advance: function() { + this.peek = ++this.index >= this.length ? $EOF : StringWrapper.charCodeAt(this.input, this.index); + }, + scanToken: function() { + var input = this.input, + length = this.length, + peek = this.peek, + index = this.index; + while (peek <= $SPACE) { + if (++index >= length) { + peek = $EOF; + break; + } else { + peek = StringWrapper.charCodeAt(input, index); + } + } + this.peek = peek; + this.index = index; + if (index >= length) { + return null; + } + if (isIdentifierStart(peek)) + return this.scanIdentifier(); + if (isDigit(peek)) + return this.scanNumber(index); + var start = index; + switch (peek) { + case $PERIOD: + this.advance(); + return isDigit(this.peek) ? this.scanNumber(start) : newCharacterToken(start, $PERIOD); + case $LPAREN: + case $RPAREN: + case $LBRACE: + case $RBRACE: + case $LBRACKET: + case $RBRACKET: + case $COMMA: + case $COLON: + case $SEMICOLON: + return this.scanCharacter(start, peek); + case $SQ: + case $DQ: + return this.scanString(); + case $HASH: + case $PLUS: + case $MINUS: + case $STAR: + case $SLASH: + case $PERCENT: + case $CARET: + return this.scanOperator(start, StringWrapper.fromCharCode(peek)); + case $QUESTION: + return this.scanComplexOperator(start, '?', $PERIOD, '.'); + case $LT: + case $GT: + return this.scanComplexOperator(start, StringWrapper.fromCharCode(peek), $EQ, '='); + case $BANG: + case $EQ: + return this.scanComplexOperator(start, StringWrapper.fromCharCode(peek), $EQ, '=', $EQ, '='); + case $AMPERSAND: + return this.scanComplexOperator(start, '&', $AMPERSAND, '&'); + case $BAR: + return this.scanComplexOperator(start, '|', $BAR, '|'); + case $NBSP: + while (isWhitespace(this.peek)) + this.advance(); + return this.scanToken(); + } + this.error(("Unexpected character [" + StringWrapper.fromCharCode(peek) + "]"), 0); + return null; + }, + scanCharacter: function(start, code) { + assert(this.peek == code); + this.advance(); + return newCharacterToken(start, code); + }, + scanOperator: function(start, str) { + assert(this.peek == StringWrapper.charCodeAt(str, 0)); + assert(SetWrapper.has(OPERATORS, str)); + this.advance(); + return newOperatorToken(start, str); + }, + scanComplexOperator: function(start, one, twoCode, two, threeCode, three) { + assert(this.peek == StringWrapper.charCodeAt(one, 0)); + this.advance(); + var str = one; + if (this.peek == twoCode) { + this.advance(); + str += two; + } + if (isPresent(threeCode) && this.peek == threeCode) { + this.advance(); + str += three; + } + assert(SetWrapper.has(OPERATORS, str)); + return newOperatorToken(start, str); + }, + scanIdentifier: function() { + assert(isIdentifierStart(this.peek)); + var start = this.index; + this.advance(); + while (isIdentifierPart(this.peek)) + this.advance(); + var str = this.input.substring(start, this.index); + if (SetWrapper.has(KEYWORDS, str)) { + return newKeywordToken(start, str); + } else { + return newIdentifierToken(start, str); + } + }, + scanNumber: function(start) { + assert(isDigit(this.peek)); + var simple = (this.index === start); + this.advance(); + while (true) { + if (isDigit(this.peek)) {} else if (this.peek == $PERIOD) { + simple = false; + } else if (isExponentStart(this.peek)) { + this.advance(); + if (isExponentSign(this.peek)) + this.advance(); + if (!isDigit(this.peek)) + this.error('Invalid exponent', -1); + simple = false; + } else { + break; + } + this.advance(); + } + var str = this.input.substring(start, this.index); + var value = simple ? NumberWrapper.parseIntAutoRadix(str) : NumberWrapper.parseFloat(str); + return newNumberToken(start, value); + }, + scanString: function() { + assert(this.peek == $SQ || this.peek == $DQ); + var start = this.index; + var quote = this.peek; + this.advance(); + var buffer; + var marker = this.index; + var input = this.input; + while (this.peek != quote) { + if (this.peek == $BACKSLASH) { + if (buffer == null) + buffer = new StringJoiner(); + buffer.add(input.substring(marker, this.index)); + this.advance(); + var unescapedCode = void 0; + if (this.peek == $u) { + var hex = input.substring(this.index + 1, this.index + 5); + try { + unescapedCode = NumberWrapper.parseInt(hex, 16); + } catch (e) { + this.error(("Invalid unicode escape [\\u" + hex + "]"), 0); + } + for (var i = 0; i < 5; i++) { + this.advance(); + } + } else { + unescapedCode = unescape(this.peek); + this.advance(); + } + buffer.add(StringWrapper.fromCharCode(unescapedCode)); + marker = this.index; + } else if (this.peek == $EOF) { + this.error('Unterminated quote', 0); + } else { + this.advance(); + } + } + var last = input.substring(marker, this.index); + this.advance(); + var unescaped = last; + if (buffer != null) { + buffer.add(last); + unescaped = buffer.toString(); + } + return newStringToken(start, unescaped); + }, + error: function(message, offset) { + var position = this.index + offset; + throw new ScannerError(("Lexer Error: " + message + " at column " + position + " in expression [" + this.input + "]")); + } + }, {}); + }()); + OPERATORS = SetWrapper.createFromList(['+', '-', '*', '/', '%', '^', '=', '==', '!=', '===', '!==', '<', '>', '<=', '>=', '&&', '||', '&', '|', '!', '?', '#', '?.']); + KEYWORDS = SetWrapper.createFromList(['var', 'null', 'undefined', 'true', 'false', 'if', 'else']); + } + }; +}); + +System.register("angular2/src/change_detection/parser/parser", ["angular2/src/di/decorators", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/parser/lexer", "angular2/src/reflection/reflection", "angular2/src/change_detection/parser/ast"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/parser/parser"; + var __decorate, + __metadata, + Injectable, + isBlank, + isPresent, + BaseException, + StringWrapper, + ListWrapper, + Lexer, + EOF, + $PERIOD, + $COLON, + $SEMICOLON, + $LBRACKET, + $RBRACKET, + $COMMA, + $LBRACE, + $RBRACE, + $LPAREN, + $RPAREN, + reflector, + Reflector, + EmptyExpr, + ImplicitReceiver, + AccessMember, + SafeAccessMember, + LiteralPrimitive, + Binary, + PrefixNot, + Conditional, + If, + BindingPipe, + Assignment, + Chain, + KeyedAccess, + LiteralArray, + LiteralMap, + Interpolation, + MethodCall, + SafeMethodCall, + FunctionCall, + TemplateBinding, + ASTWithSource, + _implicitReceiver, + INTERPOLATION_REGEXP, + Parser, + _ParseAST, + SimpleExpressionChecker; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + Lexer = $__m.Lexer; + EOF = $__m.EOF; + $PERIOD = $__m.$PERIOD; + $COLON = $__m.$COLON; + $SEMICOLON = $__m.$SEMICOLON; + $LBRACKET = $__m.$LBRACKET; + $RBRACKET = $__m.$RBRACKET; + $COMMA = $__m.$COMMA; + $LBRACE = $__m.$LBRACE; + $RBRACE = $__m.$RBRACE; + $LPAREN = $__m.$LPAREN; + $RPAREN = $__m.$RPAREN; + }, function($__m) { + reflector = $__m.reflector; + Reflector = $__m.Reflector; + }, function($__m) { + EmptyExpr = $__m.EmptyExpr; + ImplicitReceiver = $__m.ImplicitReceiver; + AccessMember = $__m.AccessMember; + SafeAccessMember = $__m.SafeAccessMember; + LiteralPrimitive = $__m.LiteralPrimitive; + Binary = $__m.Binary; + PrefixNot = $__m.PrefixNot; + Conditional = $__m.Conditional; + If = $__m.If; + BindingPipe = $__m.BindingPipe; + Assignment = $__m.Assignment; + Chain = $__m.Chain; + KeyedAccess = $__m.KeyedAccess; + LiteralArray = $__m.LiteralArray; + LiteralMap = $__m.LiteralMap; + Interpolation = $__m.Interpolation; + MethodCall = $__m.MethodCall; + SafeMethodCall = $__m.SafeMethodCall; + FunctionCall = $__m.FunctionCall; + TemplateBinding = $__m.TemplateBinding; + ASTWithSource = $__m.ASTWithSource; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + _implicitReceiver = new ImplicitReceiver(); + INTERPOLATION_REGEXP = /\{\{(.*?)\}\}/g; + Parser = (($traceurRuntime.createClass)(function(_lexer) { + var providedReflector = arguments[1] !== (void 0) ? arguments[1] : null; + this._lexer = _lexer; + this._reflector = isPresent(providedReflector) ? providedReflector : reflector; + }, { + parseAction: function(input, location) { + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, true).parseChain(); + return new ASTWithSource(ast, input, location); + }, + parseBinding: function(input, location) { + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); + return new ASTWithSource(ast, input, location); + }, + parseSimpleBinding: function(input, location) { + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseSimpleBinding(); + return new ASTWithSource(ast, input, location); + }, + parseTemplateBindings: function(input, location) { + var tokens = this._lexer.tokenize(input); + return new _ParseAST(input, location, tokens, this._reflector, false).parseTemplateBindings(); + }, + parseInterpolation: function(input, location) { + var parts = StringWrapper.split(input, INTERPOLATION_REGEXP); + if (parts.length <= 1) { + return null; + } + var strings = []; + var expressions = []; + for (var i = 0; i < parts.length; i++) { + var part = parts[i]; + if (i % 2 === 0) { + strings.push(part); + } else { + var tokens = this._lexer.tokenize(part); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); + expressions.push(ast); + } + } + return new ASTWithSource(new Interpolation(strings, expressions), input, location); + }, + wrapLiteralPrimitive: function(input, location) { + return new ASTWithSource(new LiteralPrimitive(input), input, location); + } + }, {})); + $__export("Parser", Parser); + $__export("Parser", Parser = __decorate([Injectable(), __metadata('design:paramtypes', [Lexer, Reflector])], Parser)); + _ParseAST = (function() { + function _ParseAST(input, location, tokens, reflector, parseAction) { + this.input = input; + this.location = location; + this.tokens = tokens; + this.reflector = reflector; + this.parseAction = parseAction; + this.index = 0; + } + return ($traceurRuntime.createClass)(_ParseAST, { + peek: function(offset) { + var i = this.index + offset; + return i < this.tokens.length ? this.tokens[i] : EOF; + }, + get next() { + return this.peek(0); + }, + get inputIndex() { + return (this.index < this.tokens.length) ? this.next.index : this.input.length; + }, + advance: function() { + this.index++; + }, + optionalCharacter: function(code) { + if (this.next.isCharacter(code)) { + this.advance(); + return true; + } else { + return false; + } + }, + optionalKeywordVar: function() { + if (this.peekKeywordVar()) { + this.advance(); + return true; + } else { + return false; + } + }, + peekKeywordVar: function() { + return this.next.isKeywordVar() || this.next.isOperator('#'); + }, + expectCharacter: function(code) { + if (this.optionalCharacter(code)) + return ; + this.error(("Missing expected " + StringWrapper.fromCharCode(code))); + }, + optionalOperator: function(op) { + if (this.next.isOperator(op)) { + this.advance(); + return true; + } else { + return false; + } + }, + expectOperator: function(operator) { + if (this.optionalOperator(operator)) + return ; + this.error(("Missing expected operator " + operator)); + }, + expectIdentifierOrKeyword: function() { + var n = this.next; + if (!n.isIdentifier() && !n.isKeyword()) { + this.error(("Unexpected token " + n + ", expected identifier or keyword")); + } + this.advance(); + return n.toString(); + }, + expectIdentifierOrKeywordOrString: function() { + var n = this.next; + if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) { + this.error(("Unexpected token " + n + ", expected identifier, keyword, or string")); + } + this.advance(); + return n.toString(); + }, + parseChain: function() { + var exprs = []; + while (this.index < this.tokens.length) { + var expr = this.parsePipe(); + exprs.push(expr); + if (this.optionalCharacter($SEMICOLON)) { + if (!this.parseAction) { + this.error("Binding expression cannot contain chained expression"); + } + while (this.optionalCharacter($SEMICOLON)) {} + } else if (this.index < this.tokens.length) { + this.error(("Unexpected token '" + this.next + "'")); + } + } + if (exprs.length == 0) + return new EmptyExpr(); + if (exprs.length == 1) + return exprs[0]; + return new Chain(exprs); + }, + parseSimpleBinding: function() { + var ast = this.parseChain(); + if (!SimpleExpressionChecker.check(ast)) { + this.error("Simple binding expression can only contain field access and constants'"); + } + return ast; + }, + parsePipe: function() { + var result = this.parseExpression(); + if (this.optionalOperator("|")) { + if (this.parseAction) { + this.error("Cannot have a pipe in an action expression"); + } + do { + var name = this.expectIdentifierOrKeyword(); + var args = []; + while (this.optionalCharacter($COLON)) { + args.push(this.parsePipe()); + } + result = new BindingPipe(result, name, args); + } while (this.optionalOperator("|")); + } + return result; + }, + parseExpression: function() { + var start = this.inputIndex; + var result = this.parseConditional(); + while (this.next.isOperator('=')) { + if (!result.isAssignable) { + var end = this.inputIndex; + var expression = this.input.substring(start, end); + this.error(("Expression " + expression + " is not assignable")); + } + if (!this.parseAction) { + this.error("Binding expression cannot contain assignments"); + } + this.expectOperator('='); + result = new Assignment(result, this.parseConditional()); + } + return result; + }, + parseConditional: function() { + var start = this.inputIndex; + var result = this.parseLogicalOr(); + if (this.optionalOperator('?')) { + var yes = this.parsePipe(); + if (!this.optionalCharacter($COLON)) { + var end = this.inputIndex; + var expression = this.input.substring(start, end); + this.error(("Conditional expression " + expression + " requires all 3 expressions")); + } + var no = this.parsePipe(); + return new Conditional(result, yes, no); + } else { + return result; + } + }, + parseLogicalOr: function() { + var result = this.parseLogicalAnd(); + while (this.optionalOperator('||')) { + result = new Binary('||', result, this.parseLogicalAnd()); + } + return result; + }, + parseLogicalAnd: function() { + var result = this.parseEquality(); + while (this.optionalOperator('&&')) { + result = new Binary('&&', result, this.parseEquality()); + } + return result; + }, + parseEquality: function() { + var result = this.parseRelational(); + while (true) { + if (this.optionalOperator('==')) { + result = new Binary('==', result, this.parseRelational()); + } else if (this.optionalOperator('===')) { + result = new Binary('===', result, this.parseRelational()); + } else if (this.optionalOperator('!=')) { + result = new Binary('!=', result, this.parseRelational()); + } else if (this.optionalOperator('!==')) { + result = new Binary('!==', result, this.parseRelational()); + } else { + return result; + } + } + }, + parseRelational: function() { + var result = this.parseAdditive(); + while (true) { + if (this.optionalOperator('<')) { + result = new Binary('<', result, this.parseAdditive()); + } else if (this.optionalOperator('>')) { + result = new Binary('>', result, this.parseAdditive()); + } else if (this.optionalOperator('<=')) { + result = new Binary('<=', result, this.parseAdditive()); + } else if (this.optionalOperator('>=')) { + result = new Binary('>=', result, this.parseAdditive()); + } else { + return result; + } + } + }, + parseAdditive: function() { + var result = this.parseMultiplicative(); + while (true) { + if (this.optionalOperator('+')) { + result = new Binary('+', result, this.parseMultiplicative()); + } else if (this.optionalOperator('-')) { + result = new Binary('-', result, this.parseMultiplicative()); + } else { + return result; + } + } + }, + parseMultiplicative: function() { + var result = this.parsePrefix(); + while (true) { + if (this.optionalOperator('*')) { + result = new Binary('*', result, this.parsePrefix()); + } else if (this.optionalOperator('%')) { + result = new Binary('%', result, this.parsePrefix()); + } else if (this.optionalOperator('/')) { + result = new Binary('/', result, this.parsePrefix()); + } else { + return result; + } + } + }, + parsePrefix: function() { + if (this.optionalOperator('+')) { + return this.parsePrefix(); + } else if (this.optionalOperator('-')) { + return new Binary('-', new LiteralPrimitive(0), this.parsePrefix()); + } else if (this.optionalOperator('!')) { + return new PrefixNot(this.parsePrefix()); + } else { + return this.parseCallChain(); + } + }, + parseCallChain: function() { + var result = this.parsePrimary(); + while (true) { + if (this.optionalCharacter($PERIOD)) { + result = this.parseAccessMemberOrMethodCall(result, false); + } else if (this.optionalOperator('?.')) { + result = this.parseAccessMemberOrMethodCall(result, true); + } else if (this.optionalCharacter($LBRACKET)) { + var key = this.parsePipe(); + this.expectCharacter($RBRACKET); + result = new KeyedAccess(result, key); + } else if (this.optionalCharacter($LPAREN)) { + var args = this.parseCallArguments(); + this.expectCharacter($RPAREN); + result = new FunctionCall(result, args); + } else { + return result; + } + } + }, + parsePrimary: function() { + if (this.optionalCharacter($LPAREN)) { + var result = this.parsePipe(); + this.expectCharacter($RPAREN); + return result; + } else if (this.next.isKeywordNull() || this.next.isKeywordUndefined()) { + this.advance(); + return new LiteralPrimitive(null); + } else if (this.next.isKeywordTrue()) { + this.advance(); + return new LiteralPrimitive(true); + } else if (this.next.isKeywordFalse()) { + this.advance(); + return new LiteralPrimitive(false); + } else if (this.parseAction && this.next.isKeywordIf()) { + this.advance(); + this.expectCharacter($LPAREN); + var condition = this.parseExpression(); + this.expectCharacter($RPAREN); + var ifExp = this.parseExpressionOrBlock(); + var elseExp; + if (this.next.isKeywordElse()) { + this.advance(); + elseExp = this.parseExpressionOrBlock(); + } + return new If(condition, ifExp, elseExp); + } else if (this.optionalCharacter($LBRACKET)) { + var elements = this.parseExpressionList($RBRACKET); + this.expectCharacter($RBRACKET); + return new LiteralArray(elements); + } else if (this.next.isCharacter($LBRACE)) { + return this.parseLiteralMap(); + } else if (this.next.isIdentifier()) { + return this.parseAccessMemberOrMethodCall(_implicitReceiver, false); + } else if (this.next.isNumber()) { + var value = this.next.toNumber(); + this.advance(); + return new LiteralPrimitive(value); + } else if (this.next.isString()) { + var literalValue = this.next.toString(); + this.advance(); + return new LiteralPrimitive(literalValue); + } else if (this.index >= this.tokens.length) { + this.error(("Unexpected end of expression: " + this.input)); + } else { + this.error(("Unexpected token " + this.next)); + } + throw new BaseException("Fell through all cases in parsePrimary"); + }, + parseExpressionList: function(terminator) { + var result = []; + if (!this.next.isCharacter(terminator)) { + do { + result.push(this.parsePipe()); + } while (this.optionalCharacter($COMMA)); + } + return result; + }, + parseLiteralMap: function() { + var keys = []; + var values = []; + this.expectCharacter($LBRACE); + if (!this.optionalCharacter($RBRACE)) { + do { + var key = this.expectIdentifierOrKeywordOrString(); + keys.push(key); + this.expectCharacter($COLON); + values.push(this.parsePipe()); + } while (this.optionalCharacter($COMMA)); + this.expectCharacter($RBRACE); + } + return new LiteralMap(keys, values); + }, + parseAccessMemberOrMethodCall: function(receiver) { + var isSafe = arguments[1] !== (void 0) ? arguments[1] : false; + var id = this.expectIdentifierOrKeyword(); + if (this.optionalCharacter($LPAREN)) { + var args = this.parseCallArguments(); + this.expectCharacter($RPAREN); + var fn = this.reflector.method(id); + return isSafe ? new SafeMethodCall(receiver, id, fn, args) : new MethodCall(receiver, id, fn, args); + } else { + var getter = this.reflector.getter(id); + var setter = this.reflector.setter(id); + return isSafe ? new SafeAccessMember(receiver, id, getter, setter) : new AccessMember(receiver, id, getter, setter); + } + }, + parseCallArguments: function() { + if (this.next.isCharacter($RPAREN)) + return []; + var positionals = []; + do { + positionals.push(this.parsePipe()); + } while (this.optionalCharacter($COMMA)); + return positionals; + }, + parseExpressionOrBlock: function() { + if (this.optionalCharacter($LBRACE)) { + var block = this.parseBlockContent(); + this.expectCharacter($RBRACE); + return block; + } + return this.parseExpression(); + }, + parseBlockContent: function() { + if (!this.parseAction) { + this.error("Binding expression cannot contain chained expression"); + } + var exprs = []; + while (this.index < this.tokens.length && !this.next.isCharacter($RBRACE)) { + var expr = this.parseExpression(); + exprs.push(expr); + if (this.optionalCharacter($SEMICOLON)) { + while (this.optionalCharacter($SEMICOLON)) {} + } + } + if (exprs.length == 0) + return new EmptyExpr(); + if (exprs.length == 1) + return exprs[0]; + return new Chain(exprs); + }, + expectTemplateBindingKey: function() { + var result = ''; + var operatorFound = false; + do { + result += this.expectIdentifierOrKeywordOrString(); + operatorFound = this.optionalOperator('-'); + if (operatorFound) { + result += '-'; + } + } while (operatorFound); + return result.toString(); + }, + parseTemplateBindings: function() { + var bindings = []; + var prefix = null; + while (this.index < this.tokens.length) { + var keyIsVar = this.optionalKeywordVar(); + var key = this.expectTemplateBindingKey(); + if (!keyIsVar) { + if (prefix == null) { + prefix = key; + } else { + key = prefix + '-' + key; + } + } + this.optionalCharacter($COLON); + var name = null; + var expression = null; + if (keyIsVar) { + if (this.optionalOperator("=")) { + name = this.expectTemplateBindingKey(); + } else { + name = '\$implicit'; + } + } else if (this.next !== EOF && !this.peekKeywordVar()) { + var start = this.inputIndex; + var ast = this.parsePipe(); + var source = this.input.substring(start, this.inputIndex); + expression = new ASTWithSource(ast, source, this.location); + } + bindings.push(new TemplateBinding(key, keyIsVar, name, expression)); + if (!this.optionalCharacter($SEMICOLON)) { + this.optionalCharacter($COMMA); + } + } + return bindings; + }, + error: function(message) { + var index = arguments[1] !== (void 0) ? arguments[1] : null; + if (isBlank(index)) + index = this.index; + var location = (index < this.tokens.length) ? ("at column " + (this.tokens[index].index + 1) + " in") : "at the end of the expression"; + throw new BaseException(("Parser Error: " + message + " " + location + " [" + this.input + "] in " + this.location)); + } + }, {}); + }()); + $__export("_ParseAST", _ParseAST); + SimpleExpressionChecker = (function() { + function SimpleExpressionChecker() { + this.simple = true; + } + return ($traceurRuntime.createClass)(SimpleExpressionChecker, { + visitImplicitReceiver: function(ast) {}, + visitInterpolation: function(ast) { + this.simple = false; + }, + visitLiteralPrimitive: function(ast) {}, + visitAccessMember: function(ast) {}, + visitSafeAccessMember: function(ast) { + this.simple = false; + }, + visitMethodCall: function(ast) { + this.simple = false; + }, + visitSafeMethodCall: function(ast) { + this.simple = false; + }, + visitFunctionCall: function(ast) { + this.simple = false; + }, + visitLiteralArray: function(ast) { + this.visitAll(ast.expressions); + }, + visitLiteralMap: function(ast) { + this.visitAll(ast.values); + }, + visitBinary: function(ast) { + this.simple = false; + }, + visitPrefixNot: function(ast) { + this.simple = false; + }, + visitConditional: function(ast) { + this.simple = false; + }, + visitPipe: function(ast) { + this.simple = false; + }, + visitKeyedAccess: function(ast) { + this.simple = false; + }, + visitAll: function(asts) { + var res = ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }, + visitChain: function(ast) { + this.simple = false; + }, + visitAssignment: function(ast) { + this.simple = false; + }, + visitIf: function(ast) { + this.simple = false; + } + }, {check: function(ast) { + var s = new SimpleExpressionChecker(); + ast.visit(s); + return s.simple; + }}); + }()); + } + }; +}); + +System.register("angular2/src/change_detection/parser/locals", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/parser/locals"; + var isPresent, + BaseException, + MapWrapper, + Locals; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + }, function($__m) { + MapWrapper = $__m.MapWrapper; + }], + execute: function() { + Locals = (function() { + function Locals(parent, current) { + this.parent = parent; + this.current = current; + } + return ($traceurRuntime.createClass)(Locals, { + contains: function(name) { + if (this.current.has(name)) { + return true; + } + if (isPresent(this.parent)) { + return this.parent.contains(name); + } + return false; + }, + get: function(name) { + if (this.current.has(name)) { + return this.current.get(name); + } + if (isPresent(this.parent)) { + return this.parent.get(name); + } + throw new BaseException(("Cannot find '" + name + "'")); + }, + set: function(name, value) { + if (this.current.has(name)) { + this.current.set(name, value); + } else { + throw new BaseException(("Setting of new keys post-construction is not supported. Key: " + name + ".")); + } + }, + clearValues: function() { + MapWrapper.clearValues(this.current); + } + }, {}); + }()); + $__export("Locals", Locals); + } + }; +}); + +System.register("angular2/src/change_detection/binding_record", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/binding_record"; + var isPresent, + DIRECTIVE, + DIRECTIVE_LIFECYCLE, + ELEMENT_PROPERTY, + ELEMENT_ATTRIBUTE, + ELEMENT_CLASS, + ELEMENT_STYLE, + TEXT_NODE, + BindingRecord; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }], + execute: function() { + DIRECTIVE = "directive"; + DIRECTIVE_LIFECYCLE = "directiveLifecycle"; + ELEMENT_PROPERTY = "elementProperty"; + ELEMENT_ATTRIBUTE = "elementAttribute"; + ELEMENT_CLASS = "elementClass"; + ELEMENT_STYLE = "elementStyle"; + TEXT_NODE = "textNode"; + BindingRecord = (function() { + function BindingRecord(mode, implicitReceiver, ast, elementIndex, propertyName, propertyUnit, setter, lifecycleEvent, directiveRecord) { + this.mode = mode; + this.implicitReceiver = implicitReceiver; + this.ast = ast; + this.elementIndex = elementIndex; + this.propertyName = propertyName; + this.propertyUnit = propertyUnit; + this.setter = setter; + this.lifecycleEvent = lifecycleEvent; + this.directiveRecord = directiveRecord; + } + return ($traceurRuntime.createClass)(BindingRecord, { + callOnChange: function() { + return isPresent(this.directiveRecord) && this.directiveRecord.callOnChange; + }, + isOnPushChangeDetection: function() { + return isPresent(this.directiveRecord) && this.directiveRecord.isOnPushChangeDetection(); + }, + isDirective: function() { + return this.mode === DIRECTIVE; + }, + isDirectiveLifecycle: function() { + return this.mode === DIRECTIVE_LIFECYCLE; + }, + isElementProperty: function() { + return this.mode === ELEMENT_PROPERTY; + }, + isElementAttribute: function() { + return this.mode === ELEMENT_ATTRIBUTE; + }, + isElementClass: function() { + return this.mode === ELEMENT_CLASS; + }, + isElementStyle: function() { + return this.mode === ELEMENT_STYLE; + }, + isTextNode: function() { + return this.mode === TEXT_NODE; + } + }, { + createForDirective: function(ast, propertyName, setter, directiveRecord) { + return new BindingRecord(DIRECTIVE, 0, ast, 0, propertyName, null, setter, null, directiveRecord); + }, + createDirectiveOnCheck: function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, 0, null, 0, null, null, null, "onCheck", directiveRecord); + }, + createDirectiveOnInit: function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, 0, null, 0, null, null, null, "onInit", directiveRecord); + }, + createDirectiveOnChange: function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, 0, null, 0, null, null, null, "onChange", directiveRecord); + }, + createForElementProperty: function(ast, elementIndex, propertyName) { + return new BindingRecord(ELEMENT_PROPERTY, 0, ast, elementIndex, propertyName, null, null, null, null); + }, + createForElementAttribute: function(ast, elementIndex, attributeName) { + return new BindingRecord(ELEMENT_ATTRIBUTE, 0, ast, elementIndex, attributeName, null, null, null, null); + }, + createForElementClass: function(ast, elementIndex, className) { + return new BindingRecord(ELEMENT_CLASS, 0, ast, elementIndex, className, null, null, null, null); + }, + createForElementStyle: function(ast, elementIndex, styleName, unit) { + return new BindingRecord(ELEMENT_STYLE, 0, ast, elementIndex, styleName, unit, null, null, null); + }, + createForHostProperty: function(directiveIndex, ast, propertyName) { + return new BindingRecord(ELEMENT_PROPERTY, directiveIndex, ast, directiveIndex.elementIndex, propertyName, null, null, null, null); + }, + createForHostAttribute: function(directiveIndex, ast, attributeName) { + return new BindingRecord(ELEMENT_ATTRIBUTE, directiveIndex, ast, directiveIndex.elementIndex, attributeName, null, null, null, null); + }, + createForHostClass: function(directiveIndex, ast, className) { + return new BindingRecord(ELEMENT_CLASS, directiveIndex, ast, directiveIndex.elementIndex, className, null, null, null, null); + }, + createForHostStyle: function(directiveIndex, ast, styleName, unit) { + return new BindingRecord(ELEMENT_STYLE, directiveIndex, ast, directiveIndex.elementIndex, styleName, unit, null, null, null); + }, + createForTextNode: function(ast, elementIndex) { + return new BindingRecord(TEXT_NODE, 0, ast, elementIndex, null, null, null, null, null); + } + }); + }()); + $__export("BindingRecord", BindingRecord); + } + }; +}); + +System.register("angular2/src/core/compiler/element_binder", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/element_binder"; + var isBlank, + isPresent, + BaseException, + ElementBinder; + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + }], + execute: function() { + ElementBinder = (function() { + function ElementBinder(index, parent, distanceToParent, protoElementInjector, componentDirective) { + this.index = index; + this.parent = parent; + this.distanceToParent = distanceToParent; + this.protoElementInjector = protoElementInjector; + this.componentDirective = componentDirective; + this.nestedProtoView = null; + this.hostListeners = null; + if (isBlank(index)) { + throw new BaseException('null index not allowed.'); + } + } + return ($traceurRuntime.createClass)(ElementBinder, { + hasStaticComponent: function() { + return isPresent(this.componentDirective) && isPresent(this.nestedProtoView); + }, + hasEmbeddedProtoView: function() { + return !isPresent(this.componentDirective) && isPresent(this.nestedProtoView); + } + }, {}); + }()); + $__export("ElementBinder", ElementBinder); + } + }; +}); + +System.register("angular2/src/core/compiler/view_ref", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view_ref"; + var isPresent, + ViewRef, + ProtoViewRef; + function internalView(viewRef) { + return viewRef._view; + } + function internalProtoView(protoViewRef) { + return isPresent(protoViewRef) ? protoViewRef._protoView : null; + } + $__export("internalView", internalView); + $__export("internalProtoView", internalProtoView); + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }], + execute: function() { + ViewRef = (function() { + function ViewRef(_view) { + this._view = _view; + } + return ($traceurRuntime.createClass)(ViewRef, { + get render() { + return this._view.render; + }, + get renderFragment() { + return this._view.renderFragment; + }, + setLocal: function(contextName, value) { + this._view.setLocal(contextName, value); + } + }, {}); + }()); + $__export("ViewRef", ViewRef); + ProtoViewRef = (function() { + function ProtoViewRef(_protoView) { + this._protoView = _protoView; + } + return ($traceurRuntime.createClass)(ProtoViewRef, {}, {}); + }()); + $__export("ProtoViewRef", ProtoViewRef); + } + }; +}); + +System.register("angular2/src/core/annotations_impl/di", ["angular2/src/facade/lang", "angular2/src/di/metadata", "angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/annotations_impl/di"; + var __decorate, + __metadata, + CONST, + stringify, + StringWrapper, + isString, + DependencyMetadata, + resolveForwardRef, + Attribute, + Query, + ViewQuery; + return { + setters: [function($__m) { + CONST = $__m.CONST; + stringify = $__m.stringify; + StringWrapper = $__m.StringWrapper; + isString = $__m.isString; + }, function($__m) { + DependencyMetadata = $__m.DependencyMetadata; + }, function($__m) { + resolveForwardRef = $__m.resolveForwardRef; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Attribute = (function($__super) { + function $__0(attributeName) { + $traceurRuntime.superConstructor($__0).call(this); + this.attributeName = attributeName; + } + return ($traceurRuntime.createClass)($__0, { + get token() { + return this; + }, + toString: function() { + return ("@Attribute(" + stringify(this.attributeName) + ")"); + } + }, {}, $__super); + }(DependencyMetadata)); + $__export("Attribute", Attribute); + $__export("Attribute", Attribute = __decorate([CONST(), __metadata('design:paramtypes', [String])], Attribute)); + Query = (function($__super) { + function $__0(_selector) { + var $__3; + var $__2 = arguments[1] !== (void 0) ? arguments[1] : {}, + descendants = ($__3 = $__2.descendants) === void 0 ? false : $__3; + $traceurRuntime.superConstructor($__0).call(this); + this._selector = _selector; + this.descendants = descendants; + } + return ($traceurRuntime.createClass)($__0, { + get isViewQuery() { + return false; + }, + get selector() { + return resolveForwardRef(this._selector); + }, + get isVarBindingQuery() { + return isString(this.selector); + }, + get varBindings() { + return StringWrapper.split(this.selector, new RegExp(",")); + }, + toString: function() { + return ("@Query(" + stringify(this.selector) + ")"); + } + }, {}, $__super); + }(DependencyMetadata)); + $__export("Query", Query); + $__export("Query", Query = __decorate([CONST(), __metadata('design:paramtypes', [Object, Object])], Query)); + ViewQuery = (function($__super) { + function $__0(_selector) { + var $__3; + var $__2 = arguments[1] !== (void 0) ? arguments[1] : {}, + descendants = ($__3 = $__2.descendants) === void 0 ? false : $__3; + $traceurRuntime.superConstructor($__0).call(this, _selector, {descendants: descendants}); + } + return ($traceurRuntime.createClass)($__0, { + get isViewQuery() { + return true; + }, + toString: function() { + return ("@ViewQuery(" + stringify(this.selector) + ")"); + } + }, {}, $__super); + }(Query)); + $__export("ViewQuery", ViewQuery); + $__export("ViewQuery", ViewQuery = __decorate([CONST(), __metadata('design:paramtypes', [Object, Object])], ViewQuery)); + } + }; +}); + +System.register("angular2/src/render/api", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/api"; + var isPresent, + isBlank, + RegExpWrapper, + Map, + MapWrapper, + EventBinding, + PropertyBindingType, + ElementPropertyBinding, + ElementBinder, + DirectiveBinder, + ViewType, + ProtoViewDto, + DirectiveMetadata, + RenderProtoViewRef, + RenderFragmentRef, + RenderViewRef, + ViewEncapsulation, + ViewDefinition, + RenderProtoViewMergeMapping, + RenderCompiler, + RenderViewWithFragments, + Renderer; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + RegExpWrapper = $__m.RegExpWrapper; + }, function($__m) { + Map = $__m.Map; + MapWrapper = $__m.MapWrapper; + }], + execute: function() { + EventBinding = (function() { + function EventBinding(fullName, source) { + this.fullName = fullName; + this.source = source; + } + return ($traceurRuntime.createClass)(EventBinding, {}, {}); + }()); + $__export("EventBinding", EventBinding); + $__export("PropertyBindingType", PropertyBindingType); + (function(PropertyBindingType) { + PropertyBindingType[PropertyBindingType["PROPERTY"] = 0] = "PROPERTY"; + PropertyBindingType[PropertyBindingType["ATTRIBUTE"] = 1] = "ATTRIBUTE"; + PropertyBindingType[PropertyBindingType["CLASS"] = 2] = "CLASS"; + PropertyBindingType[PropertyBindingType["STYLE"] = 3] = "STYLE"; + })(PropertyBindingType || ($__export("PropertyBindingType", PropertyBindingType = {}))); + ElementPropertyBinding = (function() { + function ElementPropertyBinding(type, astWithSource, property) { + var unit = arguments[3] !== (void 0) ? arguments[3] : null; + this.type = type; + this.astWithSource = astWithSource; + this.property = property; + this.unit = unit; + } + return ($traceurRuntime.createClass)(ElementPropertyBinding, {}, {}); + }()); + $__export("ElementPropertyBinding", ElementPropertyBinding); + ElementBinder = (function() { + function ElementBinder() { + var $__1 = arguments[0] !== (void 0) ? arguments[0] : {}, + index = $__1.index, + parentIndex = $__1.parentIndex, + distanceToParent = $__1.distanceToParent, + directives = $__1.directives, + nestedProtoView = $__1.nestedProtoView, + propertyBindings = $__1.propertyBindings, + variableBindings = $__1.variableBindings, + eventBindings = $__1.eventBindings, + readAttributes = $__1.readAttributes; + this.index = index; + this.parentIndex = parentIndex; + this.distanceToParent = distanceToParent; + this.directives = directives; + this.nestedProtoView = nestedProtoView; + this.propertyBindings = propertyBindings; + this.variableBindings = variableBindings; + this.eventBindings = eventBindings; + this.readAttributes = readAttributes; + } + return ($traceurRuntime.createClass)(ElementBinder, {}, {}); + }()); + $__export("ElementBinder", ElementBinder); + DirectiveBinder = (function() { + function DirectiveBinder($__1) { + var $__2 = $__1, + directiveIndex = $__2.directiveIndex, + propertyBindings = $__2.propertyBindings, + eventBindings = $__2.eventBindings, + hostPropertyBindings = $__2.hostPropertyBindings; + this.directiveIndex = directiveIndex; + this.propertyBindings = propertyBindings; + this.eventBindings = eventBindings; + this.hostPropertyBindings = hostPropertyBindings; + } + return ($traceurRuntime.createClass)(DirectiveBinder, {}, {}); + }()); + $__export("DirectiveBinder", DirectiveBinder); + $__export("ViewType", ViewType); + (function(ViewType) { + ViewType[ViewType["HOST"] = 0] = "HOST"; + ViewType[ViewType["COMPONENT"] = 1] = "COMPONENT"; + ViewType[ViewType["EMBEDDED"] = 2] = "EMBEDDED"; + })(ViewType || ($__export("ViewType", ViewType = {}))); + ProtoViewDto = (function() { + function ProtoViewDto($__1) { + var $__2 = $__1, + render = $__2.render, + elementBinders = $__2.elementBinders, + variableBindings = $__2.variableBindings, + type = $__2.type, + textBindings = $__2.textBindings, + transitiveNgContentCount = $__2.transitiveNgContentCount; + this.render = render; + this.elementBinders = elementBinders; + this.variableBindings = variableBindings; + this.type = type; + this.textBindings = textBindings; + this.transitiveNgContentCount = transitiveNgContentCount; + } + return ($traceurRuntime.createClass)(ProtoViewDto, {}, {}); + }()); + $__export("ProtoViewDto", ProtoViewDto); + DirectiveMetadata = (function() { + function DirectiveMetadata($__1) { + var $__2 = $__1, + id = $__2.id, + selector = $__2.selector, + compileChildren = $__2.compileChildren, + events = $__2.events, + hostListeners = $__2.hostListeners, + hostProperties = $__2.hostProperties, + hostAttributes = $__2.hostAttributes, + hostActions = $__2.hostActions, + properties = $__2.properties, + readAttributes = $__2.readAttributes, + type = $__2.type, + callOnDestroy = $__2.callOnDestroy, + callOnChange = $__2.callOnChange, + callOnCheck = $__2.callOnCheck, + callOnInit = $__2.callOnInit, + callOnAllChangesDone = $__2.callOnAllChangesDone, + changeDetection = $__2.changeDetection, + exportAs = $__2.exportAs; + this.id = id; + this.selector = selector; + this.compileChildren = isPresent(compileChildren) ? compileChildren : true; + this.events = events; + this.hostListeners = hostListeners; + this.hostAttributes = hostAttributes; + this.hostProperties = hostProperties; + this.hostActions = hostActions; + this.properties = properties; + this.readAttributes = readAttributes; + this.type = type; + this.callOnDestroy = callOnDestroy; + this.callOnChange = callOnChange; + this.callOnCheck = callOnCheck; + this.callOnInit = callOnInit; + this.callOnAllChangesDone = callOnAllChangesDone; + this.changeDetection = changeDetection; + this.exportAs = exportAs; + } + return ($traceurRuntime.createClass)(DirectiveMetadata, {}, { + get DIRECTIVE_TYPE() { + return 0; + }, + get COMPONENT_TYPE() { + return 1; + }, + create: function($__1) { + var $__2 = $__1, + id = $__2.id, + selector = $__2.selector, + compileChildren = $__2.compileChildren, + events = $__2.events, + host = $__2.host, + properties = $__2.properties, + readAttributes = $__2.readAttributes, + type = $__2.type, + callOnDestroy = $__2.callOnDestroy, + callOnChange = $__2.callOnChange, + callOnCheck = $__2.callOnCheck, + callOnInit = $__2.callOnInit, + callOnAllChangesDone = $__2.callOnAllChangesDone, + changeDetection = $__2.changeDetection, + exportAs = $__2.exportAs; + var hostListeners = new Map(); + var hostProperties = new Map(); + var hostAttributes = new Map(); + var hostActions = new Map(); + if (isPresent(host)) { + MapWrapper.forEach(host, (function(value, key) { + var matches = RegExpWrapper.firstMatch(DirectiveMetadata._hostRegExp, key); + if (isBlank(matches)) { + hostAttributes.set(key, value); + } else if (isPresent(matches[1])) { + hostProperties.set(matches[1], value); + } else if (isPresent(matches[2])) { + hostListeners.set(matches[2], value); + } else if (isPresent(matches[3])) { + hostActions.set(matches[3], value); + } + })); + } + return new DirectiveMetadata({ + id: id, + selector: selector, + compileChildren: compileChildren, + events: events, + hostListeners: hostListeners, + hostProperties: hostProperties, + hostAttributes: hostAttributes, + hostActions: hostActions, + properties: properties, + readAttributes: readAttributes, + type: type, + callOnDestroy: callOnDestroy, + callOnChange: callOnChange, + callOnCheck: callOnCheck, + callOnInit: callOnInit, + callOnAllChangesDone: callOnAllChangesDone, + changeDetection: changeDetection, + exportAs: exportAs + }); + } + }); + }()); + $__export("DirectiveMetadata", DirectiveMetadata); + DirectiveMetadata._hostRegExp = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\))|(?:@(.+)))$/g; + RenderProtoViewRef = (function() { + function RenderProtoViewRef() {} + return ($traceurRuntime.createClass)(RenderProtoViewRef, {}, {}); + }()); + $__export("RenderProtoViewRef", RenderProtoViewRef); + RenderFragmentRef = (function() { + function RenderFragmentRef() {} + return ($traceurRuntime.createClass)(RenderFragmentRef, {}, {}); + }()); + $__export("RenderFragmentRef", RenderFragmentRef); + RenderViewRef = (function() { + function RenderViewRef() {} + return ($traceurRuntime.createClass)(RenderViewRef, {}, {}); + }()); + $__export("RenderViewRef", RenderViewRef); + $__export("ViewEncapsulation", ViewEncapsulation); + (function(ViewEncapsulation) { + ViewEncapsulation[ViewEncapsulation["EMULATED"] = 0] = "EMULATED"; + ViewEncapsulation[ViewEncapsulation["NATIVE"] = 1] = "NATIVE"; + ViewEncapsulation[ViewEncapsulation["NONE"] = 2] = "NONE"; + })(ViewEncapsulation || ($__export("ViewEncapsulation", ViewEncapsulation = {}))); + ViewDefinition = (function() { + function ViewDefinition() { + var $__1 = arguments[0] !== (void 0) ? arguments[0] : {}, + componentId = $__1.componentId, + templateAbsUrl = $__1.templateAbsUrl, + template = $__1.template, + styleAbsUrls = $__1.styleAbsUrls, + styles = $__1.styles, + directives = $__1.directives, + encapsulation = $__1.encapsulation; + this.componentId = componentId; + this.templateAbsUrl = templateAbsUrl; + this.template = template; + this.styleAbsUrls = styleAbsUrls; + this.styles = styles; + this.directives = directives; + this.encapsulation = isPresent(encapsulation) ? encapsulation : ViewEncapsulation.EMULATED; + } + return ($traceurRuntime.createClass)(ViewDefinition, {}, {}); + }()); + $__export("ViewDefinition", ViewDefinition); + RenderProtoViewMergeMapping = (function() { + function RenderProtoViewMergeMapping(mergedProtoViewRef, fragmentCount, mappedElementIndices, mappedElementCount, mappedTextIndices, hostElementIndicesByViewIndex, nestedViewCountByViewIndex) { + this.mergedProtoViewRef = mergedProtoViewRef; + this.fragmentCount = fragmentCount; + this.mappedElementIndices = mappedElementIndices; + this.mappedElementCount = mappedElementCount; + this.mappedTextIndices = mappedTextIndices; + this.hostElementIndicesByViewIndex = hostElementIndicesByViewIndex; + this.nestedViewCountByViewIndex = nestedViewCountByViewIndex; + } + return ($traceurRuntime.createClass)(RenderProtoViewMergeMapping, {}, {}); + }()); + $__export("RenderProtoViewMergeMapping", RenderProtoViewMergeMapping); + RenderCompiler = (function() { + function RenderCompiler() {} + return ($traceurRuntime.createClass)(RenderCompiler, { + compileHost: function(directiveMetadata) { + return null; + }, + compile: function(view) { + return null; + }, + mergeProtoViewsRecursively: function(protoViewRefs) { + return null; + } + }, {}); + }()); + $__export("RenderCompiler", RenderCompiler); + RenderViewWithFragments = (function() { + function RenderViewWithFragments(viewRef, fragmentRefs) { + this.viewRef = viewRef; + this.fragmentRefs = fragmentRefs; + } + return ($traceurRuntime.createClass)(RenderViewWithFragments, {}, {}); + }()); + $__export("RenderViewWithFragments", RenderViewWithFragments); + Renderer = (function() { + function Renderer() {} + return ($traceurRuntime.createClass)(Renderer, { + createRootHostView: function(hostProtoViewRef, fragmentCount, hostElementSelector) { + return null; + }, + createView: function(protoViewRef, fragmentCount) { + return null; + }, + destroyView: function(viewRef) {}, + attachFragmentAfterFragment: function(previousFragmentRef, fragmentRef) {}, + attachFragmentAfterElement: function(elementRef, fragmentRef) {}, + detachFragment: function(fragmentRef) {}, + hydrateView: function(viewRef) {}, + dehydrateView: function(viewRef) {}, + getNativeElementSync: function(location) { + return null; + }, + setElementProperty: function(location, propertyName, propertyValue) {}, + setElementAttribute: function(location, attributeName, attributeValue) {}, + setElementClass: function(location, className, isAdd) {}, + setElementStyle: function(location, styleName, styleValue) {}, + invokeElementMethod: function(location, methodName, args) {}, + setText: function(viewRef, textNodeIndex, text) {}, + setEventDispatcher: function(viewRef, dispatcher) {} + }, {}); + }()); + $__export("Renderer", Renderer); + } + }; +}); + +System.register("angular2/src/core/compiler/element_ref", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/element_ref"; + var BaseException, + ElementRef; + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + }], + execute: function() { + ElementRef = (function() { + function ElementRef(parentView, boundElementIndex, renderBoundElementIndex, _renderer) { + this._renderer = _renderer; + this.parentView = parentView; + this.boundElementIndex = boundElementIndex; + this.renderBoundElementIndex = renderBoundElementIndex; + } + return ($traceurRuntime.createClass)(ElementRef, { + get renderView() { + return this.parentView.render; + }, + set renderView(viewRef) { + throw new BaseException('Abstract setter'); + }, + get nativeElement() { + return this._renderer.getNativeElementSync(this); + } + }, {}); + }()); + $__export("ElementRef", ElementRef); + } + }; +}); + +System.register("angular2/src/core/compiler/template_ref", ["angular2/src/core/compiler/view_ref"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/template_ref"; + var internalView, + TemplateRef; + return { + setters: [function($__m) { + internalView = $__m.internalView; + }], + execute: function() { + TemplateRef = (function() { + function TemplateRef(elementRef) { + this.elementRef = elementRef; + } + return ($traceurRuntime.createClass)(TemplateRef, { + _getProtoView: function() { + var parentView = internalView(this.elementRef.parentView); + return parentView.proto.elementBinders[this.elementRef.boundElementIndex - parentView.elementOffset].nestedProtoView; + }, + get protoViewRef() { + return this._getProtoView().ref; + }, + hasLocal: function(name) { + return this._getProtoView().protoLocals.has(name); + } + }, {}); + }()); + $__export("TemplateRef", TemplateRef); + } + }; +}); + +System.register("angular2/src/core/compiler/view_pool", ["angular2/di", "angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view_pool"; + var __decorate, + __metadata, + __param, + Inject, + Injectable, + OpaqueToken, + ListWrapper, + Map, + isPresent, + isBlank, + CONST_EXPR, + APP_VIEW_POOL_CAPACITY, + AppViewPool; + return { + setters: [function($__m) { + Inject = $__m.Inject; + Injectable = $__m.Injectable; + OpaqueToken = $__m.OpaqueToken; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + Map = $__m.Map; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + CONST_EXPR = $__m.CONST_EXPR; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + APP_VIEW_POOL_CAPACITY = CONST_EXPR(new OpaqueToken('AppViewPool.viewPoolCapacity')); + $__export("APP_VIEW_POOL_CAPACITY", APP_VIEW_POOL_CAPACITY); + AppViewPool = (($traceurRuntime.createClass)(function(poolCapacityPerProtoView) { + this._pooledViewsPerProtoView = new Map(); + this._poolCapacityPerProtoView = poolCapacityPerProtoView; + }, { + getView: function(protoView) { + var pooledViews = this._pooledViewsPerProtoView.get(protoView); + if (isPresent(pooledViews) && pooledViews.length > 0) { + return ListWrapper.removeLast(pooledViews); + } + return null; + }, + returnView: function(view) { + var protoView = view.proto; + var pooledViews = this._pooledViewsPerProtoView.get(protoView); + if (isBlank(pooledViews)) { + pooledViews = []; + this._pooledViewsPerProtoView.set(protoView, pooledViews); + } + var haveRemainingCapacity = pooledViews.length < this._poolCapacityPerProtoView; + if (haveRemainingCapacity) { + pooledViews.push(view); + } + return haveRemainingCapacity; + } + }, {})); + $__export("AppViewPool", AppViewPool); + $__export("AppViewPool", AppViewPool = __decorate([Injectable(), __param(0, Inject(APP_VIEW_POOL_CAPACITY)), __metadata('design:paramtypes', [Object])], AppViewPool)); + } + }; +}); + +System.register("angular2/src/core/compiler/view_listener", ["angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view_listener"; + var __decorate, + __metadata, + Injectable, + AppViewListener; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + AppViewListener = (($traceurRuntime.createClass)(function() {}, { + viewCreated: function(view) {}, + viewDestroyed: function(view) {} + }, {})); + $__export("AppViewListener", AppViewListener); + $__export("AppViewListener", AppViewListener = __decorate([Injectable(), __metadata('design:paramtypes', [])], AppViewListener)); + } + }; +}); + +System.register("angular2/src/core/compiler/view_container_ref", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/core/compiler/view_ref"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view_container_ref"; + var ListWrapper, + isPresent, + internalView, + ViewContainerRef; + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + internalView = $__m.internalView; + }], + execute: function() { + ViewContainerRef = (function() { + function ViewContainerRef(viewManager, element) { + this.viewManager = viewManager; + this.element = element; + } + return ($traceurRuntime.createClass)(ViewContainerRef, { + _getViews: function() { + var vc = internalView(this.element.parentView).viewContainers[this.element.boundElementIndex]; + return isPresent(vc) ? vc.views : []; + }, + clear: function() { + for (var i = this.length - 1; i >= 0; i--) { + this.remove(i); + } + }, + get: function(index) { + return this._getViews()[index].ref; + }, + get length() { + return this._getViews().length; + }, + createEmbeddedView: function(templateRef) { + var atIndex = arguments[1] !== (void 0) ? arguments[1] : -1; + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.createEmbeddedViewInContainer(this.element, atIndex, templateRef); + }, + createHostView: function() { + var protoViewRef = arguments[0] !== (void 0) ? arguments[0] : null; + var atIndex = arguments[1] !== (void 0) ? arguments[1] : -1; + var dynamicallyCreatedBindings = arguments[2] !== (void 0) ? arguments[2] : null; + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.createHostViewInContainer(this.element, atIndex, protoViewRef, dynamicallyCreatedBindings); + }, + insert: function(viewRef) { + var atIndex = arguments[1] !== (void 0) ? arguments[1] : -1; + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.attachViewInContainer(this.element, atIndex, viewRef); + }, + indexOf: function(viewRef) { + return ListWrapper.indexOf(this._getViews(), internalView(viewRef)); + }, + remove: function() { + var atIndex = arguments[0] !== (void 0) ? arguments[0] : -1; + if (atIndex == -1) + atIndex = this.length - 1; + this.viewManager.destroyViewInContainer(this.element, atIndex); + }, + detach: function() { + var atIndex = arguments[0] !== (void 0) ? arguments[0] : -1; + if (atIndex == -1) + atIndex = this.length - 1; + return this.viewManager.detachViewInContainer(this.element, atIndex); + } + }, {}); + }()); + $__export("ViewContainerRef", ViewContainerRef); + } + }; +}); + +System.register("angular2/src/core/compiler/directive_lifecycle_reflector", ["angular2/src/facade/lang", "angular2/src/core/annotations_impl/annotations"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/directive_lifecycle_reflector"; + var Type, + isPresent, + LifecycleEvent; + function hasLifecycleHook(e, type, annotation) { + if (isPresent(annotation.lifecycle)) { + return annotation.lifecycle.indexOf(e) !== -1; + } else { + if (!(type instanceof Type)) + return false; + var proto = type.prototype; + switch (e) { + case LifecycleEvent.onAllChangesDone: + return !!proto.onAllChangesDone; + case LifecycleEvent.onChange: + return !!proto.onChange; + case LifecycleEvent.onCheck: + return !!proto.onCheck; + case LifecycleEvent.onDestroy: + return !!proto.onDestroy; + case LifecycleEvent.onInit: + return !!proto.onInit; + default: + return false; + } + } + } + $__export("hasLifecycleHook", hasLifecycleHook); + return { + setters: [function($__m) { + Type = $__m.Type; + isPresent = $__m.isPresent; + }, function($__m) { + LifecycleEvent = $__m.LifecycleEvent; + }], + execute: function() { + } + }; +}); + +System.register("angular2/src/core/compiler/query_list", ["angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/query_list"; + var ListWrapper, + QueryList; + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + }], + execute: function() { + QueryList = (function() { + var $__1; + function QueryList() { + this._results = []; + this._callbacks = []; + this._dirty = false; + } + return ($traceurRuntime.createClass)(QueryList, ($__1 = {}, Object.defineProperty($__1, "reset", { + value: function(newList) { + this._results = newList; + this._dirty = true; + }, + configurable: true, + enumerable: true, + writable: true + }), Object.defineProperty($__1, "add", { + value: function(obj) { + this._results.push(obj); + this._dirty = true; + }, + configurable: true, + enumerable: true, + writable: true + }), Object.defineProperty($__1, "fireCallbacks", { + value: function() { + if (this._dirty) { + ListWrapper.forEach(this._callbacks, (function(c) { + return c(); + })); + this._dirty = false; + } + }, + configurable: true, + enumerable: true, + writable: true + }), Object.defineProperty($__1, "onChange", { + value: function(callback) { + this._callbacks.push(callback); + }, + configurable: true, + enumerable: true, + writable: true + }), Object.defineProperty($__1, "removeCallback", { + value: function(callback) { + ListWrapper.remove(this._callbacks, callback); + }, + configurable: true, + enumerable: true, + writable: true + }), Object.defineProperty($__1, "length", { + get: function() { + return this._results.length; + }, + configurable: true, + enumerable: true + }), Object.defineProperty($__1, "first", { + get: function() { + return ListWrapper.first(this._results); + }, + configurable: true, + enumerable: true + }), Object.defineProperty($__1, "last", { + get: function() { + return ListWrapper.last(this._results); + }, + configurable: true, + enumerable: true + }), Object.defineProperty($__1, "map", { + value: function(fn) { + return this._results.map(fn); + }, + configurable: true, + enumerable: true, + writable: true + }), Object.defineProperty($__1, Symbol.iterator, { + value: function() { + return this._results[Symbol.iterator](); + }, + configurable: true, + enumerable: true, + writable: true + }), $__1), {}); + }()); + $__export("QueryList", QueryList); + } + }; +}); + +System.register("angular2/src/core/annotations_impl/view", ["angular2/src/facade/lang", "angular2/src/render/api"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/annotations_impl/view"; + var __decorate, + __metadata, + CONST, + View; + return { + setters: [function($__m) { + CONST = $__m.CONST; + }, function($__m) { + $__export("ViewEncapsulation", $__m.ViewEncapsulation); + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + View = (($traceurRuntime.createClass)(function() { + var $__2 = arguments[0] !== (void 0) ? arguments[0] : {}, + templateUrl = $__2.templateUrl, + template = $__2.template, + directives = $__2.directives, + encapsulation = $__2.encapsulation, + styles = $__2.styles, + styleUrls = $__2.styleUrls; + this.templateUrl = templateUrl; + this.template = template; + this.styleUrls = styleUrls; + this.styles = styles; + this.directives = directives; + this.encapsulation = encapsulation; + }, {}, {})); + $__export("View", View); + $__export("View", View = __decorate([CONST(), __metadata('design:paramtypes', [Object])], View)); + } + }; +}); + +System.register("angular2/src/core/compiler/component_url_mapper", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/component_url_mapper"; + var __decorate, + __metadata, + Injectable, + isPresent, + Map, + ComponentUrlMapper, + RuntimeComponentUrlMapper; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + Map = $__m.Map; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + ComponentUrlMapper = (($traceurRuntime.createClass)(function() {}, {getUrl: function(component) { + return './'; + }}, {})); + $__export("ComponentUrlMapper", ComponentUrlMapper); + $__export("ComponentUrlMapper", ComponentUrlMapper = __decorate([Injectable(), __metadata('design:paramtypes', [])], ComponentUrlMapper)); + RuntimeComponentUrlMapper = (function($__super) { + function RuntimeComponentUrlMapper() { + $traceurRuntime.superConstructor(RuntimeComponentUrlMapper).call(this); + this._componentUrls = new Map(); + } + return ($traceurRuntime.createClass)(RuntimeComponentUrlMapper, { + setComponentUrl: function(component, url) { + this._componentUrls.set(component, url); + }, + getUrl: function(component) { + var url = this._componentUrls.get(component); + if (isPresent(url)) + return url; + return $traceurRuntime.superGet(this, RuntimeComponentUrlMapper.prototype, "getUrl").call(this, component); + } + }, {}, $__super); + }(ComponentUrlMapper)); + $__export("RuntimeComponentUrlMapper", RuntimeComponentUrlMapper); + } + }; +}); + +System.register("angular2/src/core/compiler/proto_view_factory", ["angular2/di", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/reflection/reflection", "angular2/src/change_detection/change_detection", "angular2/src/render/api", "angular2/src/core/compiler/view", "angular2/src/core/compiler/element_injector"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/proto_view_factory"; + var __decorate, + __metadata, + Injectable, + ListWrapper, + MapWrapper, + isPresent, + isBlank, + BaseException, + assertionsEnabled, + reflector, + ChangeDetection, + DirectiveIndex, + BindingRecord, + DirectiveRecord, + DEFAULT, + ChangeDetectorDefinition, + renderApi, + AppProtoView, + ProtoElementInjector, + BindingRecordsCreator, + ProtoViewFactory, + RenderProtoViewWithIndex, + ParentProtoElementInjectorWithDistance; + function getChangeDetectorDefinitions(hostComponentMetadata, rootRenderProtoView, allRenderDirectiveMetadata) { + var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); + var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); + return _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata); + } + function _collectNestedProtoViews(renderProtoView) { + var parentIndex = arguments[1] !== (void 0) ? arguments[1] : null; + var boundElementIndex = arguments[2] !== (void 0) ? arguments[2] : null; + var result = arguments[3] !== (void 0) ? arguments[3] : null; + if (isBlank(result)) { + result = []; + } + result.push(new RenderProtoViewWithIndex(renderProtoView, result.length, parentIndex, boundElementIndex)); + var currentIndex = result.length - 1; + var childBoundElementIndex = 0; + ListWrapper.forEach(renderProtoView.elementBinders, (function(elementBinder) { + if (isPresent(elementBinder.nestedProtoView)) { + _collectNestedProtoViews(elementBinder.nestedProtoView, currentIndex, childBoundElementIndex, result); + } + childBoundElementIndex++; + })); + return result; + } + function _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata) { + return ListWrapper.map(nestedPvsWithIndex, (function(pvWithIndex) { + var elementBinders = pvWithIndex.renderProtoView.elementBinders; + var bindingRecordsCreator = new BindingRecordsCreator(); + var bindingRecords = bindingRecordsCreator.getBindingRecords(pvWithIndex.renderProtoView.textBindings, elementBinders, allRenderDirectiveMetadata); + var directiveRecords = bindingRecordsCreator.getDirectiveRecords(elementBinders, allRenderDirectiveMetadata); + var strategyName = DEFAULT; + var typeString; + if (pvWithIndex.renderProtoView.type === renderApi.ViewType.COMPONENT) { + strategyName = hostComponentMetadata.changeDetection; + typeString = 'comp'; + } else if (pvWithIndex.renderProtoView.type === renderApi.ViewType.HOST) { + typeString = 'host'; + } else { + typeString = 'embedded'; + } + var id = (hostComponentMetadata.id + "_" + typeString + "_" + pvWithIndex.index); + var variableNames = nestedPvVariableNames[pvWithIndex.index]; + return new ChangeDetectorDefinition(id, strategyName, variableNames, bindingRecords, directiveRecords, assertionsEnabled()); + })); + } + function _createAppProtoView(renderProtoView, protoChangeDetector, variableBindings, allDirectives) { + var elementBinders = renderProtoView.elementBinders; + var protoView = new AppProtoView(renderProtoView.type, renderProtoView.transitiveNgContentCount > 0, renderProtoView.render, protoChangeDetector, variableBindings, createVariableLocations(elementBinders), renderProtoView.textBindings.length); + _createElementBinders(protoView, elementBinders, allDirectives); + _bindDirectiveEvents(protoView, elementBinders); + return protoView; + } + function _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex) { + return ListWrapper.map(nestedPvsWithIndex, (function(pvWithIndex) { + return _createVariableBindings(pvWithIndex.renderProtoView); + })); + } + function _createVariableBindings(renderProtoView) { + var variableBindings = new Map(); + MapWrapper.forEach(renderProtoView.variableBindings, (function(mappedName, varName) { + variableBindings.set(varName, mappedName); + })); + return variableBindings; + } + function _collectNestedProtoViewsVariableNames(nestedPvsWithIndex) { + var nestedPvVariableNames = ListWrapper.createFixedSize(nestedPvsWithIndex.length); + ListWrapper.forEach(nestedPvsWithIndex, (function(pvWithIndex) { + var parentVariableNames = isPresent(pvWithIndex.parentIndex) ? nestedPvVariableNames[pvWithIndex.parentIndex] : null; + nestedPvVariableNames[pvWithIndex.index] = _createVariableNames(parentVariableNames, pvWithIndex.renderProtoView); + })); + return nestedPvVariableNames; + } + function _createVariableNames(parentVariableNames, renderProtoView) { + var res = isBlank(parentVariableNames) ? [] : ListWrapper.clone(parentVariableNames); + MapWrapper.forEach(renderProtoView.variableBindings, (function(mappedName, varName) { + res.push(mappedName); + })); + ListWrapper.forEach(renderProtoView.elementBinders, (function(binder) { + MapWrapper.forEach(binder.variableBindings, (function(mappedName, varName) { + res.push(mappedName); + })); + })); + return res; + } + function createVariableLocations(elementBinders) { + var variableLocations = new Map(); + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + MapWrapper.forEach(binder.variableBindings, (function(mappedName, varName) { + variableLocations.set(mappedName, i); + })); + } + return variableLocations; + } + function _createElementBinders(protoView, elementBinders, allDirectiveBindings) { + for (var i = 0; i < elementBinders.length; i++) { + var renderElementBinder = elementBinders[i]; + var dirs = elementBinders[i].directives; + var parentPeiWithDistance = _findParentProtoElementInjectorWithDistance(i, protoView.elementBinders, elementBinders); + var directiveBindings = ListWrapper.map(dirs, (function(dir) { + return allDirectiveBindings[dir.directiveIndex]; + })); + var componentDirectiveBinding = null; + if (directiveBindings.length > 0) { + if (directiveBindings[0].metadata.type === renderApi.DirectiveMetadata.COMPONENT_TYPE) { + componentDirectiveBinding = directiveBindings[0]; + } + } + var protoElementInjector = _createProtoElementInjector(i, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings); + _createElementBinder(protoView, i, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings); + } + } + function _findParentProtoElementInjectorWithDistance(binderIndex, elementBinders, renderElementBinders) { + var distance = 0; + do { + var renderElementBinder = renderElementBinders[binderIndex]; + binderIndex = renderElementBinder.parentIndex; + if (binderIndex !== -1) { + distance += renderElementBinder.distanceToParent; + var elementBinder = elementBinders[binderIndex]; + if (isPresent(elementBinder.protoElementInjector)) { + return new ParentProtoElementInjectorWithDistance(elementBinder.protoElementInjector, distance); + } + } + } while (binderIndex !== -1); + return new ParentProtoElementInjectorWithDistance(null, 0); + } + function _createProtoElementInjector(binderIndex, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings) { + var protoElementInjector = null; + var hasVariables = MapWrapper.size(renderElementBinder.variableBindings) > 0; + if (directiveBindings.length > 0 || hasVariables) { + var directiveVariableBindings = createDirectiveVariableBindings(renderElementBinder, directiveBindings); + protoElementInjector = ProtoElementInjector.create(parentPeiWithDistance.protoElementInjector, binderIndex, directiveBindings, isPresent(componentDirectiveBinding), parentPeiWithDistance.distance, directiveVariableBindings); + protoElementInjector.attributes = renderElementBinder.readAttributes; + } + return protoElementInjector; + } + function _createElementBinder(protoView, boundElementIndex, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings) { + var parent = null; + if (renderElementBinder.parentIndex !== -1) { + parent = protoView.elementBinders[renderElementBinder.parentIndex]; + } + var elBinder = protoView.bindElement(parent, renderElementBinder.distanceToParent, protoElementInjector, componentDirectiveBinding); + protoView.bindEvent(renderElementBinder.eventBindings, boundElementIndex, -1); + MapWrapper.forEach(renderElementBinder.variableBindings, (function(mappedName, varName) { + protoView.protoLocals.set(mappedName, null); + })); + return elBinder; + } + function createDirectiveVariableBindings(renderElementBinder, directiveBindings) { + var directiveVariableBindings = new Map(); + MapWrapper.forEach(renderElementBinder.variableBindings, (function(templateName, exportAs) { + var dirIndex = _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs); + directiveVariableBindings.set(templateName, dirIndex); + })); + return directiveVariableBindings; + } + function _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs) { + var matchedDirectiveIndex = null; + var matchedDirective; + for (var i = 0; i < directiveBindings.length; ++i) { + var directive = directiveBindings[i]; + if (_directiveExportAs(directive) == exportAs) { + if (isPresent(matchedDirective)) { + throw new BaseException(("More than one directive have exportAs = '" + exportAs + "'. Directives: [" + matchedDirective.displayName + ", " + directive.displayName + "]")); + } + matchedDirectiveIndex = i; + matchedDirective = directive; + } + } + if (isBlank(matchedDirective) && exportAs !== "$implicit") { + throw new BaseException(("Cannot find directive with exportAs = '" + exportAs + "'")); + } + return matchedDirectiveIndex; + } + function _directiveExportAs(directive) { + var directiveExportAs = directive.metadata.exportAs; + if (isBlank(directiveExportAs) && directive.metadata.type === renderApi.DirectiveMetadata.COMPONENT_TYPE) { + return "$implicit"; + } else { + return directiveExportAs; + } + } + function _bindDirectiveEvents(protoView, elementBinders) { + for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; ++boundElementIndex) { + var dirs = elementBinders[boundElementIndex].directives; + for (var i = 0; i < dirs.length; i++) { + var directiveBinder = dirs[i]; + protoView.bindEvent(directiveBinder.eventBindings, boundElementIndex, i); + } + } + } + $__export("getChangeDetectorDefinitions", getChangeDetectorDefinitions); + $__export("createVariableLocations", createVariableLocations); + $__export("createDirectiveVariableBindings", createDirectiveVariableBindings); + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + MapWrapper = $__m.MapWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + assertionsEnabled = $__m.assertionsEnabled; + }, function($__m) { + reflector = $__m.reflector; + }, function($__m) { + ChangeDetection = $__m.ChangeDetection; + DirectiveIndex = $__m.DirectiveIndex; + BindingRecord = $__m.BindingRecord; + DirectiveRecord = $__m.DirectiveRecord; + DEFAULT = $__m.DEFAULT; + ChangeDetectorDefinition = $__m.ChangeDetectorDefinition; + }, function($__m) { + renderApi = $__m; + }, function($__m) { + AppProtoView = $__m.AppProtoView; + }, function($__m) { + ProtoElementInjector = $__m.ProtoElementInjector; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + BindingRecordsCreator = (function() { + function BindingRecordsCreator() { + this._directiveRecordsMap = new Map(); + } + return ($traceurRuntime.createClass)(BindingRecordsCreator, { + getBindingRecords: function(textBindings, elementBinders, allDirectiveMetadatas) { + var bindings = []; + this._createTextNodeRecords(bindings, textBindings); + for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; boundElementIndex++) { + var renderElementBinder = elementBinders[boundElementIndex]; + this._createElementPropertyRecords(bindings, boundElementIndex, renderElementBinder); + this._createDirectiveRecords(bindings, boundElementIndex, renderElementBinder.directives, allDirectiveMetadatas); + } + return bindings; + }, + getDirectiveRecords: function(elementBinders, allDirectiveMetadatas) { + var directiveRecords = []; + for (var elementIndex = 0; elementIndex < elementBinders.length; ++elementIndex) { + var dirs = elementBinders[elementIndex].directives; + for (var dirIndex = 0; dirIndex < dirs.length; ++dirIndex) { + directiveRecords.push(this._getDirectiveRecord(elementIndex, dirIndex, allDirectiveMetadatas[dirs[dirIndex].directiveIndex])); + } + } + return directiveRecords; + }, + _createTextNodeRecords: function(bindings, textBindings) { + for (var i = 0; i < textBindings.length; i++) { + bindings.push(BindingRecord.createForTextNode(textBindings[i], i)); + } + }, + _createElementPropertyRecords: function(bindings, boundElementIndex, renderElementBinder) { + ListWrapper.forEach(renderElementBinder.propertyBindings, (function(binding) { + if (binding.type === renderApi.PropertyBindingType.PROPERTY) { + bindings.push(BindingRecord.createForElementProperty(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === renderApi.PropertyBindingType.ATTRIBUTE) { + bindings.push(BindingRecord.createForElementAttribute(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === renderApi.PropertyBindingType.CLASS) { + bindings.push(BindingRecord.createForElementClass(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === renderApi.PropertyBindingType.STYLE) { + bindings.push(BindingRecord.createForElementStyle(binding.astWithSource, boundElementIndex, binding.property, binding.unit)); + } + })); + }, + _createDirectiveRecords: function(bindings, boundElementIndex, directiveBinders, allDirectiveMetadatas) { + for (var i = 0; i < directiveBinders.length; i++) { + var directiveBinder = directiveBinders[i]; + var directiveMetadata = allDirectiveMetadatas[directiveBinder.directiveIndex]; + var directiveRecord = this._getDirectiveRecord(boundElementIndex, i, directiveMetadata); + MapWrapper.forEach(directiveBinder.propertyBindings, (function(astWithSource, propertyName) { + var setter = reflector.setter(propertyName); + bindings.push(BindingRecord.createForDirective(astWithSource, propertyName, setter, directiveRecord)); + })); + if (directiveRecord.callOnChange) { + bindings.push(BindingRecord.createDirectiveOnChange(directiveRecord)); + } + if (directiveRecord.callOnInit) { + bindings.push(BindingRecord.createDirectiveOnInit(directiveRecord)); + } + if (directiveRecord.callOnCheck) { + bindings.push(BindingRecord.createDirectiveOnCheck(directiveRecord)); + } + } + for (var i = 0; i < directiveBinders.length; i++) { + var directiveBinder = directiveBinders[i]; + ListWrapper.forEach(directiveBinder.hostPropertyBindings, (function(binding) { + var dirIndex = new DirectiveIndex(boundElementIndex, i); + if (binding.type === renderApi.PropertyBindingType.PROPERTY) { + bindings.push(BindingRecord.createForHostProperty(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === renderApi.PropertyBindingType.ATTRIBUTE) { + bindings.push(BindingRecord.createForHostAttribute(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === renderApi.PropertyBindingType.CLASS) { + bindings.push(BindingRecord.createForHostClass(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === renderApi.PropertyBindingType.STYLE) { + bindings.push(BindingRecord.createForHostStyle(dirIndex, binding.astWithSource, binding.property, binding.unit)); + } + })); + } + }, + _getDirectiveRecord: function(boundElementIndex, directiveIndex, directiveMetadata) { + var id = boundElementIndex * 100 + directiveIndex; + if (!this._directiveRecordsMap.has(id)) { + this._directiveRecordsMap.set(id, new DirectiveRecord({ + directiveIndex: new DirectiveIndex(boundElementIndex, directiveIndex), + callOnAllChangesDone: directiveMetadata.callOnAllChangesDone, + callOnChange: directiveMetadata.callOnChange, + callOnCheck: directiveMetadata.callOnCheck, + callOnInit: directiveMetadata.callOnInit, + changeDetection: directiveMetadata.changeDetection + })); + } + return this._directiveRecordsMap.get(id); + } + }, {}); + }()); + ProtoViewFactory = (($traceurRuntime.createClass)(function(_changeDetection) { + this._changeDetection = _changeDetection; + }, {createAppProtoViews: function(hostComponentBinding, rootRenderProtoView, allDirectives) { + var $__0 = this; + var allRenderDirectiveMetadata = ListWrapper.map(allDirectives, (function(directiveBinding) { + return directiveBinding.metadata; + })); + var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); + var nestedPvVariableBindings = _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex); + var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); + var changeDetectorDefs = _getChangeDetectorDefinitions(hostComponentBinding.metadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata); + var protoChangeDetectors = ListWrapper.map(changeDetectorDefs, (function(changeDetectorDef) { + return $__0._changeDetection.createProtoChangeDetector(changeDetectorDef); + })); + var appProtoViews = ListWrapper.createFixedSize(nestedPvsWithIndex.length); + ListWrapper.forEach(nestedPvsWithIndex, (function(pvWithIndex) { + var appProtoView = _createAppProtoView(pvWithIndex.renderProtoView, protoChangeDetectors[pvWithIndex.index], nestedPvVariableBindings[pvWithIndex.index], allDirectives); + if (isPresent(pvWithIndex.parentIndex)) { + var parentView = appProtoViews[pvWithIndex.parentIndex]; + parentView.elementBinders[pvWithIndex.boundElementIndex].nestedProtoView = appProtoView; + } + appProtoViews[pvWithIndex.index] = appProtoView; + })); + return appProtoViews; + }}, {})); + $__export("ProtoViewFactory", ProtoViewFactory); + $__export("ProtoViewFactory", ProtoViewFactory = __decorate([Injectable(), __metadata('design:paramtypes', [ChangeDetection])], ProtoViewFactory)); + RenderProtoViewWithIndex = (function() { + function RenderProtoViewWithIndex(renderProtoView, index, parentIndex, boundElementIndex) { + this.renderProtoView = renderProtoView; + this.index = index; + this.parentIndex = parentIndex; + this.boundElementIndex = boundElementIndex; + } + return ($traceurRuntime.createClass)(RenderProtoViewWithIndex, {}, {}); + }()); + ParentProtoElementInjectorWithDistance = (function() { + function ParentProtoElementInjectorWithDistance(protoElementInjector, distance) { + this.protoElementInjector = protoElementInjector; + this.distance = distance; + } + return ($traceurRuntime.createClass)(ParentProtoElementInjectorWithDistance, {}, {}); + }()); + } + }; +}); + +System.register("angular2/src/services/url_resolver", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/services/url_resolver"; + var __decorate, + __metadata, + Injectable, + isPresent, + isBlank, + RegExpWrapper, + ListWrapper, + UrlResolver, + _splitRe, + _ComponentIndex; + function _buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) { + var out = []; + if (isPresent(opt_scheme)) { + out.push(opt_scheme + ':'); + } + if (isPresent(opt_domain)) { + out.push('//'); + if (isPresent(opt_userInfo)) { + out.push(opt_userInfo + '@'); + } + out.push(opt_domain); + if (isPresent(opt_port)) { + out.push(':' + opt_port); + } + } + if (isPresent(opt_path)) { + out.push(opt_path); + } + if (isPresent(opt_queryData)) { + out.push('?' + opt_queryData); + } + if (isPresent(opt_fragment)) { + out.push('#' + opt_fragment); + } + return out.join(''); + } + function _split(uri) { + return RegExpWrapper.firstMatch(_splitRe, uri); + } + function _removeDotSegments(path) { + if (path == '/') + return '/'; + var leadingSlash = path[0] == '/' ? '/' : ''; + var trailingSlash = path[path.length - 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 > 0) { + ListWrapper.removeAt(out, out.length - 1); + } else { + up++; + } + break; + default: + out.push(segment); + } + } + if (leadingSlash == '') { + while (up-- > 0) { + ListWrapper.insert(out, 0, '..'); + } + if (out.length === 0) + out.push('.'); + } + return leadingSlash + out.join('/') + trailingSlash; + } + function _joinAndCanonicalizePath(parts) { + var path = parts[_ComponentIndex.PATH]; + path = isBlank(path) ? '' : _removeDotSegments(path); + parts[_ComponentIndex.PATH] = path; + return _buildFromEncodedParts(parts[_ComponentIndex.SCHEME], parts[_ComponentIndex.USER_INFO], parts[_ComponentIndex.DOMAIN], parts[_ComponentIndex.PORT], path, parts[_ComponentIndex.QUERY_DATA], parts[_ComponentIndex.FRAGMENT]); + } + function _resolveUrl(base, url) { + var parts = _split(url); + var baseParts = _split(base); + if (isPresent(parts[_ComponentIndex.SCHEME])) { + return _joinAndCanonicalizePath(parts); + } else { + parts[_ComponentIndex.SCHEME] = baseParts[_ComponentIndex.SCHEME]; + } + for (var i = _ComponentIndex.SCHEME; i <= _ComponentIndex.PORT; i++) { + if (isBlank(parts[i])) { + parts[i] = baseParts[i]; + } + } + if (parts[_ComponentIndex.PATH][0] == '/') { + return _joinAndCanonicalizePath(parts); + } + var path = baseParts[_ComponentIndex.PATH]; + if (isBlank(path)) + path = '/'; + var index = path.lastIndexOf('/'); + path = path.substring(0, index + 1) + parts[_ComponentIndex.PATH]; + parts[_ComponentIndex.PATH] = path; + return _joinAndCanonicalizePath(parts); + } + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + RegExpWrapper = $__m.RegExpWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + UrlResolver = (($traceurRuntime.createClass)(function() {}, {resolve: function(baseUrl, url) { + return _resolveUrl(baseUrl, url); + }}, {})); + $__export("UrlResolver", UrlResolver); + $__export("UrlResolver", UrlResolver = __decorate([Injectable(), __metadata('design:paramtypes', [])], UrlResolver)); + _splitRe = RegExpWrapper.create('^' + '(?:' + '([^:/?#.]+)' + ':)?' + '(?://' + '(?:([^/?#]*)@)?' + '([\\w\\d\\-\\u0100-\\uffff.%]*)' + '(?::([0-9]+))?' + ')?' + '([^?#]+)?' + '(?:\\?([^#]*))?' + '(?:#(.*))?' + '$'); + (function(_ComponentIndex) { + _ComponentIndex[_ComponentIndex["SCHEME"] = 1] = "SCHEME"; + _ComponentIndex[_ComponentIndex["USER_INFO"] = 2] = "USER_INFO"; + _ComponentIndex[_ComponentIndex["DOMAIN"] = 3] = "DOMAIN"; + _ComponentIndex[_ComponentIndex["PORT"] = 4] = "PORT"; + _ComponentIndex[_ComponentIndex["PATH"] = 5] = "PATH"; + _ComponentIndex[_ComponentIndex["QUERY_DATA"] = 6] = "QUERY_DATA"; + _ComponentIndex[_ComponentIndex["FRAGMENT"] = 7] = "FRAGMENT"; + })(_ComponentIndex || (_ComponentIndex = {})); + } + }; +}); + +System.register("angular2/src/services/app_root_url", ["angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/services/app_root_url"; + var __decorate, + __metadata, + Injectable, + AppRootUrl; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + AppRootUrl = (($traceurRuntime.createClass)(function(value) { + this._value = value; + }, { + get value() { + return this._value; + }, + set value(value) { + this._value = value; + } + }, {})); + $__export("AppRootUrl", AppRootUrl); + $__export("AppRootUrl", AppRootUrl = __decorate([Injectable(), __metadata('design:paramtypes', [String])], AppRootUrl)); + } + }; +}); + +System.register("angular2/src/core/exception_handler", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/exception_handler"; + var __decorate, + __metadata, + Injectable, + isPresent, + isBlank, + BaseException, + isListLikeIterable, + _ArrayLogger, + ExceptionHandler; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + isListLikeIterable = $__m.isListLikeIterable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + _ArrayLogger = (function() { + function _ArrayLogger() { + this.res = []; + } + return ($traceurRuntime.createClass)(_ArrayLogger, { + log: function(s) { + this.res.push(s); + }, + logGroup: function(s) { + this.res.push(s); + }, + logGroupEnd: function() {} + }, {}); + }()); + ExceptionHandler = (($traceurRuntime.createClass)(function(logger) { + var rethrowException = arguments[1] !== (void 0) ? arguments[1] : true; + this.logger = logger; + this.rethrowException = rethrowException; + }, { + call: function(exception) { + var stackTrace = arguments[1] !== (void 0) ? arguments[1] : null; + var reason = arguments[2] !== (void 0) ? arguments[2] : null; + var originalException = this._findOriginalException(exception); + var originalStack = this._findOriginalStack(exception); + var context = this._findContext(exception); + this.logger.logGroup(("EXCEPTION: " + exception)); + if (isPresent(stackTrace) && isBlank(originalStack)) { + this.logger.log("STACKTRACE:"); + this.logger.log(this._longStackTrace(stackTrace)); + } + if (isPresent(reason)) { + this.logger.log(("REASON: " + reason)); + } + if (isPresent(originalException)) { + this.logger.log(("ORIGINAL EXCEPTION: " + originalException)); + } + if (isPresent(originalStack)) { + this.logger.log("ORIGINAL STACKTRACE:"); + this.logger.log(this._longStackTrace(originalStack)); + } + if (isPresent(context)) { + this.logger.log("ERROR CONTEXT:"); + this.logger.log(context); + } + this.logger.logGroupEnd(); + if (this.rethrowException) + throw exception; + }, + _longStackTrace: function(stackTrace) { + return isListLikeIterable(stackTrace) ? stackTrace.join("\n\n-----async gap-----\n") : stackTrace.toString(); + }, + _findContext: function(exception) { + try { + if (!(exception instanceof BaseException)) + return null; + return isPresent(exception.context) ? exception.context : this._findContext(exception.originalException); + } catch (e) { + return null; + } + }, + _findOriginalException: function(exception) { + if (!(exception instanceof BaseException)) + return null; + var e = exception.originalException; + while (e instanceof BaseException && isPresent(e.originalException)) { + e = e.originalException; + } + return e; + }, + _findOriginalStack: function(exception) { + if (!(exception instanceof BaseException)) + return null; + var e = exception; + var stack = exception.originalStack; + while (e instanceof BaseException && isPresent(e.originalException)) { + e = e.originalException; + if (e instanceof BaseException && isPresent(e.originalException)) { + stack = e.originalStack; + } + } + return stack; + } + }, {exceptionToString: function(exception) { + var stackTrace = arguments[1] !== (void 0) ? arguments[1] : null; + var reason = arguments[2] !== (void 0) ? arguments[2] : null; + var l = new _ArrayLogger(); + var e = new ExceptionHandler(l, false); + e.call(exception, stackTrace, reason); + return l.res.join("\n"); + }})); + $__export("ExceptionHandler", ExceptionHandler); + $__export("ExceptionHandler", ExceptionHandler = __decorate([Injectable(), __metadata('design:paramtypes', [Object, Boolean])], ExceptionHandler)); + } + }; +}); + +System.register("angular2/src/render/xhr", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/xhr"; + var XHR; + return { + setters: [], + execute: function() { + XHR = (function() { + function XHR() {} + return ($traceurRuntime.createClass)(XHR, {get: function(url) { + return null; + }}, {}); + }()); + $__export("XHR", XHR); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/style_url_resolver", ["angular2/di", "angular2/src/facade/lang", "angular2/src/services/url_resolver"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/style_url_resolver"; + var __decorate, + __metadata, + Injectable, + StringWrapper, + UrlResolver, + StyleUrlResolver, + _cssUrlRe, + _cssImportRe, + _quoteRe; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + StringWrapper = $__m.StringWrapper; + }, function($__m) { + UrlResolver = $__m.UrlResolver; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + StyleUrlResolver = (($traceurRuntime.createClass)(function(_resolver) { + this._resolver = _resolver; + }, { + resolveUrls: function(cssText, baseUrl) { + cssText = this._replaceUrls(cssText, _cssUrlRe, baseUrl); + cssText = this._replaceUrls(cssText, _cssImportRe, baseUrl); + return cssText; + }, + _replaceUrls: function(cssText, re, baseUrl) { + var $__0 = this; + return StringWrapper.replaceAllMapped(cssText, re, (function(m) { + var pre = m[1]; + var url = StringWrapper.replaceAll(m[2], _quoteRe, ''); + var post = m[3]; + var resolvedUrl = $__0._resolver.resolve(baseUrl, url); + return pre + "'" + resolvedUrl + "'" + post; + })); + } + }, {})); + $__export("StyleUrlResolver", StyleUrlResolver); + $__export("StyleUrlResolver", StyleUrlResolver = __decorate([Injectable(), __metadata('design:paramtypes', [UrlResolver])], StyleUrlResolver)); + _cssUrlRe = /(url\()([^)]*)(\))/g; + _cssImportRe = /(@import[\s]+(?!url\())['"]([^'"]*)['"](.*;)/g; + _quoteRe = /['"]/g; + } + }; +}); + +System.register("angular2/src/core/zone/ng_zone", ["angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/zone/ng_zone"; + var ListWrapper, + StringMapWrapper, + normalizeBlank, + isPresent, + global, + NgZone; + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + normalizeBlank = $__m.normalizeBlank; + isPresent = $__m.isPresent; + global = $__m.global; + }], + execute: function() { + NgZone = (function() { + function NgZone($__3) { + var enableLongStackTrace = $__3.enableLongStackTrace; + this._inVmTurnDone = false; + this._pendingTimeouts = []; + this._onTurnStart = null; + this._onTurnDone = null; + this._onEventDone = null; + this._onErrorHandler = null; + this._pendingMicrotasks = 0; + this._hasExecutedCodeInInnerZone = false; + this._nestedRun = 0; + if (global.zone) { + this._disabled = false; + this._mountZone = global.zone; + this._innerZone = this._createInnerZone(this._mountZone, enableLongStackTrace); + } else { + this._disabled = true; + this._mountZone = null; + } + } + return ($traceurRuntime.createClass)(NgZone, { + overrideOnTurnStart: function(onTurnStartFn) { + this._onTurnStart = normalizeBlank(onTurnStartFn); + }, + overrideOnTurnDone: function(onTurnDoneFn) { + this._onTurnDone = normalizeBlank(onTurnDoneFn); + }, + overrideOnEventDone: function(onEventDoneFn, opt_waitForAsync) { + var $__0 = this; + var normalizedOnEventDone = normalizeBlank(onEventDoneFn); + if (opt_waitForAsync) { + this._onEventDone = (function() { + if (!$__0._pendingTimeouts.length) { + normalizedOnEventDone(); + } + }); + } else { + this._onEventDone = normalizedOnEventDone; + } + }, + overrideOnErrorHandler: function(errorHandlingFn) { + this._onErrorHandler = normalizeBlank(errorHandlingFn); + }, + run: function(fn) { + if (this._disabled) { + return fn(); + } else { + return this._innerZone.run(fn); + } + }, + runOutsideAngular: function(fn) { + if (this._disabled) { + return fn(); + } else { + return this._mountZone.run(fn); + } + }, + _createInnerZone: function(zone, enableLongStackTrace) { + var ngZone = this; + var errorHandling; + if (enableLongStackTrace) { + errorHandling = StringMapWrapper.merge(Zone.longStackTraceZone, {onError: function(e) { + ngZone._onError(this, e); + }}); + } else { + errorHandling = {onError: function(e) { + ngZone._onError(this, e); + }}; + } + return zone.fork(errorHandling).fork({ + '$run': function(parentRun) { + return function() { + try { + ngZone._nestedRun++; + if (!ngZone._hasExecutedCodeInInnerZone) { + ngZone._hasExecutedCodeInInnerZone = true; + if (ngZone._onTurnStart) { + parentRun.call(ngZone._innerZone, ngZone._onTurnStart); + } + } + return parentRun.apply(this, arguments); + } finally { + ngZone._nestedRun--; + if (ngZone._pendingMicrotasks == 0 && ngZone._nestedRun == 0 && !this._inVmTurnDone) { + if (ngZone._onTurnDone && ngZone._hasExecutedCodeInInnerZone) { + try { + this._inVmTurnDone = true; + parentRun.call(ngZone._innerZone, ngZone._onTurnDone); + if (ngZone._pendingMicrotasks === 0 && isPresent(ngZone._onEventDone)) { + ngZone.runOutsideAngular(ngZone._onEventDone); + } + } finally { + this._inVmTurnDone = false; + ngZone._hasExecutedCodeInInnerZone = false; + } + } + } + } + }; + }, + '$scheduleMicrotask': function(parentScheduleMicrotask) { + return function(fn) { + ngZone._pendingMicrotasks++; + var microtask = function() { + try { + fn(); + } finally { + ngZone._pendingMicrotasks--; + } + }; + parentScheduleMicrotask.call(this, microtask); + }; + }, + '$setTimeout': function(parentSetTimeout) { + return function(fn, delay) { + for (var args = [], + $__2 = 2; $__2 < arguments.length; $__2++) + args[$__2 - 2] = arguments[$__2]; + var id; + var cb = function() { + fn(); + ListWrapper.remove(ngZone._pendingTimeouts, id); + }; + id = parentSetTimeout(cb, delay, args); + ngZone._pendingTimeouts.push(id); + return id; + }; + }, + '$clearTimeout': function(parentClearTimeout) { + return function(id) { + parentClearTimeout(id); + ListWrapper.remove(ngZone._pendingTimeouts, id); + }; + }, + _innerZone: true + }); + }, + _onError: function(zone, e) { + if (isPresent(this._onErrorHandler)) { + var trace = [normalizeBlank(e.stack)]; + while (zone && zone.constructedAtException) { + trace.push(zone.constructedAtException.get()); + zone = zone.parent; + } + this._onErrorHandler(e, trace); + } else { + console.log('## _onError ##'); + console.log(e.stack); + throw e; + } + } + }, {}); + }()); + $__export("NgZone", NgZone); + } + }; +}); + +System.register("angular2/src/core/life_cycle/life_cycle", ["angular2/di", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/life_cycle/life_cycle"; + var __decorate, + __metadata, + Injectable, + isPresent, + BaseException, + LifeCycle; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + LifeCycle = (($traceurRuntime.createClass)(function() { + var changeDetector = arguments[0] !== (void 0) ? arguments[0] : null; + var enforceNoNewChanges = arguments[1] !== (void 0) ? arguments[1] : false; + this._runningTick = false; + this._changeDetector = changeDetector; + this._enforceNoNewChanges = enforceNoNewChanges; + }, { + registerWith: function(zone) { + var changeDetector = arguments[1] !== (void 0) ? arguments[1] : null; + var $__0 = this; + if (isPresent(changeDetector)) { + this._changeDetector = changeDetector; + } + zone.overrideOnTurnDone((function() { + return $__0.tick(); + })); + }, + tick: function() { + if (this._runningTick) { + throw new BaseException("LifeCycle.tick is called recursively"); + } + try { + this._runningTick = true; + this._changeDetector.detectChanges(); + if (this._enforceNoNewChanges) { + this._changeDetector.checkNoChanges(); + } + } finally { + this._runningTick = false; + } + } + }, {})); + $__export("LifeCycle", LifeCycle); + $__export("LifeCycle", LifeCycle = __decorate([Injectable(), __metadata('design:paramtypes', [Object, Boolean])], LifeCycle)); + } + }; +}); + +System.register("angular2/src/render/xhr_impl", ["angular2/di", "angular2/src/facade/async", "angular2/src/render/xhr"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/xhr_impl"; + var __decorate, + __metadata, + Injectable, + PromiseWrapper, + XHR, + XHRImpl; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }, function($__m) { + XHR = $__m.XHR; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + XHRImpl = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, {get: function(url) { + var completer = PromiseWrapper.completer(); + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, true); + xhr.responseType = 'text'; + xhr.onload = function() { + var response = ('response' in xhr) ? xhr.response : xhr.responseText; + var status = xhr.status === 1223 ? 204 : xhr.status; + if (status === 0) { + status = response ? 200 : 0; + } + if (200 <= status && status <= 300) { + completer.resolve(response); + } else { + completer.reject(("Failed to load " + url), null); + } + }; + xhr.onerror = function() { + completer.reject(("Failed to load " + url), null); + }; + xhr.send(); + return completer.promise; + }}, {}, $__super); + }(XHR)); + $__export("XHRImpl", XHRImpl); + $__export("XHRImpl", XHRImpl = __decorate([Injectable(), __metadata('design:paramtypes', [])], XHRImpl)); + } + }; +}); + +System.register("angular2/src/render/dom/events/event_manager", ["angular2/src/facade/lang", "angular2/src/dom/dom_adapter"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/events/event_manager"; + var BaseException, + StringWrapper, + DOM, + BUBBLE_SYMBOL, + EventManager, + EventManagerPlugin, + DomEventsPlugin; + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + DOM = $__m.DOM; + }], + execute: function() { + BUBBLE_SYMBOL = '^'; + EventManager = (function() { + function EventManager(_plugins, _zone) { + this._plugins = _plugins; + this._zone = _zone; + for (var i = 0; i < _plugins.length; i++) { + _plugins[i].manager = this; + } + } + return ($traceurRuntime.createClass)(EventManager, { + addEventListener: function(element, eventName, handler) { + var withoutBubbleSymbol = this._removeBubbleSymbol(eventName); + var plugin = this._findPluginFor(withoutBubbleSymbol); + plugin.addEventListener(element, withoutBubbleSymbol, handler, withoutBubbleSymbol != eventName); + }, + addGlobalEventListener: function(target, eventName, handler) { + var withoutBubbleSymbol = this._removeBubbleSymbol(eventName); + var plugin = this._findPluginFor(withoutBubbleSymbol); + return plugin.addGlobalEventListener(target, withoutBubbleSymbol, handler, withoutBubbleSymbol != eventName); + }, + getZone: function() { + return this._zone; + }, + _findPluginFor: function(eventName) { + var plugins = this._plugins; + for (var i = 0; i < plugins.length; i++) { + var plugin = plugins[i]; + if (plugin.supports(eventName)) { + return plugin; + } + } + throw new BaseException(("No event manager plugin found for event " + eventName)); + }, + _removeBubbleSymbol: function(eventName) { + return eventName[0] == BUBBLE_SYMBOL ? StringWrapper.substring(eventName, 1) : eventName; + } + }, {}); + }()); + $__export("EventManager", EventManager); + EventManagerPlugin = (function() { + function EventManagerPlugin() {} + return ($traceurRuntime.createClass)(EventManagerPlugin, { + supports: function(eventName) { + return false; + }, + addEventListener: function(element, eventName, handler, shouldSupportBubble) { + throw "not implemented"; + }, + addGlobalEventListener: function(element, eventName, handler, shouldSupportBubble) { + throw "not implemented"; + } + }, {}); + }()); + $__export("EventManagerPlugin", EventManagerPlugin); + DomEventsPlugin = (function($__super) { + function DomEventsPlugin() { + $traceurRuntime.superConstructor(DomEventsPlugin).apply(this, arguments); + } + return ($traceurRuntime.createClass)(DomEventsPlugin, { + supports: function(eventName) { + return true; + }, + addEventListener: function(element, eventName, handler, shouldSupportBubble) { + var outsideHandler = this._getOutsideHandler(shouldSupportBubble, element, handler, this.manager._zone); + this.manager._zone.runOutsideAngular((function() { + DOM.on(element, eventName, outsideHandler); + })); + }, + addGlobalEventListener: function(target, eventName, handler, shouldSupportBubble) { + var element = DOM.getGlobalEventTarget(target); + var outsideHandler = this._getOutsideHandler(shouldSupportBubble, element, handler, this.manager._zone); + return this.manager._zone.runOutsideAngular((function() { + return DOM.onAndCancel(element, eventName, outsideHandler); + })); + }, + _getOutsideHandler: function(shouldSupportBubble, element, handler, zone) { + return shouldSupportBubble ? DomEventsPlugin.bubbleCallback(element, handler, zone) : DomEventsPlugin.sameElementCallback(element, handler, zone); + } + }, { + sameElementCallback: function(element, handler, zone) { + return (function(event) { + if (event.target === element) { + zone.run((function() { + return handler(event); + })); + } + }); + }, + bubbleCallback: function(element, handler, zone) { + return (function(event) { + return zone.run((function() { + return handler(event); + })); + }); + } + }, $__super); + }(EventManagerPlugin)); + $__export("DomEventsPlugin", DomEventsPlugin); + } + }; +}); + +System.register("angular2/src/render/dom/events/key_events", ["angular2/src/dom/dom_adapter", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/render/dom/events/event_manager"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/events/key_events"; + var DOM, + isPresent, + StringWrapper, + StringMapWrapper, + ListWrapper, + EventManagerPlugin, + modifierKeys, + modifierKeyGetters, + KeyEventsPlugin; + return { + setters: [function($__m) { + DOM = $__m.DOM; + }, function($__m) { + isPresent = $__m.isPresent; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + ListWrapper = $__m.ListWrapper; + }, function($__m) { + EventManagerPlugin = $__m.EventManagerPlugin; + }], + execute: function() { + modifierKeys = ['alt', 'control', 'meta', 'shift']; + modifierKeyGetters = { + 'alt': (function(event) { + return event.altKey; + }), + 'control': (function(event) { + return event.ctrlKey; + }), + 'meta': (function(event) { + return event.metaKey; + }), + 'shift': (function(event) { + return event.shiftKey; + }) + }; + KeyEventsPlugin = (function($__super) { + function KeyEventsPlugin() { + $traceurRuntime.superConstructor(KeyEventsPlugin).call(this); + } + return ($traceurRuntime.createClass)(KeyEventsPlugin, { + supports: function(eventName) { + return isPresent(KeyEventsPlugin.parseEventName(eventName)); + }, + addEventListener: function(element, eventName, handler, shouldSupportBubble) { + var parsedEvent = KeyEventsPlugin.parseEventName(eventName); + var outsideHandler = KeyEventsPlugin.eventCallback(element, shouldSupportBubble, StringMapWrapper.get(parsedEvent, 'fullKey'), handler, this.manager.getZone()); + this.manager.getZone().runOutsideAngular((function() { + DOM.on(element, StringMapWrapper.get(parsedEvent, 'domEventName'), outsideHandler); + })); + } + }, { + parseEventName: function(eventName) { + var parts = eventName.toLowerCase().split('.'); + var domEventName = ListWrapper.removeAt(parts, 0); + if ((parts.length === 0) || !(StringWrapper.equals(domEventName, 'keydown') || StringWrapper.equals(domEventName, 'keyup'))) { + return null; + } + var key = KeyEventsPlugin._normalizeKey(ListWrapper.removeLast(parts)); + var fullKey = ''; + ListWrapper.forEach(modifierKeys, (function(modifierName) { + if (ListWrapper.contains(parts, modifierName)) { + ListWrapper.remove(parts, modifierName); + fullKey += modifierName + '.'; + } + })); + fullKey += key; + if (parts.length != 0 || key.length === 0) { + return null; + } + var result = StringMapWrapper.create(); + StringMapWrapper.set(result, 'domEventName', domEventName); + StringMapWrapper.set(result, 'fullKey', fullKey); + return result; + }, + getEventFullKey: function(event) { + var fullKey = ''; + var key = DOM.getEventKey(event); + key = key.toLowerCase(); + if (StringWrapper.equals(key, ' ')) { + key = 'space'; + } else if (StringWrapper.equals(key, '.')) { + key = 'dot'; + } + ListWrapper.forEach(modifierKeys, (function(modifierName) { + if (modifierName != key) { + var modifierGetter = StringMapWrapper.get(modifierKeyGetters, modifierName); + if (modifierGetter(event)) { + fullKey += modifierName + '.'; + } + } + })); + fullKey += key; + return fullKey; + }, + eventCallback: function(element, shouldSupportBubble, fullKey, handler, zone) { + return (function(event) { + var correctElement = shouldSupportBubble || event.target === element; + if (correctElement && StringWrapper.equals(KeyEventsPlugin.getEventFullKey(event), fullKey)) { + zone.run((function() { + return handler(event); + })); + } + }); + }, + _normalizeKey: function(keyName) { + switch (keyName) { + case 'esc': + return 'escape'; + default: + return keyName; + } + } + }, $__super); + }(EventManagerPlugin)); + $__export("KeyEventsPlugin", KeyEventsPlugin); + } + }; +}); + +System.register("angular2/src/render/dom/events/hammer_common", ["angular2/src/render/dom/events/event_manager", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/events/hammer_common"; + var EventManagerPlugin, + StringMapWrapper, + _eventNames, + HammerGesturesPluginCommon; + return { + setters: [function($__m) { + EventManagerPlugin = $__m.EventManagerPlugin; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + }], + execute: function() { + _eventNames = { + 'pan': true, + 'panstart': true, + 'panmove': true, + 'panend': true, + 'pancancel': true, + 'panleft': true, + 'panright': true, + 'panup': true, + 'pandown': true, + 'pinch': true, + 'pinchstart': true, + 'pinchmove': true, + 'pinchend': true, + 'pinchcancel': true, + 'pinchin': true, + 'pinchout': true, + 'press': true, + 'pressup': true, + 'rotate': true, + 'rotatestart': true, + 'rotatemove': true, + 'rotateend': true, + 'rotatecancel': true, + 'swipe': true, + 'swipeleft': true, + 'swiperight': true, + 'swipeup': true, + 'swipedown': true, + 'tap': true + }; + HammerGesturesPluginCommon = (function($__super) { + function HammerGesturesPluginCommon() { + $traceurRuntime.superConstructor(HammerGesturesPluginCommon).call(this); + } + return ($traceurRuntime.createClass)(HammerGesturesPluginCommon, {supports: function(eventName) { + eventName = eventName.toLowerCase(); + return StringMapWrapper.contains(_eventNames, eventName); + }}, {}, $__super); + }(EventManagerPlugin)); + $__export("HammerGesturesPluginCommon", HammerGesturesPluginCommon); + } + }; +}); + +System.register("angular2/src/services/anchor_based_app_root_url", ["angular2/src/services/app_root_url", "angular2/src/dom/dom_adapter", "angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/services/anchor_based_app_root_url"; + var __decorate, + __metadata, + AppRootUrl, + DOM, + Injectable, + AnchorBasedAppRootUrl; + return { + setters: [function($__m) { + AppRootUrl = $__m.AppRootUrl; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + Injectable = $__m.Injectable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + AnchorBasedAppRootUrl = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).call(this, ""); + var rootUrl; + var a = DOM.createElement('a'); + DOM.resolveAndSetHref(a, './', null); + rootUrl = DOM.getHref(a); + this.value = rootUrl; + } + return ($traceurRuntime.createClass)($__0, {}, {}, $__super); + }(AppRootUrl)); + $__export("AnchorBasedAppRootUrl", AnchorBasedAppRootUrl); + $__export("AnchorBasedAppRootUrl", AnchorBasedAppRootUrl = __decorate([Injectable(), __metadata('design:paramtypes', [])], AnchorBasedAppRootUrl)); + } + }; +}); + +System.register("angular2/src/core/compiler/dynamic_component_loader", ["angular2/di", "angular2/src/core/compiler/compiler", "angular2/src/core/compiler/view_manager"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/dynamic_component_loader"; + var __decorate, + __metadata, + Injectable, + Compiler, + AppViewManager, + ComponentRef, + DynamicComponentLoader; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + Compiler = $__m.Compiler; + }, function($__m) { + AppViewManager = $__m.AppViewManager; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + ComponentRef = (function() { + function ComponentRef(location, instance, _dispose) { + this._dispose = _dispose; + this.location = location; + this.instance = instance; + } + return ($traceurRuntime.createClass)(ComponentRef, { + get hostView() { + return this.location.parentView; + }, + dispose: function() { + this._dispose(); + } + }, {}); + }()); + $__export("ComponentRef", ComponentRef); + DynamicComponentLoader = (($traceurRuntime.createClass)(function(_compiler, _viewManager) { + this._compiler = _compiler; + this._viewManager = _viewManager; + }, { + loadAsRoot: function(typeOrBinding, overrideSelector, injector) { + var $__0 = this; + return this._compiler.compileInHost(typeOrBinding).then((function(hostProtoViewRef) { + var hostViewRef = $__0._viewManager.createRootHostView(hostProtoViewRef, overrideSelector, injector); + var newLocation = $__0._viewManager.getHostElement(hostViewRef); + var component = $__0._viewManager.getComponent(newLocation); + var dispose = (function() { + $__0._viewManager.destroyRootHostView(hostViewRef); + }); + return new ComponentRef(newLocation, component, dispose); + })); + }, + loadIntoLocation: function(typeOrBinding, hostLocation, anchorName) { + var bindings = arguments[3] !== (void 0) ? arguments[3] : null; + return this.loadNextToLocation(typeOrBinding, this._viewManager.getNamedElementInComponentView(hostLocation, anchorName), bindings); + }, + loadNextToLocation: function(typeOrBinding, location) { + var bindings = arguments[2] !== (void 0) ? arguments[2] : null; + var $__0 = this; + return this._compiler.compileInHost(typeOrBinding).then((function(hostProtoViewRef) { + var viewContainer = $__0._viewManager.getViewContainer(location); + var hostViewRef = viewContainer.createHostView(hostProtoViewRef, viewContainer.length, bindings); + var newLocation = $__0._viewManager.getHostElement(hostViewRef); + var component = $__0._viewManager.getComponent(newLocation); + var dispose = (function() { + var index = viewContainer.indexOf(hostViewRef); + if (index !== -1) { + viewContainer.remove(index); + } + }); + return new ComponentRef(newLocation, component, dispose); + })); + } + }, {})); + $__export("DynamicComponentLoader", DynamicComponentLoader); + $__export("DynamicComponentLoader", DynamicComponentLoader = __decorate([Injectable(), __metadata('design:paramtypes', [Compiler, AppViewManager])], DynamicComponentLoader)); + } + }; +}); + +System.register("angular2/src/core/testability/get_testability", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/testability/get_testability"; + var global, + PublicTestability, + GetTestability; + return { + setters: [function($__m) { + global = $__m.global; + }], + execute: function() { + PublicTestability = (function() { + function PublicTestability(testability) { + this._testability = testability; + } + return ($traceurRuntime.createClass)(PublicTestability, { + whenStable: function(callback) { + this._testability.whenStable(callback); + }, + findBindings: function(using, binding, exactMatch) { + return this._testability.findBindings(using, binding, exactMatch); + } + }, {}); + }()); + GetTestability = (function() { + function GetTestability() {} + return ($traceurRuntime.createClass)(GetTestability, {}, {addToWindow: function(registry) { + global.getAngularTestability = function(elem) { + var testability = registry.findTestabilityInTree(elem); + if (testability == null) { + throw new Error('Could not find testability for element.'); + } + return new PublicTestability(testability); + }; + }}); + }()); + $__export("GetTestability", GetTestability); + } + }; +}); + +System.register("angular2/src/render/dom/dom_tokens", ["angular2/di", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/dom_tokens"; + var OpaqueToken, + bind, + CONST_EXPR, + StringWrapper, + Math, + DOCUMENT_TOKEN, + DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES, + APP_ID_TOKEN, + APP_ID_RANDOM_BINDING; + function randomChar() { + return StringWrapper.fromCharCode(97 + Math.floor(Math.random() * 25)); + } + return { + setters: [function($__m) { + OpaqueToken = $__m.OpaqueToken; + bind = $__m.bind; + }, function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + StringWrapper = $__m.StringWrapper; + Math = $__m.Math; + }], + execute: function() { + DOCUMENT_TOKEN = CONST_EXPR(new OpaqueToken('DocumentToken')); + $__export("DOCUMENT_TOKEN", DOCUMENT_TOKEN); + DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES = CONST_EXPR(new OpaqueToken('DomReflectPropertiesAsAttributes')); + $__export("DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES", DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES); + APP_ID_TOKEN = CONST_EXPR(new OpaqueToken('AppId')); + $__export("APP_ID_TOKEN", APP_ID_TOKEN); + APP_ID_RANDOM_BINDING = bind(APP_ID_TOKEN).toFactory((function() { + return ("" + randomChar() + randomChar() + randomChar()); + }), []); + $__export("APP_ID_RANDOM_BINDING", APP_ID_RANDOM_BINDING); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/compile_element", ["angular2/src/facade/collection", "angular2/src/dom/dom_adapter", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/compile_element"; + var MapWrapper, + DOM, + isBlank, + isPresent, + StringJoiner, + assertionsEnabled, + CompileElement; + function getElementDescription(domElement) { + var buf = new StringJoiner(); + var atts = DOM.attributeMap(domElement); + buf.add("<"); + buf.add(DOM.tagName(domElement).toLowerCase()); + addDescriptionAttribute(buf, "id", atts.get("id")); + addDescriptionAttribute(buf, "class", atts.get("class")); + MapWrapper.forEach(atts, (function(attValue, attName) { + if (attName !== "id" && attName !== "class") { + addDescriptionAttribute(buf, attName, attValue); + } + })); + buf.add(">"); + return buf.toString(); + } + function addDescriptionAttribute(buffer, attName, attValue) { + if (isPresent(attValue)) { + if (attValue.length === 0) { + buffer.add(' ' + attName); + } else { + buffer.add(' ' + attName + '="' + attValue + '"'); + } + } + } + return { + setters: [function($__m) { + MapWrapper = $__m.MapWrapper; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + StringJoiner = $__m.StringJoiner; + assertionsEnabled = $__m.assertionsEnabled; + }], + execute: function() { + CompileElement = (function() { + function CompileElement(element) { + var compilationUnit = arguments[1] !== (void 0) ? arguments[1] : ''; + this.element = element; + this._attrs = null; + this._classList = null; + this.isViewRoot = false; + this.inheritedProtoView = null; + this.distanceToInheritedBinder = 0; + this.inheritedElementBinder = null; + this.compileChildren = true; + var tplDesc = assertionsEnabled() ? getElementDescription(element) : null; + if (compilationUnit !== '') { + this.elementDescription = compilationUnit; + if (isPresent(tplDesc)) + this.elementDescription += ": " + tplDesc; + } else { + this.elementDescription = tplDesc; + } + } + return ($traceurRuntime.createClass)(CompileElement, { + isBound: function() { + return isPresent(this.inheritedElementBinder) && this.distanceToInheritedBinder === 0; + }, + bindElement: function() { + if (!this.isBound()) { + var parentBinder = this.inheritedElementBinder; + this.inheritedElementBinder = this.inheritedProtoView.bindElement(this.element, this.elementDescription); + if (isPresent(parentBinder)) { + this.inheritedElementBinder.setParent(parentBinder, this.distanceToInheritedBinder); + } + this.distanceToInheritedBinder = 0; + } + return this.inheritedElementBinder; + }, + refreshAttrs: function() { + this._attrs = null; + }, + attrs: function() { + if (isBlank(this._attrs)) { + this._attrs = DOM.attributeMap(this.element); + } + return this._attrs; + }, + refreshClassList: function() { + this._classList = null; + }, + classList: function() { + if (isBlank(this._classList)) { + this._classList = []; + var elClassList = DOM.classList(this.element); + for (var i = 0; i < elClassList.length; i++) { + this._classList.push(elClassList[i]); + } + } + return this._classList; + } + }, {}); + }()); + $__export("CompileElement", CompileElement); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/compile_control", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/compile_control"; + var isBlank, + CompileControl; + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + }], + execute: function() { + CompileControl = (function() { + function CompileControl(_steps) { + this._steps = _steps; + this._currentStepIndex = 0; + this._parent = null; + this._results = null; + this._additionalChildren = null; + } + return ($traceurRuntime.createClass)(CompileControl, { + internalProcess: function(results, startStepIndex, parent, current) { + this._results = results; + var previousStepIndex = this._currentStepIndex; + var previousParent = this._parent; + this._ignoreCurrentElement = false; + for (var i = startStepIndex; i < this._steps.length && !this._ignoreCurrentElement; i++) { + var step = this._steps[i]; + this._parent = parent; + this._currentStepIndex = i; + step.processElement(parent, current, this); + parent = this._parent; + } + if (!this._ignoreCurrentElement) { + results.push(current); + } + this._currentStepIndex = previousStepIndex; + this._parent = previousParent; + var localAdditionalChildren = this._additionalChildren; + this._additionalChildren = null; + return localAdditionalChildren; + }, + addParent: function(newElement) { + this.internalProcess(this._results, this._currentStepIndex + 1, this._parent, newElement); + this._parent = newElement; + }, + addChild: function(element) { + if (isBlank(this._additionalChildren)) { + this._additionalChildren = []; + } + this._additionalChildren.push(element); + }, + ignoreCurrentElement: function() { + this._ignoreCurrentElement = true; + } + }, {}); + }()); + $__export("CompileControl", CompileControl); + } + }; +}); + +System.register("angular2/src/render/dom/view/proto_view", ["angular2/src/render/api", "angular2/src/dom/dom_adapter"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/view/proto_view"; + var RenderProtoViewRef, + DOM, + DomProtoViewRef, + DomProtoView; + function resolveInternalDomProtoView(protoViewRef) { + return protoViewRef._protoView; + } + $__export("resolveInternalDomProtoView", resolveInternalDomProtoView); + return { + setters: [function($__m) { + RenderProtoViewRef = $__m.RenderProtoViewRef; + }, function($__m) { + DOM = $__m.DOM; + }], + execute: function() { + DomProtoViewRef = (function($__super) { + function DomProtoViewRef(_protoView) { + $traceurRuntime.superConstructor(DomProtoViewRef).call(this); + this._protoView = _protoView; + } + return ($traceurRuntime.createClass)(DomProtoViewRef, {}, {}, $__super); + }(RenderProtoViewRef)); + $__export("DomProtoViewRef", DomProtoViewRef); + DomProtoView = (function() { + function DomProtoView(type, rootElement, encapsulation, elementBinders, hostAttributes, rootTextNodeIndices, boundTextNodeCount, fragmentsRootNodeCount, isSingleElementFragment) { + this.type = type; + this.rootElement = rootElement; + this.encapsulation = encapsulation; + this.elementBinders = elementBinders; + this.hostAttributes = hostAttributes; + this.rootTextNodeIndices = rootTextNodeIndices; + this.boundTextNodeCount = boundTextNodeCount; + this.fragmentsRootNodeCount = fragmentsRootNodeCount; + this.isSingleElementFragment = isSingleElementFragment; + } + return ($traceurRuntime.createClass)(DomProtoView, {}, {create: function(type, rootElement, viewEncapsulation, fragmentsRootNodeCount, rootTextNodeIndices, elementBinders, hostAttributes) { + var boundTextNodeCount = rootTextNodeIndices.length; + for (var i = 0; i < elementBinders.length; i++) { + boundTextNodeCount += elementBinders[i].textNodeIndices.length; + } + var isSingleElementFragment = fragmentsRootNodeCount.length === 1 && fragmentsRootNodeCount[0] === 1 && DOM.isElementNode(DOM.firstChild(DOM.content(rootElement))); + return new DomProtoView(type, rootElement, viewEncapsulation, elementBinders, hostAttributes, rootTextNodeIndices, boundTextNodeCount, fragmentsRootNodeCount, isSingleElementFragment); + }}); + }()); + $__export("DomProtoView", DomProtoView); + } + }; +}); + +System.register("angular2/src/render/dom/view/element_binder", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/view/element_binder"; + var isPresent, + DomElementBinder, + Event, + HostAction; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }], + execute: function() { + DomElementBinder = (function() { + function DomElementBinder() { + var $__1 = arguments[0] !== (void 0) ? arguments[0] : {}, + textNodeIndices = $__1.textNodeIndices, + hasNestedProtoView = $__1.hasNestedProtoView, + eventLocals = $__1.eventLocals, + localEvents = $__1.localEvents, + globalEvents = $__1.globalEvents, + hasNativeShadowRoot = $__1.hasNativeShadowRoot; + this.textNodeIndices = textNodeIndices; + this.hasNestedProtoView = hasNestedProtoView; + this.eventLocals = eventLocals; + this.localEvents = localEvents; + this.globalEvents = globalEvents; + this.hasNativeShadowRoot = isPresent(hasNativeShadowRoot) ? hasNativeShadowRoot : false; + } + return ($traceurRuntime.createClass)(DomElementBinder, {}, {}); + }()); + $__export("DomElementBinder", DomElementBinder); + Event = (function() { + function Event(name, target, fullName) { + this.name = name; + this.target = target; + this.fullName = fullName; + } + return ($traceurRuntime.createClass)(Event, {}, {}); + }()); + $__export("Event", Event); + HostAction = (function() { + function HostAction(actionName, actionExpression, expression) { + this.actionName = actionName; + this.actionExpression = actionExpression; + this.expression = expression; + } + return ($traceurRuntime.createClass)(HostAction, {}, {}); + }()); + $__export("HostAction", HostAction); + } + }; +}); + +System.register("angular2/src/render/dom/util", ["angular2/src/facade/lang", "angular2/src/dom/dom_adapter", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/util"; + var StringWrapper, + isPresent, + isBlank, + DOM, + ListWrapper, + NG_BINDING_CLASS_SELECTOR, + NG_BINDING_CLASS, + EVENT_TARGET_SEPARATOR, + NG_CONTENT_ELEMENT_NAME, + NG_SHADOW_ROOT_ELEMENT_NAME, + CAMEL_CASE_REGEXP, + DASH_CASE_REGEXP, + ClonedProtoView; + function camelCaseToDashCase(input) { + return StringWrapper.replaceAllMapped(input, CAMEL_CASE_REGEXP, (function(m) { + return '-' + m[1].toLowerCase(); + })); + } + function dashCaseToCamelCase(input) { + return StringWrapper.replaceAllMapped(input, DASH_CASE_REGEXP, (function(m) { + return m[1].toUpperCase(); + })); + } + function queryBoundElements(templateContent, isSingleElementChild) { + var result; + var dynamicElementList; + var elementIdx = 0; + if (isSingleElementChild) { + var rootElement = DOM.firstChild(templateContent); + var rootHasBinding = DOM.hasClass(rootElement, NG_BINDING_CLASS); + dynamicElementList = DOM.getElementsByClassName(rootElement, NG_BINDING_CLASS); + result = ListWrapper.createFixedSize(dynamicElementList.length + (rootHasBinding ? 1 : 0)); + if (rootHasBinding) { + result[elementIdx++] = rootElement; + } + } else { + dynamicElementList = DOM.querySelectorAll(templateContent, NG_BINDING_CLASS_SELECTOR); + result = ListWrapper.createFixedSize(dynamicElementList.length); + } + for (var i = 0; i < dynamicElementList.length; i++) { + result[elementIdx++] = dynamicElementList[i]; + } + return result; + } + function cloneAndQueryProtoView(pv, importIntoDocument) { + var templateContent = importIntoDocument ? DOM.importIntoDoc(DOM.content(pv.rootElement)) : DOM.clone(DOM.content(pv.rootElement)); + var boundElements = queryBoundElements(templateContent, pv.isSingleElementFragment); + var boundTextNodes = queryBoundTextNodes(templateContent, pv.rootTextNodeIndices, boundElements, pv.elementBinders, pv.boundTextNodeCount); + var fragments = queryFragments(templateContent, pv.fragmentsRootNodeCount); + return new ClonedProtoView(pv, fragments, boundElements, boundTextNodes); + } + function queryFragments(templateContent, fragmentsRootNodeCount) { + var fragments = ListWrapper.createGrowableSize(fragmentsRootNodeCount.length); + var childNode = DOM.firstChild(templateContent); + for (var fragmentIndex = 0; fragmentIndex < fragments.length; fragmentIndex++) { + var fragment = ListWrapper.createFixedSize(fragmentsRootNodeCount[fragmentIndex]); + fragments[fragmentIndex] = fragment; + for (var i = 0; i < fragment.length; i++) { + fragment[i] = childNode; + childNode = DOM.nextSibling(childNode); + } + } + return fragments; + } + function queryBoundTextNodes(templateContent, rootTextNodeIndices, boundElements, elementBinders, boundTextNodeCount) { + var boundTextNodes = ListWrapper.createFixedSize(boundTextNodeCount); + var textNodeIndex = 0; + if (rootTextNodeIndices.length > 0) { + var rootChildNodes = DOM.childNodes(templateContent); + for (var i = 0; i < rootTextNodeIndices.length; i++) { + boundTextNodes[textNodeIndex++] = rootChildNodes[rootTextNodeIndices[i]]; + } + } + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + var element = boundElements[i]; + if (binder.textNodeIndices.length > 0) { + var childNodes = DOM.childNodes(element); + for (var j = 0; j < binder.textNodeIndices.length; j++) { + boundTextNodes[textNodeIndex++] = childNodes[binder.textNodeIndices[j]]; + } + } + } + return boundTextNodes; + } + function isElementWithTag(node, elementName) { + return DOM.isElementNode(node) && DOM.tagName(node).toLowerCase() == elementName.toLowerCase(); + } + function queryBoundTextNodeIndices(parentNode, boundTextNodes, resultCallback) { + var childNodes = DOM.childNodes(parentNode); + for (var j = 0; j < childNodes.length; j++) { + var node = childNodes[j]; + if (boundTextNodes.has(node)) { + resultCallback(node, j, boundTextNodes.get(node)); + } + } + } + function prependAll(parentNode, nodes) { + var lastInsertedNode = null; + nodes.forEach((function(node) { + if (isBlank(lastInsertedNode)) { + var firstChild = DOM.firstChild(parentNode); + if (isPresent(firstChild)) { + DOM.insertBefore(firstChild, node); + } else { + DOM.appendChild(parentNode, node); + } + } else { + DOM.insertAfter(lastInsertedNode, node); + } + lastInsertedNode = node; + })); + } + $__export("camelCaseToDashCase", camelCaseToDashCase); + $__export("dashCaseToCamelCase", dashCaseToCamelCase); + $__export("queryBoundElements", queryBoundElements); + $__export("cloneAndQueryProtoView", cloneAndQueryProtoView); + $__export("isElementWithTag", isElementWithTag); + $__export("queryBoundTextNodeIndices", queryBoundTextNodeIndices); + $__export("prependAll", prependAll); + return { + setters: [function($__m) { + StringWrapper = $__m.StringWrapper; + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }], + execute: function() { + NG_BINDING_CLASS_SELECTOR = '.ng-binding'; + $__export("NG_BINDING_CLASS_SELECTOR", NG_BINDING_CLASS_SELECTOR); + NG_BINDING_CLASS = 'ng-binding'; + $__export("NG_BINDING_CLASS", NG_BINDING_CLASS); + EVENT_TARGET_SEPARATOR = ':'; + $__export("EVENT_TARGET_SEPARATOR", EVENT_TARGET_SEPARATOR); + NG_CONTENT_ELEMENT_NAME = 'ng-content'; + $__export("NG_CONTENT_ELEMENT_NAME", NG_CONTENT_ELEMENT_NAME); + NG_SHADOW_ROOT_ELEMENT_NAME = 'shadow-root'; + $__export("NG_SHADOW_ROOT_ELEMENT_NAME", NG_SHADOW_ROOT_ELEMENT_NAME); + CAMEL_CASE_REGEXP = /([A-Z])/g; + DASH_CASE_REGEXP = /-([a-z])/g; + ClonedProtoView = (function() { + function ClonedProtoView(original, fragments, boundElements, boundTextNodes) { + this.original = original; + this.fragments = fragments; + this.boundElements = boundElements; + this.boundTextNodes = boundTextNodes; + } + return ($traceurRuntime.createClass)(ClonedProtoView, {}, {}); + }()); + $__export("ClonedProtoView", ClonedProtoView); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/property_binding_parser", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/render/dom/util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/property_binding_parser"; + var isPresent, + RegExpWrapper, + StringWrapper, + MapWrapper, + dashCaseToCamelCase, + BIND_NAME_REGEXP, + PropertyBindingParser; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + RegExpWrapper = $__m.RegExpWrapper; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + MapWrapper = $__m.MapWrapper; + }, function($__m) { + dashCaseToCamelCase = $__m.dashCaseToCamelCase; + }], + execute: function() { + BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(var-|#)|(on-)|(bindon-))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/g; + PropertyBindingParser = (function() { + function PropertyBindingParser(_parser) { + this._parser = _parser; + } + return ($traceurRuntime.createClass)(PropertyBindingParser, { + processStyle: function(style) { + return style; + }, + processElement: function(parent, current, control) { + var $__0 = this; + var attrs = current.attrs(); + var newAttrs = new Map(); + MapWrapper.forEach(attrs, (function(attrValue, attrName) { + attrName = $__0._normalizeAttributeName(attrName); + var bindParts = RegExpWrapper.firstMatch(BIND_NAME_REGEXP, attrName); + if (isPresent(bindParts)) { + if (isPresent(bindParts[1])) { + $__0._bindProperty(bindParts[5], attrValue, current, newAttrs); + } else if (isPresent(bindParts[2])) { + var identifier = bindParts[5]; + var value = attrValue == '' ? '\$implicit' : attrValue; + $__0._bindVariable(identifier, value, current, newAttrs); + } else if (isPresent(bindParts[3])) { + $__0._bindEvent(bindParts[5], attrValue, current, newAttrs); + } else if (isPresent(bindParts[4])) { + $__0._bindProperty(bindParts[5], attrValue, current, newAttrs); + $__0._bindAssignmentEvent(bindParts[5], attrValue, current, newAttrs); + } else if (isPresent(bindParts[6])) { + $__0._bindProperty(bindParts[6], attrValue, current, newAttrs); + $__0._bindAssignmentEvent(bindParts[6], attrValue, current, newAttrs); + } else if (isPresent(bindParts[7])) { + $__0._bindProperty(bindParts[7], attrValue, current, newAttrs); + } else if (isPresent(bindParts[8])) { + $__0._bindEvent(bindParts[8], attrValue, current, newAttrs); + } + } else { + var expr = $__0._parser.parseInterpolation(attrValue, current.elementDescription); + if (isPresent(expr)) { + $__0._bindPropertyAst(attrName, expr, current, newAttrs); + } + } + })); + MapWrapper.forEach(newAttrs, (function(attrValue, attrName) { + attrs.set(attrName, attrValue); + })); + }, + _normalizeAttributeName: function(attrName) { + return StringWrapper.startsWith(attrName, 'data-') ? StringWrapper.substring(attrName, 5) : attrName; + }, + _bindVariable: function(identifier, value, current, newAttrs) { + current.bindElement().bindVariable(dashCaseToCamelCase(identifier), value); + newAttrs.set(identifier, value); + }, + _bindProperty: function(name, expression, current, newAttrs) { + this._bindPropertyAst(name, this._parser.parseBinding(expression, current.elementDescription), current, newAttrs); + }, + _bindPropertyAst: function(name, ast, current, newAttrs) { + var binder = current.bindElement(); + binder.bindProperty(dashCaseToCamelCase(name), ast); + newAttrs.set(name, ast.source); + }, + _bindAssignmentEvent: function(name, expression, current, newAttrs) { + this._bindEvent(name, (expression + "=$event"), current, newAttrs); + }, + _bindEvent: function(name, expression, current, newAttrs) { + current.bindElement().bindEvent(dashCaseToCamelCase(name), this._parser.parseAction(expression, current.elementDescription)); + } + }, {}); + }()); + $__export("PropertyBindingParser", PropertyBindingParser); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/text_interpolation_parser", ["angular2/src/facade/lang", "angular2/src/dom/dom_adapter"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/text_interpolation_parser"; + var isPresent, + DOM, + TextInterpolationParser; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + DOM = $__m.DOM; + }], + execute: function() { + TextInterpolationParser = (function() { + function TextInterpolationParser(_parser) { + this._parser = _parser; + } + return ($traceurRuntime.createClass)(TextInterpolationParser, { + processStyle: function(style) { + return style; + }, + processElement: function(parent, current, control) { + if (!current.compileChildren) { + return ; + } + var element = current.element; + var childNodes = DOM.childNodes(DOM.templateAwareRoot(element)); + for (var i = 0; i < childNodes.length; i++) { + var node = childNodes[i]; + if (DOM.isTextNode(node)) { + var textNode = node; + var text = DOM.nodeValue(textNode); + var expr = this._parser.parseInterpolation(text, current.elementDescription); + if (isPresent(expr)) { + DOM.setText(textNode, ' '); + if (current.element === current.inheritedProtoView.rootElement) { + current.inheritedProtoView.bindRootText(textNode, expr); + } else { + current.bindElement().bindText(textNode, expr); + } + } + } + } + } + }, {}); + }()); + $__export("TextInterpolationParser", TextInterpolationParser); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/selector", ["angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/selector"; + var Map, + ListWrapper, + isPresent, + isBlank, + RegExpWrapper, + RegExpMatcherWrapper, + StringWrapper, + BaseException, + _EMPTY_ATTR_VALUE, + _SELECTOR_REGEXP, + CssSelector, + SelectorMatcher, + SelectorListContext, + SelectorContext; + return { + setters: [function($__m) { + Map = $__m.Map; + ListWrapper = $__m.ListWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + RegExpWrapper = $__m.RegExpWrapper; + RegExpMatcherWrapper = $__m.RegExpMatcherWrapper; + StringWrapper = $__m.StringWrapper; + BaseException = $__m.BaseException; + }], + execute: function() { + _EMPTY_ATTR_VALUE = ''; + _SELECTOR_REGEXP = RegExpWrapper.create('(\\:not\\()|' + '([-\\w]+)|' + '(?:\\.([-\\w]+))|' + '(?:\\[([-\\w*]+)(?:=([^\\]]*))?\\])|' + '(\\))|' + '(\\s*,\\s*)'); + CssSelector = (function() { + function CssSelector() { + this.element = null; + this.classNames = []; + this.attrs = []; + this.notSelectors = []; + } + return ($traceurRuntime.createClass)(CssSelector, { + isElementSelector: function() { + return isPresent(this.element) && ListWrapper.isEmpty(this.classNames) && ListWrapper.isEmpty(this.attrs) && this.notSelectors.length === 0; + }, + setElement: function() { + var element = arguments[0] !== (void 0) ? arguments[0] : null; + if (isPresent(element)) { + element = element.toLowerCase(); + } + this.element = element; + }, + addAttribute: function(name) { + var value = arguments[1] !== (void 0) ? arguments[1] : _EMPTY_ATTR_VALUE; + this.attrs.push(name.toLowerCase()); + if (isPresent(value)) { + value = value.toLowerCase(); + } else { + value = _EMPTY_ATTR_VALUE; + } + this.attrs.push(value); + }, + addClassName: function(name) { + this.classNames.push(name.toLowerCase()); + }, + toString: function() { + var res = ''; + if (isPresent(this.element)) { + res += this.element; + } + if (isPresent(this.classNames)) { + for (var i = 0; i < this.classNames.length; i++) { + res += '.' + this.classNames[i]; + } + } + if (isPresent(this.attrs)) { + for (var i = 0; i < this.attrs.length; ) { + var attrName = this.attrs[i++]; + var attrValue = this.attrs[i++]; + res += '[' + attrName; + if (attrValue.length > 0) { + res += '=' + attrValue; + } + res += ']'; + } + } + ListWrapper.forEach(this.notSelectors, (function(notSelector) { + res += ":not(" + notSelector.toString() + ")"; + })); + return res; + } + }, {parse: function(selector) { + var results = []; + var _addResult = (function(res, cssSel) { + if (cssSel.notSelectors.length > 0 && isBlank(cssSel.element) && ListWrapper.isEmpty(cssSel.classNames) && ListWrapper.isEmpty(cssSel.attrs)) { + cssSel.element = "*"; + } + res.push(cssSel); + }); + var cssSelector = new CssSelector(); + var matcher = RegExpWrapper.matcher(_SELECTOR_REGEXP, selector); + var match; + var current = cssSelector; + var inNot = false; + while (isPresent(match = RegExpMatcherWrapper.next(matcher))) { + if (isPresent(match[1])) { + if (inNot) { + throw new BaseException('Nesting :not is not allowed in a selector'); + } + inNot = true; + current = new CssSelector(); + cssSelector.notSelectors.push(current); + } + if (isPresent(match[2])) { + current.setElement(match[2]); + } + if (isPresent(match[3])) { + current.addClassName(match[3]); + } + if (isPresent(match[4])) { + current.addAttribute(match[4], match[5]); + } + if (isPresent(match[6])) { + inNot = false; + current = cssSelector; + } + if (isPresent(match[7])) { + if (inNot) { + throw new BaseException('Multiple selectors in :not are not supported'); + } + _addResult(results, cssSelector); + cssSelector = current = new CssSelector(); + } + } + _addResult(results, cssSelector); + return results; + }}); + }()); + $__export("CssSelector", CssSelector); + SelectorMatcher = (function() { + function SelectorMatcher() { + this._elementMap = new Map(); + this._elementPartialMap = new Map(); + this._classMap = new Map(); + this._classPartialMap = new Map(); + this._attrValueMap = new Map(); + this._attrValuePartialMap = new Map(); + this._listContexts = []; + } + return ($traceurRuntime.createClass)(SelectorMatcher, { + addSelectables: function(cssSelectors, callbackCtxt) { + var listContext = null; + if (cssSelectors.length > 1) { + listContext = new SelectorListContext(cssSelectors); + this._listContexts.push(listContext); + } + for (var i = 0; i < cssSelectors.length; i++) { + this._addSelectable(cssSelectors[i], callbackCtxt, listContext); + } + }, + _addSelectable: function(cssSelector, callbackCtxt, listContext) { + var matcher = this; + var element = cssSelector.element; + var classNames = cssSelector.classNames; + var attrs = cssSelector.attrs; + var selectable = new SelectorContext(cssSelector, callbackCtxt, listContext); + if (isPresent(element)) { + var isTerminal = attrs.length === 0 && classNames.length === 0; + if (isTerminal) { + this._addTerminal(matcher._elementMap, element, selectable); + } else { + matcher = this._addPartial(matcher._elementPartialMap, element); + } + } + if (isPresent(classNames)) { + for (var index = 0; index < classNames.length; index++) { + var isTerminal = attrs.length === 0 && index === classNames.length - 1; + var className = classNames[index]; + if (isTerminal) { + this._addTerminal(matcher._classMap, className, selectable); + } else { + matcher = this._addPartial(matcher._classPartialMap, className); + } + } + } + if (isPresent(attrs)) { + for (var index = 0; index < attrs.length; ) { + var isTerminal = index === attrs.length - 2; + var attrName = attrs[index++]; + var attrValue = attrs[index++]; + if (isTerminal) { + var terminalMap = matcher._attrValueMap; + var terminalValuesMap = terminalMap.get(attrName); + if (isBlank(terminalValuesMap)) { + terminalValuesMap = new Map(); + terminalMap.set(attrName, terminalValuesMap); + } + this._addTerminal(terminalValuesMap, attrValue, selectable); + } else { + var parttialMap = matcher._attrValuePartialMap; + var partialValuesMap = parttialMap.get(attrName); + if (isBlank(partialValuesMap)) { + partialValuesMap = new Map(); + parttialMap.set(attrName, partialValuesMap); + } + matcher = this._addPartial(partialValuesMap, attrValue); + } + } + } + }, + _addTerminal: function(map, name, selectable) { + var terminalList = map.get(name); + if (isBlank(terminalList)) { + terminalList = []; + map.set(name, terminalList); + } + terminalList.push(selectable); + }, + _addPartial: function(map, name) { + var matcher = map.get(name); + if (isBlank(matcher)) { + matcher = new SelectorMatcher(); + map.set(name, matcher); + } + return matcher; + }, + match: function(cssSelector, matchedCallback) { + var result = false; + var element = cssSelector.element; + var classNames = cssSelector.classNames; + var attrs = cssSelector.attrs; + for (var i = 0; i < this._listContexts.length; i++) { + this._listContexts[i].alreadyMatched = false; + } + result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result; + result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) || result; + if (isPresent(classNames)) { + for (var index = 0; index < classNames.length; index++) { + var className = classNames[index]; + result = this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result; + result = this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) || result; + } + } + if (isPresent(attrs)) { + for (var index = 0; index < attrs.length; ) { + var attrName = attrs[index++]; + var attrValue = attrs[index++]; + var terminalValuesMap = this._attrValueMap.get(attrName); + if (!StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchTerminal(terminalValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result; + } + result = this._matchTerminal(terminalValuesMap, attrValue, cssSelector, matchedCallback) || result; + var partialValuesMap = this._attrValuePartialMap.get(attrName); + if (!StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchPartial(partialValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result; + } + result = this._matchPartial(partialValuesMap, attrValue, cssSelector, matchedCallback) || result; + } + } + return result; + }, + _matchTerminal: function(map, name, cssSelector, matchedCallback) { + if (isBlank(map) || isBlank(name)) { + return false; + } + var selectables = map.get(name); + var starSelectables = map.get("*"); + if (isPresent(starSelectables)) { + selectables = ListWrapper.concat(selectables, starSelectables); + } + if (isBlank(selectables)) { + return false; + } + var selectable; + var result = false; + for (var index = 0; index < selectables.length; index++) { + selectable = selectables[index]; + result = selectable.finalize(cssSelector, matchedCallback) || result; + } + return result; + }, + _matchPartial: function(map, name, cssSelector, matchedCallback) { + if (isBlank(map) || isBlank(name)) { + return false; + } + var nestedSelector = map.get(name); + if (isBlank(nestedSelector)) { + return false; + } + return nestedSelector.match(cssSelector, matchedCallback); + } + }, {createNotMatcher: function(notSelectors) { + var notMatcher = new SelectorMatcher(); + notMatcher.addSelectables(notSelectors, null); + return notMatcher; + }}); + }()); + $__export("SelectorMatcher", SelectorMatcher); + SelectorListContext = (function() { + function SelectorListContext(selectors) { + this.selectors = selectors; + this.alreadyMatched = false; + } + return ($traceurRuntime.createClass)(SelectorListContext, {}, {}); + }()); + $__export("SelectorListContext", SelectorListContext); + SelectorContext = (function() { + function SelectorContext(selector, cbContext, listContext) { + this.selector = selector; + this.cbContext = cbContext; + this.listContext = listContext; + this.notSelectors = selector.notSelectors; + } + return ($traceurRuntime.createClass)(SelectorContext, {finalize: function(cssSelector, callback) { + var result = true; + if (this.notSelectors.length > 0 && (isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + var notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors); + result = !notMatcher.match(cssSelector, null); + } + if (result && isPresent(callback) && (isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + if (isPresent(this.listContext)) { + this.listContext.alreadyMatched = true; + } + callback(this.selector, this.cbContext); + } + return result; + }}, {}); + }()); + $__export("SelectorContext", SelectorContext); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/view_splitter", ["angular2/src/facade/lang", "angular2/src/dom/dom_adapter", "angular2/src/facade/collection", "angular2/src/render/dom/compiler/compile_element", "angular2/src/render/dom/util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/view_splitter"; + var isPresent, + BaseException, + StringWrapper, + DOM, + MapWrapper, + CompileElement, + dashCaseToCamelCase, + ViewSplitter; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + MapWrapper = $__m.MapWrapper; + }, function($__m) { + CompileElement = $__m.CompileElement; + }, function($__m) { + dashCaseToCamelCase = $__m.dashCaseToCamelCase; + }], + execute: function() { + ViewSplitter = (function() { + function ViewSplitter(_parser) { + this._parser = _parser; + } + return ($traceurRuntime.createClass)(ViewSplitter, { + processStyle: function(style) { + return style; + }, + processElement: function(parent, current, control) { + var attrs = current.attrs(); + var templateBindings = attrs.get('template'); + var hasTemplateBinding = isPresent(templateBindings); + MapWrapper.forEach(attrs, (function(attrValue, attrName) { + if (StringWrapper.startsWith(attrName, '*')) { + var key = StringWrapper.substring(attrName, 1); + if (hasTemplateBinding) { + throw new BaseException("Only one template directive per element is allowed: " + (templateBindings + " and " + key + " cannot be used simultaneously ") + ("in " + current.elementDescription)); + } else { + templateBindings = (attrValue.length == 0) ? key : key + ' ' + attrValue; + hasTemplateBinding = true; + } + } + })); + if (isPresent(parent)) { + if (DOM.isTemplateElement(current.element)) { + if (!current.isViewRoot) { + var viewRoot = new CompileElement(DOM.createTemplate('')); + viewRoot.inheritedProtoView = current.bindElement().bindNestedProtoView(viewRoot.element); + viewRoot.elementDescription = current.elementDescription; + viewRoot.isViewRoot = true; + this._moveChildNodes(DOM.content(current.element), DOM.content(viewRoot.element)); + control.addChild(viewRoot); + } + } + if (hasTemplateBinding) { + var anchor = new CompileElement(DOM.createTemplate('')); + anchor.inheritedProtoView = current.inheritedProtoView; + anchor.inheritedElementBinder = current.inheritedElementBinder; + anchor.distanceToInheritedBinder = current.distanceToInheritedBinder; + anchor.elementDescription = current.elementDescription; + var viewRoot = new CompileElement(DOM.createTemplate('')); + viewRoot.inheritedProtoView = anchor.bindElement().bindNestedProtoView(viewRoot.element); + viewRoot.elementDescription = current.elementDescription; + viewRoot.isViewRoot = true; + current.inheritedProtoView = viewRoot.inheritedProtoView; + current.inheritedElementBinder = null; + current.distanceToInheritedBinder = 0; + this._parseTemplateBindings(templateBindings, anchor); + DOM.insertBefore(current.element, anchor.element); + control.addParent(anchor); + DOM.appendChild(DOM.content(viewRoot.element), current.element); + control.addParent(viewRoot); + } + } + }, + _moveChildNodes: function(source, target) { + var next = DOM.firstChild(source); + while (isPresent(next)) { + DOM.appendChild(target, next); + next = DOM.firstChild(source); + } + }, + _parseTemplateBindings: function(templateBindings, compileElement) { + var bindings = this._parser.parseTemplateBindings(templateBindings, compileElement.elementDescription); + for (var i = 0; i < bindings.length; i++) { + var binding = bindings[i]; + if (binding.keyIsVar) { + compileElement.bindElement().bindVariable(dashCaseToCamelCase(binding.key), binding.name); + compileElement.attrs().set(binding.key, binding.name); + } else if (isPresent(binding.expression)) { + compileElement.bindElement().bindProperty(dashCaseToCamelCase(binding.key), binding.expression); + compileElement.attrs().set(binding.key, binding.expression.source); + } else { + DOM.setAttribute(compileElement.element, binding.key, ''); + } + } + } + }, {}); + }()); + $__export("ViewSplitter", ViewSplitter); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/shadow_css", ["angular2/src/dom/dom_adapter", "angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/shadow_css"; + var DOM, + ListWrapper, + StringWrapper, + RegExpWrapper, + RegExpMatcherWrapper, + isPresent, + isBlank, + ShadowCss, + _cssContentNextSelectorRe, + _cssContentRuleRe, + _cssContentUnscopedRuleRe, + _polyfillHost, + _polyfillHostContext, + _parenSuffix, + _cssColonHostRe, + _cssColonHostContextRe, + _polyfillHostNoCombinator, + _shadowDOMSelectorsRe, + _selectorReSuffix, + _polyfillHostRe, + _colonHostRe, + _colonHostContextRe; + function _cssToRules(cssText) { + return DOM.cssToRules(cssText); + } + function _withCssRules(cssText, callback) { + if (isBlank(callback)) + return ; + var rules = _cssToRules(cssText); + callback(rules); + } + return { + setters: [function($__m) { + DOM = $__m.DOM; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + StringWrapper = $__m.StringWrapper; + RegExpWrapper = $__m.RegExpWrapper; + RegExpMatcherWrapper = $__m.RegExpMatcherWrapper; + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + }], + execute: function() { + ShadowCss = (function() { + function ShadowCss() { + this.strictStyling = true; + } + return ($traceurRuntime.createClass)(ShadowCss, { + shimStyle: function(style, selector) { + var hostSelector = arguments[2] !== (void 0) ? arguments[2] : ''; + var cssText = DOM.getText(style); + return this.shimCssText(cssText, selector, hostSelector); + }, + shimCssText: function(cssText, selector) { + var hostSelector = arguments[2] !== (void 0) ? arguments[2] : ''; + cssText = this._insertDirectives(cssText); + return this._scopeCssText(cssText, selector, hostSelector); + }, + _insertDirectives: function(cssText) { + cssText = this._insertPolyfillDirectivesInCssText(cssText); + return this._insertPolyfillRulesInCssText(cssText); + }, + _insertPolyfillDirectivesInCssText: function(cssText) { + return StringWrapper.replaceAllMapped(cssText, _cssContentNextSelectorRe, function(m) { + return m[1] + '{'; + }); + }, + _insertPolyfillRulesInCssText: function(cssText) { + return StringWrapper.replaceAllMapped(cssText, _cssContentRuleRe, function(m) { + var rule = m[0]; + rule = StringWrapper.replace(rule, m[1], ''); + rule = StringWrapper.replace(rule, m[2], ''); + return m[3] + rule; + }); + }, + _scopeCssText: function(cssText, scopeSelector, hostSelector) { + var $__0 = this; + var unscoped = this._extractUnscopedRulesFromCssText(cssText); + cssText = this._insertPolyfillHostInCssText(cssText); + cssText = this._convertColonHost(cssText); + cssText = this._convertColonHostContext(cssText); + cssText = this._convertShadowDOMSelectors(cssText); + if (isPresent(scopeSelector)) { + _withCssRules(cssText, (function(rules) { + cssText = $__0._scopeRules(rules, scopeSelector, hostSelector); + })); + } + cssText = cssText + '\n' + unscoped; + return cssText.trim(); + }, + _extractUnscopedRulesFromCssText: function(cssText) { + var r = '', + m; + var matcher = RegExpWrapper.matcher(_cssContentUnscopedRuleRe, cssText); + while (isPresent(m = RegExpMatcherWrapper.next(matcher))) { + var rule = m[0]; + rule = StringWrapper.replace(rule, m[2], ''); + rule = StringWrapper.replace(rule, m[1], m[3]); + r += rule + '\n\n'; + } + return r; + }, + _convertColonHost: function(cssText) { + return this._convertColonRule(cssText, _cssColonHostRe, this._colonHostPartReplacer); + }, + _convertColonHostContext: function(cssText) { + return this._convertColonRule(cssText, _cssColonHostContextRe, this._colonHostContextPartReplacer); + }, + _convertColonRule: function(cssText, regExp, partReplacer) { + return StringWrapper.replaceAllMapped(cssText, regExp, function(m) { + if (isPresent(m[2])) { + var parts = m[2].split(','), + r = []; + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + if (isBlank(p)) + break; + p = p.trim(); + r.push(partReplacer(_polyfillHostNoCombinator, p, m[3])); + } + return r.join(','); + } else { + return _polyfillHostNoCombinator + m[3]; + } + }); + }, + _colonHostContextPartReplacer: function(host, part, suffix) { + if (StringWrapper.contains(part, _polyfillHost)) { + return this._colonHostPartReplacer(host, part, suffix); + } else { + return host + part + suffix + ', ' + part + ' ' + host + suffix; + } + }, + _colonHostPartReplacer: function(host, part, suffix) { + return host + StringWrapper.replace(part, _polyfillHost, '') + suffix; + }, + _convertShadowDOMSelectors: function(cssText) { + for (var i = 0; i < _shadowDOMSelectorsRe.length; i++) { + cssText = StringWrapper.replaceAll(cssText, _shadowDOMSelectorsRe[i], ' '); + } + return cssText; + }, + _scopeRules: function(cssRules, scopeSelector, hostSelector) { + var cssText = ''; + if (isPresent(cssRules)) { + for (var i = 0; i < cssRules.length; i++) { + var rule = cssRules[i]; + if (DOM.isStyleRule(rule) || DOM.isPageRule(rule)) { + cssText += this._scopeSelector(rule.selectorText, scopeSelector, hostSelector, this.strictStyling) + ' {\n'; + cssText += this._propertiesFromRule(rule) + '\n}\n\n'; + } else if (DOM.isMediaRule(rule)) { + cssText += '@media ' + rule.media.mediaText + ' {\n'; + cssText += this._scopeRules(rule.cssRules, scopeSelector, hostSelector); + cssText += '\n}\n\n'; + } else { + try { + if (isPresent(rule.cssText)) { + cssText += rule.cssText + '\n\n'; + } + } catch (x) { + if (DOM.isKeyframesRule(rule) && isPresent(rule.cssRules)) { + cssText += this._ieSafeCssTextFromKeyFrameRule(rule); + } + } + } + } + } + return cssText; + }, + _ieSafeCssTextFromKeyFrameRule: function(rule) { + var cssText = '@keyframes ' + rule.name + ' {'; + for (var i = 0; i < rule.cssRules.length; i++) { + var r = rule.cssRules[i]; + cssText += ' ' + r.keyText + ' {' + r.style.cssText + '}'; + } + cssText += ' }'; + return cssText; + }, + _scopeSelector: function(selector, scopeSelector, hostSelector, strict) { + var r = [], + parts = selector.split(','); + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + p = p.trim(); + if (this._selectorNeedsScoping(p, scopeSelector)) { + p = strict && !StringWrapper.contains(p, _polyfillHostNoCombinator) ? this._applyStrictSelectorScope(p, scopeSelector) : this._applySelectorScope(p, scopeSelector, hostSelector); + } + r.push(p); + } + return r.join(', '); + }, + _selectorNeedsScoping: function(selector, scopeSelector) { + var re = this._makeScopeMatcher(scopeSelector); + return !isPresent(RegExpWrapper.firstMatch(re, selector)); + }, + _makeScopeMatcher: function(scopeSelector) { + var lre = /\[/g; + var rre = /\]/g; + scopeSelector = StringWrapper.replaceAll(scopeSelector, lre, '\\['); + scopeSelector = StringWrapper.replaceAll(scopeSelector, rre, '\\]'); + return RegExpWrapper.create('^(' + scopeSelector + ')' + _selectorReSuffix, 'm'); + }, + _applySelectorScope: function(selector, scopeSelector, hostSelector) { + return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector); + }, + _applySimpleSelectorScope: function(selector, scopeSelector, hostSelector) { + if (isPresent(RegExpWrapper.firstMatch(_polyfillHostRe, selector))) { + var replaceBy = this.strictStyling ? ("[" + hostSelector + "]") : scopeSelector; + selector = StringWrapper.replace(selector, _polyfillHostNoCombinator, replaceBy); + return StringWrapper.replaceAll(selector, _polyfillHostRe, replaceBy + ' '); + } else { + return scopeSelector + ' ' + selector; + } + }, + _applyStrictSelectorScope: function(selector, scopeSelector) { + var isRe = /\[is=([^\]]*)\]/g; + scopeSelector = StringWrapper.replaceAllMapped(scopeSelector, isRe, (function(m) { + return m[1]; + })); + var splits = [' ', '>', '+', '~'], + scoped = selector, + attrName = '[' + scopeSelector + ']'; + for (var i = 0; i < splits.length; i++) { + var sep = splits[i]; + var parts = scoped.split(sep); + scoped = ListWrapper.map(parts, function(p) { + var t = StringWrapper.replaceAll(p.trim(), _polyfillHostRe, ''); + if (t.length > 0 && !ListWrapper.contains(splits, t) && !StringWrapper.contains(t, attrName)) { + var re = /([^:]*)(:*)(.*)/g; + var m = RegExpWrapper.firstMatch(re, t); + if (isPresent(m)) { + p = m[1] + attrName + m[2] + m[3]; + } + } + return p; + }).join(sep); + } + return scoped; + }, + _insertPolyfillHostInCssText: function(selector) { + selector = StringWrapper.replaceAll(selector, _colonHostContextRe, _polyfillHostContext); + selector = StringWrapper.replaceAll(selector, _colonHostRe, _polyfillHost); + return selector; + }, + _propertiesFromRule: function(rule) { + var cssText = rule.style.cssText; + var attrRe = /['"]+|attr/g; + if (rule.style.content.length > 0 && !isPresent(RegExpWrapper.firstMatch(attrRe, rule.style.content))) { + var contentRe = /content:[^;]*;/g; + cssText = StringWrapper.replaceAll(cssText, contentRe, 'content: \'' + rule.style.content + '\';'); + } + return cssText; + } + }, {}); + }()); + $__export("ShadowCss", ShadowCss); + _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim; + _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim; + _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim; + _polyfillHost = '-shadowcsshost'; + _polyfillHostContext = '-shadowcsscontext'; + _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)'; + _cssColonHostRe = RegExpWrapper.create('(' + _polyfillHost + _parenSuffix, 'im'); + _cssColonHostContextRe = RegExpWrapper.create('(' + _polyfillHostContext + _parenSuffix, 'im'); + _polyfillHostNoCombinator = _polyfillHost + '-no-combinator'; + _shadowDOMSelectorsRe = [/>>>/g, /::shadow/g, /::content/g, /\/deep\//g, /\/shadow-deep\//g, /\/shadow\//g]; + _selectorReSuffix = '([>\\s~+\[.,{:][\\s\\S]*)?$'; + _polyfillHostRe = RegExpWrapper.create(_polyfillHost, 'im'); + _colonHostRe = /:host/gim; + _colonHostContextRe = /:host-context/gim; + } + }; +}); + +System.register("angular2/src/render/dom/view/proto_view_merger", ["angular2/src/dom/dom_adapter", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/render/dom/view/proto_view", "angular2/src/render/dom/view/element_binder", "angular2/src/render/api", "angular2/src/render/dom/util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/view/proto_view_merger"; + var DOM, + isPresent, + isBlank, + isArray, + ListWrapper, + SetWrapper, + MapWrapper, + DomProtoView, + DomProtoViewRef, + resolveInternalDomProtoView, + DomElementBinder, + RenderProtoViewMergeMapping, + ViewType, + ViewEncapsulation, + NG_BINDING_CLASS, + NG_CONTENT_ELEMENT_NAME, + cloneAndQueryProtoView, + queryBoundElements, + queryBoundTextNodeIndices, + NG_SHADOW_ROOT_ELEMENT_NAME; + function mergeProtoViewsRecursively(protoViewRefs) { + var clonedProtoViews = []; + var hostViewAndBinderIndices = []; + cloneProtoViews(protoViewRefs, clonedProtoViews, hostViewAndBinderIndices); + var mainProtoView = clonedProtoViews[0]; + mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices); + var fragments = []; + var elementsWithNativeShadowRoot = new Set(); + mergeComponents(clonedProtoViews, hostViewAndBinderIndices, fragments, elementsWithNativeShadowRoot); + markBoundTextNodeParentsAsBoundElements(clonedProtoViews); + var rootElement = createRootElementFromFragments(fragments); + var fragmentsRootNodeCount = fragments.map((function(fragment) { + return fragment.length; + })); + var rootNode = DOM.content(rootElement); + var mergedBoundElements = queryBoundElements(rootNode, false); + var mergedBoundTextIndices = new Map(); + var boundTextNodeMap = indexBoundTextNodes(clonedProtoViews); + var rootTextNodeIndices = calcRootTextNodeIndices(rootNode, boundTextNodeMap, mergedBoundTextIndices); + var mergedElementBinders = calcElementBinders(clonedProtoViews, mergedBoundElements, elementsWithNativeShadowRoot, boundTextNodeMap, mergedBoundTextIndices); + var mappedElementIndices = calcMappedElementIndices(clonedProtoViews, mergedBoundElements); + var mappedTextIndices = calcMappedTextIndices(clonedProtoViews, mergedBoundTextIndices); + var hostElementIndicesByViewIndex = calcHostElementIndicesByViewIndex(clonedProtoViews, hostViewAndBinderIndices); + var nestedViewCounts = calcNestedViewCounts(hostViewAndBinderIndices); + var mergedProtoView = DomProtoView.create(mainProtoView.original.type, rootElement, mainProtoView.original.encapsulation, fragmentsRootNodeCount, rootTextNodeIndices, mergedElementBinders, new Map()); + return new RenderProtoViewMergeMapping(new DomProtoViewRef(mergedProtoView), fragmentsRootNodeCount.length, mappedElementIndices, mergedBoundElements.length, mappedTextIndices, hostElementIndicesByViewIndex, nestedViewCounts); + } + function cloneProtoViews(protoViewRefs, targetClonedProtoViews, targetHostViewAndBinderIndices) { + var hostProtoView = resolveInternalDomProtoView(protoViewRefs[0]); + var hostPvIdx = targetClonedProtoViews.length; + targetClonedProtoViews.push(cloneAndQueryProtoView(hostProtoView, false)); + if (targetHostViewAndBinderIndices.length === 0) { + targetHostViewAndBinderIndices.push([null, null]); + } + var protoViewIdx = 1; + for (var i = 0; i < hostProtoView.elementBinders.length; i++) { + var binder = hostProtoView.elementBinders[i]; + if (binder.hasNestedProtoView) { + var nestedEntry = protoViewRefs[protoViewIdx++]; + if (isPresent(nestedEntry)) { + targetHostViewAndBinderIndices.push([hostPvIdx, i]); + if (isArray(nestedEntry)) { + cloneProtoViews(nestedEntry, targetClonedProtoViews, targetHostViewAndBinderIndices); + } else { + targetClonedProtoViews.push(cloneAndQueryProtoView(resolveInternalDomProtoView(nestedEntry), false)); + } + } + } + } + } + function markBoundTextNodeParentsAsBoundElements(mergableProtoViews) { + mergableProtoViews.forEach((function(mergableProtoView) { + mergableProtoView.boundTextNodes.forEach((function(textNode) { + var parentNode = textNode.parentNode; + if (isPresent(parentNode) && DOM.isElementNode(parentNode)) { + DOM.addClass(parentNode, NG_BINDING_CLASS); + } + })); + })); + } + function indexBoundTextNodes(mergableProtoViews) { + var boundTextNodeMap = new Map(); + for (var pvIndex = 0; pvIndex < mergableProtoViews.length; pvIndex++) { + var mergableProtoView = mergableProtoViews[pvIndex]; + mergableProtoView.boundTextNodes.forEach((function(textNode) { + boundTextNodeMap.set(textNode, null); + })); + } + return boundTextNodeMap; + } + function mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices) { + var nearestHostComponentOrRootPvIndices = calcNearestHostComponentOrRootPvIndices(clonedProtoViews, hostViewAndBinderIndices); + for (var viewIdx = 1; viewIdx < clonedProtoViews.length; viewIdx++) { + var clonedProtoView = clonedProtoViews[viewIdx]; + if (clonedProtoView.original.type === ViewType.EMBEDDED) { + var hostComponentIdx = nearestHostComponentOrRootPvIndices[viewIdx]; + var hostPv = clonedProtoViews[hostComponentIdx]; + clonedProtoView.fragments.forEach((function(fragment) { + return hostPv.fragments.push(fragment); + })); + } + } + } + function calcNearestHostComponentOrRootPvIndices(clonedProtoViews, hostViewAndBinderIndices) { + var nearestHostComponentOrRootPvIndices = ListWrapper.createFixedSize(clonedProtoViews.length); + nearestHostComponentOrRootPvIndices[0] = null; + for (var viewIdx = 1; viewIdx < hostViewAndBinderIndices.length; viewIdx++) { + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostProtoView = clonedProtoViews[hostViewIdx]; + if (hostViewIdx === 0 || hostProtoView.original.type === ViewType.COMPONENT) { + nearestHostComponentOrRootPvIndices[viewIdx] = hostViewIdx; + } else { + nearestHostComponentOrRootPvIndices[viewIdx] = nearestHostComponentOrRootPvIndices[hostViewIdx]; + } + } + return nearestHostComponentOrRootPvIndices; + } + function mergeComponents(clonedProtoViews, hostViewAndBinderIndices, targetFragments, targetElementsWithNativeShadowRoot) { + var hostProtoView = clonedProtoViews[0]; + hostProtoView.fragments.forEach((function(fragment) { + return targetFragments.push(fragment); + })); + for (var viewIdx = 1; viewIdx < clonedProtoViews.length; viewIdx++) { + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostBinderIdx = hostViewAndBinderIndices[viewIdx][1]; + var hostProtoView = clonedProtoViews[hostViewIdx]; + var clonedProtoView = clonedProtoViews[viewIdx]; + if (clonedProtoView.original.type === ViewType.COMPONENT) { + mergeComponent(hostProtoView, hostBinderIdx, clonedProtoView, targetFragments, targetElementsWithNativeShadowRoot); + } + } + } + function mergeComponent(hostProtoView, binderIdx, nestedProtoView, targetFragments, targetElementsWithNativeShadowRoot) { + var hostElement = hostProtoView.boundElements[binderIdx]; + var fragmentElements = mapFragmentsIntoElements(nestedProtoView.fragments); + var contentElements = findContentElements(fragmentElements); + var projectableNodes = DOM.childNodesAsList(hostElement); + for (var i = 0; i < contentElements.length; i++) { + var contentElement = contentElements[i]; + var select = DOM.getAttribute(contentElement, 'select'); + projectableNodes = projectMatchingNodes(select, contentElement, projectableNodes); + } + var fragments = extractFragmentNodesFromElements(fragmentElements); + var useNativeShadowRoot = nestedProtoView.original.encapsulation === ViewEncapsulation.NATIVE; + if (useNativeShadowRoot) { + targetElementsWithNativeShadowRoot.add(hostElement); + } + MapWrapper.forEach(nestedProtoView.original.hostAttributes, (function(attrValue, attrName) { + DOM.setAttribute(hostElement, attrName, attrValue); + })); + appendComponentNodesToHost(hostProtoView, binderIdx, fragments[0], useNativeShadowRoot); + for (var i = 1; i < fragments.length; i++) { + targetFragments.push(fragments[i]); + } + } + function mapFragmentsIntoElements(fragments) { + return fragments.map((function(fragment) { + var fragmentElement = DOM.createTemplate(''); + fragment.forEach((function(node) { + return DOM.appendChild(DOM.content(fragmentElement), node); + })); + return fragmentElement; + })); + } + function extractFragmentNodesFromElements(fragmentElements) { + return fragmentElements.map((function(fragmentElement) { + return DOM.childNodesAsList(DOM.content(fragmentElement)); + })); + } + function findContentElements(fragmentElements) { + var contentElements = []; + fragmentElements.forEach((function(fragmentElement) { + var fragmentContentElements = DOM.querySelectorAll(DOM.content(fragmentElement), NG_CONTENT_ELEMENT_NAME); + for (var i = 0; i < fragmentContentElements.length; i++) { + contentElements.push(fragmentContentElements[i]); + } + })); + return sortContentElements(contentElements); + } + function appendComponentNodesToHost(hostProtoView, binderIdx, componentRootNodes, useNativeShadowRoot) { + var hostElement = hostProtoView.boundElements[binderIdx]; + if (useNativeShadowRoot) { + var shadowRootWrapper = DOM.createElement(NG_SHADOW_ROOT_ELEMENT_NAME); + for (var i = 0; i < componentRootNodes.length; i++) { + DOM.appendChild(shadowRootWrapper, componentRootNodes[i]); + } + var firstChild = DOM.firstChild(hostElement); + if (isPresent(firstChild)) { + DOM.insertBefore(firstChild, shadowRootWrapper); + } else { + DOM.appendChild(hostElement, shadowRootWrapper); + } + } else { + DOM.clearNodes(hostElement); + for (var i = 0; i < componentRootNodes.length; i++) { + DOM.appendChild(hostElement, componentRootNodes[i]); + } + } + } + function projectMatchingNodes(selector, contentElement, nodes) { + var remaining = []; + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var matches = false; + if (isWildcard(selector)) { + matches = true; + } else if (DOM.isElementNode(node) && DOM.elementMatches(node, selector)) { + matches = true; + } + if (matches) { + DOM.insertBefore(contentElement, node); + } else { + remaining.push(node); + } + } + DOM.remove(contentElement); + return remaining; + } + function isWildcard(selector) { + return isBlank(selector) || selector.length === 0 || selector == '*'; + } + function sortContentElements(contentElements) { + var firstWildcard = null; + var sorted = []; + contentElements.forEach((function(contentElement) { + var select = DOM.getAttribute(contentElement, 'select'); + if (isWildcard(select)) { + if (isBlank(firstWildcard)) { + firstWildcard = contentElement; + } + } else { + sorted.push(contentElement); + } + })); + if (isPresent(firstWildcard)) { + sorted.push(firstWildcard); + } + return sorted; + } + function createRootElementFromFragments(fragments) { + var rootElement = DOM.createTemplate(''); + var rootNode = DOM.content(rootElement); + fragments.forEach((function(fragment) { + fragment.forEach((function(node) { + DOM.appendChild(rootNode, node); + })); + })); + return rootElement; + } + function calcRootTextNodeIndices(rootNode, boundTextNodes, targetBoundTextIndices) { + var rootTextNodeIndices = []; + queryBoundTextNodeIndices(rootNode, boundTextNodes, (function(textNode, nodeIndex, _) { + rootTextNodeIndices.push(nodeIndex); + targetBoundTextIndices.set(textNode, targetBoundTextIndices.size); + })); + return rootTextNodeIndices; + } + function calcElementBinders(clonedProtoViews, mergedBoundElements, elementsWithNativeShadowRoot, boundTextNodes, targetBoundTextIndices) { + var elementBinderByElement = indexElementBindersByElement(clonedProtoViews); + var mergedElementBinders = []; + for (var i = 0; i < mergedBoundElements.length; i++) { + var element = mergedBoundElements[i]; + var textNodeIndices = []; + queryBoundTextNodeIndices(element, boundTextNodes, (function(textNode, nodeIndex, _) { + textNodeIndices.push(nodeIndex); + targetBoundTextIndices.set(textNode, targetBoundTextIndices.size); + })); + mergedElementBinders.push(updateElementBinders(elementBinderByElement.get(element), textNodeIndices, SetWrapper.has(elementsWithNativeShadowRoot, element))); + } + return mergedElementBinders; + } + function indexElementBindersByElement(mergableProtoViews) { + var elementBinderByElement = new Map(); + mergableProtoViews.forEach((function(mergableProtoView) { + for (var i = 0; i < mergableProtoView.boundElements.length; i++) { + var el = mergableProtoView.boundElements[i]; + if (isPresent(el)) { + elementBinderByElement.set(el, mergableProtoView.original.elementBinders[i]); + } + } + })); + return elementBinderByElement; + } + function updateElementBinders(elementBinder, textNodeIndices, hasNativeShadowRoot) { + var result; + if (isBlank(elementBinder)) { + result = new DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: false, + eventLocals: null, + localEvents: [], + globalEvents: [], + hasNativeShadowRoot: false + }); + } else { + result = new DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: false, + eventLocals: elementBinder.eventLocals, + localEvents: elementBinder.localEvents, + globalEvents: elementBinder.globalEvents, + hasNativeShadowRoot: hasNativeShadowRoot + }); + } + return result; + } + function calcMappedElementIndices(clonedProtoViews, mergedBoundElements) { + var mergedBoundElementIndices = indexArray(mergedBoundElements); + var mappedElementIndices = []; + clonedProtoViews.forEach((function(clonedProtoView) { + clonedProtoView.boundElements.forEach((function(boundElement) { + var mappedElementIndex = mergedBoundElementIndices.get(boundElement); + mappedElementIndices.push(mappedElementIndex); + })); + })); + return mappedElementIndices; + } + function calcMappedTextIndices(clonedProtoViews, mergedBoundTextIndices) { + var mappedTextIndices = []; + clonedProtoViews.forEach((function(clonedProtoView) { + clonedProtoView.boundTextNodes.forEach((function(textNode) { + var mappedTextIndex = mergedBoundTextIndices.get(textNode); + mappedTextIndices.push(mappedTextIndex); + })); + })); + return mappedTextIndices; + } + function calcHostElementIndicesByViewIndex(clonedProtoViews, hostViewAndBinderIndices) { + var hostElementIndices = [null]; + var viewElementOffsets = [0]; + var elementIndex = clonedProtoViews[0].original.elementBinders.length; + for (var viewIdx = 1; viewIdx < hostViewAndBinderIndices.length; viewIdx++) { + viewElementOffsets.push(elementIndex); + elementIndex += clonedProtoViews[viewIdx].original.elementBinders.length; + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostBinderIdx = hostViewAndBinderIndices[viewIdx][1]; + hostElementIndices.push(viewElementOffsets[hostViewIdx] + hostBinderIdx); + } + return hostElementIndices; + } + function calcNestedViewCounts(hostViewAndBinderIndices) { + var nestedViewCounts = ListWrapper.createFixedSize(hostViewAndBinderIndices.length); + ListWrapper.fill(nestedViewCounts, 0); + for (var viewIdx = hostViewAndBinderIndices.length - 1; viewIdx >= 1; viewIdx--) { + var hostViewAndElementIdx = hostViewAndBinderIndices[viewIdx]; + if (isPresent(hostViewAndElementIdx)) { + nestedViewCounts[hostViewAndElementIdx[0]] += nestedViewCounts[viewIdx] + 1; + } + } + return nestedViewCounts; + } + function indexArray(arr) { + var map = new Map(); + for (var i = 0; i < arr.length; i++) { + map.set(arr[i], i); + } + return map; + } + $__export("mergeProtoViewsRecursively", mergeProtoViewsRecursively); + return { + setters: [function($__m) { + DOM = $__m.DOM; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + isArray = $__m.isArray; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + SetWrapper = $__m.SetWrapper; + MapWrapper = $__m.MapWrapper; + }, function($__m) { + DomProtoView = $__m.DomProtoView; + DomProtoViewRef = $__m.DomProtoViewRef; + resolveInternalDomProtoView = $__m.resolveInternalDomProtoView; + }, function($__m) { + DomElementBinder = $__m.DomElementBinder; + }, function($__m) { + RenderProtoViewMergeMapping = $__m.RenderProtoViewMergeMapping; + ViewType = $__m.ViewType; + ViewEncapsulation = $__m.ViewEncapsulation; + }, function($__m) { + NG_BINDING_CLASS = $__m.NG_BINDING_CLASS; + NG_CONTENT_ELEMENT_NAME = $__m.NG_CONTENT_ELEMENT_NAME; + cloneAndQueryProtoView = $__m.cloneAndQueryProtoView; + queryBoundElements = $__m.queryBoundElements; + queryBoundTextNodeIndices = $__m.queryBoundTextNodeIndices; + NG_SHADOW_ROOT_ELEMENT_NAME = $__m.NG_SHADOW_ROOT_ELEMENT_NAME; + }], + execute: function() { + } + }; +}); + +System.register("angular2/src/render/dom/view/view", ["angular2/src/dom/dom_adapter", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/render/api", "angular2/src/render/dom/util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/view/view"; + var DOM, + Map, + isPresent, + stringify, + RenderViewRef, + camelCaseToDashCase, + DomViewRef, + DomView; + function resolveInternalDomView(viewRef) { + return viewRef._view; + } + $__export("resolveInternalDomView", resolveInternalDomView); + return { + setters: [function($__m) { + DOM = $__m.DOM; + }, function($__m) { + Map = $__m.Map; + }, function($__m) { + isPresent = $__m.isPresent; + stringify = $__m.stringify; + }, function($__m) { + RenderViewRef = $__m.RenderViewRef; + }, function($__m) { + camelCaseToDashCase = $__m.camelCaseToDashCase; + }], + execute: function() { + DomViewRef = (function($__super) { + function DomViewRef(_view) { + $traceurRuntime.superConstructor(DomViewRef).call(this); + this._view = _view; + } + return ($traceurRuntime.createClass)(DomViewRef, {}, {}, $__super); + }(RenderViewRef)); + $__export("DomViewRef", DomViewRef); + DomView = (function() { + function DomView(proto, boundTextNodes, boundElements) { + this.proto = proto; + this.boundTextNodes = boundTextNodes; + this.boundElements = boundElements; + this.hydrated = false; + this.eventDispatcher = null; + this.eventHandlerRemovers = []; + } + return ($traceurRuntime.createClass)(DomView, { + setElementProperty: function(elementIndex, propertyName, value) { + DOM.setProperty(this.boundElements[elementIndex], propertyName, value); + }, + setElementAttribute: function(elementIndex, attributeName, value) { + var element = this.boundElements[elementIndex]; + var dashCasedAttributeName = camelCaseToDashCase(attributeName); + if (isPresent(value)) { + DOM.setAttribute(element, dashCasedAttributeName, stringify(value)); + } else { + DOM.removeAttribute(element, dashCasedAttributeName); + } + }, + setElementClass: function(elementIndex, className, isAdd) { + var element = this.boundElements[elementIndex]; + if (isAdd) { + DOM.addClass(element, className); + } else { + DOM.removeClass(element, className); + } + }, + setElementStyle: function(elementIndex, styleName, value) { + var element = this.boundElements[elementIndex]; + var dashCasedStyleName = camelCaseToDashCase(styleName); + if (isPresent(value)) { + DOM.setStyle(element, dashCasedStyleName, stringify(value)); + } else { + DOM.removeStyle(element, dashCasedStyleName); + } + }, + invokeElementMethod: function(elementIndex, methodName, args) { + var element = this.boundElements[elementIndex]; + DOM.invoke(element, methodName, args); + }, + setText: function(textIndex, value) { + DOM.setText(this.boundTextNodes[textIndex], value); + }, + dispatchEvent: function(elementIndex, eventName, event) { + var allowDefaultBehavior = true; + if (isPresent(this.eventDispatcher)) { + var evalLocals = new Map(); + evalLocals.set('$event', event); + allowDefaultBehavior = this.eventDispatcher.dispatchRenderEvent(elementIndex, eventName, evalLocals); + if (!allowDefaultBehavior) { + event.preventDefault(); + } + } + return allowDefaultBehavior; + } + }, {}); + }()); + $__export("DomView", DomView); + } + }; +}); + +System.register("angular2/src/render/dom/view/fragment", ["angular2/src/render/api"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/view/fragment"; + var RenderFragmentRef, + DomFragmentRef; + function resolveInternalDomFragment(fragmentRef) { + return fragmentRef._nodes; + } + $__export("resolveInternalDomFragment", resolveInternalDomFragment); + return { + setters: [function($__m) { + RenderFragmentRef = $__m.RenderFragmentRef; + }], + execute: function() { + DomFragmentRef = (function($__super) { + function DomFragmentRef(_nodes) { + $traceurRuntime.superConstructor(DomFragmentRef).call(this); + this._nodes = _nodes; + } + return ($traceurRuntime.createClass)(DomFragmentRef, {}, {}, $__super); + }(RenderFragmentRef)); + $__export("DomFragmentRef", DomFragmentRef); + } + }; +}); + +System.register("angular2/src/core/application_tokens", ["angular2/di", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/application_tokens"; + var OpaqueToken, + CONST_EXPR, + appComponentRefPromiseToken, + appComponentTypeToken; + return { + setters: [function($__m) { + OpaqueToken = $__m.OpaqueToken; + }, function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }], + execute: function() { + appComponentRefPromiseToken = CONST_EXPR(new OpaqueToken('Promise')); + $__export("appComponentRefPromiseToken", appComponentRefPromiseToken); + appComponentTypeToken = CONST_EXPR(new OpaqueToken('RootComponent')); + $__export("appComponentTypeToken", appComponentTypeToken); + } + }; +}); + +System.register("angular2/src/core/annotations/annotations", ["angular2/src/core/annotations_impl/annotations"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/annotations/annotations"; + return { + setters: [function($__m) { + $__export("ComponentAnnotation", $__m.Component); + $__export("DirectiveAnnotation", $__m.Directive); + $__export("LifecycleEvent", $__m.LifecycleEvent); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/core/annotations/view", ["angular2/src/core/annotations_impl/view"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/annotations/view"; + return { + setters: [function($__m) { + $__export("ViewAnnotation", $__m.View); + $__export("ViewEncapsulation", $__m.ViewEncapsulation); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/core/annotations/di", ["angular2/src/core/annotations_impl/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/annotations/di"; + return { + setters: [function($__m) { + $__export("QueryAnnotation", $__m.Query); + $__export("ViewQueryAnnotation", $__m.ViewQuery); + $__export("AttributeAnnotation", $__m.Attribute); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/core/annotations/decorators", ["angular2/src/core/annotations/annotations", "angular2/src/core/annotations/view", "angular2/src/core/annotations/di", "angular2/src/util/decorators"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/annotations/decorators"; + var ComponentAnnotation, + DirectiveAnnotation, + ViewAnnotation, + AttributeAnnotation, + QueryAnnotation, + ViewQueryAnnotation, + makeDecorator, + makeParamDecorator, + Component, + Directive, + View, + Attribute, + Query, + ViewQuery; + return { + setters: [function($__m) { + ComponentAnnotation = $__m.ComponentAnnotation; + DirectiveAnnotation = $__m.DirectiveAnnotation; + }, function($__m) { + ViewAnnotation = $__m.ViewAnnotation; + }, function($__m) { + AttributeAnnotation = $__m.AttributeAnnotation; + QueryAnnotation = $__m.QueryAnnotation; + ViewQueryAnnotation = $__m.ViewQueryAnnotation; + }, function($__m) { + makeDecorator = $__m.makeDecorator; + makeParamDecorator = $__m.makeParamDecorator; + }], + execute: function() { + Component = makeDecorator(ComponentAnnotation, (function(fn) { + return fn.View = View; + })); + $__export("Component", Component); + Directive = makeDecorator(DirectiveAnnotation); + $__export("Directive", Directive); + View = makeDecorator(ViewAnnotation, (function(fn) { + return fn.View = View; + })); + $__export("View", View); + Attribute = makeParamDecorator(AttributeAnnotation); + $__export("Attribute", Attribute); + Query = makeParamDecorator(QueryAnnotation); + $__export("Query", Query); + ViewQuery = makeParamDecorator(ViewQueryAnnotation); + $__export("ViewQuery", ViewQuery); + } + }; +}); + +System.register("angular2/core", ["angular2/src/core/application_tokens", "angular2/src/core/application_common", "angular2/src/services/app_root_url", "angular2/src/services/url_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/compiler", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/query_list", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/zone/ng_zone", "angular2/src/facade/async"], function($__export) { + "use strict"; + var __moduleName = "angular2/core"; + return { + setters: [function($__m) { + $__export("appComponentTypeToken", $__m.appComponentTypeToken); + }, function($__m) { + $__export("ApplicationRef", $__m.ApplicationRef); + }, function($__m) { + $__export("AppRootUrl", $__m.AppRootUrl); + }, function($__m) { + $__export("UrlResolver", $__m.UrlResolver); + }, function($__m) { + $__export("ComponentUrlMapper", $__m.ComponentUrlMapper); + }, function($__m) { + $__export("DirectiveResolver", $__m.DirectiveResolver); + }, function($__m) { + $__export("Compiler", $__m.Compiler); + }, function($__m) { + $__export("AppViewManager", $__m.AppViewManager); + }, function($__m) { + $__export("QueryList", $__m.QueryList); + }, function($__m) { + $__export("DynamicComponentLoader", $__m.DynamicComponentLoader); + $__export("ComponentRef", $__m.ComponentRef); + }, function($__m) { + $__export("ElementRef", $__m.ElementRef); + }, function($__m) { + $__export("TemplateRef", $__m.TemplateRef); + }, function($__m) { + $__export("ViewRef", $__m.ViewRef); + $__export("ProtoViewRef", $__m.ProtoViewRef); + }, function($__m) { + $__export("ViewContainerRef", $__m.ViewContainerRef); + }, function($__m) { + $__export("NgZone", $__m.NgZone); + }, function($__m) { + $__export("Observable", $__m.Observable); + $__export("EventEmitter", $__m.EventEmitter); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/directives/ng_for", ["angular2/annotations", "angular2/core", "angular2/change_detection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/directives/ng_for"; + var __decorate, + __metadata, + Directive, + LifecycleEvent, + ViewContainerRef, + TemplateRef, + ChangeDetectorRef, + Pipes, + isPresent, + isBlank, + NgFor, + RecordViewTuple; + return { + setters: [function($__m) { + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + ViewContainerRef = $__m.ViewContainerRef; + TemplateRef = $__m.TemplateRef; + }, function($__m) { + ChangeDetectorRef = $__m.ChangeDetectorRef; + Pipes = $__m.Pipes; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + NgFor = (($traceurRuntime.createClass)(function(viewContainer, templateRef, pipes, cdr) { + this.viewContainer = viewContainer; + this.templateRef = templateRef; + this.pipes = pipes; + this.cdr = cdr; + }, { + set ngForOf(value) { + this._ngForOf = value; + this._pipe = this.pipes.get("iterableDiff", value, this.cdr, this._pipe); + }, + onCheck: function() { + var diff = this._pipe.transform(this._ngForOf, null); + if (isPresent(diff)) + this._applyChanges(diff.wrapped); + }, + _applyChanges: function(changes) { + if (isBlank(changes)) { + this.viewContainer.clear(); + return ; + } + var recordViewTuples = []; + changes.forEachRemovedItem((function(removedRecord) { + return recordViewTuples.push(new RecordViewTuple(removedRecord, null)); + })); + changes.forEachMovedItem((function(movedRecord) { + return recordViewTuples.push(new RecordViewTuple(movedRecord, null)); + })); + var insertTuples = NgFor.bulkRemove(recordViewTuples, this.viewContainer); + changes.forEachAddedItem((function(addedRecord) { + return insertTuples.push(new RecordViewTuple(addedRecord, null)); + })); + NgFor.bulkInsert(insertTuples, this.viewContainer, this.templateRef); + for (var i = 0; i < insertTuples.length; i++) { + this._perViewChange(insertTuples[i].view, insertTuples[i].record); + } + }, + _perViewChange: function(view, record) { + view.setLocal('\$implicit', record.item); + view.setLocal('index', record.currentIndex); + } + }, { + bulkRemove: function(tuples, viewContainer) { + tuples.sort((function(a, b) { + return a.record.previousIndex - b.record.previousIndex; + })); + var movedTuples = []; + for (var i = tuples.length - 1; i >= 0; i--) { + var tuple = tuples[i]; + if (isPresent(tuple.record.currentIndex)) { + tuple.view = viewContainer.detach(tuple.record.previousIndex); + movedTuples.push(tuple); + } else { + viewContainer.remove(tuple.record.previousIndex); + } + } + return movedTuples; + }, + bulkInsert: function(tuples, viewContainer, templateRef) { + tuples.sort((function(a, b) { + return a.record.currentIndex - b.record.currentIndex; + })); + for (var i = 0; i < tuples.length; i++) { + var tuple = tuples[i]; + if (isPresent(tuple.view)) { + viewContainer.insert(tuple.view, tuple.record.currentIndex); + } else { + tuple.view = viewContainer.createEmbeddedView(templateRef, tuple.record.currentIndex); + } + } + return tuples; + } + })); + $__export("NgFor", NgFor); + $__export("NgFor", NgFor = __decorate([Directive({ + selector: '[ng-for][ng-for-of]', + properties: ['ngForOf'], + lifecycle: [LifecycleEvent.onCheck] + }), __metadata('design:paramtypes', [ViewContainerRef, TemplateRef, Pipes, ChangeDetectorRef])], NgFor)); + RecordViewTuple = (function() { + function RecordViewTuple(record, view) { + this.record = record; + this.view = view; + } + return ($traceurRuntime.createClass)(RecordViewTuple, {}, {}); + }()); + $__export("RecordViewTuple", RecordViewTuple); + } + }; +}); + +System.register("angular2/src/directives/ng_if", ["angular2/annotations", "angular2/core", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/directives/ng_if"; + var __decorate, + __metadata, + Directive, + ViewContainerRef, + TemplateRef, + isBlank, + NgIf; + return { + setters: [function($__m) { + Directive = $__m.Directive; + }, function($__m) { + ViewContainerRef = $__m.ViewContainerRef; + TemplateRef = $__m.TemplateRef; + }, function($__m) { + isBlank = $__m.isBlank; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + NgIf = (($traceurRuntime.createClass)(function(viewContainer, templateRef) { + this.viewContainer = viewContainer; + this.prevCondition = null; + this.templateRef = templateRef; + }, {set ngIf(newCondition) { + if (newCondition && (isBlank(this.prevCondition) || !this.prevCondition)) { + this.prevCondition = true; + this.viewContainer.createEmbeddedView(this.templateRef); + } else if (!newCondition && (isBlank(this.prevCondition) || this.prevCondition)) { + this.prevCondition = false; + this.viewContainer.clear(); + } + }}, {})); + $__export("NgIf", NgIf); + $__export("NgIf", NgIf = __decorate([Directive({ + selector: '[ng-if]', + properties: ['ngIf'] + }), __metadata('design:paramtypes', [ViewContainerRef, TemplateRef])], NgIf)); + } + }; +}); + +System.register("angular2/src/directives/ng_non_bindable", ["angular2/annotations"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/directives/ng_non_bindable"; + var __decorate, + __metadata, + Directive, + NgNonBindable; + return { + setters: [function($__m) { + Directive = $__m.Directive; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + NgNonBindable = (($traceurRuntime.createClass)(function() {}, {}, {})); + $__export("NgNonBindable", NgNonBindable); + $__export("NgNonBindable", NgNonBindable = __decorate([Directive({ + selector: '[ng-non-bindable]', + compileChildren: false + }), __metadata('design:paramtypes', [])], NgNonBindable)); + } + }; +}); + +System.register("angular2/src/directives/ng_switch", ["angular2/annotations", "angular2/di", "angular2/core", "angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/directives/ng_switch"; + var __decorate, + __metadata, + __param, + Directive, + Ancestor, + ViewContainerRef, + TemplateRef, + isPresent, + isBlank, + normalizeBlank, + ListWrapper, + MapWrapper, + Map, + SwitchView, + NgSwitch, + NgSwitchWhen, + NgSwitchDefault, + _whenDefault; + return { + setters: [function($__m) { + Directive = $__m.Directive; + }, function($__m) { + Ancestor = $__m.Ancestor; + }, function($__m) { + ViewContainerRef = $__m.ViewContainerRef; + TemplateRef = $__m.TemplateRef; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + normalizeBlank = $__m.normalizeBlank; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + MapWrapper = $__m.MapWrapper; + Map = $__m.Map; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + SwitchView = (function() { + function SwitchView(viewContainerRef, templateRef) { + this._templateRef = templateRef; + this._viewContainerRef = viewContainerRef; + } + return ($traceurRuntime.createClass)(SwitchView, { + create: function() { + this._viewContainerRef.createEmbeddedView(this._templateRef); + }, + destroy: function() { + this._viewContainerRef.clear(); + } + }, {}); + }()); + $__export("SwitchView", SwitchView); + NgSwitch = (($traceurRuntime.createClass)(function() { + this._valueViews = new Map(); + this._activeViews = []; + this._useDefault = false; + }, { + set ngSwitch(value) { + this._emptyAllActiveViews(); + this._useDefault = false; + var views = this._valueViews.get(value); + if (isBlank(views)) { + this._useDefault = true; + views = normalizeBlank(this._valueViews.get(_whenDefault)); + } + this._activateViews(views); + this._switchValue = value; + }, + _onWhenValueChanged: function(oldWhen, newWhen, view) { + this._deregisterView(oldWhen, view); + this._registerView(newWhen, view); + if (oldWhen === this._switchValue) { + view.destroy(); + ListWrapper.remove(this._activeViews, view); + } else if (newWhen === this._switchValue) { + if (this._useDefault) { + this._useDefault = false; + this._emptyAllActiveViews(); + } + view.create(); + this._activeViews.push(view); + } + if (this._activeViews.length === 0 && !this._useDefault) { + this._useDefault = true; + this._activateViews(this._valueViews.get(_whenDefault)); + } + }, + _emptyAllActiveViews: function() { + var activeContainers = this._activeViews; + for (var i = 0; i < activeContainers.length; i++) { + activeContainers[i].destroy(); + } + this._activeViews = []; + }, + _activateViews: function(views) { + if (isPresent(views)) { + for (var i = 0; i < views.length; i++) { + views[i].create(); + } + this._activeViews = views; + } + }, + _registerView: function(value, view) { + var views = this._valueViews.get(value); + if (isBlank(views)) { + views = []; + this._valueViews.set(value, views); + } + views.push(view); + }, + _deregisterView: function(value, view) { + if (value == _whenDefault) + return ; + var views = this._valueViews.get(value); + if (views.length == 1) { + MapWrapper.delete(this._valueViews, value); + } else { + ListWrapper.remove(views, view); + } + } + }, {})); + $__export("NgSwitch", NgSwitch); + $__export("NgSwitch", NgSwitch = __decorate([Directive({ + selector: '[ng-switch]', + properties: ['ngSwitch'] + }), __metadata('design:paramtypes', [])], NgSwitch)); + NgSwitchWhen = (($traceurRuntime.createClass)(function(viewContainer, templateRef, sswitch) { + this._value = _whenDefault; + this._switch = sswitch; + this._view = new SwitchView(viewContainer, templateRef); + }, { + onDestroy: function() { + this._switch; + }, + set ngSwitchWhen(value) { + this._switch._onWhenValueChanged(this._value, value, this._view); + this._value = value; + } + }, {})); + $__export("NgSwitchWhen", NgSwitchWhen); + $__export("NgSwitchWhen", NgSwitchWhen = __decorate([Directive({ + selector: '[ng-switch-when]', + properties: ['ngSwitchWhen'] + }), __param(2, Ancestor()), __metadata('design:paramtypes', [ViewContainerRef, TemplateRef, NgSwitch])], NgSwitchWhen)); + NgSwitchDefault = (($traceurRuntime.createClass)(function(viewContainer, templateRef, sswitch) { + sswitch._registerView(_whenDefault, new SwitchView(viewContainer, templateRef)); + }, {}, {})); + $__export("NgSwitchDefault", NgSwitchDefault); + $__export("NgSwitchDefault", NgSwitchDefault = __decorate([Directive({selector: '[ng-switch-default]'}), __param(2, Ancestor()), __metadata('design:paramtypes', [ViewContainerRef, TemplateRef, NgSwitch])], NgSwitchDefault)); + _whenDefault = new Object(); + } + }; +}); + +System.register("angular2/src/directives/class", ["angular2/annotations", "angular2/core", "angular2/src/change_detection/pipes/pipes", "angular2/src/render/api", "angular2/src/change_detection/pipes/iterable_changes", "angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/directives/class"; + var __decorate, + __metadata, + Directive, + LifecycleEvent, + ElementRef, + Pipes, + Renderer, + IterableChanges, + isPresent, + isString, + ListWrapper, + StringMapWrapper, + isListLikeIterable, + CSSClass; + return { + setters: [function($__m) { + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + ElementRef = $__m.ElementRef; + }, function($__m) { + Pipes = $__m.Pipes; + }, function($__m) { + Renderer = $__m.Renderer; + }, function($__m) { + IterableChanges = $__m.IterableChanges; + }, function($__m) { + isPresent = $__m.isPresent; + isString = $__m.isString; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + StringMapWrapper = $__m.StringMapWrapper; + isListLikeIterable = $__m.isListLikeIterable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + CSSClass = (($traceurRuntime.createClass)(function(_pipes, _ngEl, _renderer) { + this._pipes = _pipes; + this._ngEl = _ngEl; + this._renderer = _renderer; + }, { + set rawClass(v) { + this._cleanupClasses(this._rawClass); + if (isString(v)) { + v = v.split(' '); + } + this._rawClass = v; + this._pipe = this._pipes.get(isListLikeIterable(v) ? 'iterableDiff' : 'keyValDiff', v); + }, + onCheck: function() { + var diff = this._pipe.transform(this._rawClass, null); + if (isPresent(diff) && isPresent(diff.wrapped)) { + if (diff.wrapped instanceof IterableChanges) { + this._applyArrayChanges(diff.wrapped); + } else { + this._applyObjectChanges(diff.wrapped); + } + } + }, + onDestroy: function() { + this._cleanupClasses(this._rawClass); + }, + _cleanupClasses: function(rawClassVal) { + var $__0 = this; + if (isPresent(rawClassVal)) { + if (isListLikeIterable(rawClassVal)) { + ListWrapper.forEach(rawClassVal, (function(className) { + $__0._toggleClass(className, false); + })); + } else { + StringMapWrapper.forEach(rawClassVal, (function(expVal, className) { + if (expVal) + $__0._toggleClass(className, false); + })); + } + } + }, + _applyObjectChanges: function(diff) { + var $__0 = this; + diff.forEachAddedItem((function(record) { + $__0._toggleClass(record.key, record.currentValue); + })); + diff.forEachChangedItem((function(record) { + $__0._toggleClass(record.key, record.currentValue); + })); + diff.forEachRemovedItem((function(record) { + if (record.previousValue) { + $__0._toggleClass(record.key, false); + } + })); + }, + _applyArrayChanges: function(diff) { + var $__0 = this; + diff.forEachAddedItem((function(record) { + $__0._toggleClass(record.item, true); + })); + diff.forEachRemovedItem((function(record) { + $__0._toggleClass(record.item, false); + })); + }, + _toggleClass: function(className, enabled) { + this._renderer.setElementClass(this._ngEl, className, enabled); + } + }, {})); + $__export("CSSClass", CSSClass); + $__export("CSSClass", CSSClass = __decorate([Directive({ + selector: '[class]', + lifecycle: [LifecycleEvent.onCheck, LifecycleEvent.onDestroy], + properties: ['rawClass: class'] + }), __metadata('design:paramtypes', [Pipes, ElementRef, Renderer])], CSSClass)); + } + }; +}); + +System.register("angular2/src/directives/ng_style", ["angular2/annotations", "angular2/core", "angular2/src/change_detection/pipes/pipes", "angular2/src/facade/lang", "angular2/src/render/api"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/directives/ng_style"; + var __decorate, + __metadata, + Directive, + LifecycleEvent, + ElementRef, + Pipes, + isPresent, + Renderer, + NgStyle; + return { + setters: [function($__m) { + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + ElementRef = $__m.ElementRef; + }, function($__m) { + Pipes = $__m.Pipes; + }, function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + Renderer = $__m.Renderer; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + NgStyle = (($traceurRuntime.createClass)(function(_pipes, _ngEl, _renderer) { + this._pipes = _pipes; + this._ngEl = _ngEl; + this._renderer = _renderer; + }, { + set rawStyle(v) { + this._rawStyle = v; + this._pipe = this._pipes.get('keyValDiff', this._rawStyle); + }, + onCheck: function() { + var diff = this._pipe.transform(this._rawStyle, null); + if (isPresent(diff) && isPresent(diff.wrapped)) { + this._applyChanges(diff.wrapped); + } + }, + _applyChanges: function(diff) { + var $__0 = this; + diff.forEachAddedItem((function(record) { + $__0._setStyle(record.key, record.currentValue); + })); + diff.forEachChangedItem((function(record) { + $__0._setStyle(record.key, record.currentValue); + })); + diff.forEachRemovedItem((function(record) { + $__0._setStyle(record.key, null); + })); + }, + _setStyle: function(name, val) { + this._renderer.setElementStyle(this._ngEl, name, val); + } + }, {})); + $__export("NgStyle", NgStyle); + $__export("NgStyle", NgStyle = __decorate([Directive({ + selector: '[ng-style]', + lifecycle: [LifecycleEvent.onCheck], + properties: ['rawStyle: ng-style'] + }), __metadata('design:paramtypes', [Pipes, ElementRef, Renderer])], NgStyle)); + } + }; +}); + +System.register("angular2/src/http/interfaces", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/interfaces"; + var BaseException, + ConnectionBackend, + Connection; + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + }], + execute: function() { + ConnectionBackend = (function() { + function ConnectionBackend() {} + return ($traceurRuntime.createClass)(ConnectionBackend, {createConnection: function(request) { + throw new BaseException('Abstract!'); + }}, {}); + }()); + $__export("ConnectionBackend", ConnectionBackend); + Connection = (function() { + function Connection() {} + return ($traceurRuntime.createClass)(Connection, {dispose: function() { + throw new BaseException('Abstract!'); + }}, {}); + }()); + $__export("Connection", Connection); + } + }; +}); + +System.register("angular2/src/http/headers", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/headers"; + var isBlank, + BaseException, + isListLikeIterable, + Map, + MapWrapper, + ListWrapper, + StringMap, + Headers; + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + isListLikeIterable = $__m.isListLikeIterable; + Map = $__m.Map; + MapWrapper = $__m.MapWrapper; + ListWrapper = $__m.ListWrapper; + StringMap = $__m.StringMap; + }], + execute: function() { + Headers = (function() { + function Headers(headers) { + var $__0 = this; + if (isBlank(headers)) { + this._headersMap = new Map(); + return ; + } + if (headers instanceof Headers) { + this._headersMap = headers._headersMap; + } else if (headers instanceof StringMap) { + this._headersMap = MapWrapper.createFromStringMap(headers); + MapWrapper.forEach(this._headersMap, (function(v, k) { + if (!isListLikeIterable(v)) { + var list = []; + list.push(v); + $__0._headersMap.set(k, list); + } + })); + } + } + return ($traceurRuntime.createClass)(Headers, { + append: function(name, value) { + var mapName = this._headersMap.get(name); + var list = isListLikeIterable(mapName) ? mapName : []; + list.push(value); + this._headersMap.set(name, list); + }, + delete: function(name) { + MapWrapper.delete(this._headersMap, name); + }, + forEach: function(fn) { + MapWrapper.forEach(this._headersMap, fn); + }, + get: function(header) { + return ListWrapper.first(this._headersMap.get(header)); + }, + has: function(header) { + return this._headersMap.has(header); + }, + keys: function() { + return MapWrapper.keys(this._headersMap); + }, + set: function(header, value) { + var list = []; + if (isListLikeIterable(value)) { + var pushValue = value.join(','); + list.push(pushValue); + } else { + list.push(value); + } + this._headersMap.set(header, list); + }, + values: function() { + return MapWrapper.values(this._headersMap); + }, + getAll: function(header) { + var headers = this._headersMap.get(header); + return isListLikeIterable(headers) ? headers : []; + }, + entries: function() { + throw new BaseException('"entries" method is not implemented on Headers class'); + } + }, {}); + }()); + $__export("Headers", Headers); + } + }; +}); + +System.register("angular2/src/http/enums", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/enums"; + var RequestModesOpts, + RequestCacheOpts, + RequestCredentialsOpts, + RequestMethods, + RequestMethodsMap, + ReadyStates, + ResponseTypes; + return { + setters: [], + execute: function() { + $__export("RequestModesOpts", RequestModesOpts); + (function(RequestModesOpts) { + RequestModesOpts[RequestModesOpts["Cors"] = 0] = "Cors"; + RequestModesOpts[RequestModesOpts["NoCors"] = 1] = "NoCors"; + RequestModesOpts[RequestModesOpts["SameOrigin"] = 2] = "SameOrigin"; + })(RequestModesOpts || ($__export("RequestModesOpts", RequestModesOpts = {}))); + $__export("RequestCacheOpts", RequestCacheOpts); + (function(RequestCacheOpts) { + RequestCacheOpts[RequestCacheOpts["Default"] = 0] = "Default"; + RequestCacheOpts[RequestCacheOpts["NoStore"] = 1] = "NoStore"; + RequestCacheOpts[RequestCacheOpts["Reload"] = 2] = "Reload"; + RequestCacheOpts[RequestCacheOpts["NoCache"] = 3] = "NoCache"; + RequestCacheOpts[RequestCacheOpts["ForceCache"] = 4] = "ForceCache"; + RequestCacheOpts[RequestCacheOpts["OnlyIfCached"] = 5] = "OnlyIfCached"; + })(RequestCacheOpts || ($__export("RequestCacheOpts", RequestCacheOpts = {}))); + $__export("RequestCredentialsOpts", RequestCredentialsOpts); + (function(RequestCredentialsOpts) { + RequestCredentialsOpts[RequestCredentialsOpts["Omit"] = 0] = "Omit"; + RequestCredentialsOpts[RequestCredentialsOpts["SameOrigin"] = 1] = "SameOrigin"; + RequestCredentialsOpts[RequestCredentialsOpts["Include"] = 2] = "Include"; + })(RequestCredentialsOpts || ($__export("RequestCredentialsOpts", RequestCredentialsOpts = {}))); + $__export("RequestMethods", RequestMethods); + (function(RequestMethods) { + RequestMethods[RequestMethods["GET"] = 0] = "GET"; + RequestMethods[RequestMethods["POST"] = 1] = "POST"; + RequestMethods[RequestMethods["PUT"] = 2] = "PUT"; + RequestMethods[RequestMethods["DELETE"] = 3] = "DELETE"; + RequestMethods[RequestMethods["OPTIONS"] = 4] = "OPTIONS"; + RequestMethods[RequestMethods["HEAD"] = 5] = "HEAD"; + RequestMethods[RequestMethods["PATCH"] = 6] = "PATCH"; + })(RequestMethods || ($__export("RequestMethods", RequestMethods = {}))); + RequestMethodsMap = (function() { + function RequestMethodsMap() { + this._methods = ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'HEAD', 'PATCH']; + } + return ($traceurRuntime.createClass)(RequestMethodsMap, {getMethod: function(method) { + return this._methods[method]; + }}, {}); + }()); + $__export("RequestMethodsMap", RequestMethodsMap); + $__export("ReadyStates", ReadyStates); + (function(ReadyStates) { + ReadyStates[ReadyStates["UNSENT"] = 0] = "UNSENT"; + ReadyStates[ReadyStates["OPEN"] = 1] = "OPEN"; + ReadyStates[ReadyStates["HEADERS_RECEIVED"] = 2] = "HEADERS_RECEIVED"; + ReadyStates[ReadyStates["LOADING"] = 3] = "LOADING"; + ReadyStates[ReadyStates["DONE"] = 4] = "DONE"; + ReadyStates[ReadyStates["CANCELLED"] = 5] = "CANCELLED"; + })(ReadyStates || ($__export("ReadyStates", ReadyStates = {}))); + $__export("ResponseTypes", ResponseTypes); + (function(ResponseTypes) { + ResponseTypes[ResponseTypes["Basic"] = 0] = "Basic"; + ResponseTypes[ResponseTypes["Cors"] = 1] = "Cors"; + ResponseTypes[ResponseTypes["Default"] = 2] = "Default"; + ResponseTypes[ResponseTypes["Error"] = 3] = "Error"; + ResponseTypes[ResponseTypes["Opaque"] = 4] = "Opaque"; + })(ResponseTypes || ($__export("ResponseTypes", ResponseTypes = {}))); + } + }; +}); + +System.register("angular2/src/http/http_utils", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/http_utils"; + return { + setters: [function($__m) { + $__export("isJsObject", $__m.isJsObject); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/http/base_response_options", ["angular2/di", "angular2/src/facade/lang", "angular2/src/http/headers", "angular2/src/http/enums"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/base_response_options"; + var __decorate, + __metadata, + Injectable, + isPresent, + Headers, + ResponseTypes, + ResponseOptions, + BaseResponseOptions; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + Headers = $__m.Headers; + }, function($__m) { + ResponseTypes = $__m.ResponseTypes; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + ResponseOptions = (function() { + function ResponseOptions() { + var $__2 = arguments[0] !== (void 0) ? arguments[0] : {}, + body = $__2.body, + status = $__2.status, + headers = $__2.headers, + statusText = $__2.statusText, + type = $__2.type, + url = $__2.url; + this.body = isPresent(body) ? body : null; + this.status = isPresent(status) ? status : null; + this.headers = isPresent(headers) ? headers : null; + this.statusText = isPresent(statusText) ? statusText : null; + this.type = isPresent(type) ? type : null; + this.url = isPresent(url) ? url : null; + } + return ($traceurRuntime.createClass)(ResponseOptions, {merge: function(options) { + return new ResponseOptions({ + body: isPresent(options) && isPresent(options.body) ? options.body : this.body, + status: isPresent(options) && isPresent(options.status) ? options.status : this.status, + headers: isPresent(options) && isPresent(options.headers) ? options.headers : this.headers, + statusText: isPresent(options) && isPresent(options.statusText) ? options.statusText : this.statusText, + type: isPresent(options) && isPresent(options.type) ? options.type : this.type, + url: isPresent(options) && isPresent(options.url) ? options.url : this.url + }); + }}, {}); + }()); + $__export("ResponseOptions", ResponseOptions); + BaseResponseOptions = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).call(this, { + status: 200, + statusText: 'Ok', + type: ResponseTypes.Default, + headers: new Headers() + }); + } + return ($traceurRuntime.createClass)($__0, {}, {}, $__super); + }(ResponseOptions)); + $__export("BaseResponseOptions", BaseResponseOptions); + $__export("BaseResponseOptions", BaseResponseOptions = __decorate([Injectable(), __metadata('design:paramtypes', [])], BaseResponseOptions)); + } + }; +}); + +System.register("angular2/src/http/backends/browser_xhr", ["angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/backends/browser_xhr"; + var __decorate, + __metadata, + Injectable, + BrowserXhr; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + BrowserXhr = (($traceurRuntime.createClass)(function() {}, {build: function() { + return (new XMLHttpRequest()); + }}, {})); + $__export("BrowserXhr", BrowserXhr); + $__export("BrowserXhr", BrowserXhr = __decorate([Injectable(), __metadata('design:paramtypes', [])], BrowserXhr)); + } + }; +}); + +System.register("angular2/src/http/backends/browser_jsonp", ["angular2/di", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/backends/browser_jsonp"; + var __decorate, + __metadata, + Injectable, + global, + _nextRequestId, + JSONP_HOME, + _jsonpConnections, + BrowserJsonp; + function _getJsonpConnections() { + if (_jsonpConnections === null) { + _jsonpConnections = global[JSONP_HOME] = {}; + } + return _jsonpConnections; + } + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + global = $__m.global; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + _nextRequestId = 0; + JSONP_HOME = '__ng_jsonp__'; + $__export("JSONP_HOME", JSONP_HOME); + _jsonpConnections = null; + BrowserJsonp = (($traceurRuntime.createClass)(function() {}, { + build: function(url) { + var node = document.createElement('script'); + node.src = url; + return node; + }, + nextRequestID: function() { + return ("__req" + _nextRequestId++); + }, + requestCallback: function(id) { + return (JSONP_HOME + "." + id + ".finished"); + }, + exposeConnection: function(id, connection) { + var connections = _getJsonpConnections(); + connections[id] = connection; + }, + removeConnection: function(id) { + var connections = _getJsonpConnections(); + connections[id] = null; + }, + send: function(node) { + document.body.appendChild((node)); + }, + cleanup: function(node) { + if (node.parentNode) { + node.parentNode.removeChild((node)); + } + } + }, {})); + $__export("BrowserJsonp", BrowserJsonp); + $__export("BrowserJsonp", BrowserJsonp = __decorate([Injectable(), __metadata('design:paramtypes', [])], BrowserJsonp)); + } + }; +}); + +System.register("angular2/src/http/backends/mock_backend", ["angular2/di", "angular2/src/http/static_request", "angular2/src/http/enums", "angular2/src/http/interfaces", "angular2/src/facade/async", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/backends/mock_backend"; + var __decorate, + __metadata, + Injectable, + Request, + ReadyStates, + Connection, + ConnectionBackend, + ObservableWrapper, + EventEmitter, + isPresent, + IMPLEMENTS, + BaseException, + MockConnection, + MockBackend; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + Request = $__m.Request; + }, function($__m) { + ReadyStates = $__m.ReadyStates; + }, function($__m) { + Connection = $__m.Connection; + ConnectionBackend = $__m.ConnectionBackend; + }, function($__m) { + ObservableWrapper = $__m.ObservableWrapper; + EventEmitter = $__m.EventEmitter; + }, function($__m) { + isPresent = $__m.isPresent; + IMPLEMENTS = $__m.IMPLEMENTS; + BaseException = $__m.BaseException; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + MockConnection = (($traceurRuntime.createClass)(function(req) { + this.response = new EventEmitter(); + this.readyState = ReadyStates.OPEN; + this.request = req; + }, { + dispose: function() { + if (this.readyState !== ReadyStates.DONE) { + this.readyState = ReadyStates.CANCELLED; + } + }, + mockRespond: function(res) { + if (this.readyState === ReadyStates.DONE || this.readyState === ReadyStates.CANCELLED) { + throw new BaseException('Connection has already been resolved'); + } + this.readyState = ReadyStates.DONE; + ObservableWrapper.callNext(this.response, res); + ObservableWrapper.callReturn(this.response); + }, + mockDownload: function(res) {}, + mockError: function(err) { + this.readyState = ReadyStates.DONE; + ObservableWrapper.callThrow(this.response, err); + ObservableWrapper.callReturn(this.response); + } + }, {})); + $__export("MockConnection", MockConnection); + $__export("MockConnection", MockConnection = __decorate([IMPLEMENTS(Connection), __metadata('design:paramtypes', [Request])], MockConnection)); + MockBackend = (($traceurRuntime.createClass)(function() { + var $__0 = this; + this.connectionsArray = []; + this.connections = new EventEmitter(); + ObservableWrapper.subscribe(this.connections, (function(connection) { + return $__0.connectionsArray.push(connection); + })); + this.pendingConnections = new EventEmitter(); + }, { + verifyNoPendingRequests: function() { + var pending = 0; + ObservableWrapper.subscribe(this.pendingConnections, (function(c) { + return pending++; + })); + if (pending > 0) + throw new BaseException((pending + " pending connections to be resolved")); + }, + resolveAllConnections: function() { + ObservableWrapper.subscribe(this.connections, (function(c) { + return c.readyState = 4; + })); + }, + createConnection: function(req) { + if (!isPresent(req) || !(req instanceof Request)) { + throw new BaseException(("createConnection requires an instance of Request, got " + req)); + } + var connection = new MockConnection(req); + ObservableWrapper.callNext(this.connections, connection); + return connection; + } + }, {})); + $__export("MockBackend", MockBackend); + $__export("MockBackend", MockBackend = __decorate([Injectable(), IMPLEMENTS(ConnectionBackend), __metadata('design:paramtypes', [])], MockBackend)); + } + }; +}); + +System.register("angular2/src/http/url_search_params", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/url_search_params"; + var isPresent, + StringWrapper, + Map, + MapWrapper, + ListWrapper, + isListLikeIterable, + URLSearchParams; + function paramParser(rawParams) { + var map = new Map(); + var params = StringWrapper.split(rawParams, new RegExp('&')); + ListWrapper.forEach(params, (function(param) { + var split = StringWrapper.split(param, new RegExp('=')); + var key = ListWrapper.get(split, 0); + var val = ListWrapper.get(split, 1); + var list = isPresent(map.get(key)) ? map.get(key) : []; + list.push(val); + map.set(key, list); + })); + return map; + } + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + Map = $__m.Map; + MapWrapper = $__m.MapWrapper; + ListWrapper = $__m.ListWrapper; + isListLikeIterable = $__m.isListLikeIterable; + }], + execute: function() { + URLSearchParams = (function() { + function URLSearchParams(rawParams) { + this.rawParams = rawParams; + this.paramsMap = paramParser(rawParams); + } + return ($traceurRuntime.createClass)(URLSearchParams, { + has: function(param) { + return this.paramsMap.has(param); + }, + get: function(param) { + var storedParam = this.paramsMap.get(param); + if (isListLikeIterable(storedParam)) { + return ListWrapper.first(storedParam); + } else { + return null; + } + }, + getAll: function(param) { + var mapParam = this.paramsMap.get(param); + return isPresent(mapParam) ? mapParam : []; + }, + append: function(param, val) { + var mapParam = this.paramsMap.get(param); + var list = isPresent(mapParam) ? mapParam : []; + list.push(val); + this.paramsMap.set(param, list); + }, + toString: function() { + var paramsList = []; + MapWrapper.forEach(this.paramsMap, (function(values, k) { + ListWrapper.forEach(values, (function(v) { + paramsList.push(k + '=' + v); + })); + })); + return ListWrapper.join(paramsList, '&'); + }, + delete: function(param) { + MapWrapper.delete(this.paramsMap, param); + } + }, {}); + }()); + $__export("URLSearchParams", URLSearchParams); + } + }; +}); + +System.register("angular2/src/forms/validators", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/validators"; + var isBlank, + isPresent, + ListWrapper, + StringMapWrapper, + Validators; + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }], + execute: function() { + Validators = (function() { + function Validators() {} + return ($traceurRuntime.createClass)(Validators, {}, { + required: function(c) { + return isBlank(c.value) || c.value == "" ? {"required": true} : null; + }, + nullValidator: function(c) { + return null; + }, + compose: function(validators) { + return function(c) { + var res = ListWrapper.reduce(validators, (function(res, validator) { + var errors = validator(c); + return isPresent(errors) ? StringMapWrapper.merge(res, errors) : res; + }), {}); + return StringMapWrapper.isEmpty(res) ? null : res; + }; + }, + group: function(c) { + var res = {}; + StringMapWrapper.forEach(c.controls, (function(control, name) { + if (c.contains(name) && isPresent(control.errors)) { + Validators._mergeErrors(control, res); + } + })); + return StringMapWrapper.isEmpty(res) ? null : res; + }, + array: function(c) { + var res = {}; + ListWrapper.forEach(c.controls, (function(control) { + if (isPresent(control.errors)) { + Validators._mergeErrors(control, res); + } + })); + return StringMapWrapper.isEmpty(res) ? null : res; + }, + _mergeErrors: function(control, res) { + StringMapWrapper.forEach(control.errors, (function(value, error) { + if (!StringMapWrapper.contains(res, error)) { + res[error] = []; + } + var current = res[error]; + current.push(control); + })); + } + }); + }()); + $__export("Validators", Validators); + } + }; +}); + +System.register("angular2/src/forms/directives/abstract_control_directive", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/abstract_control_directive"; + var AbstractControlDirective; + return { + setters: [], + execute: function() { + AbstractControlDirective = (function() { + function AbstractControlDirective() {} + return ($traceurRuntime.createClass)(AbstractControlDirective, { + get control() { + return null; + }, + get value() { + return this.control.value; + }, + get valid() { + return this.control.valid; + }, + get errors() { + return this.control.errors; + }, + get pristine() { + return this.control.pristine; + }, + get dirty() { + return this.control.dirty; + }, + get touched() { + return this.control.touched; + }, + get untouched() { + return this.control.untouched; + } + }, {}); + }()); + $__export("AbstractControlDirective", AbstractControlDirective); + } + }; +}); + +System.register("angular2/src/forms/directives/control_container", ["angular2/src/forms/directives/abstract_control_directive"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/control_container"; + var AbstractControlDirective, + ControlContainer; + return { + setters: [function($__m) { + AbstractControlDirective = $__m.AbstractControlDirective; + }], + execute: function() { + ControlContainer = (function($__super) { + function ControlContainer() { + $traceurRuntime.superConstructor(ControlContainer).apply(this, arguments); + } + return ($traceurRuntime.createClass)(ControlContainer, { + get formDirective() { + return null; + }, + get path() { + return null; + } + }, {}, $__super); + }(AbstractControlDirective)); + $__export("ControlContainer", ControlContainer); + } + }; +}); + +System.register("angular2/src/forms/directives/ng_control", ["angular2/src/forms/directives/abstract_control_directive"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/ng_control"; + var AbstractControlDirective, + NgControl; + return { + setters: [function($__m) { + AbstractControlDirective = $__m.AbstractControlDirective; + }], + execute: function() { + NgControl = (function($__super) { + function NgControl() { + var $__2; + for (var args = [], + $__1 = 0; $__1 < arguments.length; $__1++) + args[$__1] = arguments[$__1]; + ($__2 = $traceurRuntime.superConstructor(NgControl)).call.apply($__2, $traceurRuntime.spread([this], args)); + this.name = null; + this.valueAccessor = null; + } + return ($traceurRuntime.createClass)(NgControl, { + get validator() { + return null; + }, + get path() { + return null; + }, + viewToModelUpdate: function(newValue) {} + }, {}, $__super); + }(AbstractControlDirective)); + $__export("NgControl", NgControl); + } + }; +}); + +System.register("angular2/src/forms/directives/validators", ["angular2/di", "angular2/src/facade/lang", "angular2/annotations", "angular2/src/forms/validators"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/validators"; + var __decorate, + __metadata, + forwardRef, + Binding, + CONST_EXPR, + Directive, + Validators, + NgValidator, + requiredValidatorBinding, + NgRequiredValidator; + return { + setters: [function($__m) { + forwardRef = $__m.forwardRef; + Binding = $__m.Binding; + }, function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + Directive = $__m.Directive; + }, function($__m) { + Validators = $__m.Validators; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + NgValidator = (function() { + function NgValidator() {} + return ($traceurRuntime.createClass)(NgValidator, {get validator() { + throw "Is not implemented"; + }}, {}); + }()); + $__export("NgValidator", NgValidator); + requiredValidatorBinding = CONST_EXPR(new Binding(NgValidator, {toAlias: forwardRef((function() { + return NgRequiredValidator; + }))})); + NgRequiredValidator = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, {get validator() { + return Validators.required; + }}, {}, $__super); + }(NgValidator)); + $__export("NgRequiredValidator", NgRequiredValidator); + $__export("NgRequiredValidator", NgRequiredValidator = __decorate([Directive({ + selector: '[required][ng-control],[required][ng-form-control],[required][ng-model]', + hostInjector: [requiredValidatorBinding] + }), __metadata('design:paramtypes', [])], NgRequiredValidator)); + } + }; +}); + +System.register("angular2/src/forms/directives/shared", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/forms/validators"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/shared"; + var ListWrapper, + StringMapWrapper, + isBlank, + BaseException, + looseIdentical, + Validators; + function controlPath(name, parent) { + var p = ListWrapper.clone(parent.path); + p.push(name); + return p; + } + function setUpControl(c, dir) { + if (isBlank(c)) + _throwError(dir, "Cannot find control"); + if (isBlank(dir.valueAccessor)) + _throwError(dir, "No value accessor for"); + c.validator = Validators.compose([c.validator, dir.validator]); + dir.valueAccessor.writeValue(c.value); + dir.valueAccessor.registerOnChange((function(newValue) { + dir.viewToModelUpdate(newValue); + c.updateValue(newValue, {emitModelToViewChange: false}); + c.markAsDirty(); + })); + c.registerOnChange((function(newValue) { + return dir.valueAccessor.writeValue(newValue); + })); + dir.valueAccessor.registerOnTouched((function() { + return c.markAsTouched(); + })); + } + function composeNgValidator(ngValidators) { + if (isBlank(ngValidators)) + return Validators.nullValidator; + return Validators.compose(ngValidators.map((function(v) { + return v.validator; + }))); + } + function _throwError(dir, message) { + var path = ListWrapper.join(dir.path, " -> "); + throw new BaseException((message + " '" + path + "'")); + } + function setProperty(renderer, elementRef, propName, propValue) { + renderer.setElementProperty(elementRef, propName, propValue); + } + function isPropertyUpdated(changes, viewModel) { + if (!StringMapWrapper.contains(changes, "model")) + return false; + var change = changes["model"]; + if (change.isFirstChange()) + return true; + return !looseIdentical(viewModel, change.currentValue); + } + $__export("controlPath", controlPath); + $__export("setUpControl", setUpControl); + $__export("composeNgValidator", composeNgValidator); + $__export("setProperty", setProperty); + $__export("isPropertyUpdated", isPropertyUpdated); + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + looseIdentical = $__m.looseIdentical; + }, function($__m) { + Validators = $__m.Validators; + }], + execute: function() { + } + }; +}); + +System.register("angular2/src/forms/directives/ng_form_control", ["angular2/src/facade/lang", "angular2/src/facade/async", "angular2/core", "angular2/annotations", "angular2/di", "angular2/src/forms/directives/ng_control", "angular2/src/forms/directives/validators", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/ng_form_control"; + var __decorate, + __metadata, + __param, + CONST_EXPR, + EventEmitter, + ObservableWrapper, + QueryList, + Query, + Directive, + LifecycleEvent, + forwardRef, + Binding, + NgControl, + NgValidator, + setUpControl, + composeNgValidator, + isPropertyUpdated, + formControlBinding, + NgFormControl; + return { + setters: [function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + QueryList = $__m.QueryList; + }, function($__m) { + Query = $__m.Query; + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + forwardRef = $__m.forwardRef; + Binding = $__m.Binding; + }, function($__m) { + NgControl = $__m.NgControl; + }, function($__m) { + NgValidator = $__m.NgValidator; + }, function($__m) { + setUpControl = $__m.setUpControl; + composeNgValidator = $__m.composeNgValidator; + isPropertyUpdated = $__m.isPropertyUpdated; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + formControlBinding = CONST_EXPR(new Binding(NgControl, {toAlias: forwardRef((function() { + return NgFormControl; + }))})); + NgFormControl = (function($__super) { + function $__0(ngValidators) { + $traceurRuntime.superConstructor($__0).call(this); + this.update = new EventEmitter(); + this._added = false; + this.ngValidators = ngValidators; + } + return ($traceurRuntime.createClass)($__0, { + onChange: function(c) { + if (!this._added) { + setUpControl(this.form, this); + this.form.updateValidity(); + this._added = true; + } + if (isPropertyUpdated(c, this.viewModel)) { + this.form.updateValue(this.model); + } + }, + get path() { + return []; + }, + get control() { + return this.form; + }, + get validator() { + return composeNgValidator(this.ngValidators); + }, + viewToModelUpdate: function(newValue) { + this.viewModel = newValue; + ObservableWrapper.callNext(this.update, newValue); + } + }, {}, $__super); + }(NgControl)); + $__export("NgFormControl", NgFormControl); + $__export("NgFormControl", NgFormControl = __decorate([Directive({ + selector: '[ng-form-control]', + hostInjector: [formControlBinding], + properties: ['form: ngFormControl', 'model: ngModel'], + events: ['update: ngModel'], + lifecycle: [LifecycleEvent.onChange], + exportAs: 'form' + }), __param(0, Query(NgValidator)), __metadata('design:paramtypes', [QueryList])], NgFormControl)); + } + }; +}); + +System.register("angular2/src/forms/directives/ng_model", ["angular2/src/facade/lang", "angular2/src/facade/async", "angular2/core", "angular2/annotations", "angular2/di", "angular2/src/forms/directives/ng_control", "angular2/src/forms/model", "angular2/src/forms/directives/validators", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/ng_model"; + var __decorate, + __metadata, + __param, + CONST_EXPR, + EventEmitter, + ObservableWrapper, + QueryList, + Query, + Directive, + LifecycleEvent, + forwardRef, + Binding, + NgControl, + Control, + NgValidator, + setUpControl, + composeNgValidator, + isPropertyUpdated, + formControlBinding, + NgModel; + return { + setters: [function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + QueryList = $__m.QueryList; + }, function($__m) { + Query = $__m.Query; + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + forwardRef = $__m.forwardRef; + Binding = $__m.Binding; + }, function($__m) { + NgControl = $__m.NgControl; + }, function($__m) { + Control = $__m.Control; + }, function($__m) { + NgValidator = $__m.NgValidator; + }, function($__m) { + setUpControl = $__m.setUpControl; + composeNgValidator = $__m.composeNgValidator; + isPropertyUpdated = $__m.isPropertyUpdated; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + formControlBinding = CONST_EXPR(new Binding(NgControl, {toAlias: forwardRef((function() { + return NgModel; + }))})); + NgModel = (function($__super) { + function $__0(ngValidators) { + $traceurRuntime.superConstructor($__0).call(this); + this._control = new Control(); + this._added = false; + this.update = new EventEmitter(); + this.ngValidators = ngValidators; + } + return ($traceurRuntime.createClass)($__0, { + onChange: function(c) { + if (!this._added) { + setUpControl(this._control, this); + this._control.updateValidity(); + this._added = true; + } + if (isPropertyUpdated(c, this.viewModel)) { + this._control.updateValue(this.model); + } + }, + get control() { + return this._control; + }, + get path() { + return []; + }, + get validator() { + return composeNgValidator(this.ngValidators); + }, + viewToModelUpdate: function(newValue) { + this.viewModel = newValue; + ObservableWrapper.callNext(this.update, newValue); + } + }, {}, $__super); + }(NgControl)); + $__export("NgModel", NgModel); + $__export("NgModel", NgModel = __decorate([Directive({ + selector: '[ng-model]:not([ng-control]):not([ng-form-control])', + hostInjector: [formControlBinding], + properties: ['model: ngModel'], + events: ['update: ngModel'], + lifecycle: [LifecycleEvent.onChange], + exportAs: 'form' + }), __param(0, Query(NgValidator)), __metadata('design:paramtypes', [QueryList])], NgModel)); + } + }; +}); + +System.register("angular2/src/forms/directives/ng_control_group", ["angular2/annotations", "angular2/di", "angular2/src/facade/lang", "angular2/src/forms/directives/control_container", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/ng_control_group"; + var __decorate, + __metadata, + __param, + Directive, + LifecycleEvent, + Ancestor, + forwardRef, + Binding, + CONST_EXPR, + ControlContainer, + controlPath, + controlGroupBinding, + NgControlGroup; + return { + setters: [function($__m) { + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + Ancestor = $__m.Ancestor; + forwardRef = $__m.forwardRef; + Binding = $__m.Binding; + }, function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + ControlContainer = $__m.ControlContainer; + }, function($__m) { + controlPath = $__m.controlPath; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + controlGroupBinding = CONST_EXPR(new Binding(ControlContainer, {toAlias: forwardRef((function() { + return NgControlGroup; + }))})); + NgControlGroup = (function($__super) { + function $__0(_parent) { + $traceurRuntime.superConstructor($__0).call(this); + this._parent = _parent; + } + return ($traceurRuntime.createClass)($__0, { + onInit: function() { + this.formDirective.addControlGroup(this); + }, + onDestroy: function() { + this.formDirective.removeControlGroup(this); + }, + get control() { + return this.formDirective.getControlGroup(this); + }, + get path() { + return controlPath(this.name, this._parent); + }, + get formDirective() { + return this._parent.formDirective; + } + }, {}, $__super); + }(ControlContainer)); + $__export("NgControlGroup", NgControlGroup); + $__export("NgControlGroup", NgControlGroup = __decorate([Directive({ + selector: '[ng-control-group]', + hostInjector: [controlGroupBinding], + properties: ['name: ng-control-group'], + lifecycle: [LifecycleEvent.onInit, LifecycleEvent.onDestroy], + exportAs: 'form' + }), __param(0, Ancestor()), __metadata('design:paramtypes', [ControlContainer])], NgControlGroup)); + } + }; +}); + +System.register("angular2/src/forms/directives/ng_form_model", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/facade/async", "angular2/annotations", "angular2/di", "angular2/src/forms/directives/control_container", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/ng_form_model"; + var __decorate, + __metadata, + CONST_EXPR, + ListWrapper, + ObservableWrapper, + EventEmitter, + Directive, + LifecycleEvent, + forwardRef, + Binding, + ControlContainer, + setUpControl, + formDirectiveBinding, + NgFormModel; + return { + setters: [function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + ObservableWrapper = $__m.ObservableWrapper; + EventEmitter = $__m.EventEmitter; + }, function($__m) { + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + forwardRef = $__m.forwardRef; + Binding = $__m.Binding; + }, function($__m) { + ControlContainer = $__m.ControlContainer; + }, function($__m) { + setUpControl = $__m.setUpControl; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + formDirectiveBinding = CONST_EXPR(new Binding(ControlContainer, {toAlias: forwardRef((function() { + return NgFormModel; + }))})); + NgFormModel = (function($__super) { + function $__1() { + var $__4; + for (var args = [], + $__3 = 0; $__3 < arguments.length; $__3++) + args[$__3] = arguments[$__3]; + ($__4 = $traceurRuntime.superConstructor($__1)).call.apply($__4, $traceurRuntime.spread([this], args)); + this.form = null; + this.directives = []; + this.ngSubmit = new EventEmitter(); + } + return ($traceurRuntime.createClass)($__1, { + onChange: function(_) { + this._updateDomValue(); + }, + get formDirective() { + return this; + }, + get control() { + return this.form; + }, + get path() { + return []; + }, + addControl: function(dir) { + var c = this.form.find(dir.path); + setUpControl(c, dir); + c.updateValidity(); + this.directives.push(dir); + }, + getControl: function(dir) { + return this.form.find(dir.path); + }, + removeControl: function(dir) { + ListWrapper.remove(this.directives, dir); + }, + addControlGroup: function(dir) {}, + removeControlGroup: function(dir) {}, + getControlGroup: function(dir) { + return this.form.find(dir.path); + }, + updateModel: function(dir, value) { + var c = this.form.find(dir.path); + c.updateValue(value); + }, + onSubmit: function() { + ObservableWrapper.callNext(this.ngSubmit, null); + return false; + }, + _updateDomValue: function() { + var $__0 = this; + ListWrapper.forEach(this.directives, (function(dir) { + var c = $__0.form.find(dir.path); + dir.valueAccessor.writeValue(c.value); + })); + } + }, {}, $__super); + }(ControlContainer)); + $__export("NgFormModel", NgFormModel); + $__export("NgFormModel", NgFormModel = __decorate([Directive({ + selector: '[ng-form-model]', + hostInjector: [formDirectiveBinding], + properties: ['form: ng-form-model'], + lifecycle: [LifecycleEvent.onChange], + host: {'(submit)': 'onSubmit()'}, + events: ['ngSubmit'], + exportAs: 'form' + }), __metadata('design:paramtypes', [])], NgFormModel)); + } + }; +}); + +System.register("angular2/src/forms/directives/ng_form", ["angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/annotations", "angular2/di", "angular2/src/forms/directives/control_container", "angular2/src/forms/model", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/ng_form"; + var __decorate, + __metadata, + PromiseWrapper, + ObservableWrapper, + EventEmitter, + ListWrapper, + isPresent, + CONST_EXPR, + Directive, + forwardRef, + Binding, + ControlContainer, + ControlGroup, + Control, + setUpControl, + formDirectiveBinding, + NgForm; + return { + setters: [function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + ObservableWrapper = $__m.ObservableWrapper; + EventEmitter = $__m.EventEmitter; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + Directive = $__m.Directive; + }, function($__m) { + forwardRef = $__m.forwardRef; + Binding = $__m.Binding; + }, function($__m) { + ControlContainer = $__m.ControlContainer; + }, function($__m) { + ControlGroup = $__m.ControlGroup; + Control = $__m.Control; + }, function($__m) { + setUpControl = $__m.setUpControl; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + formDirectiveBinding = CONST_EXPR(new Binding(ControlContainer, {toAlias: forwardRef((function() { + return NgForm; + }))})); + NgForm = (function($__super) { + function $__1() { + $traceurRuntime.superConstructor($__1).call(this); + this.ngSubmit = new EventEmitter(); + this.form = new ControlGroup({}); + } + return ($traceurRuntime.createClass)($__1, { + get formDirective() { + return this; + }, + get control() { + return this.form; + }, + get path() { + return []; + }, + get controls() { + return this.form.controls; + }, + addControl: function(dir) { + var $__0 = this; + this._later((function(_) { + var container = $__0._findContainer(dir.path); + var c = new Control(); + setUpControl(c, dir); + container.addControl(dir.name, c); + c.updateValidity(); + })); + }, + getControl: function(dir) { + return this.form.find(dir.path); + }, + removeControl: function(dir) { + var $__0 = this; + this._later((function(_) { + var container = $__0._findContainer(dir.path); + if (isPresent(container)) { + container.removeControl(dir.name); + container.updateValidity(); + } + })); + }, + addControlGroup: function(dir) { + var $__0 = this; + this._later((function(_) { + var container = $__0._findContainer(dir.path); + var c = new ControlGroup({}); + container.addControl(dir.name, c); + c.updateValidity(); + })); + }, + removeControlGroup: function(dir) { + var $__0 = this; + this._later((function(_) { + var container = $__0._findContainer(dir.path); + if (isPresent(container)) { + container.removeControl(dir.name); + container.updateValidity(); + } + })); + }, + getControlGroup: function(dir) { + return this.form.find(dir.path); + }, + updateModel: function(dir, value) { + var $__0 = this; + this._later((function(_) { + var c = $__0.form.find(dir.path); + c.updateValue(value); + })); + }, + onSubmit: function() { + ObservableWrapper.callNext(this.ngSubmit, null); + return false; + }, + _findContainer: function(path) { + ListWrapper.removeLast(path); + return ListWrapper.isEmpty(path) ? this.form : this.form.find(path); + }, + _later: function(fn) { + var c = PromiseWrapper.completer(); + PromiseWrapper.then(c.promise, fn, (function(_) {})); + c.resolve(null); + } + }, {}, $__super); + }(ControlContainer)); + $__export("NgForm", NgForm); + $__export("NgForm", NgForm = __decorate([Directive({ + selector: 'form:not([ng-no-form]):not([ng-form-model]),ng-form,[ng-form]', + hostInjector: [formDirectiveBinding], + host: {'(submit)': 'onSubmit()'}, + events: ['ngSubmit'], + exportAs: 'form' + }), __metadata('design:paramtypes', [])], NgForm)); + } + }; +}); + +System.register("angular2/render", ["angular2/src/render/render"], function($__export) { + "use strict"; + var __moduleName = "angular2/render"; + return { + setters: [function($__m) { + $__export("Renderer", $__m.Renderer); + $__export("RenderViewRef", $__m.RenderViewRef); + $__export("RenderProtoViewRef", $__m.RenderProtoViewRef); + $__export("RenderFragmentRef", $__m.RenderFragmentRef); + $__export("RenderViewWithFragments", $__m.RenderViewWithFragments); + $__export("DomRenderer", $__m.DomRenderer); + $__export("DOCUMENT_TOKEN", $__m.DOCUMENT_TOKEN); + $__export("APP_ID_TOKEN", $__m.APP_ID_TOKEN); + $__export("DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES", $__m.DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/forms/directives/checkbox_value_accessor", ["angular2/render", "angular2/annotations", "angular2/core", "angular2/di", "angular2/src/forms/directives/ng_control", "angular2/src/facade/lang", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/checkbox_value_accessor"; + var __decorate, + __metadata, + __param, + Renderer, + Directive, + ElementRef, + Self, + NgControl, + isPresent, + setProperty, + CheckboxControlValueAccessor; + return { + setters: [function($__m) { + Renderer = $__m.Renderer; + }, function($__m) { + Directive = $__m.Directive; + }, function($__m) { + ElementRef = $__m.ElementRef; + }, function($__m) { + Self = $__m.Self; + }, function($__m) { + NgControl = $__m.NgControl; + }, function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + setProperty = $__m.setProperty; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + CheckboxControlValueAccessor = (($traceurRuntime.createClass)(function(cd, renderer, elementRef) { + this.renderer = renderer; + this.elementRef = elementRef; + this.onChange = (function(_) {}); + this.onTouched = (function() {}); + this.cd = cd; + cd.valueAccessor = this; + }, { + writeValue: function(value) { + setProperty(this.renderer, this.elementRef, "checked", value); + }, + get ngClassUntouched() { + return isPresent(this.cd.control) ? this.cd.control.untouched : false; + }, + get ngClassTouched() { + return isPresent(this.cd.control) ? this.cd.control.touched : false; + }, + get ngClassPristine() { + return isPresent(this.cd.control) ? this.cd.control.pristine : false; + }, + get ngClassDirty() { + return isPresent(this.cd.control) ? this.cd.control.dirty : false; + }, + get ngClassValid() { + return isPresent(this.cd.control) ? this.cd.control.valid : false; + }, + get ngClassInvalid() { + return isPresent(this.cd.control) ? !this.cd.control.valid : false; + }, + registerOnChange: function(fn) { + this.onChange = fn; + }, + registerOnTouched: function(fn) { + this.onTouched = fn; + } + }, {})); + $__export("CheckboxControlValueAccessor", CheckboxControlValueAccessor); + $__export("CheckboxControlValueAccessor", CheckboxControlValueAccessor = __decorate([Directive({ + selector: 'input[type=checkbox][ng-control],input[type=checkbox][ng-form-control],input[type=checkbox][ng-model]', + host: { + '(change)': 'onChange($event.target.checked)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, Self()), __metadata('design:paramtypes', [NgControl, Renderer, ElementRef])], CheckboxControlValueAccessor)); + } + }; +}); + +System.register("angular2/src/forms/directives/select_control_value_accessor", ["angular2/render", "angular2/core", "angular2/di", "angular2/annotations", "angular2/src/forms/directives/ng_control", "angular2/src/facade/lang", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/select_control_value_accessor"; + var __decorate, + __metadata, + __param, + Renderer, + ElementRef, + QueryList, + Self, + Query, + Directive, + NgControl, + isPresent, + setProperty, + NgSelectOption, + SelectControlValueAccessor; + return { + setters: [function($__m) { + Renderer = $__m.Renderer; + }, function($__m) { + ElementRef = $__m.ElementRef; + QueryList = $__m.QueryList; + }, function($__m) { + Self = $__m.Self; + }, function($__m) { + Query = $__m.Query; + Directive = $__m.Directive; + }, function($__m) { + NgControl = $__m.NgControl; + }, function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + setProperty = $__m.setProperty; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + NgSelectOption = (($traceurRuntime.createClass)(function() {}, {}, {})); + $__export("NgSelectOption", NgSelectOption); + $__export("NgSelectOption", NgSelectOption = __decorate([Directive({selector: 'option'}), __metadata('design:paramtypes', [])], NgSelectOption)); + SelectControlValueAccessor = (($traceurRuntime.createClass)(function(cd, renderer, elementRef, query) { + this.renderer = renderer; + this.elementRef = elementRef; + this.onChange = (function(_) {}); + this.onTouched = (function() {}); + this.cd = cd; + cd.valueAccessor = this; + this._updateValueWhenListOfOptionsChanges(query); + }, { + writeValue: function(value) { + this.value = value; + setProperty(this.renderer, this.elementRef, "value", value); + }, + get ngClassUntouched() { + return isPresent(this.cd.control) ? this.cd.control.untouched : false; + }, + get ngClassTouched() { + return isPresent(this.cd.control) ? this.cd.control.touched : false; + }, + get ngClassPristine() { + return isPresent(this.cd.control) ? this.cd.control.pristine : false; + }, + get ngClassDirty() { + return isPresent(this.cd.control) ? this.cd.control.dirty : false; + }, + get ngClassValid() { + return isPresent(this.cd.control) ? this.cd.control.valid : false; + }, + get ngClassInvalid() { + return isPresent(this.cd.control) ? !this.cd.control.valid : false; + }, + registerOnChange: function(fn) { + this.onChange = fn; + }, + registerOnTouched: function(fn) { + this.onTouched = fn; + }, + _updateValueWhenListOfOptionsChanges: function(query) { + var $__0 = this; + query.onChange((function() { + return $__0.writeValue($__0.value); + })); + } + }, {})); + $__export("SelectControlValueAccessor", SelectControlValueAccessor); + $__export("SelectControlValueAccessor", SelectControlValueAccessor = __decorate([Directive({ + selector: 'select[ng-control],select[ng-form-control],select[ng-model]', + host: { + '(change)': 'onChange($event.target.value)', + '(input)': 'onChange($event.target.value)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, Self()), __param(3, Query(NgSelectOption, {descendants: true})), __metadata('design:paramtypes', [NgControl, Renderer, ElementRef, QueryList])], SelectControlValueAccessor)); + } + }; +}); + +System.register("angular2/src/forms/directives", ["angular2/src/facade/lang", "angular2/src/forms/directives/ng_control_name", "angular2/src/forms/directives/ng_form_control", "angular2/src/forms/directives/ng_model", "angular2/src/forms/directives/ng_control_group", "angular2/src/forms/directives/ng_form_model", "angular2/src/forms/directives/ng_form", "angular2/src/forms/directives/default_value_accessor", "angular2/src/forms/directives/checkbox_value_accessor", "angular2/src/forms/directives/select_control_value_accessor", "angular2/src/forms/directives/validators", "angular2/src/forms/directives/ng_control"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives"; + var CONST_EXPR, + NgControlName, + NgFormControl, + NgModel, + NgControlGroup, + NgFormModel, + NgForm, + DefaultValueAccessor, + CheckboxControlValueAccessor, + SelectControlValueAccessor, + NgSelectOption, + NgRequiredValidator, + formDirectives; + return { + setters: [function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + NgControlName = $__m.NgControlName; + $__export("NgControlName", $__m.NgControlName); + }, function($__m) { + NgFormControl = $__m.NgFormControl; + $__export("NgFormControl", $__m.NgFormControl); + }, function($__m) { + NgModel = $__m.NgModel; + $__export("NgModel", $__m.NgModel); + }, function($__m) { + NgControlGroup = $__m.NgControlGroup; + $__export("NgControlGroup", $__m.NgControlGroup); + }, function($__m) { + NgFormModel = $__m.NgFormModel; + $__export("NgFormModel", $__m.NgFormModel); + }, function($__m) { + NgForm = $__m.NgForm; + $__export("NgForm", $__m.NgForm); + }, function($__m) { + DefaultValueAccessor = $__m.DefaultValueAccessor; + $__export("DefaultValueAccessor", $__m.DefaultValueAccessor); + }, function($__m) { + CheckboxControlValueAccessor = $__m.CheckboxControlValueAccessor; + $__export("CheckboxControlValueAccessor", $__m.CheckboxControlValueAccessor); + }, function($__m) { + SelectControlValueAccessor = $__m.SelectControlValueAccessor; + NgSelectOption = $__m.NgSelectOption; + $__export("SelectControlValueAccessor", $__m.SelectControlValueAccessor); + $__export("NgSelectOption", $__m.NgSelectOption); + }, function($__m) { + NgRequiredValidator = $__m.NgRequiredValidator; + $__export("NgValidator", $__m.NgValidator); + $__export("NgRequiredValidator", $__m.NgRequiredValidator); + }, function($__m) { + $__export("NgControl", $__m.NgControl); + }], + execute: function() { + formDirectives = CONST_EXPR([NgControlName, NgControlGroup, NgFormControl, NgModel, NgFormModel, NgForm, NgSelectOption, DefaultValueAccessor, CheckboxControlValueAccessor, SelectControlValueAccessor, NgRequiredValidator]); + $__export("formDirectives", formDirectives); + } + }; +}); + +System.register("angular2/src/forms/form_builder", ["angular2/di", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/forms/model"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/form_builder"; + var __decorate, + __metadata, + Injectable, + StringMapWrapper, + ListWrapper, + isPresent, + isArray, + modelModule, + FormBuilder; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + ListWrapper = $__m.ListWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + isArray = $__m.isArray; + }, function($__m) { + modelModule = $__m; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + FormBuilder = (($traceurRuntime.createClass)(function() {}, { + group: function(controlsConfig) { + var extra = arguments[1] !== (void 0) ? arguments[1] : null; + var controls = this._reduceControls(controlsConfig); + var optionals = isPresent(extra) ? StringMapWrapper.get(extra, "optionals") : null; + var validator = isPresent(extra) ? StringMapWrapper.get(extra, "validator") : null; + if (isPresent(validator)) { + return new modelModule.ControlGroup(controls, optionals, validator); + } else { + return new modelModule.ControlGroup(controls, optionals); + } + }, + control: function(value) { + var validator = arguments[1] !== (void 0) ? arguments[1] : null; + if (isPresent(validator)) { + return new modelModule.Control(value, validator); + } else { + return new modelModule.Control(value); + } + }, + array: function(controlsConfig) { + var validator = arguments[1] !== (void 0) ? arguments[1] : null; + var $__0 = this; + var controls = ListWrapper.map(controlsConfig, (function(c) { + return $__0._createControl(c); + })); + if (isPresent(validator)) { + return new modelModule.ControlArray(controls, validator); + } else { + return new modelModule.ControlArray(controls); + } + }, + _reduceControls: function(controlsConfig) { + var $__0 = this; + var controls = {}; + StringMapWrapper.forEach(controlsConfig, (function(controlConfig, controlName) { + controls[controlName] = $__0._createControl(controlConfig); + })); + return controls; + }, + _createControl: function(controlConfig) { + if (controlConfig instanceof modelModule.Control || controlConfig instanceof modelModule.ControlGroup || controlConfig instanceof modelModule.ControlArray) { + return controlConfig; + } else if (isArray(controlConfig)) { + var value = ListWrapper.get(controlConfig, 0); + var validator = controlConfig.length > 1 ? controlConfig[1] : null; + return this.control(value, validator); + } else { + return this.control(controlConfig); + } + } + }, {})); + $__export("FormBuilder", FormBuilder); + $__export("FormBuilder", FormBuilder = __decorate([Injectable(), __metadata('design:paramtypes', [])], FormBuilder)); + } + }; +}); + +System.register("angular2/src/di/metadata", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/metadata"; + var __decorate, + __metadata, + CONST, + CONST_EXPR, + stringify, + isBlank, + InjectMetadata, + OptionalMetadata, + DependencyMetadata, + InjectableMetadata, + VisibilityMetadata, + SelfMetadata, + AncestorMetadata, + UnboundedMetadata, + DEFAULT_VISIBILITY; + return { + setters: [function($__m) { + CONST = $__m.CONST; + CONST_EXPR = $__m.CONST_EXPR; + stringify = $__m.stringify; + isBlank = $__m.isBlank; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + InjectMetadata = (($traceurRuntime.createClass)(function(token) { + this.token = token; + }, {toString: function() { + return ("@Inject(" + stringify(this.token) + ")"); + }}, {})); + $__export("InjectMetadata", InjectMetadata); + $__export("InjectMetadata", InjectMetadata = __decorate([CONST(), __metadata('design:paramtypes', [Object])], InjectMetadata)); + OptionalMetadata = (($traceurRuntime.createClass)(function() {}, {toString: function() { + return "@Optional()"; + }}, {})); + $__export("OptionalMetadata", OptionalMetadata); + $__export("OptionalMetadata", OptionalMetadata = __decorate([CONST(), __metadata('design:paramtypes', [])], OptionalMetadata)); + DependencyMetadata = (($traceurRuntime.createClass)(function() {}, {get token() { + return null; + }}, {})); + $__export("DependencyMetadata", DependencyMetadata); + $__export("DependencyMetadata", DependencyMetadata = __decorate([CONST(), __metadata('design:paramtypes', [])], DependencyMetadata)); + InjectableMetadata = (($traceurRuntime.createClass)(function() {}, {}, {})); + $__export("InjectableMetadata", InjectableMetadata); + $__export("InjectableMetadata", InjectableMetadata = __decorate([CONST(), __metadata('design:paramtypes', [])], InjectableMetadata)); + VisibilityMetadata = (($traceurRuntime.createClass)(function(crossBoundaries, _includeSelf) { + this.crossBoundaries = crossBoundaries; + this._includeSelf = _includeSelf; + }, { + get includeSelf() { + return isBlank(this._includeSelf) ? false : this._includeSelf; + }, + toString: function() { + return ("@Visibility(crossBoundaries: " + this.crossBoundaries + ", includeSelf: " + this.includeSelf + "})"); + } + }, {})); + $__export("VisibilityMetadata", VisibilityMetadata); + $__export("VisibilityMetadata", VisibilityMetadata = __decorate([CONST(), __metadata('design:paramtypes', [Boolean, Boolean])], VisibilityMetadata)); + SelfMetadata = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).call(this, false, true); + } + return ($traceurRuntime.createClass)($__0, {toString: function() { + return "@Self()"; + }}, {}, $__super); + }(VisibilityMetadata)); + $__export("SelfMetadata", SelfMetadata); + $__export("SelfMetadata", SelfMetadata = __decorate([CONST(), __metadata('design:paramtypes', [])], SelfMetadata)); + AncestorMetadata = (function($__super) { + function $__0() { + var self = (arguments[0] !== (void 0) ? arguments[0] : {}).self; + $traceurRuntime.superConstructor($__0).call(this, false, self); + } + return ($traceurRuntime.createClass)($__0, {toString: function() { + return ("@Ancestor(self: " + this.includeSelf + "})"); + }}, {}, $__super); + }(VisibilityMetadata)); + $__export("AncestorMetadata", AncestorMetadata); + $__export("AncestorMetadata", AncestorMetadata = __decorate([CONST(), __metadata('design:paramtypes', [Object])], AncestorMetadata)); + UnboundedMetadata = (function($__super) { + function $__0() { + var self = (arguments[0] !== (void 0) ? arguments[0] : {}).self; + $traceurRuntime.superConstructor($__0).call(this, true, self); + } + return ($traceurRuntime.createClass)($__0, {toString: function() { + return ("@Unbounded(self: " + this.includeSelf + "})"); + }}, {}, $__super); + }(VisibilityMetadata)); + $__export("UnboundedMetadata", UnboundedMetadata); + $__export("UnboundedMetadata", UnboundedMetadata = __decorate([CONST(), __metadata('design:paramtypes', [Object])], UnboundedMetadata)); + DEFAULT_VISIBILITY = CONST_EXPR(new UnboundedMetadata({self: true})); + $__export("DEFAULT_VISIBILITY", DEFAULT_VISIBILITY); + } + }; +}); + +System.register("angular2/src/di/decorators", ["angular2/src/di/metadata", "angular2/src/util/decorators"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/decorators"; + var InjectMetadata, + OptionalMetadata, + InjectableMetadata, + SelfMetadata, + AncestorMetadata, + UnboundedMetadata, + makeDecorator, + makeParamDecorator, + Inject, + Optional, + Injectable, + Self, + Ancestor, + Unbounded; + return { + setters: [function($__m) { + InjectMetadata = $__m.InjectMetadata; + OptionalMetadata = $__m.OptionalMetadata; + InjectableMetadata = $__m.InjectableMetadata; + SelfMetadata = $__m.SelfMetadata; + AncestorMetadata = $__m.AncestorMetadata; + UnboundedMetadata = $__m.UnboundedMetadata; + }, function($__m) { + makeDecorator = $__m.makeDecorator; + makeParamDecorator = $__m.makeParamDecorator; + }], + execute: function() { + Inject = makeParamDecorator(InjectMetadata); + $__export("Inject", Inject); + Optional = makeParamDecorator(OptionalMetadata); + $__export("Optional", Optional); + Injectable = makeDecorator(InjectableMetadata); + $__export("Injectable", Injectable); + Self = makeParamDecorator(SelfMetadata); + $__export("Self", Self); + Ancestor = makeParamDecorator(AncestorMetadata); + $__export("Ancestor", Ancestor); + Unbounded = makeParamDecorator(UnboundedMetadata); + $__export("Unbounded", Unbounded); + } + }; +}); + +System.register("angular2/src/reflection/reflection", ["angular2/src/reflection/reflector", "angular2/src/reflection/reflection_capabilities"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/reflection/reflection"; + var Reflector, + ReflectionCapabilities, + reflector; + return { + setters: [function($__m) { + Reflector = $__m.Reflector; + $__export("Reflector", $__m.Reflector); + $__export("ReflectionInfo", $__m.ReflectionInfo); + }, function($__m) { + ReflectionCapabilities = $__m.ReflectionCapabilities; + }], + execute: function() { + reflector = new Reflector(new ReflectionCapabilities()); + $__export("reflector", reflector); + } + }; +}); + +System.register("angular2/src/di/key", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/di/type_literal", "angular2/src/di/forward_ref"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/key"; + var MapWrapper, + stringify, + isBlank, + BaseException, + TypeLiteral, + resolveForwardRef, + Key, + KeyRegistry, + _globalKeyRegistry; + return { + setters: [function($__m) { + MapWrapper = $__m.MapWrapper; + }, function($__m) { + stringify = $__m.stringify; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + TypeLiteral = $__m.TypeLiteral; + $__export("TypeLiteral", $__m.TypeLiteral); + }, function($__m) { + resolveForwardRef = $__m.resolveForwardRef; + }], + execute: function() { + Key = (function() { + function Key(token, id) { + this.token = token; + this.id = id; + if (isBlank(token)) { + throw new BaseException('Token must be defined!'); + } + } + return ($traceurRuntime.createClass)(Key, {get displayName() { + return stringify(this.token); + }}, { + get: function(token) { + return _globalKeyRegistry.get(resolveForwardRef(token)); + }, + get numberOfKeys() { + return _globalKeyRegistry.numberOfKeys; + } + }); + }()); + $__export("Key", Key); + KeyRegistry = (function() { + function KeyRegistry() { + this._allKeys = new Map(); + } + return ($traceurRuntime.createClass)(KeyRegistry, { + get: function(token) { + if (token instanceof Key) + return token; + var theToken = token; + if (token instanceof TypeLiteral) { + theToken = token.type; + } + token = theToken; + if (this._allKeys.has(token)) { + return this._allKeys.get(token); + } + var newKey = new Key(token, Key.numberOfKeys); + this._allKeys.set(token, newKey); + return newKey; + }, + get numberOfKeys() { + return MapWrapper.size(this._allKeys); + } + }, {}); + }()); + $__export("KeyRegistry", KeyRegistry); + _globalKeyRegistry = new KeyRegistry(); + } + }; +}); + +System.register("angular2/src/dom/browser_adapter", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/dom/dom_adapter", "angular2/src/dom/generic_browser_adapter"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/dom/browser_adapter"; + var ListWrapper, + isBlank, + isPresent, + global, + setRootDomAdapter, + GenericBrowserDomAdapter, + _attrToPropMap, + DOM_KEY_LOCATION_NUMPAD, + _keyMap, + _chromeNumKeyPadMap, + BrowserDomAdapter, + baseElement, + urlParsingNode; + function getBaseElementHref() { + if (isBlank(baseElement)) { + baseElement = document.querySelector('base'); + if (isBlank(baseElement)) { + return null; + } + } + return baseElement.attr('href'); + } + function relativePath(url) { + if (isBlank(urlParsingNode)) { + urlParsingNode = document.createElement("a"); + } + urlParsingNode.setAttribute('href', url); + return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname : '/' + urlParsingNode.pathname; + } + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + global = $__m.global; + }, function($__m) { + setRootDomAdapter = $__m.setRootDomAdapter; + }, function($__m) { + GenericBrowserDomAdapter = $__m.GenericBrowserDomAdapter; + }], + execute: function() { + _attrToPropMap = { + 'innerHtml': 'innerHTML', + 'readonly': 'readOnly', + 'tabindex': 'tabIndex' + }; + DOM_KEY_LOCATION_NUMPAD = 3; + _keyMap = { + '\b': 'Backspace', + '\t': 'Tab', + '\x7F': 'Delete', + '\x1B': 'Escape', + 'Del': 'Delete', + 'Esc': 'Escape', + 'Left': 'ArrowLeft', + 'Right': 'ArrowRight', + 'Up': 'ArrowUp', + 'Down': 'ArrowDown', + 'Menu': 'ContextMenu', + 'Scroll': 'ScrollLock', + 'Win': 'OS' + }; + _chromeNumKeyPadMap = { + 'A': '1', + 'B': '2', + 'C': '3', + 'D': '4', + 'E': '5', + 'F': '6', + 'G': '7', + 'H': '8', + 'I': '9', + 'J': '*', + 'K': '+', + 'M': '-', + 'N': '.', + 'O': '/', + '\x60': '0', + '\x90': 'NumLock' + }; + BrowserDomAdapter = (function($__super) { + function BrowserDomAdapter() { + $traceurRuntime.superConstructor(BrowserDomAdapter).apply(this, arguments); + } + return ($traceurRuntime.createClass)(BrowserDomAdapter, { + hasProperty: function(element, name) { + return name in element; + }, + setProperty: function(el, name, value) { + el[name] = value; + }, + getProperty: function(el, name) { + return el[name]; + }, + invoke: function(el, methodName, args) { + el[methodName].apply(el, args); + }, + logError: function(error) { + window.console.error(error); + }, + log: function(error) { + window.console.log(error); + }, + logGroup: function(error) { + if (window.console.group) { + window.console.group(error); + } else { + window.console.log(error); + } + }, + logGroupEnd: function() { + if (window.console.groupEnd) { + window.console.groupEnd(); + } + }, + get attrToPropMap() { + return _attrToPropMap; + }, + query: function(selector) { + return document.querySelector(selector); + }, + querySelector: function(el, selector) { + return el.querySelector(selector); + }, + querySelectorAll: function(el, selector) { + return el.querySelectorAll(selector); + }, + on: function(el, evt, listener) { + el.addEventListener(evt, listener, false); + }, + onAndCancel: function(el, evt, listener) { + el.addEventListener(evt, listener, false); + return (function() { + el.removeEventListener(evt, listener, false); + }); + }, + dispatchEvent: function(el, evt) { + el.dispatchEvent(evt); + }, + createMouseEvent: function(eventType) { + var evt = document.createEvent('MouseEvent'); + evt.initEvent(eventType, true, true); + return evt; + }, + createEvent: function(eventType) { + var evt = document.createEvent('Event'); + evt.initEvent(eventType, true, true); + return evt; + }, + preventDefault: function(evt) { + evt.preventDefault(); + evt.returnValue = false; + }, + getInnerHTML: function(el) { + return el.innerHTML; + }, + getOuterHTML: function(el) { + return el.outerHTML; + }, + nodeName: function(node) { + return node.nodeName; + }, + nodeValue: function(node) { + return node.nodeValue; + }, + type: function(node) { + return node.type; + }, + content: function(node) { + if (this.hasProperty(node, "content")) { + return node.content; + } else { + return node; + } + }, + firstChild: function(el) { + return el.firstChild; + }, + nextSibling: function(el) { + return el.nextSibling; + }, + parentElement: function(el) { + return el.parentElement; + }, + childNodes: function(el) { + return el.childNodes; + }, + childNodesAsList: function(el) { + var childNodes = el.childNodes; + var res = ListWrapper.createFixedSize(childNodes.length); + for (var i = 0; i < childNodes.length; i++) { + res[i] = childNodes[i]; + } + return res; + }, + clearNodes: function(el) { + while (el.firstChild) { + el.firstChild.remove(); + } + }, + appendChild: function(el, node) { + el.appendChild(node); + }, + removeChild: function(el, node) { + el.removeChild(node); + }, + replaceChild: function(el, newChild, oldChild) { + el.replaceChild(newChild, oldChild); + }, + remove: function(node) { + node.remove(); + return node; + }, + insertBefore: function(el, node) { + el.parentNode.insertBefore(node, el); + }, + insertAllBefore: function(el, nodes) { + ListWrapper.forEach(nodes, (function(n) { + el.parentNode.insertBefore(n, el); + })); + }, + insertAfter: function(el, node) { + el.parentNode.insertBefore(node, el.nextSibling); + }, + setInnerHTML: function(el, value) { + el.innerHTML = value; + }, + getText: function(el) { + return el.textContent; + }, + setText: function(el, value) { + el.textContent = value; + }, + getValue: function(el) { + return el.value; + }, + setValue: function(el, value) { + el.value = value; + }, + getChecked: function(el) { + return el.checked; + }, + setChecked: function(el, value) { + el.checked = value; + }, + createTemplate: function(html) { + var t = document.createElement('template'); + t.innerHTML = html; + return t; + }, + createElement: function(tagName) { + var doc = arguments[1] !== (void 0) ? arguments[1] : document; + return doc.createElement(tagName); + }, + createTextNode: function(text) { + var doc = arguments[1] !== (void 0) ? arguments[1] : document; + return doc.createTextNode(text); + }, + createScriptTag: function(attrName, attrValue) { + var doc = arguments[2] !== (void 0) ? arguments[2] : document; + var el = doc.createElement('SCRIPT'); + el.setAttribute(attrName, attrValue); + return el; + }, + createStyleElement: function(css) { + var doc = arguments[1] !== (void 0) ? arguments[1] : document; + var style = doc.createElement('style'); + this.appendChild(style, this.createTextNode(css)); + return style; + }, + createShadowRoot: function(el) { + return el.createShadowRoot(); + }, + getShadowRoot: function(el) { + return el.shadowRoot; + }, + getHost: function(el) { + return el.host; + }, + clone: function(node) { + return node.cloneNode(true); + }, + getElementsByClassName: function(element, name) { + return element.getElementsByClassName(name); + }, + getElementsByTagName: function(element, name) { + return element.getElementsByTagName(name); + }, + classList: function(element) { + return Array.prototype.slice.call(element.classList, 0); + }, + addClass: function(element, classname) { + element.classList.add(classname); + }, + removeClass: function(element, classname) { + element.classList.remove(classname); + }, + hasClass: function(element, classname) { + return element.classList.contains(classname); + }, + setStyle: function(element, stylename, stylevalue) { + element.style[stylename] = stylevalue; + }, + removeStyle: function(element, stylename) { + element.style[stylename] = null; + }, + getStyle: function(element, stylename) { + return element.style[stylename]; + }, + tagName: function(element) { + return element.tagName; + }, + attributeMap: function(element) { + var res = new Map(); + var elAttrs = element.attributes; + for (var i = 0; i < elAttrs.length; i++) { + var attrib = elAttrs[i]; + res.set(attrib.name, attrib.value); + } + return res; + }, + hasAttribute: function(element, attribute) { + return element.hasAttribute(attribute); + }, + getAttribute: function(element, attribute) { + return element.getAttribute(attribute); + }, + setAttribute: function(element, name, value) { + element.setAttribute(name, value); + }, + removeAttribute: function(element, attribute) { + element.removeAttribute(attribute); + }, + templateAwareRoot: function(el) { + return this.isTemplateElement(el) ? this.content(el) : el; + }, + createHtmlDocument: function() { + return document.implementation.createHTMLDocument('fakeTitle'); + }, + defaultDoc: function() { + return document; + }, + getBoundingClientRect: function(el) { + try { + return el.getBoundingClientRect(); + } catch (e) { + return { + top: 0, + bottom: 0, + left: 0, + right: 0, + width: 0, + height: 0 + }; + } + }, + getTitle: function() { + return document.title; + }, + setTitle: function(newTitle) { + document.title = newTitle || ''; + }, + elementMatches: function(n, selector) { + return n instanceof HTMLElement && n.matches ? n.matches(selector) : n.msMatchesSelector(selector); + }, + isTemplateElement: function(el) { + return el instanceof HTMLElement && el.nodeName == "TEMPLATE"; + }, + isTextNode: function(node) { + return node.nodeType === Node.TEXT_NODE; + }, + isCommentNode: function(node) { + return node.nodeType === Node.COMMENT_NODE; + }, + isElementNode: function(node) { + return node.nodeType === Node.ELEMENT_NODE; + }, + hasShadowRoot: function(node) { + return node instanceof HTMLElement && isPresent(node.shadowRoot); + }, + isShadowRoot: function(node) { + return node instanceof DocumentFragment; + }, + importIntoDoc: function(node) { + var toImport = node; + if (this.isTemplateElement(node)) { + toImport = this.content(node); + } + return document.importNode(toImport, true); + }, + isPageRule: function(rule) { + return rule.type === CSSRule.PAGE_RULE; + }, + isStyleRule: function(rule) { + return rule.type === CSSRule.STYLE_RULE; + }, + isMediaRule: function(rule) { + return rule.type === CSSRule.MEDIA_RULE; + }, + isKeyframesRule: function(rule) { + return rule.type === CSSRule.KEYFRAMES_RULE; + }, + getHref: function(el) { + return el.href; + }, + getEventKey: function(event) { + var key = event.key; + if (isBlank(key)) { + key = event.keyIdentifier; + if (isBlank(key)) { + return 'Unidentified'; + } + if (key.startsWith('U+')) { + key = String.fromCharCode(parseInt(key.substring(2), 16)); + if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) { + key = _chromeNumKeyPadMap[key]; + } + } + } + if (_keyMap.hasOwnProperty(key)) { + key = _keyMap[key]; + } + return key; + }, + getGlobalEventTarget: function(target) { + if (target == "window") { + return window; + } else if (target == "document") { + return document; + } else if (target == "body") { + return document.body; + } + }, + getHistory: function() { + return window.history; + }, + getLocation: function() { + return window.location; + }, + getBaseHref: function() { + var href = getBaseElementHref(); + if (isBlank(href)) { + return null; + } + return relativePath(href); + }, + getUserAgent: function() { + return window.navigator.userAgent; + }, + setData: function(element, name, value) { + element.dataset[name] = value; + }, + getData: function(element, name) { + return element.dataset[name]; + }, + setGlobalVar: function(name, value) { + global[name] = value; + } + }, {makeCurrent: function() { + setRootDomAdapter(new BrowserDomAdapter()); + }}, $__super); + }(GenericBrowserDomAdapter)); + $__export("BrowserDomAdapter", BrowserDomAdapter); + baseElement = null; + urlParsingNode = null; + } + }; +}); + +System.register("angular2/src/facade/async", ["angular2/src/facade/lang", "rx"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/facade/async"; + var global, + Rx, + Promise, + PromiseWrapper, + TimerWrapper, + ObservableWrapper, + Observable, + EventEmitter; + return { + setters: [function($__m) { + global = $__m.global; + }, function($__m) { + Rx = $__m; + }], + execute: function() { + Promise = global.Promise; + $__export("Promise", Promise); + PromiseWrapper = (function() { + function PromiseWrapper() {} + return ($traceurRuntime.createClass)(PromiseWrapper, {}, { + resolve: function(obj) { + return Promise.resolve(obj); + }, + reject: function(obj, _) { + return Promise.reject(obj); + }, + catchError: function(promise, onError) { + return promise.catch(onError); + }, + all: function(promises) { + if (promises.length == 0) + return Promise.resolve([]); + return Promise.all(promises); + }, + then: function(promise, success, rejection) { + return promise.then(success, rejection); + }, + wrap: function(computation) { + return new Promise((function(res, rej) { + try { + res(computation()); + } catch (e) { + rej(e); + } + })); + }, + completer: function() { + var resolve; + var reject; + var p = new Promise(function(res, rej) { + resolve = res; + reject = rej; + }); + return { + promise: p, + resolve: resolve, + reject: reject + }; + } + }); + }()); + $__export("PromiseWrapper", PromiseWrapper); + TimerWrapper = (function() { + function TimerWrapper() {} + return ($traceurRuntime.createClass)(TimerWrapper, {}, { + setTimeout: function(fn, millis) { + return global.setTimeout(fn, millis); + }, + clearTimeout: function(id) { + global.clearTimeout(id); + }, + setInterval: function(fn, millis) { + return global.setInterval(fn, millis); + }, + clearInterval: function(id) { + global.clearInterval(id); + } + }); + }()); + $__export("TimerWrapper", TimerWrapper); + ObservableWrapper = (function() { + function ObservableWrapper() {} + return ($traceurRuntime.createClass)(ObservableWrapper, {}, { + subscribe: function(emitter, onNext) { + var onThrow = arguments[2] !== (void 0) ? arguments[2] : null; + var onReturn = arguments[3] !== (void 0) ? arguments[3] : null; + return emitter.observer({ + next: onNext, + throw: onThrow, + return: onReturn + }); + }, + isObservable: function(obs) { + return obs instanceof Observable; + }, + dispose: function(subscription) { + subscription.dispose(); + }, + callNext: function(emitter, value) { + emitter.next(value); + }, + callThrow: function(emitter, error) { + emitter.throw(error); + }, + callReturn: function(emitter) { + emitter.return(null); + } + }); + }()); + $__export("ObservableWrapper", ObservableWrapper); + Observable = (function() { + function Observable() {} + return ($traceurRuntime.createClass)(Observable, {observer: function(generator) { + return null; + }}, {}); + }()); + $__export("Observable", Observable); + EventEmitter = (function($__super) { + function EventEmitter() { + $traceurRuntime.superConstructor(EventEmitter).call(this); + if (Rx.hasOwnProperty('default')) { + this._subject = new Rx.default.Rx.Subject(); + this._immediateScheduler = Rx.default.Rx.Scheduler.immediate; + } else { + this._subject = new Rx.Subject(); + this._immediateScheduler = Rx.Scheduler.immediate; + } + } + return ($traceurRuntime.createClass)(EventEmitter, { + observer: function(generator) { + return this._subject.observeOn(this._immediateScheduler).subscribe((function(value) { + setTimeout((function() { + return generator.next(value); + })); + }), (function(error) { + return generator.throw ? generator.throw(error) : null; + }), (function() { + return generator.return ? generator.return() : null; + })); + }, + toRx: function() { + return this._subject; + }, + next: function(value) { + this._subject.onNext(value); + }, + throw: function(error) { + this._subject.onError(error); + }, + return: function(value) { + this._subject.onCompleted(); + } + }, {}, $__super); + }(Observable)); + $__export("EventEmitter", EventEmitter); + } + }; +}); + +System.register("angular2/src/change_detection/change_detector_ref", ["angular2/src/change_detection/constants"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/change_detector_ref"; + var DETACHED, + CHECK_ALWAYS, + ChangeDetectorRef; + return { + setters: [function($__m) { + DETACHED = $__m.DETACHED; + CHECK_ALWAYS = $__m.CHECK_ALWAYS; + }], + execute: function() { + ChangeDetectorRef = (function() { + function ChangeDetectorRef(_cd) { + this._cd = _cd; + } + return ($traceurRuntime.createClass)(ChangeDetectorRef, { + requestCheck: function() { + this._cd.markPathToRootAsCheckOnce(); + }, + detach: function() { + this._cd.mode = DETACHED; + }, + reattach: function() { + this._cd.mode = CHECK_ALWAYS; + this.requestCheck(); + } + }, {}); + }()); + $__export("ChangeDetectorRef", ChangeDetectorRef); + } + }; +}); + +System.register("angular2/src/change_detection/change_detection_util", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/exceptions", "angular2/src/change_detection/pipes/pipe", "angular2/src/change_detection/constants"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/change_detection_util"; + var CONST_EXPR, + isPresent, + isBlank, + BaseException, + StringMapWrapper, + DehydratedException, + ExpressionChangedAfterItHasBeenCheckedException, + WrappedValue, + CHECK_ALWAYS, + CHECK_ONCE, + ON_PUSH, + SimpleChange, + _simpleChangesIndex, + _simpleChanges, + ChangeDetectionUtil; + function _simpleChange(previousValue, currentValue) { + var index = _simpleChangesIndex++ % 20; + var s = _simpleChanges[index]; + s.previousValue = previousValue; + s.currentValue = currentValue; + return s; + } + return { + setters: [function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + DehydratedException = $__m.DehydratedException; + ExpressionChangedAfterItHasBeenCheckedException = $__m.ExpressionChangedAfterItHasBeenCheckedException; + }, function($__m) { + WrappedValue = $__m.WrappedValue; + }, function($__m) { + CHECK_ALWAYS = $__m.CHECK_ALWAYS; + CHECK_ONCE = $__m.CHECK_ONCE; + ON_PUSH = $__m.ON_PUSH; + }], + execute: function() { + SimpleChange = (function() { + function SimpleChange(previousValue, currentValue) { + this.previousValue = previousValue; + this.currentValue = currentValue; + } + return ($traceurRuntime.createClass)(SimpleChange, {isFirstChange: function() { + return this.previousValue === ChangeDetectionUtil.uninitialized; + }}, {}); + }()); + $__export("SimpleChange", SimpleChange); + _simpleChangesIndex = 0; + _simpleChanges = [new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null)]; + ChangeDetectionUtil = (function() { + function ChangeDetectionUtil() {} + return ($traceurRuntime.createClass)(ChangeDetectionUtil, {}, { + arrayFn0: function() { + return []; + }, + arrayFn1: function(a1) { + return [a1]; + }, + arrayFn2: function(a1, a2) { + return [a1, a2]; + }, + arrayFn3: function(a1, a2, a3) { + return [a1, a2, a3]; + }, + arrayFn4: function(a1, a2, a3, a4) { + return [a1, a2, a3, a4]; + }, + arrayFn5: function(a1, a2, a3, a4, a5) { + return [a1, a2, a3, a4, a5]; + }, + arrayFn6: function(a1, a2, a3, a4, a5, a6) { + return [a1, a2, a3, a4, a5, a6]; + }, + arrayFn7: function(a1, a2, a3, a4, a5, a6, a7) { + return [a1, a2, a3, a4, a5, a6, a7]; + }, + arrayFn8: function(a1, a2, a3, a4, a5, a6, a7, a8) { + return [a1, a2, a3, a4, a5, a6, a7, a8]; + }, + arrayFn9: function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return [a1, a2, a3, a4, a5, a6, a7, a8, a9]; + }, + operation_negate: function(value) { + return !value; + }, + operation_add: function(left, right) { + return left + right; + }, + operation_subtract: function(left, right) { + return left - right; + }, + operation_multiply: function(left, right) { + return left * right; + }, + operation_divide: function(left, right) { + return left / right; + }, + operation_remainder: function(left, right) { + return left % right; + }, + operation_equals: function(left, right) { + return left == right; + }, + operation_not_equals: function(left, right) { + return left != right; + }, + operation_identical: function(left, right) { + return left === right; + }, + operation_not_identical: function(left, right) { + return left !== right; + }, + operation_less_then: function(left, right) { + return left < right; + }, + operation_greater_then: function(left, right) { + return left > right; + }, + operation_less_or_equals_then: function(left, right) { + return left <= right; + }, + operation_greater_or_equals_then: function(left, right) { + return left >= right; + }, + operation_logical_and: function(left, right) { + return left && right; + }, + operation_logical_or: function(left, right) { + return left || right; + }, + cond: function(cond, trueVal, falseVal) { + return cond ? trueVal : falseVal; + }, + mapFn: function(keys) { + function buildMap(values) { + var res = StringMapWrapper.create(); + for (var i = 0; i < keys.length; ++i) { + StringMapWrapper.set(res, keys[i], values[i]); + } + return res; + } + switch (keys.length) { + case 0: + return (function() { + return []; + }); + case 1: + return (function(a1) { + return buildMap([a1]); + }); + case 2: + return (function(a1, a2) { + return buildMap([a1, a2]); + }); + case 3: + return (function(a1, a2, a3) { + return buildMap([a1, a2, a3]); + }); + case 4: + return (function(a1, a2, a3, a4) { + return buildMap([a1, a2, a3, a4]); + }); + case 5: + return (function(a1, a2, a3, a4, a5) { + return buildMap([a1, a2, a3, a4, a5]); + }); + case 6: + return (function(a1, a2, a3, a4, a5, a6) { + return buildMap([a1, a2, a3, a4, a5, a6]); + }); + case 7: + return (function(a1, a2, a3, a4, a5, a6, a7) { + return buildMap([a1, a2, a3, a4, a5, a6, a7]); + }); + case 8: + return (function(a1, a2, a3, a4, a5, a6, a7, a8) { + return buildMap([a1, a2, a3, a4, a5, a6, a7, a8]); + }); + case 9: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return buildMap([a1, a2, a3, a4, a5, a6, a7, a8, a9]); + }); + default: + throw new BaseException("Does not support literal maps with more than 9 elements"); + } + }, + keyedAccess: function(obj, args) { + return obj[args[0]]; + }, + unwrapValue: function(value) { + if (value instanceof WrappedValue) { + return value.wrapped; + } else { + return value; + } + }, + throwOnChange: function(proto, change) { + throw new ExpressionChangedAfterItHasBeenCheckedException(proto, change, null); + }, + throwDehydrated: function() { + throw new DehydratedException(); + }, + changeDetectionMode: function(strategy) { + return strategy == ON_PUSH ? CHECK_ONCE : CHECK_ALWAYS; + }, + simpleChange: function(previousValue, currentValue) { + return _simpleChange(previousValue, currentValue); + }, + addChange: function(changes, propertyName, change) { + if (isBlank(changes)) { + changes = {}; + } + changes[propertyName] = change; + return changes; + }, + isValueBlank: function(value) { + return isBlank(value); + }, + s: function(value) { + return isPresent(value) ? ("" + value) : ''; + } + }); + }()); + $__export("ChangeDetectionUtil", ChangeDetectionUtil); + ChangeDetectionUtil.uninitialized = CONST_EXPR(new Object()); + } + }; +}); + +System.register("angular2/src/change_detection/proto_change_detector", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/parser/ast", "angular2/src/change_detection/change_detection_util", "angular2/src/change_detection/dynamic_change_detector", "angular2/src/change_detection/directive_record", "angular2/src/change_detection/coalesce", "angular2/src/change_detection/proto_record"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/proto_change_detector"; + var BaseException, + isPresent, + isString, + ListWrapper, + ImplicitReceiver, + ChangeDetectionUtil, + DynamicChangeDetector, + DirectiveIndex, + coalesce, + ProtoRecord, + RecordType, + DynamicProtoChangeDetector, + ProtoRecordBuilder, + _ConvertAstIntoProtoRecords; + function _arrayFn(length) { + switch (length) { + case 0: + return ChangeDetectionUtil.arrayFn0; + case 1: + return ChangeDetectionUtil.arrayFn1; + case 2: + return ChangeDetectionUtil.arrayFn2; + case 3: + return ChangeDetectionUtil.arrayFn3; + case 4: + return ChangeDetectionUtil.arrayFn4; + case 5: + return ChangeDetectionUtil.arrayFn5; + case 6: + return ChangeDetectionUtil.arrayFn6; + case 7: + return ChangeDetectionUtil.arrayFn7; + case 8: + return ChangeDetectionUtil.arrayFn8; + case 9: + return ChangeDetectionUtil.arrayFn9; + default: + throw new BaseException("Does not support literal maps with more than 9 elements"); + } + } + function _mapPrimitiveName(keys) { + var stringifiedKeys = ListWrapper.join(ListWrapper.map(keys, (function(k) { + return isString(k) ? ("\"" + k + "\"") : ("" + k); + })), ", "); + return ("mapFn([" + stringifiedKeys + "])"); + } + function _operationToPrimitiveName(operation) { + switch (operation) { + case '+': + return "operation_add"; + case '-': + return "operation_subtract"; + case '*': + return "operation_multiply"; + case '/': + return "operation_divide"; + case '%': + return "operation_remainder"; + case '==': + return "operation_equals"; + case '!=': + return "operation_not_equals"; + case '===': + return "operation_identical"; + case '!==': + return "operation_not_identical"; + case '<': + return "operation_less_then"; + case '>': + return "operation_greater_then"; + case '<=': + return "operation_less_or_equals_then"; + case '>=': + return "operation_greater_or_equals_then"; + case '&&': + return "operation_logical_and"; + case '||': + return "operation_logical_or"; + default: + throw new BaseException(("Unsupported operation " + operation)); + } + } + function _operationToFunction(operation) { + switch (operation) { + case '+': + return ChangeDetectionUtil.operation_add; + case '-': + return ChangeDetectionUtil.operation_subtract; + case '*': + return ChangeDetectionUtil.operation_multiply; + case '/': + return ChangeDetectionUtil.operation_divide; + case '%': + return ChangeDetectionUtil.operation_remainder; + case '==': + return ChangeDetectionUtil.operation_equals; + case '!=': + return ChangeDetectionUtil.operation_not_equals; + case '===': + return ChangeDetectionUtil.operation_identical; + case '!==': + return ChangeDetectionUtil.operation_not_identical; + case '<': + return ChangeDetectionUtil.operation_less_then; + case '>': + return ChangeDetectionUtil.operation_greater_then; + case '<=': + return ChangeDetectionUtil.operation_less_or_equals_then; + case '>=': + return ChangeDetectionUtil.operation_greater_or_equals_then; + case '&&': + return ChangeDetectionUtil.operation_logical_and; + case '||': + return ChangeDetectionUtil.operation_logical_or; + default: + throw new BaseException(("Unsupported operation " + operation)); + } + } + function s(v) { + return isPresent(v) ? ("" + v) : ''; + } + function _interpolationFn(strings) { + var length = strings.length; + var c0 = length > 0 ? strings[0] : null; + var c1 = length > 1 ? strings[1] : null; + var c2 = length > 2 ? strings[2] : null; + var c3 = length > 3 ? strings[3] : null; + var c4 = length > 4 ? strings[4] : null; + var c5 = length > 5 ? strings[5] : null; + var c6 = length > 6 ? strings[6] : null; + var c7 = length > 7 ? strings[7] : null; + var c8 = length > 8 ? strings[8] : null; + var c9 = length > 9 ? strings[9] : null; + switch (length - 1) { + case 1: + return (function(a1) { + return c0 + s(a1) + c1; + }); + case 2: + return (function(a1, a2) { + return c0 + s(a1) + c1 + s(a2) + c2; + }); + case 3: + return (function(a1, a2, a3) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3; + }); + case 4: + return (function(a1, a2, a3, a4) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4; + }); + case 5: + return (function(a1, a2, a3, a4, a5) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5; + }); + case 6: + return (function(a1, a2, a3, a4, a5, a6) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6; + }); + case 7: + return (function(a1, a2, a3, a4, a5, a6, a7) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7; + }); + case 8: + return (function(a1, a2, a3, a4, a5, a6, a7, a8) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7 + s(a8) + c8; + }); + case 9: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7 + s(a8) + c8 + s(a9) + c9; + }); + default: + throw new BaseException("Does not support more than 9 expressions"); + } + } + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + isPresent = $__m.isPresent; + isString = $__m.isString; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + ImplicitReceiver = $__m.ImplicitReceiver; + }, function($__m) { + ChangeDetectionUtil = $__m.ChangeDetectionUtil; + }, function($__m) { + DynamicChangeDetector = $__m.DynamicChangeDetector; + }, function($__m) { + DirectiveIndex = $__m.DirectiveIndex; + }, function($__m) { + coalesce = $__m.coalesce; + }, function($__m) { + ProtoRecord = $__m.ProtoRecord; + RecordType = $__m.RecordType; + }], + execute: function() { + DynamicProtoChangeDetector = (function() { + function DynamicProtoChangeDetector(definition) { + this.definition = definition; + this._records = this._createRecords(definition); + } + return ($traceurRuntime.createClass)(DynamicProtoChangeDetector, { + instantiate: function(dispatcher) { + return new DynamicChangeDetector(this.definition.id, this.definition.strategy, dispatcher, this._records, this.definition.directiveRecords); + }, + _createRecords: function(definition) { + var recordBuilder = new ProtoRecordBuilder(); + ListWrapper.forEach(definition.bindingRecords, (function(b) { + recordBuilder.add(b, definition.variableNames); + })); + return coalesce(recordBuilder.records); + } + }, {}); + }()); + $__export("DynamicProtoChangeDetector", DynamicProtoChangeDetector); + ProtoRecordBuilder = (function() { + function ProtoRecordBuilder() { + this.records = []; + } + return ($traceurRuntime.createClass)(ProtoRecordBuilder, { + add: function(b) { + var variableNames = arguments[1] !== (void 0) ? arguments[1] : null; + var oldLast = ListWrapper.last(this.records); + if (isPresent(oldLast) && oldLast.bindingRecord.directiveRecord == b.directiveRecord) { + oldLast.lastInDirective = false; + } + this._appendRecords(b, variableNames); + var newLast = ListWrapper.last(this.records); + if (isPresent(newLast) && newLast !== oldLast) { + newLast.lastInBinding = true; + newLast.lastInDirective = true; + } + }, + _appendRecords: function(b, variableNames) { + if (b.isDirectiveLifecycle()) { + this.records.push(new ProtoRecord(RecordType.DIRECTIVE_LIFECYCLE, b.lifecycleEvent, null, [], [], -1, null, this.records.length + 1, b, null, false, false)); + } else { + _ConvertAstIntoProtoRecords.append(this.records, b, variableNames); + } + } + }, {}); + }()); + $__export("ProtoRecordBuilder", ProtoRecordBuilder); + _ConvertAstIntoProtoRecords = (function() { + function _ConvertAstIntoProtoRecords(_records, _bindingRecord, _expressionAsString, _variableNames) { + this._records = _records; + this._bindingRecord = _bindingRecord; + this._expressionAsString = _expressionAsString; + this._variableNames = _variableNames; + } + return ($traceurRuntime.createClass)(_ConvertAstIntoProtoRecords, { + visitImplicitReceiver: function(ast) { + return this._bindingRecord.implicitReceiver; + }, + visitInterpolation: function(ast) { + var args = this._visitAll(ast.expressions); + return this._addRecord(RecordType.INTERPOLATE, "interpolate", _interpolationFn(ast.strings), args, ast.strings, 0); + }, + visitLiteralPrimitive: function(ast) { + return this._addRecord(RecordType.CONST, "literal", ast.value, [], null, 0); + }, + visitAccessMember: function(ast) { + var receiver = ast.receiver.visit(this); + if (isPresent(this._variableNames) && ListWrapper.contains(this._variableNames, ast.name) && ast.receiver instanceof ImplicitReceiver) { + return this._addRecord(RecordType.LOCAL, ast.name, ast.name, [], null, receiver); + } else { + return this._addRecord(RecordType.PROPERTY, ast.name, ast.getter, [], null, receiver); + } + }, + visitSafeAccessMember: function(ast) { + var receiver = ast.receiver.visit(this); + return this._addRecord(RecordType.SAFE_PROPERTY, ast.name, ast.getter, [], null, receiver); + }, + visitMethodCall: function(ast) { + var receiver = ast.receiver.visit(this); + var args = this._visitAll(ast.args); + if (isPresent(this._variableNames) && ListWrapper.contains(this._variableNames, ast.name)) { + var target = this._addRecord(RecordType.LOCAL, ast.name, ast.name, [], null, receiver); + return this._addRecord(RecordType.INVOKE_CLOSURE, "closure", null, args, null, target); + } else { + return this._addRecord(RecordType.INVOKE_METHOD, ast.name, ast.fn, args, null, receiver); + } + }, + visitSafeMethodCall: function(ast) { + var receiver = ast.receiver.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(RecordType.SAFE_INVOKE_METHOD, ast.name, ast.fn, args, null, receiver); + }, + visitFunctionCall: function(ast) { + var target = ast.target.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(RecordType.INVOKE_CLOSURE, "closure", null, args, null, target); + }, + visitLiteralArray: function(ast) { + var primitiveName = ("arrayFn" + ast.expressions.length); + return this._addRecord(RecordType.PRIMITIVE_OP, primitiveName, _arrayFn(ast.expressions.length), this._visitAll(ast.expressions), null, 0); + }, + visitLiteralMap: function(ast) { + return this._addRecord(RecordType.PRIMITIVE_OP, _mapPrimitiveName(ast.keys), ChangeDetectionUtil.mapFn(ast.keys), this._visitAll(ast.values), null, 0); + }, + visitBinary: function(ast) { + var left = ast.left.visit(this); + var right = ast.right.visit(this); + return this._addRecord(RecordType.PRIMITIVE_OP, _operationToPrimitiveName(ast.operation), _operationToFunction(ast.operation), [left, right], null, 0); + }, + visitPrefixNot: function(ast) { + var exp = ast.expression.visit(this); + return this._addRecord(RecordType.PRIMITIVE_OP, "operation_negate", ChangeDetectionUtil.operation_negate, [exp], null, 0); + }, + visitConditional: function(ast) { + var c = ast.condition.visit(this); + var t = ast.trueExp.visit(this); + var f = ast.falseExp.visit(this); + return this._addRecord(RecordType.PRIMITIVE_OP, "cond", ChangeDetectionUtil.cond, [c, t, f], null, 0); + }, + visitPipe: function(ast) { + var value = ast.exp.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(RecordType.PIPE, ast.name, ast.name, args, null, value); + }, + visitKeyedAccess: function(ast) { + var obj = ast.obj.visit(this); + var key = ast.key.visit(this); + return this._addRecord(RecordType.KEYED_ACCESS, "keyedAccess", ChangeDetectionUtil.keyedAccess, [key], null, obj); + }, + visitAssignment: function(ast) { + throw new BaseException('Not supported'); + }, + visitChain: function(ast) { + throw new BaseException('Not supported'); + }, + visitIf: function(ast) { + throw new BaseException('Not supported'); + }, + _visitAll: function(asts) { + var res = ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }, + _addRecord: function(type, name, funcOrValue, args, fixedArgs, context) { + var selfIndex = this._records.length + 1; + if (context instanceof DirectiveIndex) { + this._records.push(new ProtoRecord(type, name, funcOrValue, args, fixedArgs, -1, context, selfIndex, this._bindingRecord, this._expressionAsString, false, false)); + } else { + this._records.push(new ProtoRecord(type, name, funcOrValue, args, fixedArgs, context, null, selfIndex, this._bindingRecord, this._expressionAsString, false, false)); + } + return selfIndex; + } + }, {append: function(records, b, variableNames) { + var c = new _ConvertAstIntoProtoRecords(records, b, b.ast.toString(), variableNames); + b.ast.visit(c); + }}); + }()); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/limit_to_pipe", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/facade/math"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/limit_to_pipe"; + var __decorate, + __metadata, + isBlank, + isString, + isArray, + StringWrapper, + BaseException, + CONST, + ListWrapper, + Math, + LimitToPipe, + LimitToPipeFactory; + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + isString = $__m.isString; + isArray = $__m.isArray; + StringWrapper = $__m.StringWrapper; + BaseException = $__m.BaseException; + CONST = $__m.CONST; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + Math = $__m.Math; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + LimitToPipe = (function() { + function LimitToPipe() {} + return ($traceurRuntime.createClass)(LimitToPipe, { + supports: function(obj) { + return LimitToPipe.supportsObj(obj); + }, + transform: function(value) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + if (isBlank(args) || args.length == 0) { + throw new BaseException('limitTo pipe requires one argument'); + } + var limit = args[0]; + var left = 0, + right = Math.min(limit, value.length); + if (limit < 0) { + left = Math.max(0, value.length + limit); + right = value.length; + } + if (isString(value)) { + return StringWrapper.substring(value, left, right); + } + return ListWrapper.slice(value, left, right); + }, + onDestroy: function() {} + }, {supportsObj: function(obj) { + return isString(obj) || isArray(obj); + }}); + }()); + $__export("LimitToPipe", LimitToPipe); + LimitToPipeFactory = (($traceurRuntime.createClass)(function() {}, { + supports: function(obj) { + return LimitToPipe.supportsObj(obj); + }, + create: function(cdRef) { + return new LimitToPipe(); + } + }, {})); + $__export("LimitToPipeFactory", LimitToPipeFactory); + $__export("LimitToPipeFactory", LimitToPipeFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], LimitToPipeFactory)); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/date_pipe", ["angular2/src/facade/lang", "angular2/src/facade/intl", "angular2/src/facade/collection", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/date_pipe"; + var __decorate, + __metadata, + isDate, + isNumber, + isPresent, + DateWrapper, + CONST, + DateFormatter, + StringMapWrapper, + BasePipe, + defaultLocale, + DatePipe; + return { + setters: [function($__m) { + isDate = $__m.isDate; + isNumber = $__m.isNumber; + isPresent = $__m.isPresent; + DateWrapper = $__m.DateWrapper; + CONST = $__m.CONST; + }, function($__m) { + DateFormatter = $__m.DateFormatter; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + BasePipe = $__m.BasePipe; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + defaultLocale = 'en-US'; + DatePipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, { + transform: function(value, args) { + var pattern = isPresent(args) && args.length > 0 ? args[0] : 'mediumDate'; + if (isNumber(value)) { + value = DateWrapper.fromMillis(value); + } + if (StringMapWrapper.contains(DatePipe._ALIASES, pattern)) { + pattern = StringMapWrapper.get(DatePipe._ALIASES, pattern); + } + return DateFormatter.format(value, defaultLocale, pattern); + }, + supports: function(obj) { + return isDate(obj) || isNumber(obj); + }, + create: function(cdRef) { + return this; + } + }, {}, $__super); + }(BasePipe)); + $__export("DatePipe", DatePipe); + DatePipe._ALIASES = { + 'medium': 'yMMMdjms', + 'short': 'yMdjm', + 'fullDate': 'yMMMMEEEEd', + 'longDate': 'yMMMMd', + 'mediumDate': 'yMMMd', + 'shortDate': 'yMd', + 'mediumTime': 'jms', + 'shortTime': 'jm' + }; + $__export("DatePipe", DatePipe = __decorate([CONST(), __metadata('design:paramtypes', [])], DatePipe)); + } + }; +}); + +System.register("angular2/src/core/compiler/view", ["angular2/src/facade/collection", "angular2/src/change_detection/change_detection", "angular2/src/core/compiler/element_binder", "angular2/src/facade/lang", "angular2/src/core/compiler/view_ref"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view"; + var ListWrapper, + MapWrapper, + Map, + StringMapWrapper, + Locals, + ElementBinder, + isPresent, + isBlank, + BaseException, + ViewRef, + ProtoViewRef, + internalView, + AppProtoViewMergeMapping, + AppViewContainer, + AppView, + DebugContext, + _Context, + EventEvaluationError, + AppProtoView; + function inverseIndexMapping(input, resultLength) { + var result = ListWrapper.createGrowableSize(resultLength); + for (var i = 0; i < input.length; i++) { + var value = input[i]; + if (isPresent(value)) { + result[input[i]] = i; + } + } + return result; + } + function _localsToStringMap(locals) { + var res = {}; + var c = locals; + while (isPresent(c)) { + res = StringMapWrapper.merge(res, MapWrapper.toStringMap(c.current)); + c = c.parent; + } + return res; + } + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + MapWrapper = $__m.MapWrapper; + Map = $__m.Map; + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + Locals = $__m.Locals; + }, function($__m) { + ElementBinder = $__m.ElementBinder; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + ViewRef = $__m.ViewRef; + ProtoViewRef = $__m.ProtoViewRef; + internalView = $__m.internalView; + }], + execute: function() { + AppProtoViewMergeMapping = (function() { + function AppProtoViewMergeMapping(renderProtoViewMergeMapping) { + this.renderProtoViewRef = renderProtoViewMergeMapping.mergedProtoViewRef; + this.renderFragmentCount = renderProtoViewMergeMapping.fragmentCount; + this.renderElementIndices = renderProtoViewMergeMapping.mappedElementIndices; + this.renderInverseElementIndices = inverseIndexMapping(this.renderElementIndices, renderProtoViewMergeMapping.mappedElementCount); + this.renderTextIndices = renderProtoViewMergeMapping.mappedTextIndices; + this.hostElementIndicesByViewIndex = renderProtoViewMergeMapping.hostElementIndicesByViewIndex; + this.nestedViewIndicesByElementIndex = inverseIndexMapping(this.hostElementIndicesByViewIndex, this.renderElementIndices.length); + this.nestedViewCountByViewIndex = renderProtoViewMergeMapping.nestedViewCountByViewIndex; + } + return ($traceurRuntime.createClass)(AppProtoViewMergeMapping, {}, {}); + }()); + $__export("AppProtoViewMergeMapping", AppProtoViewMergeMapping); + AppViewContainer = (function() { + function AppViewContainer() { + this.views = []; + } + return ($traceurRuntime.createClass)(AppViewContainer, {}, {}); + }()); + $__export("AppViewContainer", AppViewContainer); + AppView = (function() { + function AppView(renderer, proto, mainMergeMapping, viewOffset, elementOffset, textOffset, protoLocals, render, renderFragment) { + this.renderer = renderer; + this.proto = proto; + this.mainMergeMapping = mainMergeMapping; + this.viewOffset = viewOffset; + this.elementOffset = elementOffset; + this.textOffset = textOffset; + this.render = render; + this.renderFragment = renderFragment; + this.views = null; + this.elementInjectors = null; + this.viewContainers = null; + this.preBuiltObjects = null; + this.changeDetector = null; + this.context = null; + this.ref = new ViewRef(this); + this.locals = new Locals(null, MapWrapper.clone(protoLocals)); + } + return ($traceurRuntime.createClass)(AppView, { + init: function(changeDetector, elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers) { + this.changeDetector = changeDetector; + this.elementInjectors = elementInjectors; + this.rootElementInjectors = rootElementInjectors; + this.preBuiltObjects = preBuiltObjects; + this.views = views; + this.elementRefs = elementRefs; + this.viewContainers = viewContainers; + }, + setLocal: function(contextName, value) { + if (!this.hydrated()) + throw new BaseException('Cannot set locals on dehydrated view.'); + if (!this.proto.variableBindings.has(contextName)) { + return ; + } + var templateName = this.proto.variableBindings.get(contextName); + this.locals.set(templateName, value); + }, + hydrated: function() { + return isPresent(this.context); + }, + triggerEventHandlers: function(eventName, eventObj, boundElementIndex) { + var locals = new Map(); + locals.set('$event', eventObj); + this.dispatchEvent(boundElementIndex, eventName, locals); + }, + notifyOnBinding: function(b, currentValue) { + if (b.isTextNode()) { + this.renderer.setText(this.render, this.mainMergeMapping.renderTextIndices[b.elementIndex + this.textOffset], currentValue); + } else { + var elementRef = this.elementRefs[this.elementOffset + b.elementIndex]; + if (b.isElementProperty()) { + this.renderer.setElementProperty(elementRef, b.propertyName, currentValue); + } else if (b.isElementAttribute()) { + this.renderer.setElementAttribute(elementRef, b.propertyName, currentValue); + } else if (b.isElementClass()) { + this.renderer.setElementClass(elementRef, b.propertyName, currentValue); + } else if (b.isElementStyle()) { + var unit = isPresent(b.propertyUnit) ? b.propertyUnit : ''; + this.renderer.setElementStyle(elementRef, b.propertyName, ("" + currentValue + unit)); + } else { + throw new BaseException('Unsupported directive record'); + } + } + }, + notifyOnAllChangesDone: function() { + var eiCount = this.proto.elementBinders.length; + var ei = this.elementInjectors; + for (var i = eiCount - 1; i >= 0; i--) { + if (isPresent(ei[i + this.elementOffset])) + ei[i + this.elementOffset].onAllChangesDone(); + } + }, + getDirectiveFor: function(directive) { + var elementInjector = this.elementInjectors[this.elementOffset + directive.elementIndex]; + return elementInjector.getDirectiveAtIndex(directive.directiveIndex); + }, + getNestedView: function(boundElementIndex) { + var viewIndex = this.mainMergeMapping.nestedViewIndicesByElementIndex[boundElementIndex]; + return isPresent(viewIndex) ? this.views[viewIndex] : null; + }, + getHostElement: function() { + var boundElementIndex = this.mainMergeMapping.hostElementIndicesByViewIndex[this.viewOffset]; + return isPresent(boundElementIndex) ? this.elementRefs[boundElementIndex] : null; + }, + getDebugContext: function(elementIndex, directiveIndex) { + try { + var offsettedIndex = this.elementOffset + elementIndex; + var hasRefForIndex = offsettedIndex < this.elementRefs.length; + var elementRef = hasRefForIndex ? this.elementRefs[this.elementOffset + elementIndex] : null; + var host = this.getHostElement(); + var ei = hasRefForIndex ? this.elementInjectors[this.elementOffset + elementIndex] : null; + var element = isPresent(elementRef) ? elementRef.nativeElement : null; + var componentElement = isPresent(host) ? host.nativeElement : null; + var directive = isPresent(directiveIndex) ? this.getDirectiveFor(directiveIndex) : null; + var injector = isPresent(ei) ? ei.getInjector() : null; + return new DebugContext(element, componentElement, directive, this.context, _localsToStringMap(this.locals), injector); + } catch (e) { + return null; + } + }, + getDetectorFor: function(directive) { + var childView = this.getNestedView(this.elementOffset + directive.elementIndex); + return isPresent(childView) ? childView.changeDetector : null; + }, + invokeElementMethod: function(elementIndex, methodName, args) { + this.renderer.invokeElementMethod(this.elementRefs[elementIndex], methodName, args); + }, + dispatchRenderEvent: function(renderElementIndex, eventName, locals) { + var elementRef = this.elementRefs[this.mainMergeMapping.renderInverseElementIndices[renderElementIndex]]; + var view = internalView(elementRef.parentView); + return view.dispatchEvent(elementRef.boundElementIndex, eventName, locals); + }, + dispatchEvent: function(boundElementIndex, eventName, locals) { + var $__0 = this; + try { + var allowDefaultBehavior = true; + if (this.hydrated()) { + var elBinder = this.proto.elementBinders[boundElementIndex - this.elementOffset]; + if (isBlank(elBinder.hostListeners)) + return allowDefaultBehavior; + var eventMap = elBinder.hostListeners[eventName]; + if (isBlank(eventMap)) + return allowDefaultBehavior; + MapWrapper.forEach(eventMap, (function(expr, directiveIndex) { + var context; + if (directiveIndex === -1) { + context = $__0.context; + } else { + context = $__0.elementInjectors[boundElementIndex].getDirectiveAtIndex(directiveIndex); + } + var result = expr.eval(context, new Locals($__0.locals, locals)); + if (isPresent(result)) { + allowDefaultBehavior = allowDefaultBehavior && result == true; + } + })); + } + return allowDefaultBehavior; + } catch (e) { + var c = this.getDebugContext(boundElementIndex - this.elementOffset, null); + var context = isPresent(c) ? new _Context(c.element, c.componentElement, c.context, c.locals, c.injector) : null; + throw new EventEvaluationError(eventName, e, e.stack, context); + } + } + }, {}); + }()); + $__export("AppView", AppView); + DebugContext = (function() { + function DebugContext(element, componentElement, directive, context, locals, injector) { + this.element = element; + this.componentElement = componentElement; + this.directive = directive; + this.context = context; + this.locals = locals; + this.injector = injector; + } + return ($traceurRuntime.createClass)(DebugContext, {}, {}); + }()); + $__export("DebugContext", DebugContext); + _Context = (function() { + function _Context(element, componentElement, context, locals, injector) { + this.element = element; + this.componentElement = componentElement; + this.context = context; + this.locals = locals; + this.injector = injector; + } + return ($traceurRuntime.createClass)(_Context, {}, {}); + }()); + EventEvaluationError = (function($__super) { + function EventEvaluationError(eventName, originalException, originalStack, context) { + $traceurRuntime.superConstructor(EventEvaluationError).call(this, ("Error during evaluation of \"" + eventName + "\""), originalException, originalStack, context); + } + return ($traceurRuntime.createClass)(EventEvaluationError, {}, {}, $__super); + }(BaseException)); + AppProtoView = (function() { + function AppProtoView(type, isEmbeddedFragment, render, protoChangeDetector, variableBindings, variableLocations, textBindingCount) { + var $__0 = this; + this.type = type; + this.isEmbeddedFragment = isEmbeddedFragment; + this.render = render; + this.protoChangeDetector = protoChangeDetector; + this.variableBindings = variableBindings; + this.variableLocations = variableLocations; + this.textBindingCount = textBindingCount; + this.elementBinders = []; + this.protoLocals = new Map(); + this.ref = new ProtoViewRef(this); + if (isPresent(variableBindings)) { + MapWrapper.forEach(variableBindings, (function(templateName, _) { + $__0.protoLocals.set(templateName, null); + })); + } + } + return ($traceurRuntime.createClass)(AppProtoView, { + bindElement: function(parent, distanceToParent, protoElementInjector) { + var componentDirective = arguments[3] !== (void 0) ? arguments[3] : null; + var elBinder = new ElementBinder(this.elementBinders.length, parent, distanceToParent, protoElementInjector, componentDirective); + this.elementBinders.push(elBinder); + return elBinder; + }, + bindEvent: function(eventBindings, boundElementIndex) { + var directiveIndex = arguments[2] !== (void 0) ? arguments[2] : -1; + var elBinder = this.elementBinders[boundElementIndex]; + var events = elBinder.hostListeners; + if (isBlank(events)) { + events = StringMapWrapper.create(); + elBinder.hostListeners = events; + } + for (var i = 0; i < eventBindings.length; i++) { + var eventBinding = eventBindings[i]; + var eventName = eventBinding.fullName; + var event = StringMapWrapper.get(events, eventName); + if (isBlank(event)) { + event = new Map(); + StringMapWrapper.set(events, eventName, event); + } + event.set(directiveIndex, eventBinding.source); + } + } + }, {}); + }()); + $__export("AppProtoView", AppProtoView); + } + }; +}); + +System.register("angular2/src/core/compiler/view_manager_utils", ["angular2/di", "angular2/src/facade/collection", "angular2/src/core/compiler/element_injector", "angular2/src/facade/lang", "angular2/src/core/compiler/view", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/render/api"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view_manager_utils"; + var __decorate, + __metadata, + Injector, + Injectable, + ListWrapper, + MapWrapper, + eli, + isPresent, + isBlank, + viewModule, + internalView, + ElementRef, + TemplateRef, + ViewType, + AppViewManagerUtils; + return { + setters: [function($__m) { + Injector = $__m.Injector; + Injectable = $__m.Injectable; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + MapWrapper = $__m.MapWrapper; + }, function($__m) { + eli = $__m; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + }, function($__m) { + viewModule = $__m; + }, function($__m) { + internalView = $__m.internalView; + }, function($__m) { + ElementRef = $__m.ElementRef; + }, function($__m) { + TemplateRef = $__m.TemplateRef; + }, function($__m) { + ViewType = $__m.ViewType; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + AppViewManagerUtils = (($traceurRuntime.createClass)(function() {}, { + getComponentInstance: function(parentView, boundElementIndex) { + var eli = parentView.elementInjectors[boundElementIndex]; + return eli.getComponent(); + }, + createView: function(mergedParentViewProto, renderViewWithFragments, viewManager, renderer) { + var renderFragments = renderViewWithFragments.fragmentRefs; + var renderView = renderViewWithFragments.viewRef; + var elementCount = mergedParentViewProto.mergeMapping.renderElementIndices.length; + var viewCount = mergedParentViewProto.mergeMapping.nestedViewCountByViewIndex[0] + 1; + var elementRefs = ListWrapper.createFixedSize(elementCount); + var viewContainers = ListWrapper.createFixedSize(elementCount); + var preBuiltObjects = ListWrapper.createFixedSize(elementCount); + var elementInjectors = ListWrapper.createFixedSize(elementCount); + var views = ListWrapper.createFixedSize(viewCount); + var elementOffset = 0; + var textOffset = 0; + var fragmentIdx = 0; + for (var viewOffset = 0; viewOffset < viewCount; viewOffset++) { + var hostElementIndex = mergedParentViewProto.mergeMapping.hostElementIndicesByViewIndex[viewOffset]; + var parentView = isPresent(hostElementIndex) ? internalView(elementRefs[hostElementIndex].parentView) : null; + var protoView = isPresent(hostElementIndex) ? parentView.proto.elementBinders[hostElementIndex - parentView.elementOffset].nestedProtoView : mergedParentViewProto; + var renderFragment = null; + if (viewOffset === 0 || protoView.type === ViewType.EMBEDDED) { + renderFragment = renderFragments[fragmentIdx++]; + } + var currentView = new viewModule.AppView(renderer, protoView, mergedParentViewProto.mergeMapping, viewOffset, elementOffset, textOffset, protoView.protoLocals, renderView, renderFragment); + views[viewOffset] = currentView; + var rootElementInjectors = []; + for (var binderIdx = 0; binderIdx < protoView.elementBinders.length; binderIdx++) { + var binder = protoView.elementBinders[binderIdx]; + var boundElementIndex = elementOffset + binderIdx; + var elementInjector = null; + var protoElementInjector = binder.protoElementInjector; + if (isPresent(protoElementInjector)) { + if (isPresent(protoElementInjector.parent)) { + var parentElementInjector = elementInjectors[elementOffset + protoElementInjector.parent.index]; + elementInjector = protoElementInjector.instantiate(parentElementInjector); + } else { + elementInjector = protoElementInjector.instantiate(null); + rootElementInjectors.push(elementInjector); + } + } + elementInjectors[boundElementIndex] = elementInjector; + var el = new ElementRef(currentView.ref, boundElementIndex, mergedParentViewProto.mergeMapping.renderElementIndices[boundElementIndex], renderer); + elementRefs[el.boundElementIndex] = el; + if (isPresent(elementInjector)) { + var templateRef = binder.hasEmbeddedProtoView() ? new TemplateRef(el) : null; + preBuiltObjects[boundElementIndex] = new eli.PreBuiltObjects(viewManager, currentView, el, templateRef); + } + } + currentView.init(protoView.protoChangeDetector.instantiate(currentView), elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers); + if (isPresent(parentView) && protoView.type === ViewType.COMPONENT) { + parentView.changeDetector.addShadowDomChild(currentView.changeDetector); + } + elementOffset += protoView.elementBinders.length; + textOffset += protoView.textBindingCount; + } + return views[0]; + }, + hydrateRootHostView: function(hostView, injector) { + this._hydrateView(hostView, injector, null, new Object(), null); + }, + attachViewInContainer: function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view) { + if (isBlank(contextView)) { + contextView = parentView; + contextBoundElementIndex = boundElementIndex; + } + parentView.changeDetector.addChild(view.changeDetector); + var viewContainer = parentView.viewContainers[boundElementIndex]; + if (isBlank(viewContainer)) { + viewContainer = new viewModule.AppViewContainer(); + parentView.viewContainers[boundElementIndex] = viewContainer; + } + ListWrapper.insert(viewContainer.views, atIndex, view); + var sibling; + if (atIndex == 0) { + sibling = null; + } else { + sibling = ListWrapper.last(viewContainer.views[atIndex - 1].rootElementInjectors); + } + var elementInjector = contextView.elementInjectors[contextBoundElementIndex]; + for (var i = view.rootElementInjectors.length - 1; i >= 0; i--) { + if (isPresent(elementInjector.parent)) { + view.rootElementInjectors[i].linkAfter(elementInjector.parent, sibling); + } else { + contextView.rootElementInjectors.push(view.rootElementInjectors[i]); + } + } + }, + detachViewInContainer: function(parentView, boundElementIndex, atIndex) { + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + view.changeDetector.remove(); + ListWrapper.removeAt(viewContainer.views, atIndex); + for (var i = 0; i < view.rootElementInjectors.length; ++i) { + var inj = view.rootElementInjectors[i]; + if (isPresent(inj.parent)) { + inj.unlink(); + } else { + var removeIdx = ListWrapper.indexOf(parentView.rootElementInjectors, inj); + if (removeIdx >= 0) { + ListWrapper.removeAt(parentView.rootElementInjectors, removeIdx); + } + } + } + }, + hydrateViewInContainer: function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, imperativelyCreatedBindings) { + if (isBlank(contextView)) { + contextView = parentView; + contextBoundElementIndex = boundElementIndex; + } + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + var elementInjector = contextView.elementInjectors[contextBoundElementIndex]; + var injector = isPresent(imperativelyCreatedBindings) ? Injector.fromResolvedBindings(imperativelyCreatedBindings) : null; + this._hydrateView(view, injector, elementInjector.getHost(), contextView.context, contextView.locals); + }, + _hydrateView: function(initView, imperativelyCreatedInjector, hostElementInjector, context, parentLocals) { + var viewIdx = initView.viewOffset; + var endViewOffset = viewIdx + initView.mainMergeMapping.nestedViewCountByViewIndex[viewIdx]; + while (viewIdx <= endViewOffset) { + var currView = initView.views[viewIdx]; + var currProtoView = currView.proto; + if (currView !== initView && currView.proto.type === ViewType.EMBEDDED) { + viewIdx += initView.mainMergeMapping.nestedViewCountByViewIndex[viewIdx] + 1; + } else { + if (currView !== initView) { + imperativelyCreatedInjector = null; + parentLocals = null; + var hostElementIndex = initView.mainMergeMapping.hostElementIndicesByViewIndex[viewIdx]; + hostElementInjector = initView.elementInjectors[hostElementIndex]; + context = hostElementInjector.getComponent(); + } + currView.context = context; + currView.locals.parent = parentLocals; + var binders = currProtoView.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var boundElementIndex = binderIdx + currView.elementOffset; + var elementInjector = initView.elementInjectors[boundElementIndex]; + if (isPresent(elementInjector)) { + elementInjector.hydrate(imperativelyCreatedInjector, hostElementInjector, currView.preBuiltObjects[boundElementIndex]); + this._populateViewLocals(currView, elementInjector, boundElementIndex); + this._setUpEventEmitters(currView, elementInjector, boundElementIndex); + this._setUpHostActions(currView, elementInjector, boundElementIndex); + } + } + var pipes = this._getPipes(imperativelyCreatedInjector, hostElementInjector); + currView.changeDetector.hydrate(currView.context, currView.locals, currView, pipes); + viewIdx++; + } + } + }, + _getPipes: function(imperativelyCreatedInjector, hostElementInjector) { + var pipesKey = eli.StaticKeys.instance().pipesKey; + if (isPresent(imperativelyCreatedInjector)) + return imperativelyCreatedInjector.getOptional(pipesKey); + if (isPresent(hostElementInjector)) + return hostElementInjector.getPipes(); + return null; + }, + _populateViewLocals: function(view, elementInjector, boundElementIdx) { + if (isPresent(elementInjector.getDirectiveVariableBindings())) { + MapWrapper.forEach(elementInjector.getDirectiveVariableBindings(), (function(directiveIndex, name) { + if (isBlank(directiveIndex)) { + view.locals.set(name, view.elementRefs[boundElementIdx].nativeElement); + } else { + view.locals.set(name, elementInjector.getDirectiveAtIndex(directiveIndex)); + } + })); + } + }, + _setUpEventEmitters: function(view, elementInjector, boundElementIndex) { + var emitters = elementInjector.getEventEmitterAccessors(); + for (var directiveIndex = 0; directiveIndex < emitters.length; ++directiveIndex) { + var directiveEmitters = emitters[directiveIndex]; + var directive = elementInjector.getDirectiveAtIndex(directiveIndex); + for (var eventIndex = 0; eventIndex < directiveEmitters.length; ++eventIndex) { + var eventEmitterAccessor = directiveEmitters[eventIndex]; + eventEmitterAccessor.subscribe(view, boundElementIndex, directive); + } + } + }, + _setUpHostActions: function(view, elementInjector, boundElementIndex) { + var hostActions = elementInjector.getHostActionAccessors(); + for (var directiveIndex = 0; directiveIndex < hostActions.length; ++directiveIndex) { + var directiveHostActions = hostActions[directiveIndex]; + var directive = elementInjector.getDirectiveAtIndex(directiveIndex); + for (var index = 0; index < directiveHostActions.length; ++index) { + var hostActionAccessor = directiveHostActions[index]; + hostActionAccessor.subscribe(view, boundElementIndex, directive); + } + } + }, + dehydrateView: function(initView) { + var endViewOffset = initView.viewOffset + initView.mainMergeMapping.nestedViewCountByViewIndex[initView.viewOffset]; + for (var viewIdx = initView.viewOffset; viewIdx <= endViewOffset; viewIdx++) { + var currView = initView.views[viewIdx]; + if (currView.hydrated()) { + if (isPresent(currView.locals)) { + currView.locals.clearValues(); + } + currView.context = null; + currView.changeDetector.dehydrate(); + var binders = currView.proto.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var eli = initView.elementInjectors[currView.elementOffset + binderIdx]; + if (isPresent(eli)) { + eli.dehydrate(); + } + } + } + } + } + }, {})); + $__export("AppViewManagerUtils", AppViewManagerUtils); + $__export("AppViewManagerUtils", AppViewManagerUtils = __decorate([Injectable(), __metadata('design:paramtypes', [])], AppViewManagerUtils)); + } + }; +}); + +System.register("angular2/src/core/compiler/view_resolver", ["angular2/di", "angular2/src/core/annotations_impl/view", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/reflection/reflection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view_resolver"; + var __decorate, + __metadata, + Injectable, + View, + stringify, + isBlank, + BaseException, + Map, + reflector, + ViewResolver; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + View = $__m.View; + }, function($__m) { + stringify = $__m.stringify; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + Map = $__m.Map; + }, function($__m) { + reflector = $__m.reflector; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + ViewResolver = (($traceurRuntime.createClass)(function() { + this._cache = new Map(); + }, { + resolve: function(component) { + var view = this._cache.get(component); + if (isBlank(view)) { + view = this._resolve(component); + this._cache.set(component, view); + } + return view; + }, + _resolve: function(component) { + var annotations = reflector.annotations(component); + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + if (annotation instanceof View) { + return annotation; + } + } + throw new BaseException(("No View annotation found on component " + stringify(component))); + } + }, {})); + $__export("ViewResolver", ViewResolver); + $__export("ViewResolver", ViewResolver = __decorate([Injectable(), __metadata('design:paramtypes', [])], ViewResolver)); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/style_inliner", ["angular2/di", "angular2/src/render/xhr", "angular2/src/facade/collection", "angular2/src/services/url_resolver", "angular2/src/render/dom/compiler/style_url_resolver", "angular2/src/facade/lang", "angular2/src/facade/async"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/style_inliner"; + var __decorate, + __metadata, + Injectable, + XHR, + ListWrapper, + UrlResolver, + StyleUrlResolver, + isBlank, + isPresent, + RegExpWrapper, + StringWrapper, + isPromise, + PromiseWrapper, + StyleInliner, + _importRe, + _urlRe, + _mediaQueryRe; + function _extractUrl(importRule) { + var match = RegExpWrapper.firstMatch(_urlRe, importRule); + if (isBlank(match)) + return null; + return isPresent(match[1]) ? match[1] : match[2]; + } + function _extractMediaQuery(importRule) { + var match = RegExpWrapper.firstMatch(_mediaQueryRe, importRule); + if (isBlank(match)) + return null; + var mediaQuery = match[1].trim(); + return (mediaQuery.length > 0) ? mediaQuery : null; + } + function _wrapInMediaRule(css, query) { + return (isBlank(query)) ? css : ("@media " + query + " {\n" + css + "\n}"); + } + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + XHR = $__m.XHR; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + UrlResolver = $__m.UrlResolver; + }, function($__m) { + StyleUrlResolver = $__m.StyleUrlResolver; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + RegExpWrapper = $__m.RegExpWrapper; + StringWrapper = $__m.StringWrapper; + isPromise = $__m.isPromise; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + StyleInliner = (($traceurRuntime.createClass)(function(_xhr, _styleUrlResolver, _urlResolver) { + this._xhr = _xhr; + this._styleUrlResolver = _styleUrlResolver; + this._urlResolver = _urlResolver; + }, { + inlineImports: function(cssText, baseUrl) { + return this._inlineImports(cssText, baseUrl, []); + }, + _inlineImports: function(cssText, baseUrl, inlinedUrls) { + var $__0 = this; + var partIndex = 0; + var parts = StringWrapper.split(cssText, _importRe); + if (parts.length === 1) { + return cssText; + } + var promises = []; + while (partIndex < parts.length - 1) { + var prefix = parts[partIndex]; + var rule = parts[partIndex + 1]; + var url = _extractUrl(rule); + if (isPresent(url)) { + url = this._urlResolver.resolve(baseUrl, url); + } + var mediaQuery = _extractMediaQuery(rule); + var promise = void 0; + if (isBlank(url)) { + promise = PromiseWrapper.resolve(("/* Invalid import rule: \"@import " + rule + ";\" */")); + } else if (ListWrapper.contains(inlinedUrls, url)) { + promise = PromiseWrapper.resolve(prefix); + } else { + inlinedUrls.push(url); + promise = PromiseWrapper.then(this._xhr.get(url), (function(rawCss) { + var inlinedCss = $__0._inlineImports(rawCss, url, inlinedUrls); + if (isPromise(inlinedCss)) { + return inlinedCss.then((function(css) { + return prefix + $__0._transformImportedCss(css, mediaQuery, url) + '\n'; + })); + } else { + return prefix + $__0._transformImportedCss(inlinedCss, mediaQuery, url) + '\n'; + } + }), (function(error) { + return ("/* failed to import " + url + " */\n"); + })); + } + promises.push(promise); + partIndex += 2; + } + return PromiseWrapper.all(promises).then(function(cssParts) { + var cssText = cssParts.join(''); + if (partIndex < parts.length) { + cssText += parts[partIndex]; + } + return cssText; + }); + }, + _transformImportedCss: function(css, mediaQuery, url) { + css = this._styleUrlResolver.resolveUrls(css, url); + return _wrapInMediaRule(css, mediaQuery); + } + }, {})); + $__export("StyleInliner", StyleInliner); + $__export("StyleInliner", StyleInliner = __decorate([Injectable(), __metadata('design:paramtypes', [XHR, StyleUrlResolver, UrlResolver])], StyleInliner)); + _importRe = /@import\s+([^;]+);/g; + _urlRe = RegExpWrapper.create('url\\(\\s*?[\'"]?([^\'")]+)[\'"]?|' + '[\'"]([^\'")]+)[\'"]'); + _mediaQueryRe = /['"][^'"]+['"]\s*\)?\s*(.*)/g; + } + }; +}); + +System.register("angular2/src/render/dom/events/hammer_gestures", ["angular2/src/render/dom/events/hammer_common", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/events/hammer_gestures"; + var HammerGesturesPluginCommon, + isPresent, + BaseException, + HammerGesturesPlugin; + return { + setters: [function($__m) { + HammerGesturesPluginCommon = $__m.HammerGesturesPluginCommon; + }, function($__m) { + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + }], + execute: function() { + HammerGesturesPlugin = (function($__super) { + function HammerGesturesPlugin() { + $traceurRuntime.superConstructor(HammerGesturesPlugin).call(this); + } + return ($traceurRuntime.createClass)(HammerGesturesPlugin, { + supports: function(eventName) { + if (!$traceurRuntime.superGet(this, HammerGesturesPlugin.prototype, "supports").call(this, eventName)) + return false; + if (!isPresent(window['Hammer'])) { + throw new BaseException(("Hammer.js is not loaded, can not bind " + eventName + " event")); + } + return true; + }, + addEventListener: function(element, eventName, handler, shouldSupportBubble) { + if (shouldSupportBubble) + throw new BaseException('Hammer.js plugin does not support bubbling gestures.'); + var zone = this.manager.getZone(); + eventName = eventName.toLowerCase(); + zone.runOutsideAngular(function() { + var mc = new Hammer(element); + mc.get('pinch').set({enable: true}); + mc.get('rotate').set({enable: true}); + mc.on(eventName, function(eventObj) { + zone.run(function() { + handler(eventObj); + }); + }); + }); + } + }, {}, $__super); + }(HammerGesturesPluginCommon)); + $__export("HammerGesturesPlugin", HammerGesturesPlugin); + } + }; +}); + +System.register("angular2/src/core/testability/testability", ["angular2/di", "angular2/src/dom/dom_adapter", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/core/testability/get_testability", "angular2/src/core/zone/ng_zone", "angular2/src/facade/async"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/testability/testability"; + var __decorate, + __metadata, + Injectable, + DOM, + Map, + BaseException, + getTestabilityModule, + NgZone, + PromiseWrapper, + Testability, + TestabilityRegistry; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + Map = $__m.Map; + }, function($__m) { + BaseException = $__m.BaseException; + }, function($__m) { + getTestabilityModule = $__m; + }, function($__m) { + NgZone = $__m.NgZone; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Testability = (($traceurRuntime.createClass)(function(_ngZone) { + this._ngZone = _ngZone; + this._pendingCount = 0; + this._callbacks = []; + this._isAngularEventPending = false; + this._watchAngularEvents(_ngZone); + }, { + _watchAngularEvents: function(_ngZone) { + var $__0 = this; + _ngZone.overrideOnTurnStart((function() { + $__0._isAngularEventPending = true; + })); + _ngZone.overrideOnEventDone((function() { + $__0._isAngularEventPending = false; + $__0._runCallbacksIfReady(); + }), true); + }, + increasePendingRequestCount: function() { + this._pendingCount += 1; + return this._pendingCount; + }, + decreasePendingRequestCount: function() { + this._pendingCount -= 1; + if (this._pendingCount < 0) { + throw new BaseException('pending async requests below zero'); + } + this._runCallbacksIfReady(); + return this._pendingCount; + }, + _runCallbacksIfReady: function() { + var $__0 = this; + if (this._pendingCount != 0 || this._isAngularEventPending) { + return ; + } + PromiseWrapper.resolve(null).then((function(_) { + while ($__0._callbacks.length !== 0) { + ($__0._callbacks.pop())(); + } + })); + }, + whenStable: function(callback) { + this._callbacks.push(callback); + this._runCallbacksIfReady(); + }, + getPendingRequestCount: function() { + return this._pendingCount; + }, + isAngularEventPending: function() { + return this._isAngularEventPending; + }, + findBindings: function(using, binding, exactMatch) { + return []; + } + }, {})); + $__export("Testability", Testability); + $__export("Testability", Testability = __decorate([Injectable(), __metadata('design:paramtypes', [NgZone])], Testability)); + TestabilityRegistry = (($traceurRuntime.createClass)(function() { + this._applications = new Map(); + getTestabilityModule.GetTestability.addToWindow(this); + }, { + registerApplication: function(token, testability) { + this._applications.set(token, testability); + }, + findTestabilityInTree: function(elem) { + if (elem == null) { + return null; + } + if (this._applications.has(elem)) { + return this._applications.get(elem); + } + if (DOM.isShadowRoot(elem)) { + return this.findTestabilityInTree(DOM.getHost(elem)); + } + return this.findTestabilityInTree(DOM.parentElement(elem)); + } + }, {})); + $__export("TestabilityRegistry", TestabilityRegistry); + $__export("TestabilityRegistry", TestabilityRegistry = __decorate([Injectable(), __metadata('design:paramtypes', [])], TestabilityRegistry)); + } + }; +}); + +System.register("angular2/src/render/dom/view/shared_styles_host", ["angular2/src/dom/dom_adapter", "angular2/di", "angular2/src/facade/collection", "angular2/src/render/dom/dom_tokens"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/view/shared_styles_host"; + var __decorate, + __metadata, + __param, + DOM, + Inject, + Injectable, + SetWrapper, + DOCUMENT_TOKEN, + SharedStylesHost, + DomSharedStylesHost; + return { + setters: [function($__m) { + DOM = $__m.DOM; + }, function($__m) { + Inject = $__m.Inject; + Injectable = $__m.Injectable; + }, function($__m) { + SetWrapper = $__m.SetWrapper; + }, function($__m) { + DOCUMENT_TOKEN = $__m.DOCUMENT_TOKEN; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + SharedStylesHost = (($traceurRuntime.createClass)(function() { + this._styles = []; + this._stylesSet = new Set(); + }, { + addStyles: function(styles) { + var $__0 = this; + var additions = []; + styles.forEach((function(style) { + if (!SetWrapper.has($__0._stylesSet, style)) { + $__0._stylesSet.add(style); + $__0._styles.push(style); + additions.push(style); + } + })); + this.onStylesAdded(additions); + }, + onStylesAdded: function(additions) {}, + getAllStyles: function() { + return this._styles; + } + }, {})); + $__export("SharedStylesHost", SharedStylesHost); + $__export("SharedStylesHost", SharedStylesHost = __decorate([Injectable(), __metadata('design:paramtypes', [])], SharedStylesHost)); + DomSharedStylesHost = (function($__super) { + function $__1(doc) { + $traceurRuntime.superConstructor($__1).call(this); + this._hostNodes = new Set(); + this._hostNodes.add(doc.head); + } + return ($traceurRuntime.createClass)($__1, { + _addStylesToHost: function(styles, host) { + for (var i = 0; i < styles.length; i++) { + var style = styles[i]; + DOM.appendChild(host, DOM.createStyleElement(style)); + } + }, + addHost: function(hostNode) { + this._addStylesToHost(this._styles, hostNode); + this._hostNodes.add(hostNode); + }, + removeHost: function(hostNode) { + SetWrapper.delete(this._hostNodes, hostNode); + }, + onStylesAdded: function(additions) { + var $__0 = this; + this._hostNodes.forEach((function(hostNode) { + $__0._addStylesToHost(additions, hostNode); + })); + } + }, {}, $__super); + }(SharedStylesHost)); + $__export("DomSharedStylesHost", DomSharedStylesHost); + $__export("DomSharedStylesHost", DomSharedStylesHost = __decorate([Injectable(), __param(0, Inject(DOCUMENT_TOKEN)), __metadata('design:paramtypes', [Object])], DomSharedStylesHost)); + } + }; +}); + +System.register("angular2/src/render/dom/view/proto_view_builder", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/dom/dom_adapter", "angular2/src/change_detection/change_detection", "angular2/src/render/dom/view/proto_view", "angular2/src/render/dom/view/element_binder", "angular2/src/render/api", "angular2/src/render/dom/util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/view/proto_view_builder"; + var isPresent, + isBlank, + BaseException, + StringWrapper, + ListWrapper, + MapWrapper, + Set, + SetWrapper, + StringMapWrapper, + DOM, + ASTWithSource, + AstTransformer, + AccessMember, + LiteralArray, + ImplicitReceiver, + DomProtoView, + DomProtoViewRef, + DomElementBinder, + Event, + api, + NG_BINDING_CLASS, + EVENT_TARGET_SEPARATOR, + queryBoundTextNodeIndices, + camelCaseToDashCase, + ProtoViewBuilder, + ElementBinderBuilder, + DirectiveBuilder, + EventBuilder, + PROPERTY_PARTS_SEPARATOR, + ATTRIBUTE_PREFIX, + CLASS_PREFIX, + STYLE_PREFIX; + function buildElementPropertyBindings(protoElement, isNgComponent, bindingsInTemplate, directiveTempaltePropertyNames) { + var propertyBindings = []; + MapWrapper.forEach(bindingsInTemplate, (function(ast, propertyNameInTemplate) { + var propertyBinding = createElementPropertyBinding(ast, propertyNameInTemplate); + if (isValidElementPropertyBinding(protoElement, isNgComponent, propertyBinding)) { + propertyBindings.push(propertyBinding); + } else if (!SetWrapper.has(directiveTempaltePropertyNames, propertyNameInTemplate)) { + throw new BaseException(("Can't bind to '" + propertyNameInTemplate + "' since it isn't a known property of the '<" + DOM.tagName(protoElement).toLowerCase() + ">' element and there are no matching directives with a corresponding property")); + } + })); + return propertyBindings; + } + function isValidElementPropertyBinding(protoElement, isNgComponent, binding) { + if (binding.type === api.PropertyBindingType.PROPERTY) { + var tagName = DOM.tagName(protoElement); + var possibleCustomElement = tagName.indexOf('-') !== -1; + if (possibleCustomElement && !isNgComponent) { + return true; + } else { + return DOM.hasProperty(protoElement, binding.property); + } + } + return true; + } + function createElementPropertyBinding(ast, propertyNameInTemplate) { + var parts = StringWrapper.split(propertyNameInTemplate, PROPERTY_PARTS_SEPARATOR); + if (parts.length === 1) { + var propName = parts[0]; + var mappedPropName = StringMapWrapper.get(DOM.attrToPropMap, propName); + propName = isPresent(mappedPropName) ? mappedPropName : propName; + return new api.ElementPropertyBinding(api.PropertyBindingType.PROPERTY, ast, propName); + } else if (parts[0] == ATTRIBUTE_PREFIX) { + return new api.ElementPropertyBinding(api.PropertyBindingType.ATTRIBUTE, ast, parts[1]); + } else if (parts[0] == CLASS_PREFIX) { + return new api.ElementPropertyBinding(api.PropertyBindingType.CLASS, ast, camelCaseToDashCase(parts[1])); + } else if (parts[0] == STYLE_PREFIX) { + var unit = parts.length > 2 ? parts[2] : null; + return new api.ElementPropertyBinding(api.PropertyBindingType.STYLE, ast, parts[1], unit); + } else { + throw new BaseException(("Invalid property name " + propertyNameInTemplate)); + } + } + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + MapWrapper = $__m.MapWrapper; + Set = $__m.Set; + SetWrapper = $__m.SetWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + ASTWithSource = $__m.ASTWithSource; + AstTransformer = $__m.AstTransformer; + AccessMember = $__m.AccessMember; + LiteralArray = $__m.LiteralArray; + ImplicitReceiver = $__m.ImplicitReceiver; + }, function($__m) { + DomProtoView = $__m.DomProtoView; + DomProtoViewRef = $__m.DomProtoViewRef; + }, function($__m) { + DomElementBinder = $__m.DomElementBinder; + Event = $__m.Event; + }, function($__m) { + api = $__m; + }, function($__m) { + NG_BINDING_CLASS = $__m.NG_BINDING_CLASS; + EVENT_TARGET_SEPARATOR = $__m.EVENT_TARGET_SEPARATOR; + queryBoundTextNodeIndices = $__m.queryBoundTextNodeIndices; + camelCaseToDashCase = $__m.camelCaseToDashCase; + }], + execute: function() { + ProtoViewBuilder = (function() { + function ProtoViewBuilder(rootElement, type, viewEncapsulation) { + this.rootElement = rootElement; + this.type = type; + this.viewEncapsulation = viewEncapsulation; + this.variableBindings = new Map(); + this.elements = []; + this.rootTextBindings = new Map(); + this.ngContentCount = 0; + this.hostAttributes = new Map(); + } + return ($traceurRuntime.createClass)(ProtoViewBuilder, { + bindElement: function(element) { + var description = arguments[1] !== (void 0) ? arguments[1] : null; + var builder = new ElementBinderBuilder(this.elements.length, element, description); + this.elements.push(builder); + DOM.addClass(element, NG_BINDING_CLASS); + return builder; + }, + bindVariable: function(name, value) { + this.variableBindings.set(value, name); + }, + bindRootText: function(textNode, expression) { + this.rootTextBindings.set(textNode, expression); + }, + bindNgContent: function() { + this.ngContentCount++; + }, + setHostAttribute: function(name, value) { + this.hostAttributes.set(name, value); + }, + build: function() { + var domElementBinders = []; + var apiElementBinders = []; + var textNodeExpressions = []; + var rootTextNodeIndices = []; + var transitiveNgContentCount = this.ngContentCount; + queryBoundTextNodeIndices(DOM.content(this.rootElement), this.rootTextBindings, (function(node, nodeIndex, expression) { + textNodeExpressions.push(expression); + rootTextNodeIndices.push(nodeIndex); + })); + ListWrapper.forEach(this.elements, (function(ebb) { + var directiveTemplatePropertyNames = new Set(); + var apiDirectiveBinders = ListWrapper.map(ebb.directives, (function(dbb) { + ebb.eventBuilder.merge(dbb.eventBuilder); + ListWrapper.forEach(dbb.templatePropertyNames, (function(name) { + return directiveTemplatePropertyNames.add(name); + })); + return new api.DirectiveBinder({ + directiveIndex: dbb.directiveIndex, + propertyBindings: dbb.propertyBindings, + eventBindings: dbb.eventBindings, + hostPropertyBindings: buildElementPropertyBindings(ebb.element, isPresent(ebb.componentId), dbb.hostPropertyBindings, directiveTemplatePropertyNames) + }); + })); + var nestedProtoView = isPresent(ebb.nestedProtoView) ? ebb.nestedProtoView.build() : null; + if (isPresent(nestedProtoView)) { + transitiveNgContentCount += nestedProtoView.transitiveNgContentCount; + } + var parentIndex = isPresent(ebb.parent) ? ebb.parent.index : -1; + var textNodeIndices = []; + queryBoundTextNodeIndices(ebb.element, ebb.textBindings, (function(node, nodeIndex, expression) { + textNodeExpressions.push(expression); + textNodeIndices.push(nodeIndex); + })); + apiElementBinders.push(new api.ElementBinder({ + index: ebb.index, + parentIndex: parentIndex, + distanceToParent: ebb.distanceToParent, + directives: apiDirectiveBinders, + nestedProtoView: nestedProtoView, + propertyBindings: buildElementPropertyBindings(ebb.element, isPresent(ebb.componentId), ebb.propertyBindings, directiveTemplatePropertyNames), + variableBindings: ebb.variableBindings, + eventBindings: ebb.eventBindings, + readAttributes: ebb.readAttributes + })); + domElementBinders.push(new DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: isPresent(nestedProtoView) || isPresent(ebb.componentId), + hasNativeShadowRoot: false, + eventLocals: new LiteralArray(ebb.eventBuilder.buildEventLocals()), + localEvents: ebb.eventBuilder.buildLocalEvents(), + globalEvents: ebb.eventBuilder.buildGlobalEvents() + })); + })); + var rootNodeCount = DOM.childNodes(DOM.content(this.rootElement)).length; + return new api.ProtoViewDto({ + render: new DomProtoViewRef(DomProtoView.create(this.type, this.rootElement, this.viewEncapsulation, [rootNodeCount], rootTextNodeIndices, domElementBinders, this.hostAttributes)), + type: this.type, + elementBinders: apiElementBinders, + variableBindings: this.variableBindings, + textBindings: textNodeExpressions, + transitiveNgContentCount: transitiveNgContentCount + }); + } + }, {}); + }()); + $__export("ProtoViewBuilder", ProtoViewBuilder); + ElementBinderBuilder = (function() { + function ElementBinderBuilder(index, element, description) { + this.index = index; + this.element = element; + this.parent = null; + this.distanceToParent = 0; + this.directives = []; + this.nestedProtoView = null; + this.propertyBindings = new Map(); + this.variableBindings = new Map(); + this.eventBindings = []; + this.eventBuilder = new EventBuilder(); + this.textBindings = new Map(); + this.readAttributes = new Map(); + this.componentId = null; + } + return ($traceurRuntime.createClass)(ElementBinderBuilder, { + setParent: function(parent, distanceToParent) { + this.parent = parent; + if (isPresent(parent)) { + this.distanceToParent = distanceToParent; + } + return this; + }, + readAttribute: function(attrName) { + if (isBlank(this.readAttributes.get(attrName))) { + this.readAttributes.set(attrName, DOM.getAttribute(this.element, attrName)); + } + }, + bindDirective: function(directiveIndex) { + var directive = new DirectiveBuilder(directiveIndex); + this.directives.push(directive); + return directive; + }, + bindNestedProtoView: function(rootElement) { + if (isPresent(this.nestedProtoView)) { + throw new BaseException('Only one nested view per element is allowed'); + } + this.nestedProtoView = new ProtoViewBuilder(rootElement, api.ViewType.EMBEDDED, api.ViewEncapsulation.NONE); + return this.nestedProtoView; + }, + bindProperty: function(name, expression) { + this.propertyBindings.set(name, expression); + }, + bindVariable: function(name, value) { + if (isPresent(this.nestedProtoView)) { + this.nestedProtoView.bindVariable(name, value); + } else { + this.variableBindings.set(value, name); + } + }, + bindEvent: function(name, expression) { + var target = arguments[2] !== (void 0) ? arguments[2] : null; + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); + }, + bindText: function(textNode, expression) { + this.textBindings.set(textNode, expression); + }, + setComponentId: function(componentId) { + this.componentId = componentId; + } + }, {}); + }()); + $__export("ElementBinderBuilder", ElementBinderBuilder); + DirectiveBuilder = (function() { + function DirectiveBuilder(directiveIndex) { + this.directiveIndex = directiveIndex; + this.propertyBindings = new Map(); + this.templatePropertyNames = []; + this.hostPropertyBindings = new Map(); + this.eventBindings = []; + this.eventBuilder = new EventBuilder(); + } + return ($traceurRuntime.createClass)(DirectiveBuilder, { + bindProperty: function(name, expression, elProp) { + this.propertyBindings.set(name, expression); + if (isPresent(elProp)) { + this.templatePropertyNames.push(elProp); + } + }, + bindHostProperty: function(name, expression) { + this.hostPropertyBindings.set(name, expression); + }, + bindEvent: function(name, expression) { + var target = arguments[2] !== (void 0) ? arguments[2] : null; + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); + } + }, {}); + }()); + $__export("DirectiveBuilder", DirectiveBuilder); + EventBuilder = (function($__super) { + function EventBuilder() { + $traceurRuntime.superConstructor(EventBuilder).call(this); + this.locals = []; + this.localEvents = []; + this.globalEvents = []; + this._implicitReceiver = new ImplicitReceiver(); + } + return ($traceurRuntime.createClass)(EventBuilder, { + add: function(name, source, target) { + var adjustedAst = source.ast; + var fullName = isPresent(target) ? target + EVENT_TARGET_SEPARATOR + name : name; + var result = new api.EventBinding(fullName, new ASTWithSource(adjustedAst, source.source, source.location)); + var event = new Event(name, target, fullName); + if (isBlank(target)) { + this.localEvents.push(event); + } else { + this.globalEvents.push(event); + } + return result; + }, + visitAccessMember: function(ast) { + var isEventAccess = false; + var current = ast; + while (!isEventAccess && (current instanceof AccessMember)) { + var am = current; + if (am.name == '$event') { + isEventAccess = true; + } + current = am.receiver; + } + if (isEventAccess) { + this.locals.push(ast); + var index = this.locals.length - 1; + return new AccessMember(this._implicitReceiver, ("" + index), (function(arr) { + return arr[index]; + }), null); + } else { + return ast; + } + }, + buildEventLocals: function() { + return this.locals; + }, + buildLocalEvents: function() { + return this.localEvents; + }, + buildGlobalEvents: function() { + return this.globalEvents; + }, + merge: function(eventBuilder) { + this._merge(this.localEvents, eventBuilder.localEvents); + this._merge(this.globalEvents, eventBuilder.globalEvents); + ListWrapper.concat(this.locals, eventBuilder.locals); + }, + _merge: function(host, tobeAdded) { + var names = []; + for (var i = 0; i < host.length; i++) { + names.push(host[i].fullName); + } + for (var j = 0; j < tobeAdded.length; j++) { + if (!ListWrapper.contains(names, tobeAdded[j].fullName)) { + host.push(tobeAdded[j]); + } + } + } + }, {}, $__super); + }(AstTransformer)); + $__export("EventBuilder", EventBuilder); + PROPERTY_PARTS_SEPARATOR = new RegExp('\\.'); + ATTRIBUTE_PREFIX = 'attr'; + CLASS_PREFIX = 'class'; + STYLE_PREFIX = 'style'; + } + }; +}); + +System.register("angular2/src/render/dom/compiler/directive_parser", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/dom/dom_adapter", "angular2/src/render/dom/compiler/selector", "angular2/src/render/api", "angular2/src/render/dom/util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/directive_parser"; + var isPresent, + isBlank, + BaseException, + StringWrapper, + MapWrapper, + ListWrapper, + DOM, + SelectorMatcher, + CssSelector, + DirectiveMetadata, + dashCaseToCamelCase, + camelCaseToDashCase, + EVENT_TARGET_SEPARATOR, + DirectiveParser; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + MapWrapper = $__m.MapWrapper; + ListWrapper = $__m.ListWrapper; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + SelectorMatcher = $__m.SelectorMatcher; + CssSelector = $__m.CssSelector; + }, function($__m) { + DirectiveMetadata = $__m.DirectiveMetadata; + }, function($__m) { + dashCaseToCamelCase = $__m.dashCaseToCamelCase; + camelCaseToDashCase = $__m.camelCaseToDashCase; + EVENT_TARGET_SEPARATOR = $__m.EVENT_TARGET_SEPARATOR; + }], + execute: function() { + DirectiveParser = (function() { + function DirectiveParser(_parser, _directives) { + this._parser = _parser; + this._directives = _directives; + this._selectorMatcher = new SelectorMatcher(); + for (var i = 0; i < _directives.length; i++) { + var directive = _directives[i]; + var selector = CssSelector.parse(directive.selector); + this._ensureComponentOnlyHasElementSelector(selector, directive); + this._selectorMatcher.addSelectables(selector, i); + } + } + return ($traceurRuntime.createClass)(DirectiveParser, { + processStyle: function(style) { + return style; + }, + _ensureComponentOnlyHasElementSelector: function(selector, directive) { + var isElementSelector = selector.length === 1 && selector[0].isElementSelector(); + if (!isElementSelector && directive.type === DirectiveMetadata.COMPONENT_TYPE) { + throw new BaseException(("Component '" + directive.id + "' can only have an element selector, but had '" + directive.selector + "'")); + } + }, + processElement: function(parent, current, control) { + var $__0 = this; + var attrs = current.attrs(); + var classList = current.classList(); + var cssSelector = new CssSelector(); + var foundDirectiveIndices = []; + var elementBinder = null; + cssSelector.setElement(DOM.nodeName(current.element)); + for (var i = 0; i < classList.length; i++) { + cssSelector.addClassName(classList[i]); + } + MapWrapper.forEach(attrs, (function(attrValue, attrName) { + cssSelector.addAttribute(attrName, attrValue); + })); + this._selectorMatcher.match(cssSelector, (function(selector, directiveIndex) { + var directive = $__0._directives[directiveIndex]; + elementBinder = current.bindElement(); + if (directive.type === DirectiveMetadata.COMPONENT_TYPE) { + $__0._ensureHasOnlyOneComponent(elementBinder, current.elementDescription); + ListWrapper.insert(foundDirectiveIndices, 0, directiveIndex); + elementBinder.setComponentId(directive.id); + } else { + foundDirectiveIndices.push(directiveIndex); + } + })); + ListWrapper.forEach(foundDirectiveIndices, (function(directiveIndex) { + var dirMetadata = $__0._directives[directiveIndex]; + var directiveBinderBuilder = elementBinder.bindDirective(directiveIndex); + current.compileChildren = current.compileChildren && dirMetadata.compileChildren; + if (isPresent(dirMetadata.properties)) { + ListWrapper.forEach(dirMetadata.properties, (function(bindConfig) { + $__0._bindDirectiveProperty(bindConfig, current, directiveBinderBuilder); + })); + } + if (isPresent(dirMetadata.hostListeners)) { + $__0._sortedKeysForEach(dirMetadata.hostListeners, (function(action, eventName) { + $__0._bindDirectiveEvent(eventName, action, current, directiveBinderBuilder); + })); + } + if (isPresent(dirMetadata.hostProperties)) { + $__0._sortedKeysForEach(dirMetadata.hostProperties, (function(expression, hostPropertyName) { + $__0._bindHostProperty(hostPropertyName, expression, current, directiveBinderBuilder); + })); + } + if (isPresent(dirMetadata.hostAttributes)) { + $__0._sortedKeysForEach(dirMetadata.hostAttributes, (function(hostAttrValue, hostAttrName) { + $__0._addHostAttribute(hostAttrName, hostAttrValue, current); + })); + } + if (isPresent(dirMetadata.readAttributes)) { + ListWrapper.forEach(dirMetadata.readAttributes, (function(attrName) { + elementBinder.readAttribute(attrName); + })); + } + })); + }, + _sortedKeysForEach: function(map, fn) { + var keys = MapWrapper.keys(map); + ListWrapper.sort(keys, (function(a, b) { + var compareVal = StringWrapper.compare(a, b); + return compareVal == 0 ? -1 : compareVal; + })); + ListWrapper.forEach(keys, (function(key) { + fn(MapWrapper.get(map, key), key); + })); + }, + _ensureHasOnlyOneComponent: function(elementBinder, elDescription) { + if (isPresent(elementBinder.componentId)) { + throw new BaseException(("Only one component directive is allowed per element - check " + elDescription)); + } + }, + _bindDirectiveProperty: function(bindConfig, compileElement, directiveBinderBuilder) { + var dirProperty; + var elProp; + var pipes; + var assignIndex = bindConfig.indexOf(':'); + if (assignIndex > -1) { + dirProperty = StringWrapper.substring(bindConfig, 0, assignIndex).trim(); + pipes = this._splitBindConfig(StringWrapper.substring(bindConfig, assignIndex + 1)); + elProp = ListWrapper.removeAt(pipes, 0); + } else { + dirProperty = bindConfig; + elProp = bindConfig; + pipes = []; + } + elProp = dashCaseToCamelCase(elProp); + var bindingAst = compileElement.bindElement().propertyBindings.get(elProp); + if (isBlank(bindingAst)) { + var attributeValue = compileElement.attrs().get(camelCaseToDashCase(elProp)); + if (isPresent(attributeValue)) { + bindingAst = this._parser.wrapLiteralPrimitive(attributeValue, compileElement.elementDescription); + } + } + if (isPresent(bindingAst)) { + directiveBinderBuilder.bindProperty(dirProperty, bindingAst, elProp); + } + }, + _bindDirectiveEvent: function(eventName, action, compileElement, directiveBinderBuilder) { + var ast = this._parser.parseAction(action, compileElement.elementDescription); + if (StringWrapper.contains(eventName, EVENT_TARGET_SEPARATOR)) { + var parts = eventName.split(EVENT_TARGET_SEPARATOR); + directiveBinderBuilder.bindEvent(parts[1], ast, parts[0]); + } else { + directiveBinderBuilder.bindEvent(eventName, ast); + } + }, + _bindHostProperty: function(hostPropertyName, expression, compileElement, directiveBinderBuilder) { + var ast = this._parser.parseSimpleBinding(expression, ("hostProperties of " + compileElement.elementDescription)); + directiveBinderBuilder.bindHostProperty(hostPropertyName, ast); + }, + _addHostAttribute: function(attrName, attrValue, compileElement) { + if (StringWrapper.equals(attrName, 'class')) { + ListWrapper.forEach(attrValue.split(' '), (function(className) { + DOM.addClass(compileElement.element, className); + })); + } else if (!DOM.hasAttribute(compileElement.element, attrName)) { + DOM.setAttribute(compileElement.element, attrName, attrValue); + } + }, + _splitBindConfig: function(bindConfig) { + return ListWrapper.map(bindConfig.split('|'), (function(s) { + return s.trim(); + })); + } + }, {}); + }()); + $__export("DirectiveParser", DirectiveParser); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/style_encapsulator", ["angular2/src/render/api", "angular2/src/render/dom/util", "angular2/src/dom/dom_adapter", "angular2/src/facade/lang", "angular2/src/render/dom/compiler/shadow_css"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/style_encapsulator"; + var ViewEncapsulation, + ViewType, + NG_CONTENT_ELEMENT_NAME, + isElementWithTag, + DOM, + isBlank, + isPresent, + ShadowCss, + StyleEncapsulator; + function getHostAttribute(compId) { + return ("_nghost-" + compId); + } + function getContentAttribute(compId) { + return ("_ngcontent-" + compId); + } + return { + setters: [function($__m) { + ViewEncapsulation = $__m.ViewEncapsulation; + ViewType = $__m.ViewType; + }, function($__m) { + NG_CONTENT_ELEMENT_NAME = $__m.NG_CONTENT_ELEMENT_NAME; + isElementWithTag = $__m.isElementWithTag; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + }, function($__m) { + ShadowCss = $__m.ShadowCss; + }], + execute: function() { + StyleEncapsulator = (function() { + function StyleEncapsulator(_appId, _view, _componentUIDsCache) { + this._appId = _appId; + this._view = _view; + this._componentUIDsCache = _componentUIDsCache; + } + return ($traceurRuntime.createClass)(StyleEncapsulator, { + processElement: function(parent, current, control) { + if (isElementWithTag(current.element, NG_CONTENT_ELEMENT_NAME)) { + current.inheritedProtoView.bindNgContent(); + } else { + if (this._view.encapsulation === ViewEncapsulation.EMULATED) { + this._processEmulatedScopedElement(current, parent); + } + } + }, + processStyle: function(style) { + var encapsulation = this._view.encapsulation; + if (encapsulation === ViewEncapsulation.EMULATED) { + return this._shimCssForComponent(style, this._view.componentId); + } else { + return style; + } + }, + _processEmulatedScopedElement: function(current, parent) { + var element = current.element; + var hostComponentId = this._view.componentId; + var viewType = current.inheritedProtoView.type; + if (viewType !== ViewType.HOST && isPresent(hostComponentId)) { + var contentAttribute = getContentAttribute(this._getComponentId(hostComponentId)); + DOM.setAttribute(element, contentAttribute, ''); + if (isBlank(parent) && viewType == ViewType.COMPONENT) { + var hostAttribute = getHostAttribute(this._getComponentId(hostComponentId)); + current.inheritedProtoView.setHostAttribute(hostAttribute, ''); + } + } + }, + _shimCssForComponent: function(cssText, componentId) { + var id = this._getComponentId(componentId); + var shadowCss = new ShadowCss(); + return shadowCss.shimCssText(cssText, getContentAttribute(id), getHostAttribute(id)); + }, + _getComponentId: function(componentStringId) { + var id = this._componentUIDsCache.get(componentStringId); + if (isBlank(id)) { + id = (this._appId + "-" + this._componentUIDsCache.size); + this._componentUIDsCache.set(componentStringId, id); + } + return id; + } + }, {}); + }()); + $__export("StyleEncapsulator", StyleEncapsulator); + } + }; +}); + +System.register("angular2/src/render/dom/dom_renderer", ["angular2/di", "angular2/src/facade/lang", "angular2/src/dom/dom_adapter", "angular2/src/render/dom/events/event_manager", "angular2/src/render/dom/view/proto_view", "angular2/src/render/dom/view/view", "angular2/src/render/dom/view/fragment", "angular2/src/render/dom/view/shared_styles_host", "angular2/src/render/dom/util", "angular2/src/render/api", "angular2/src/render/dom/dom_tokens"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/dom_renderer"; + var __decorate, + __metadata, + __param, + Inject, + Injectable, + isPresent, + isBlank, + BaseException, + DOM, + EventManager, + resolveInternalDomProtoView, + DomView, + DomViewRef, + resolveInternalDomView, + DomFragmentRef, + resolveInternalDomFragment, + DomSharedStylesHost, + cloneAndQueryProtoView, + camelCaseToDashCase, + Renderer, + RenderViewWithFragments, + DOCUMENT_TOKEN, + DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES, + REFLECT_PREFIX, + DomRenderer; + function moveNodesAfterSibling(sibling, nodes) { + if (nodes.length > 0 && isPresent(DOM.parentElement(sibling))) { + for (var i = 0; i < nodes.length; i++) { + DOM.insertBefore(sibling, nodes[i]); + } + DOM.insertBefore(nodes[nodes.length - 1], sibling); + } + } + function moveChildNodes(source, target) { + var currChild = DOM.firstChild(source); + while (isPresent(currChild)) { + var nextChild = DOM.nextSibling(currChild); + DOM.appendChild(target, currChild); + currChild = nextChild; + } + } + return { + setters: [function($__m) { + Inject = $__m.Inject; + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + EventManager = $__m.EventManager; + }, function($__m) { + resolveInternalDomProtoView = $__m.resolveInternalDomProtoView; + }, function($__m) { + DomView = $__m.DomView; + DomViewRef = $__m.DomViewRef; + resolveInternalDomView = $__m.resolveInternalDomView; + }, function($__m) { + DomFragmentRef = $__m.DomFragmentRef; + resolveInternalDomFragment = $__m.resolveInternalDomFragment; + }, function($__m) { + DomSharedStylesHost = $__m.DomSharedStylesHost; + }, function($__m) { + cloneAndQueryProtoView = $__m.cloneAndQueryProtoView; + camelCaseToDashCase = $__m.camelCaseToDashCase; + }, function($__m) { + Renderer = $__m.Renderer; + RenderViewWithFragments = $__m.RenderViewWithFragments; + }, function($__m) { + DOCUMENT_TOKEN = $__m.DOCUMENT_TOKEN; + DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES = $__m.DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + REFLECT_PREFIX = 'ng-reflect-'; + DomRenderer = (function($__super) { + function $__0(_eventManager, _domSharedStylesHost, document, reflectPropertiesAsAttributes) { + $traceurRuntime.superConstructor($__0).call(this); + this._eventManager = _eventManager; + this._domSharedStylesHost = _domSharedStylesHost; + this._reflectPropertiesAsAttributes = reflectPropertiesAsAttributes; + this._document = document; + } + return ($traceurRuntime.createClass)($__0, { + createRootHostView: function(hostProtoViewRef, fragmentCount, hostElementSelector) { + var hostProtoView = resolveInternalDomProtoView(hostProtoViewRef); + var element = DOM.querySelector(this._document, hostElementSelector); + if (isBlank(element)) { + throw new BaseException(("The selector \"" + hostElementSelector + "\" did not match any elements")); + } + return this._createView(hostProtoView, element); + }, + createView: function(protoViewRef, fragmentCount) { + var protoView = resolveInternalDomProtoView(protoViewRef); + return this._createView(protoView, null); + }, + destroyView: function(viewRef) { + var view = resolveInternalDomView(viewRef); + var elementBinders = view.proto.elementBinders; + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + if (binder.hasNativeShadowRoot) { + this._domSharedStylesHost.removeHost(DOM.getShadowRoot(view.boundElements[i])); + } + } + }, + getNativeElementSync: function(location) { + if (isBlank(location.renderBoundElementIndex)) { + return null; + } + return resolveInternalDomView(location.renderView).boundElements[location.renderBoundElementIndex]; + }, + getRootNodes: function(fragment) { + return resolveInternalDomFragment(fragment); + }, + attachFragmentAfterFragment: function(previousFragmentRef, fragmentRef) { + var previousFragmentNodes = resolveInternalDomFragment(previousFragmentRef); + if (previousFragmentNodes.length > 0) { + var sibling = previousFragmentNodes[previousFragmentNodes.length - 1]; + moveNodesAfterSibling(sibling, resolveInternalDomFragment(fragmentRef)); + } + }, + attachFragmentAfterElement: function(elementRef, fragmentRef) { + if (isBlank(elementRef.renderBoundElementIndex)) { + return ; + } + var parentView = resolveInternalDomView(elementRef.renderView); + var element = parentView.boundElements[elementRef.renderBoundElementIndex]; + moveNodesAfterSibling(element, resolveInternalDomFragment(fragmentRef)); + }, + detachFragment: function(fragmentRef) { + var fragmentNodes = resolveInternalDomFragment(fragmentRef); + for (var i = 0; i < fragmentNodes.length; i++) { + DOM.remove(fragmentNodes[i]); + } + }, + hydrateView: function(viewRef) { + var view = resolveInternalDomView(viewRef); + if (view.hydrated) + throw new BaseException('The view is already hydrated.'); + view.hydrated = true; + view.eventHandlerRemovers = []; + var binders = view.proto.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var binder = binders[binderIdx]; + if (isPresent(binder.globalEvents)) { + for (var i = 0; i < binder.globalEvents.length; i++) { + var globalEvent = binder.globalEvents[i]; + var remover = this._createGlobalEventListener(view, binderIdx, globalEvent.name, globalEvent.target, globalEvent.fullName); + view.eventHandlerRemovers.push(remover); + } + } + } + }, + dehydrateView: function(viewRef) { + var view = resolveInternalDomView(viewRef); + for (var i = 0; i < view.eventHandlerRemovers.length; i++) { + view.eventHandlerRemovers[i](); + } + view.eventHandlerRemovers = null; + view.hydrated = false; + }, + setElementProperty: function(location, propertyName, propertyValue) { + if (isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = resolveInternalDomView(location.renderView); + view.setElementProperty(location.renderBoundElementIndex, propertyName, propertyValue); + if (this._reflectPropertiesAsAttributes) { + this.setElementAttribute(location, ("" + REFLECT_PREFIX + camelCaseToDashCase(propertyName)), ("" + propertyValue)); + } + }, + setElementAttribute: function(location, attributeName, attributeValue) { + if (isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = resolveInternalDomView(location.renderView); + view.setElementAttribute(location.renderBoundElementIndex, attributeName, attributeValue); + }, + setElementClass: function(location, className, isAdd) { + if (isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = resolveInternalDomView(location.renderView); + view.setElementClass(location.renderBoundElementIndex, className, isAdd); + }, + setElementStyle: function(location, styleName, styleValue) { + if (isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = resolveInternalDomView(location.renderView); + view.setElementStyle(location.renderBoundElementIndex, styleName, styleValue); + }, + invokeElementMethod: function(location, methodName, args) { + if (isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = resolveInternalDomView(location.renderView); + view.invokeElementMethod(location.renderBoundElementIndex, methodName, args); + }, + setText: function(viewRef, textNodeIndex, text) { + if (isBlank(textNodeIndex)) { + return ; + } + var view = resolveInternalDomView(viewRef); + DOM.setText(view.boundTextNodes[textNodeIndex], text); + }, + setEventDispatcher: function(viewRef, dispatcher) { + var view = resolveInternalDomView(viewRef); + view.eventDispatcher = dispatcher; + }, + _createView: function(protoView, inplaceElement) { + var clonedProtoView = cloneAndQueryProtoView(protoView, true); + var boundElements = clonedProtoView.boundElements; + if (isPresent(inplaceElement)) { + if (protoView.fragmentsRootNodeCount[0] !== 1) { + throw new BaseException('Root proto views can only contain one element!'); + } + DOM.clearNodes(inplaceElement); + var tempRoot = clonedProtoView.fragments[0][0]; + moveChildNodes(tempRoot, inplaceElement); + if (boundElements.length > 0 && boundElements[0] === tempRoot) { + boundElements[0] = inplaceElement; + } + clonedProtoView.fragments[0][0] = inplaceElement; + } + var view = new DomView(protoView, clonedProtoView.boundTextNodes, boundElements); + var binders = protoView.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var binder = binders[binderIdx]; + var element = boundElements[binderIdx]; + if (binder.hasNativeShadowRoot) { + var shadowRootWrapper = DOM.firstChild(element); + var shadowRoot = DOM.createShadowRoot(element); + this._domSharedStylesHost.addHost(shadowRoot); + moveChildNodes(shadowRootWrapper, shadowRoot); + DOM.remove(shadowRootWrapper); + } + if (isPresent(binder.eventLocals) && isPresent(binder.localEvents)) { + for (var i = 0; i < binder.localEvents.length; i++) { + this._createEventListener(view, element, binderIdx, binder.localEvents[i].name, binder.eventLocals); + } + } + } + return new RenderViewWithFragments(new DomViewRef(view), clonedProtoView.fragments.map((function(nodes) { + return new DomFragmentRef(nodes); + }))); + }, + _createEventListener: function(view, element, elementIndex, eventName, eventLocals) { + this._eventManager.addEventListener(element, eventName, (function(event) { + view.dispatchEvent(elementIndex, eventName, event); + })); + }, + _createGlobalEventListener: function(view, elementIndex, eventName, eventTarget, fullName) { + return this._eventManager.addGlobalEventListener(eventTarget, eventName, (function(event) { + view.dispatchEvent(elementIndex, fullName, event); + })); + } + }, {}, $__super); + }(Renderer)); + $__export("DomRenderer", DomRenderer); + $__export("DomRenderer", DomRenderer = __decorate([Injectable(), __param(2, Inject(DOCUMENT_TOKEN)), __param(3, Inject(DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES)), __metadata('design:paramtypes', [EventManager, DomSharedStylesHost, Object, Boolean])], DomRenderer)); + } + }; +}); + +System.register("angular2/annotations", ["angular2/src/core/annotations/annotations", "angular2/src/core/annotations/view", "angular2/src/core/annotations/di", "angular2/src/util/decorators", "angular2/src/core/annotations/decorators"], function($__export) { + "use strict"; + var __moduleName = "angular2/annotations"; + return { + setters: [function($__m) { + $__export("ComponentAnnotation", $__m.ComponentAnnotation); + $__export("DirectiveAnnotation", $__m.DirectiveAnnotation); + $__export("LifecycleEvent", $__m.LifecycleEvent); + }, function($__m) { + $__export("ViewAnnotation", $__m.ViewAnnotation); + $__export("ViewEncapsulation", $__m.ViewEncapsulation); + }, function($__m) { + $__export("QueryAnnotation", $__m.QueryAnnotation); + $__export("AttributeAnnotation", $__m.AttributeAnnotation); + }, function($__m) { + $__export("Class", $__m.Class); + }, function($__m) { + $__export("Attribute", $__m.Attribute); + $__export("Component", $__m.Component); + $__export("Directive", $__m.Directive); + $__export("View", $__m.View); + $__export("Query", $__m.Query); + $__export("ViewQuery", $__m.ViewQuery); + }], + execute: function() {} + }; +}); + +System.register("angular2/directives", ["angular2/src/facade/lang", "angular2/src/directives/ng_for", "angular2/src/directives/ng_if", "angular2/src/directives/ng_non_bindable", "angular2/src/directives/ng_switch", "angular2/src/directives/class", "angular2/src/directives/ng_style"], function($__export) { + "use strict"; + var __moduleName = "angular2/directives"; + var CONST_EXPR, + NgFor, + NgIf, + NgNonBindable, + NgSwitch, + NgSwitchWhen, + NgSwitchDefault, + coreDirectives; + var $__exportNames = {coreDirectives: true}; + var $__exportNames = {coreDirectives: true}; + var $__exportNames = {coreDirectives: true}; + var $__exportNames = {coreDirectives: true}; + var $__exportNames = {coreDirectives: true}; + var $__exportNames = {coreDirectives: true}; + return { + setters: [function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + NgFor = $__m.NgFor; + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + NgIf = $__m.NgIf; + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + NgNonBindable = $__m.NgNonBindable; + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + NgSwitch = $__m.NgSwitch; + NgSwitchWhen = $__m.NgSwitchWhen; + NgSwitchDefault = $__m.NgSwitchDefault; + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }], + execute: function() { + coreDirectives = CONST_EXPR([NgFor, NgIf, NgNonBindable, NgSwitch, NgSwitchWhen, NgSwitchDefault]); + $__export("coreDirectives", coreDirectives); + } + }; +}); + +System.register("angular2/src/http/static_request", ["angular2/src/http/headers", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/static_request"; + var Headers, + isPresent, + Request; + return { + setters: [function($__m) { + Headers = $__m.Headers; + }, function($__m) { + isPresent = $__m.isPresent; + }], + execute: function() { + Request = (function() { + function Request(requestOptions) { + this.url = requestOptions.url; + this._body = requestOptions.body; + this.method = requestOptions.method; + this.mode = requestOptions.mode; + this.credentials = requestOptions.credentials; + this.headers = new Headers(requestOptions.headers); + this.cache = requestOptions.cache; + } + return ($traceurRuntime.createClass)(Request, {text: function() { + return isPresent(this._body) ? this._body.toString() : ''; + }}, {}); + }()); + $__export("Request", Request); + } + }; +}); + +System.register("angular2/src/http/base_request_options", ["angular2/src/facade/lang", "angular2/src/http/headers", "angular2/src/http/enums", "angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/base_request_options"; + var __decorate, + __metadata, + isPresent, + Headers, + RequestModesOpts, + RequestMethods, + Injectable, + RequestOptions, + BaseRequestOptions; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + Headers = $__m.Headers; + }, function($__m) { + RequestModesOpts = $__m.RequestModesOpts; + RequestMethods = $__m.RequestMethods; + }, function($__m) { + Injectable = $__m.Injectable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + RequestOptions = (function() { + function RequestOptions() { + var $__2 = arguments[0] !== (void 0) ? arguments[0] : {}, + method = $__2.method, + headers = $__2.headers, + body = $__2.body, + mode = $__2.mode, + credentials = $__2.credentials, + cache = $__2.cache, + url = $__2.url; + this.method = isPresent(method) ? method : null; + this.headers = isPresent(headers) ? headers : null; + this.body = isPresent(body) ? body : null; + this.mode = isPresent(mode) ? mode : null; + this.credentials = isPresent(credentials) ? credentials : null; + this.cache = isPresent(cache) ? cache : null; + this.url = isPresent(url) ? url : null; + } + return ($traceurRuntime.createClass)(RequestOptions, {merge: function(options) { + return new RequestOptions({ + method: isPresent(options) && isPresent(options.method) ? options.method : this.method, + headers: isPresent(options) && isPresent(options.headers) ? options.headers : this.headers, + body: isPresent(options) && isPresent(options.body) ? options.body : this.body, + mode: isPresent(options) && isPresent(options.mode) ? options.mode : this.mode, + credentials: isPresent(options) && isPresent(options.credentials) ? options.credentials : this.credentials, + cache: isPresent(options) && isPresent(options.cache) ? options.cache : this.cache, + url: isPresent(options) && isPresent(options.url) ? options.url : this.url + }); + }}, {}); + }()); + $__export("RequestOptions", RequestOptions); + BaseRequestOptions = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).call(this, { + method: RequestMethods.GET, + headers: new Headers(), + mode: RequestModesOpts.Cors + }); + } + return ($traceurRuntime.createClass)($__0, {}, {}, $__super); + }(RequestOptions)); + $__export("BaseRequestOptions", BaseRequestOptions); + $__export("BaseRequestOptions", BaseRequestOptions = __decorate([Injectable(), __metadata('design:paramtypes', [])], BaseRequestOptions)); + } + }; +}); + +System.register("angular2/src/http/static_response", ["angular2/src/facade/lang", "angular2/src/http/http_utils"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/static_response"; + var BaseException, + isString, + Json, + isJsObject, + Response; + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + isString = $__m.isString; + Json = $__m.Json; + }, function($__m) { + isJsObject = $__m.isJsObject; + }], + execute: function() { + Response = (function() { + function Response(responseOptions) { + this._body = responseOptions.body; + this.status = responseOptions.status; + this.statusText = responseOptions.statusText; + this.headers = responseOptions.headers; + this.type = responseOptions.type; + this.url = responseOptions.url; + } + return ($traceurRuntime.createClass)(Response, { + blob: function() { + throw new BaseException('"blob()" method not implemented on Response superclass'); + }, + json: function() { + var jsonResponse; + if (isJsObject(this._body)) { + jsonResponse = this._body; + } else if (isString(this._body)) { + jsonResponse = Json.parse(this._body); + } + return jsonResponse; + }, + text: function() { + return this._body.toString(); + }, + arrayBuffer: function() { + throw new BaseException('"arrayBuffer()" method not implemented on Response superclass'); + } + }, {}); + }()); + $__export("Response", Response); + } + }; +}); + +System.register("angular2/src/http/backends/jsonp_backend", ["angular2/src/http/enums", "angular2/src/http/static_response", "angular2/src/http/base_response_options", "angular2/di", "angular2/src/http/backends/browser_jsonp", "angular2/src/facade/async", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/backends/jsonp_backend"; + var __decorate, + __metadata, + ReadyStates, + RequestMethods, + Response, + ResponseOptions, + Injectable, + BrowserJsonp, + EventEmitter, + ObservableWrapper, + StringWrapper, + isPresent, + makeTypeError, + JSONPConnection, + JSONPBackend; + return { + setters: [function($__m) { + ReadyStates = $__m.ReadyStates; + RequestMethods = $__m.RequestMethods; + }, function($__m) { + Response = $__m.Response; + }, function($__m) { + ResponseOptions = $__m.ResponseOptions; + }, function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + BrowserJsonp = $__m.BrowserJsonp; + }, function($__m) { + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + StringWrapper = $__m.StringWrapper; + isPresent = $__m.isPresent; + makeTypeError = $__m.makeTypeError; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + JSONPConnection = (function() { + function JSONPConnection(req, _dom, baseResponseOptions) { + var $__0 = this; + this._dom = _dom; + this.baseResponseOptions = baseResponseOptions; + this._finished = false; + if (req.method !== RequestMethods.GET) { + throw makeTypeError("JSONP requests must use GET request method."); + } + this.request = req; + this.response = new EventEmitter(); + this.readyState = ReadyStates.LOADING; + this._id = _dom.nextRequestID(); + _dom.exposeConnection(this._id, this); + var callback = _dom.requestCallback(this._id); + var url = req.url; + if (url.indexOf('=JSONP_CALLBACK&') > -1) { + url = StringWrapper.replace(url, '=JSONP_CALLBACK&', ("=" + callback + "&")); + } else if (url.lastIndexOf('=JSONP_CALLBACK') === url.length - '=JSONP_CALLBACK'.length) { + url = StringWrapper.substring(url, 0, url.length - '=JSONP_CALLBACK'.length) + ("=" + callback); + } + var script = this._script = _dom.build(url); + script.addEventListener('load', (function(event) { + if ($__0.readyState === ReadyStates.CANCELLED) + return ; + $__0.readyState = ReadyStates.DONE; + _dom.cleanup(script); + if (!$__0._finished) { + ObservableWrapper.callThrow($__0.response, makeTypeError('JSONP injected script did not invoke callback.')); + return ; + } + var responseOptions = new ResponseOptions({body: $__0._responseData}); + if (isPresent($__0.baseResponseOptions)) { + responseOptions = $__0.baseResponseOptions.merge(responseOptions); + } + ObservableWrapper.callNext($__0.response, new Response(responseOptions)); + })); + script.addEventListener('error', (function(error) { + if ($__0.readyState === ReadyStates.CANCELLED) + return ; + $__0.readyState = ReadyStates.DONE; + _dom.cleanup(script); + ObservableWrapper.callThrow($__0.response, error); + })); + _dom.send(script); + } + return ($traceurRuntime.createClass)(JSONPConnection, { + finished: function(data) { + this._finished = true; + this._dom.removeConnection(this._id); + if (this.readyState === ReadyStates.CANCELLED) + return ; + this._responseData = data; + }, + dispose: function() { + this.readyState = ReadyStates.CANCELLED; + var script = this._script; + this._script = null; + if (isPresent(script)) { + this._dom.cleanup(script); + } + ObservableWrapper.callReturn(this.response); + } + }, {}); + }()); + $__export("JSONPConnection", JSONPConnection); + JSONPBackend = (($traceurRuntime.createClass)(function(_browserJSONP, _baseResponseOptions) { + this._browserJSONP = _browserJSONP; + this._baseResponseOptions = _baseResponseOptions; + }, {createConnection: function(request) { + return new JSONPConnection(request, this._browserJSONP, this._baseResponseOptions); + }}, {})); + $__export("JSONPBackend", JSONPBackend); + $__export("JSONPBackend", JSONPBackend = __decorate([Injectable(), __metadata('design:paramtypes', [BrowserJsonp, ResponseOptions])], JSONPBackend)); + } + }; +}); + +System.register("angular2/src/forms/model", ["angular2/src/facade/lang", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/forms/validators"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/model"; + var StringWrapper, + isPresent, + isBlank, + EventEmitter, + ObservableWrapper, + StringMapWrapper, + ListWrapper, + List, + Validators, + VALID, + INVALID, + AbstractControl, + Control, + ControlGroup, + ControlArray; + function isControl(c) { + return c instanceof AbstractControl; + } + function _find(c, path) { + if (isBlank(path)) + return null; + if (!(path instanceof List)) { + path = StringWrapper.split(path, new RegExp("/")); + } + if (path instanceof List && ListWrapper.isEmpty(path)) + return null; + return ListWrapper.reduce(path, (function(v, name) { + if (v instanceof ControlGroup) { + return isPresent(v.controls[name]) ? v.controls[name] : null; + } else if (v instanceof ControlArray) { + var index = name; + return isPresent(v.at(index)) ? v.at(index) : null; + } else { + return null; + } + }), c); + } + $__export("isControl", isControl); + return { + setters: [function($__m) { + StringWrapper = $__m.StringWrapper; + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + }, function($__m) { + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + ListWrapper = $__m.ListWrapper; + List = $__m.List; + }, function($__m) { + Validators = $__m.Validators; + }], + execute: function() { + VALID = "VALID"; + $__export("VALID", VALID); + INVALID = "INVALID"; + $__export("INVALID", INVALID); + AbstractControl = (function() { + function AbstractControl(validator) { + this.validator = validator; + this._pristine = true; + this._touched = false; + } + return ($traceurRuntime.createClass)(AbstractControl, { + get value() { + return this._value; + }, + get status() { + return this._status; + }, + get valid() { + return this._status === VALID; + }, + get errors() { + return this._errors; + }, + get pristine() { + return this._pristine; + }, + get dirty() { + return !this.pristine; + }, + get touched() { + return this._touched; + }, + get untouched() { + return !this._touched; + }, + get valueChanges() { + return this._valueChanges; + }, + markAsTouched: function() { + this._touched = true; + }, + markAsDirty: function() { + var onlySelf = (arguments[0] !== (void 0) ? arguments[0] : {}).onlySelf; + onlySelf = isPresent(onlySelf) ? onlySelf : false; + this._pristine = false; + if (isPresent(this._parent) && !onlySelf) { + this._parent.markAsDirty({onlySelf: onlySelf}); + } + }, + setParent: function(parent) { + this._parent = parent; + }, + updateValidity: function() { + var onlySelf = (arguments[0] !== (void 0) ? arguments[0] : {}).onlySelf; + onlySelf = isPresent(onlySelf) ? onlySelf : false; + this._errors = this.validator(this); + this._status = isPresent(this._errors) ? INVALID : VALID; + if (isPresent(this._parent) && !onlySelf) { + this._parent.updateValidity({onlySelf: onlySelf}); + } + }, + updateValueAndValidity: function() { + var $__2 = arguments[0] !== (void 0) ? arguments[0] : {}, + onlySelf = $__2.onlySelf, + emitEvent = $__2.emitEvent; + onlySelf = isPresent(onlySelf) ? onlySelf : false; + emitEvent = isPresent(emitEvent) ? emitEvent : true; + this._updateValue(); + if (emitEvent) { + ObservableWrapper.callNext(this._valueChanges, this._value); + } + this._errors = this.validator(this); + this._status = isPresent(this._errors) ? INVALID : VALID; + if (isPresent(this._parent) && !onlySelf) { + this._parent.updateValueAndValidity({ + onlySelf: onlySelf, + emitEvent: emitEvent + }); + } + }, + find: function(path) { + return _find(this, path); + }, + getError: function(errorCode) { + var path = arguments[1] !== (void 0) ? arguments[1] : null; + var c = isPresent(path) && !ListWrapper.isEmpty(path) ? this.find(path) : this; + if (isPresent(c) && isPresent(c._errors)) { + return StringMapWrapper.get(c._errors, errorCode); + } else { + return null; + } + }, + hasError: function(errorCode) { + var path = arguments[1] !== (void 0) ? arguments[1] : null; + return isPresent(this.getError(errorCode, path)); + }, + _updateValue: function() {} + }, {}); + }()); + $__export("AbstractControl", AbstractControl); + Control = (function($__super) { + function Control() { + var value = arguments[0] !== (void 0) ? arguments[0] : null; + var validator = arguments[1] !== (void 0) ? arguments[1] : Validators.nullValidator; + $traceurRuntime.superConstructor(Control).call(this, validator); + this._value = value; + this.updateValidity({onlySelf: true}); + this._valueChanges = new EventEmitter(); + } + return ($traceurRuntime.createClass)(Control, { + updateValue: function(value) { + var $__2 = arguments[1] !== (void 0) ? arguments[1] : {}, + onlySelf = $__2.onlySelf, + emitEvent = $__2.emitEvent, + emitModelToViewChange = $__2.emitModelToViewChange; + emitModelToViewChange = isPresent(emitModelToViewChange) ? emitModelToViewChange : true; + this._value = value; + if (isPresent(this._onChange) && emitModelToViewChange) + this._onChange(this._value); + this.updateValueAndValidity({ + onlySelf: onlySelf, + emitEvent: emitEvent + }); + }, + registerOnChange: function(fn) { + this._onChange = fn; + } + }, {}, $__super); + }(AbstractControl)); + $__export("Control", Control); + ControlGroup = (function($__super) { + function ControlGroup(controls) { + var optionals = arguments[1] !== (void 0) ? arguments[1] : null; + var validator = arguments[2] !== (void 0) ? arguments[2] : Validators.group; + $traceurRuntime.superConstructor(ControlGroup).call(this, validator); + this.controls = controls; + this._optionals = isPresent(optionals) ? optionals : {}; + this._valueChanges = new EventEmitter(); + this._setParentForControls(); + this._value = this._reduceValue(); + this.updateValidity({onlySelf: true}); + } + return ($traceurRuntime.createClass)(ControlGroup, { + addControl: function(name, c) { + this.controls[name] = c; + c.setParent(this); + }, + removeControl: function(name) { + StringMapWrapper.delete(this.controls, name); + }, + include: function(controlName) { + StringMapWrapper.set(this._optionals, controlName, true); + this.updateValueAndValidity(); + }, + exclude: function(controlName) { + StringMapWrapper.set(this._optionals, controlName, false); + this.updateValueAndValidity(); + }, + contains: function(controlName) { + var c = StringMapWrapper.contains(this.controls, controlName); + return c && this._included(controlName); + }, + _setParentForControls: function() { + var $__0 = this; + StringMapWrapper.forEach(this.controls, (function(control, name) { + control.setParent($__0); + })); + }, + _updateValue: function() { + this._value = this._reduceValue(); + }, + _reduceValue: function() { + return this._reduceChildren({}, (function(acc, control, name) { + acc[name] = control.value; + return acc; + })); + }, + _reduceChildren: function(initValue, fn) { + var $__0 = this; + var res = initValue; + StringMapWrapper.forEach(this.controls, (function(control, name) { + if ($__0._included(name)) { + res = fn(res, control, name); + } + })); + return res; + }, + _included: function(controlName) { + var isOptional = StringMapWrapper.contains(this._optionals, controlName); + return !isOptional || StringMapWrapper.get(this._optionals, controlName); + } + }, {}, $__super); + }(AbstractControl)); + $__export("ControlGroup", ControlGroup); + ControlArray = (function($__super) { + function ControlArray(controls) { + var validator = arguments[1] !== (void 0) ? arguments[1] : Validators.array; + $traceurRuntime.superConstructor(ControlArray).call(this, validator); + this.controls = controls; + this._valueChanges = new EventEmitter(); + this._setParentForControls(); + this._updateValue(); + this.updateValidity({onlySelf: true}); + } + return ($traceurRuntime.createClass)(ControlArray, { + at: function(index) { + return this.controls[index]; + }, + push: function(control) { + this.controls.push(control); + control.setParent(this); + this.updateValueAndValidity(); + }, + insert: function(index, control) { + ListWrapper.insert(this.controls, index, control); + control.setParent(this); + this.updateValueAndValidity(); + }, + removeAt: function(index) { + ListWrapper.removeAt(this.controls, index); + this.updateValueAndValidity(); + }, + get length() { + return this.controls.length; + }, + _updateValue: function() { + this._value = ListWrapper.map(this.controls, (function(c) { + return c.value; + })); + }, + _setParentForControls: function() { + var $__0 = this; + ListWrapper.forEach(this.controls, (function(control) { + control.setParent($__0); + })); + } + }, {}, $__super); + }(AbstractControl)); + $__export("ControlArray", ControlArray); + } + }; +}); + +System.register("angular2/src/forms/directives/ng_control_name", ["angular2/src/facade/lang", "angular2/src/facade/async", "angular2/core", "angular2/annotations", "angular2/di", "angular2/src/forms/directives/control_container", "angular2/src/forms/directives/ng_control", "angular2/src/forms/directives/validators", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/ng_control_name"; + var __decorate, + __metadata, + __param, + CONST_EXPR, + EventEmitter, + ObservableWrapper, + QueryList, + Query, + Directive, + LifecycleEvent, + forwardRef, + Ancestor, + Binding, + ControlContainer, + NgControl, + NgValidator, + controlPath, + composeNgValidator, + isPropertyUpdated, + controlNameBinding, + NgControlName; + return { + setters: [function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + QueryList = $__m.QueryList; + }, function($__m) { + Query = $__m.Query; + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + forwardRef = $__m.forwardRef; + Ancestor = $__m.Ancestor; + Binding = $__m.Binding; + }, function($__m) { + ControlContainer = $__m.ControlContainer; + }, function($__m) { + NgControl = $__m.NgControl; + }, function($__m) { + NgValidator = $__m.NgValidator; + }, function($__m) { + controlPath = $__m.controlPath; + composeNgValidator = $__m.composeNgValidator; + isPropertyUpdated = $__m.isPropertyUpdated; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + controlNameBinding = CONST_EXPR(new Binding(NgControl, {toAlias: forwardRef((function() { + return NgControlName; + }))})); + NgControlName = (function($__super) { + function $__0(parent, ngValidators) { + $traceurRuntime.superConstructor($__0).call(this); + this.update = new EventEmitter(); + this._added = false; + this._parent = parent; + this.ngValidators = ngValidators; + } + return ($traceurRuntime.createClass)($__0, { + onChange: function(c) { + if (!this._added) { + this.formDirective.addControl(this); + this._added = true; + } + if (isPropertyUpdated(c, this.viewModel)) { + this.viewModel = this.model; + this.formDirective.updateModel(this, this.model); + } + }, + onDestroy: function() { + this.formDirective.removeControl(this); + }, + viewToModelUpdate: function(newValue) { + this.viewModel = newValue; + ObservableWrapper.callNext(this.update, newValue); + }, + get path() { + return controlPath(this.name, this._parent); + }, + get formDirective() { + return this._parent.formDirective; + }, + get control() { + return this.formDirective.getControl(this); + }, + get validator() { + return composeNgValidator(this.ngValidators); + } + }, {}, $__super); + }(NgControl)); + $__export("NgControlName", NgControlName); + $__export("NgControlName", NgControlName = __decorate([Directive({ + selector: '[ng-control]', + hostInjector: [controlNameBinding], + properties: ['name: ngControl', 'model: ngModel'], + events: ['update: ngModel'], + lifecycle: [LifecycleEvent.onDestroy, LifecycleEvent.onChange], + exportAs: 'form' + }), __param(0, Ancestor()), __param(1, Query(NgValidator)), __metadata('design:paramtypes', [ControlContainer, QueryList])], NgControlName)); + } + }; +}); + +System.register("angular2/src/forms/directives/default_value_accessor", ["angular2/render", "angular2/annotations", "angular2/core", "angular2/di", "angular2/src/forms/directives/ng_control", "angular2/src/facade/lang", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/default_value_accessor"; + var __decorate, + __metadata, + __param, + Renderer, + Directive, + ElementRef, + Self, + NgControl, + isBlank, + isPresent, + setProperty, + DefaultValueAccessor; + return { + setters: [function($__m) { + Renderer = $__m.Renderer; + }, function($__m) { + Directive = $__m.Directive; + }, function($__m) { + ElementRef = $__m.ElementRef; + }, function($__m) { + Self = $__m.Self; + }, function($__m) { + NgControl = $__m.NgControl; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + }, function($__m) { + setProperty = $__m.setProperty; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + DefaultValueAccessor = (($traceurRuntime.createClass)(function(cd, renderer, elementRef) { + this.renderer = renderer; + this.elementRef = elementRef; + this.onChange = (function(_) {}); + this.onTouched = (function() {}); + this.cd = cd; + cd.valueAccessor = this; + }, { + writeValue: function(value) { + var normalizedValue = isBlank(value) ? '' : value; + setProperty(this.renderer, this.elementRef, 'value', normalizedValue); + }, + get ngClassUntouched() { + return isPresent(this.cd.control) ? this.cd.control.untouched : false; + }, + get ngClassTouched() { + return isPresent(this.cd.control) ? this.cd.control.touched : false; + }, + get ngClassPristine() { + return isPresent(this.cd.control) ? this.cd.control.pristine : false; + }, + get ngClassDirty() { + return isPresent(this.cd.control) ? this.cd.control.dirty : false; + }, + get ngClassValid() { + return isPresent(this.cd.control) ? this.cd.control.valid : false; + }, + get ngClassInvalid() { + return isPresent(this.cd.control) ? !this.cd.control.valid : false; + }, + registerOnChange: function(fn) { + this.onChange = fn; + }, + registerOnTouched: function(fn) { + this.onTouched = fn; + } + }, {})); + $__export("DefaultValueAccessor", DefaultValueAccessor); + $__export("DefaultValueAccessor", DefaultValueAccessor = __decorate([Directive({ + selector: 'input:not([type=checkbox])[ng-control],textarea[ng-control],input:not([type=checkbox])[ng-form-control],textarea[ng-form-control],input:not([type=checkbox])[ng-model],textarea[ng-model]', + host: { + '(change)': 'onChange($event.target.value)', + '(input)': 'onChange($event.target.value)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, Self()), __metadata('design:paramtypes', [NgControl, Renderer, ElementRef])], DefaultValueAccessor)); + } + }; +}); + +System.register("angular2/src/di/binding", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/reflection/reflection", "angular2/src/di/key", "angular2/src/di/metadata", "angular2/src/di/exceptions", "angular2/src/di/forward_ref"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/binding"; + var __decorate, + __metadata, + Type, + isBlank, + isPresent, + CONST, + CONST_EXPR, + BaseException, + stringify, + isArray, + ListWrapper, + reflector, + Key, + InjectMetadata, + VisibilityMetadata, + OptionalMetadata, + DEFAULT_VISIBILITY, + DependencyMetadata, + NoAnnotationError, + resolveForwardRef, + Dependency, + _EMPTY_LIST, + Binding, + ResolvedBinding, + BindingBuilder; + function bind(token) { + return new BindingBuilder(token); + } + function _constructDependencies(factoryFunction, dependencies) { + if (isBlank(dependencies)) { + return _dependenciesFor(factoryFunction); + } else { + var params = ListWrapper.map(dependencies, (function(t) { + return [t]; + })); + return ListWrapper.map(dependencies, (function(t) { + return _extractToken(factoryFunction, t, params); + })); + } + } + function _dependenciesFor(typeOrFunc) { + var params = reflector.parameters(typeOrFunc); + if (isBlank(params)) + return []; + if (ListWrapper.any(params, (function(p) { + return isBlank(p); + }))) { + throw new NoAnnotationError(typeOrFunc, params); + } + return ListWrapper.map(params, (function(p) { + return _extractToken(typeOrFunc, p, params); + })); + } + function _extractToken(typeOrFunc, annotations, params) { + var depProps = []; + var token = null; + var optional = false; + if (!isArray(annotations)) { + return _createDependency(annotations, optional, DEFAULT_VISIBILITY, depProps); + } + var visibility = DEFAULT_VISIBILITY; + for (var i = 0; i < annotations.length; ++i) { + var paramAnnotation = annotations[i]; + if (paramAnnotation instanceof Type) { + token = paramAnnotation; + } else if (paramAnnotation instanceof InjectMetadata) { + token = paramAnnotation.token; + } else if (paramAnnotation instanceof OptionalMetadata) { + optional = true; + } else if (paramAnnotation instanceof VisibilityMetadata) { + visibility = paramAnnotation; + } else if (paramAnnotation instanceof DependencyMetadata) { + if (isPresent(paramAnnotation.token)) { + token = paramAnnotation.token; + } + depProps.push(paramAnnotation); + } + } + token = resolveForwardRef(token); + if (isPresent(token)) { + return _createDependency(token, optional, visibility, depProps); + } else { + throw new NoAnnotationError(typeOrFunc, params); + } + } + function _createDependency(token, optional, visibility, depProps) { + return new Dependency(Key.get(token), optional, visibility, depProps); + } + $__export("bind", bind); + return { + setters: [function($__m) { + Type = $__m.Type; + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + CONST = $__m.CONST; + CONST_EXPR = $__m.CONST_EXPR; + BaseException = $__m.BaseException; + stringify = $__m.stringify; + isArray = $__m.isArray; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + reflector = $__m.reflector; + }, function($__m) { + Key = $__m.Key; + }, function($__m) { + InjectMetadata = $__m.InjectMetadata; + VisibilityMetadata = $__m.VisibilityMetadata; + OptionalMetadata = $__m.OptionalMetadata; + DEFAULT_VISIBILITY = $__m.DEFAULT_VISIBILITY; + DependencyMetadata = $__m.DependencyMetadata; + }, function($__m) { + NoAnnotationError = $__m.NoAnnotationError; + }, function($__m) { + resolveForwardRef = $__m.resolveForwardRef; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Dependency = (function() { + function Dependency(key, optional, visibility, properties) { + this.key = key; + this.optional = optional; + this.visibility = visibility; + this.properties = properties; + } + return ($traceurRuntime.createClass)(Dependency, {}, {fromKey: function(key) { + return new Dependency(key, false, DEFAULT_VISIBILITY, []); + }}); + }()); + $__export("Dependency", Dependency); + _EMPTY_LIST = CONST_EXPR([]); + Binding = (($traceurRuntime.createClass)(function(token, $__3) { + var $__4 = $__3, + toClass = $__4.toClass, + toValue = $__4.toValue, + toAlias = $__4.toAlias, + toFactory = $__4.toFactory, + deps = $__4.deps; + this.token = token; + this.toClass = toClass; + this.toValue = toValue; + this.toAlias = toAlias; + this.toFactory = toFactory; + this.dependencies = deps; + }, {resolve: function() { + var $__0 = this; + var factoryFn; + var resolvedDeps; + if (isPresent(this.toClass)) { + var toClass = resolveForwardRef(this.toClass); + factoryFn = reflector.factory(toClass); + resolvedDeps = _dependenciesFor(toClass); + } else if (isPresent(this.toAlias)) { + factoryFn = (function(aliasInstance) { + return aliasInstance; + }); + resolvedDeps = [Dependency.fromKey(Key.get(this.toAlias))]; + } else if (isPresent(this.toFactory)) { + factoryFn = this.toFactory; + resolvedDeps = _constructDependencies(this.toFactory, this.dependencies); + } else { + factoryFn = (function() { + return $__0.toValue; + }); + resolvedDeps = _EMPTY_LIST; + } + return new ResolvedBinding(Key.get(this.token), factoryFn, resolvedDeps); + }}, {})); + $__export("Binding", Binding); + $__export("Binding", Binding = __decorate([CONST(), __metadata('design:paramtypes', [Object, Object])], Binding)); + ResolvedBinding = (function() { + function ResolvedBinding(key, factory, dependencies) { + this.key = key; + this.factory = factory; + this.dependencies = dependencies; + } + return ($traceurRuntime.createClass)(ResolvedBinding, {}, {}); + }()); + $__export("ResolvedBinding", ResolvedBinding); + BindingBuilder = (function() { + function BindingBuilder(token) { + this.token = token; + } + return ($traceurRuntime.createClass)(BindingBuilder, { + toClass: function(type) { + return new Binding(this.token, {toClass: type}); + }, + toValue: function(value) { + return new Binding(this.token, {toValue: value}); + }, + toAlias: function(aliasToken) { + if (isBlank(aliasToken)) { + throw new BaseException(("Can not alias " + stringify(this.token) + " to a blank value!")); + } + return new Binding(this.token, {toAlias: aliasToken}); + }, + toFactory: function(factoryFunction, dependencies) { + return new Binding(this.token, { + toFactory: factoryFunction, + deps: dependencies + }); + } + }, {}); + }()); + $__export("BindingBuilder", BindingBuilder); + } + }; +}); + +System.register("angular2/src/change_detection/abstract_change_detector", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/change_detector_ref", "angular2/src/change_detection/exceptions", "angular2/src/change_detection/constants"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/abstract_change_detector"; + var isPresent, + BaseException, + ListWrapper, + ChangeDetectorRef, + ChangeDetectionError, + CHECK_ONCE, + CHECKED, + DETACHED, + _Context, + AbstractChangeDetector; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + ChangeDetectorRef = $__m.ChangeDetectorRef; + }, function($__m) { + ChangeDetectionError = $__m.ChangeDetectionError; + }, function($__m) { + CHECK_ONCE = $__m.CHECK_ONCE; + CHECKED = $__m.CHECKED; + DETACHED = $__m.DETACHED; + }], + execute: function() { + _Context = (function() { + function _Context(element, componentElement, instance, context, locals, injector, expression) { + this.element = element; + this.componentElement = componentElement; + this.instance = instance; + this.context = context; + this.locals = locals; + this.injector = injector; + this.expression = expression; + } + return ($traceurRuntime.createClass)(_Context, {}, {}); + }()); + AbstractChangeDetector = (function() { + function AbstractChangeDetector(id, dispatcher) { + this.id = id; + this.dispatcher = dispatcher; + this.lightDomChildren = []; + this.shadowDomChildren = []; + this.mode = null; + this.ref = new ChangeDetectorRef(this); + } + return ($traceurRuntime.createClass)(AbstractChangeDetector, { + addChild: function(cd) { + this.lightDomChildren.push(cd); + cd.parent = this; + }, + removeChild: function(cd) { + ListWrapper.remove(this.lightDomChildren, cd); + }, + addShadowDomChild: function(cd) { + this.shadowDomChildren.push(cd); + cd.parent = this; + }, + removeShadowDomChild: function(cd) { + ListWrapper.remove(this.shadowDomChildren, cd); + }, + remove: function() { + this.parent.removeChild(this); + }, + detectChanges: function() { + this.runDetectChanges(false); + }, + checkNoChanges: function() { + throw new BaseException("Not implemented"); + }, + runDetectChanges: function(throwOnChange) { + if (this.mode === DETACHED || this.mode === CHECKED) + return ; + this.detectChangesInRecords(throwOnChange); + this._detectChangesInLightDomChildren(throwOnChange); + if (throwOnChange === false) + this.callOnAllChangesDone(); + this._detectChangesInShadowDomChildren(throwOnChange); + if (this.mode === CHECK_ONCE) + this.mode = CHECKED; + }, + detectChangesInRecords: function(throwOnChange) {}, + hydrate: function(context, locals, directives, pipes) {}, + hydrateDirectives: function(directives) {}, + dehydrate: function() {}, + dehydrateDirectives: function(destroyPipes) {}, + callOnAllChangesDone: function() {}, + _detectChangesInLightDomChildren: function(throwOnChange) { + var c = this.lightDomChildren; + for (var i = 0; i < c.length; ++i) { + c[i].runDetectChanges(throwOnChange); + } + }, + _detectChangesInShadowDomChildren: function(throwOnChange) { + var c = this.shadowDomChildren; + for (var i = 0; i < c.length; ++i) { + c[i].runDetectChanges(throwOnChange); + } + }, + markAsCheckOnce: function() { + this.mode = CHECK_ONCE; + }, + markPathToRootAsCheckOnce: function() { + var c = this; + while (isPresent(c) && c.mode != DETACHED) { + if (c.mode === CHECKED) + c.mode = CHECK_ONCE; + c = c.parent; + } + }, + throwError: function(proto, exception, stack) { + var c = this.dispatcher.getDebugContext(proto.bindingRecord.elementIndex, proto.directiveIndex); + var context = isPresent(c) ? new _Context(c.element, c.componentElement, c.directive, c.context, c.locals, c.injector, proto.expressionAsString) : null; + throw new ChangeDetectionError(proto, exception, stack, context); + } + }, {}); + }()); + $__export("AbstractChangeDetector", AbstractChangeDetector); + } + }; +}); + +System.register("angular2/src/core/compiler/view_manager", ["angular2/di", "angular2/src/facade/lang", "angular2/src/core/compiler/view_ref", "angular2/src/render/api", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_listener"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view_manager"; + var __decorate, + __metadata, + Injectable, + isPresent, + isBlank, + BaseException, + internalView, + internalProtoView, + Renderer, + ViewType, + AppViewManagerUtils, + AppViewPool, + AppViewListener, + AppViewManager; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + internalView = $__m.internalView; + internalProtoView = $__m.internalProtoView; + }, function($__m) { + Renderer = $__m.Renderer; + ViewType = $__m.ViewType; + }, function($__m) { + AppViewManagerUtils = $__m.AppViewManagerUtils; + }, function($__m) { + AppViewPool = $__m.AppViewPool; + }, function($__m) { + AppViewListener = $__m.AppViewListener; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + AppViewManager = (($traceurRuntime.createClass)(function(_viewPool, _viewListener, _utils, _renderer) { + this._viewPool = _viewPool; + this._viewListener = _viewListener; + this._utils = _utils; + this._renderer = _renderer; + }, { + getViewContainer: function(location) { + var hostView = internalView(location.parentView); + return hostView.elementInjectors[location.boundElementIndex].getViewContainerRef(); + }, + getHostElement: function(hostViewRef) { + var hostView = internalView(hostViewRef); + if (hostView.proto.type !== ViewType.HOST) { + throw new BaseException('This operation is only allowed on host views'); + } + return hostView.elementRefs[hostView.elementOffset]; + }, + getNamedElementInComponentView: function(hostLocation, variableName) { + var hostView = internalView(hostLocation.parentView); + var boundElementIndex = hostLocation.boundElementIndex; + var componentView = hostView.getNestedView(boundElementIndex); + if (isBlank(componentView)) { + throw new BaseException(("There is no component directive at element " + boundElementIndex)); + } + var binderIdx = componentView.proto.variableLocations.get(variableName); + if (isBlank(binderIdx)) { + throw new BaseException(("Could not find variable " + variableName)); + } + return componentView.elementRefs[componentView.elementOffset + binderIdx]; + }, + getComponent: function(hostLocation) { + var hostView = internalView(hostLocation.parentView); + var boundElementIndex = hostLocation.boundElementIndex; + return this._utils.getComponentInstance(hostView, boundElementIndex); + }, + createRootHostView: function(hostProtoViewRef, overrideSelector, injector) { + var hostProtoView = internalProtoView(hostProtoViewRef); + var hostElementSelector = overrideSelector; + if (isBlank(hostElementSelector)) { + hostElementSelector = hostProtoView.elementBinders[0].componentDirective.metadata.selector; + } + var renderViewWithFragments = this._renderer.createRootHostView(hostProtoView.mergeMapping.renderProtoViewRef, hostProtoView.mergeMapping.renderFragmentCount, hostElementSelector); + var hostView = this._createMainView(hostProtoView, renderViewWithFragments); + this._renderer.hydrateView(hostView.render); + this._utils.hydrateRootHostView(hostView, injector); + return hostView.ref; + }, + destroyRootHostView: function(hostViewRef) { + var hostView = internalView(hostViewRef); + this._renderer.detachFragment(hostView.renderFragment); + this._renderer.dehydrateView(hostView.render); + this._viewDehydrateRecurse(hostView); + this._viewListener.viewDestroyed(hostView); + this._renderer.destroyView(hostView.render); + }, + createEmbeddedViewInContainer: function(viewContainerLocation, atIndex, templateRef) { + var protoView = internalProtoView(templateRef.protoViewRef); + if (protoView.type !== ViewType.EMBEDDED) { + throw new BaseException('This method can only be called with embedded ProtoViews!'); + } + return this._createViewInContainer(viewContainerLocation, atIndex, protoView, templateRef.elementRef, null); + }, + createHostViewInContainer: function(viewContainerLocation, atIndex, protoViewRef, imperativelyCreatedInjector) { + var protoView = internalProtoView(protoViewRef); + if (protoView.type !== ViewType.HOST) { + throw new BaseException('This method can only be called with host ProtoViews!'); + } + return this._createViewInContainer(viewContainerLocation, atIndex, protoView, viewContainerLocation, imperativelyCreatedInjector); + }, + _createViewInContainer: function(viewContainerLocation, atIndex, protoView, context, imperativelyCreatedInjector) { + var parentView = internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + var contextView = internalView(context.parentView); + var contextBoundElementIndex = context.boundElementIndex; + var embeddedFragmentView = contextView.getNestedView(contextBoundElementIndex); + var view; + if (protoView.type === ViewType.EMBEDDED && isPresent(embeddedFragmentView) && !embeddedFragmentView.hydrated()) { + view = embeddedFragmentView; + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + } else { + view = this._createPooledView(protoView); + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + this._renderer.hydrateView(view.render); + } + this._utils.attachViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view); + this._utils.hydrateViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, imperativelyCreatedInjector); + return view.ref; + }, + _attachRenderView: function(parentView, boundElementIndex, atIndex, view) { + var elementRef = parentView.elementRefs[boundElementIndex]; + if (atIndex === 0) { + this._renderer.attachFragmentAfterElement(elementRef, view.renderFragment); + } else { + var prevView = parentView.viewContainers[boundElementIndex].views[atIndex - 1]; + this._renderer.attachFragmentAfterFragment(prevView.renderFragment, view.renderFragment); + } + }, + destroyViewInContainer: function(viewContainerLocation, atIndex) { + var parentView = internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + this._destroyViewInContainer(parentView, boundElementIndex, atIndex); + }, + attachViewInContainer: function(viewContainerLocation, atIndex, viewRef) { + var view = internalView(viewRef); + var parentView = internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + this._utils.attachViewInContainer(parentView, boundElementIndex, null, null, atIndex, view); + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + return viewRef; + }, + detachViewInContainer: function(viewContainerLocation, atIndex) { + var parentView = internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex); + this._renderer.detachFragment(view.renderFragment); + return view.ref; + }, + _createMainView: function(protoView, renderViewWithFragments) { + var mergedParentView = this._utils.createView(protoView, renderViewWithFragments, this, this._renderer); + this._renderer.setEventDispatcher(mergedParentView.render, mergedParentView); + this._viewListener.viewCreated(mergedParentView); + return mergedParentView; + }, + _createPooledView: function(protoView) { + var view = this._viewPool.getView(protoView); + if (isBlank(view)) { + view = this._createMainView(protoView, this._renderer.createView(protoView.mergeMapping.renderProtoViewRef, protoView.mergeMapping.renderFragmentCount)); + } + return view; + }, + _destroyPooledView: function(view) { + var wasReturned = this._viewPool.returnView(view); + if (!wasReturned) { + this._viewListener.viewDestroyed(view); + this._renderer.destroyView(view.render); + } + }, + _destroyViewInContainer: function(parentView, boundElementIndex, atIndex) { + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + this._viewDehydrateRecurse(view); + this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex); + if (view.viewOffset > 0) { + this._renderer.detachFragment(view.renderFragment); + } else { + this._renderer.dehydrateView(view.render); + this._renderer.detachFragment(view.renderFragment); + this._destroyPooledView(view); + } + }, + _viewDehydrateRecurse: function(view) { + if (view.hydrated()) { + this._utils.dehydrateView(view); + } + var viewContainers = view.viewContainers; + var startViewOffset = view.viewOffset; + var endViewOffset = view.viewOffset + view.mainMergeMapping.nestedViewCountByViewIndex[view.viewOffset]; + var elementOffset = view.elementOffset; + for (var viewIdx = startViewOffset; viewIdx <= endViewOffset; viewIdx++) { + var currView = view.views[viewIdx]; + for (var binderIdx = 0; binderIdx < currView.proto.elementBinders.length; binderIdx++, elementOffset++) { + var vc = viewContainers[elementOffset]; + if (isPresent(vc)) { + for (var j = vc.views.length - 1; j >= 0; j--) { + this._destroyViewInContainer(currView, elementOffset, j); + } + } + } + } + } + }, {})); + $__export("AppViewManager", AppViewManager); + $__export("AppViewManager", AppViewManager = __decorate([Injectable(), __metadata('design:paramtypes', [AppViewPool, AppViewListener, AppViewManagerUtils, Renderer])], AppViewManager)); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/view_loader", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/facade/async", "angular2/src/dom/dom_adapter", "angular2/src/render/xhr", "angular2/src/render/dom/compiler/style_inliner", "angular2/src/render/dom/compiler/style_url_resolver"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/view_loader"; + var __decorate, + __metadata, + Injectable, + isBlank, + isPresent, + BaseException, + isPromise, + StringWrapper, + Map, + MapWrapper, + ListWrapper, + PromiseWrapper, + DOM, + XHR, + StyleInliner, + StyleUrlResolver, + TemplateAndStyles, + ViewLoader; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + isPromise = $__m.isPromise; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + Map = $__m.Map; + MapWrapper = $__m.MapWrapper; + ListWrapper = $__m.ListWrapper; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + XHR = $__m.XHR; + }, function($__m) { + StyleInliner = $__m.StyleInliner; + }, function($__m) { + StyleUrlResolver = $__m.StyleUrlResolver; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + TemplateAndStyles = (function() { + function TemplateAndStyles(template, styles) { + this.template = template; + this.styles = styles; + } + return ($traceurRuntime.createClass)(TemplateAndStyles, {}, {}); + }()); + $__export("TemplateAndStyles", TemplateAndStyles); + ViewLoader = (($traceurRuntime.createClass)(function(_xhr, _styleInliner, _styleUrlResolver) { + this._xhr = _xhr; + this._styleInliner = _styleInliner; + this._styleUrlResolver = _styleUrlResolver; + this._cache = new Map(); + }, { + load: function(viewDef) { + var $__0 = this; + var tplAndStyles = [this._loadHtml(viewDef.template, viewDef.templateAbsUrl)]; + if (isPresent(viewDef.styles)) { + viewDef.styles.forEach((function(cssText) { + var textOrPromise = $__0._resolveAndInlineCssText(cssText, viewDef.templateAbsUrl); + tplAndStyles.push(textOrPromise); + })); + } + if (isPresent(viewDef.styleAbsUrls)) { + viewDef.styleAbsUrls.forEach((function(url) { + var promise = $__0._loadText(url).then((function(cssText) { + return $__0._resolveAndInlineCssText(cssText, viewDef.templateAbsUrl); + })); + tplAndStyles.push(promise); + })); + } + return PromiseWrapper.all(tplAndStyles).then((function(res) { + var loadedTplAndStyles = res[0]; + var styles = ListWrapper.slice(res, 1); + return new TemplateAndStyles(loadedTplAndStyles.template, loadedTplAndStyles.styles.concat(styles)); + })); + }, + _loadText: function(url) { + var response = this._cache.get(url); + if (isBlank(response)) { + response = PromiseWrapper.catchError(this._xhr.get(url), (function(_) { + return PromiseWrapper.reject(new BaseException(("Failed to fetch url \"" + url + "\"")), null); + })); + this._cache.set(url, response); + } + return response; + }, + _loadHtml: function(template, templateAbsUrl) { + var $__0 = this; + var html; + if (isPresent(template)) { + html = PromiseWrapper.resolve(template); + } else if (isPresent(templateAbsUrl)) { + html = this._loadText(templateAbsUrl); + } else { + throw new BaseException('View should have either the templateUrl or template property set'); + } + return html.then((function(html) { + var tplEl = DOM.createTemplate(html); + if (isPresent(templateAbsUrl) && templateAbsUrl.indexOf("/") >= 0) { + var baseUrl = templateAbsUrl.substring(0, templateAbsUrl.lastIndexOf("/")); + $__0._substituteBaseUrl(DOM.content(tplEl), baseUrl); + } + var styleEls = DOM.querySelectorAll(DOM.content(tplEl), 'STYLE'); + var unresolvedStyles = []; + for (var i = 0; i < styleEls.length; i++) { + var styleEl = styleEls[i]; + unresolvedStyles.push(DOM.getText(styleEl)); + DOM.remove(styleEl); + } + var syncStyles = []; + var asyncStyles = []; + for (var i$__3 = 0; i$__3 < styleEls.length; i$__3++) { + var styleEl = styleEls[i$__3]; + var resolvedStyled = $__0._resolveAndInlineCssText(DOM.getText(styleEl), templateAbsUrl); + if (isPromise(resolvedStyled)) { + asyncStyles.push(resolvedStyled); + } else { + syncStyles.push(resolvedStyled); + } + } + if (asyncStyles.length === 0) { + return PromiseWrapper.resolve(new TemplateAndStyles(DOM.getInnerHTML(tplEl), syncStyles)); + } else { + return PromiseWrapper.all(asyncStyles).then((function(loadedStyles) { + return new TemplateAndStyles(DOM.getInnerHTML(tplEl), syncStyles.concat(loadedStyles)); + })); + } + })); + }, + _substituteBaseUrl: function(element, baseUrl) { + if (DOM.isElementNode(element)) { + var attrs = DOM.attributeMap(element); + MapWrapper.forEach(attrs, (function(v, k) { + if (isPresent(v) && v.indexOf('$baseUrl') >= 0) { + DOM.setAttribute(element, k, StringWrapper.replaceAll(v, /\$baseUrl/g, baseUrl)); + } + })); + } + var children = DOM.childNodes(element); + for (var i = 0; i < children.length; i++) { + if (DOM.isElementNode(children[i])) { + this._substituteBaseUrl(children[i], baseUrl); + } + } + }, + _resolveAndInlineCssText: function(cssText, baseUrl) { + cssText = this._styleUrlResolver.resolveUrls(cssText, baseUrl); + return this._styleInliner.inlineImports(cssText, baseUrl); + } + }, {})); + $__export("ViewLoader", ViewLoader); + $__export("ViewLoader", ViewLoader = __decorate([Injectable(), __metadata('design:paramtypes', [XHR, StyleInliner, StyleUrlResolver])], ViewLoader)); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/compile_pipeline", ["angular2/src/facade/lang", "angular2/src/dom/dom_adapter", "angular2/src/render/dom/compiler/compile_element", "angular2/src/render/dom/compiler/compile_control", "angular2/src/render/dom/view/proto_view_builder"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/compile_pipeline"; + var isPresent, + DOM, + CompileElement, + CompileControl, + ProtoViewBuilder, + CompilePipeline; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + CompileElement = $__m.CompileElement; + }, function($__m) { + CompileControl = $__m.CompileControl; + }, function($__m) { + ProtoViewBuilder = $__m.ProtoViewBuilder; + }], + execute: function() { + CompilePipeline = (function() { + function CompilePipeline(steps) { + this.steps = steps; + this._control = new CompileControl(steps); + } + return ($traceurRuntime.createClass)(CompilePipeline, { + processStyles: function(styles) { + var $__0 = this; + return styles.map((function(style) { + $__0.steps.forEach((function(step) { + style = step.processStyle(style); + })); + return style; + })); + }, + processElements: function(rootElement, protoViewType, viewDef) { + var results = []; + var compilationCtxtDescription = viewDef.componentId; + var rootCompileElement = new CompileElement(rootElement, compilationCtxtDescription); + rootCompileElement.inheritedProtoView = new ProtoViewBuilder(rootElement, protoViewType, viewDef.encapsulation); + rootCompileElement.isViewRoot = true; + this._processElement(results, null, rootCompileElement, compilationCtxtDescription); + return results; + }, + _processElement: function(results, parent, current) { + var compilationCtxtDescription = arguments[3] !== (void 0) ? arguments[3] : ''; + var additionalChildren = this._control.internalProcess(results, 0, parent, current); + if (current.compileChildren) { + var node = DOM.firstChild(DOM.templateAwareRoot(current.element)); + while (isPresent(node)) { + var nextNode = DOM.nextSibling(node); + if (DOM.isElementNode(node)) { + var childCompileElement = new CompileElement(node, compilationCtxtDescription); + childCompileElement.inheritedProtoView = current.inheritedProtoView; + childCompileElement.inheritedElementBinder = current.inheritedElementBinder; + childCompileElement.distanceToInheritedBinder = current.distanceToInheritedBinder + 1; + this._processElement(results, current, childCompileElement); + } + node = nextNode; + } + } + if (isPresent(additionalChildren)) { + for (var i = 0; i < additionalChildren.length; i++) { + this._processElement(results, current, additionalChildren[i]); + } + } + } + }, {}); + }()); + $__export("CompilePipeline", CompilePipeline); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/compile_step_factory", ["angular2/src/render/dom/compiler/property_binding_parser", "angular2/src/render/dom/compiler/text_interpolation_parser", "angular2/src/render/dom/compiler/directive_parser", "angular2/src/render/dom/compiler/view_splitter", "angular2/src/render/dom/compiler/style_encapsulator"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/compile_step_factory"; + var PropertyBindingParser, + TextInterpolationParser, + DirectiveParser, + ViewSplitter, + StyleEncapsulator, + CompileStepFactory, + DefaultStepFactory; + return { + setters: [function($__m) { + PropertyBindingParser = $__m.PropertyBindingParser; + }, function($__m) { + TextInterpolationParser = $__m.TextInterpolationParser; + }, function($__m) { + DirectiveParser = $__m.DirectiveParser; + }, function($__m) { + ViewSplitter = $__m.ViewSplitter; + }, function($__m) { + StyleEncapsulator = $__m.StyleEncapsulator; + }], + execute: function() { + CompileStepFactory = (function() { + function CompileStepFactory() {} + return ($traceurRuntime.createClass)(CompileStepFactory, {createSteps: function(view) { + return null; + }}, {}); + }()); + $__export("CompileStepFactory", CompileStepFactory); + DefaultStepFactory = (function($__super) { + function DefaultStepFactory(_parser, _appId) { + $traceurRuntime.superConstructor(DefaultStepFactory).call(this); + this._parser = _parser; + this._appId = _appId; + this._componentUIDsCache = new Map(); + } + return ($traceurRuntime.createClass)(DefaultStepFactory, {createSteps: function(view) { + return [new ViewSplitter(this._parser), new PropertyBindingParser(this._parser), new DirectiveParser(this._parser, view.directives), new TextInterpolationParser(this._parser), new StyleEncapsulator(this._appId, view, this._componentUIDsCache)]; + }}, {}, $__super); + }(CompileStepFactory)); + $__export("DefaultStepFactory", DefaultStepFactory); + } + }; +}); + +System.register("angular2/src/http/http", ["angular2/src/facade/lang", "angular2/src/di/decorators", "angular2/src/http/interfaces", "angular2/src/http/static_request", "angular2/src/http/base_request_options", "angular2/src/http/enums"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/http"; + var __decorate, + __metadata, + isString, + isPresent, + makeTypeError, + Injectable, + ConnectionBackend, + Request, + RequestOptions, + RequestMethods, + Http, + Jsonp; + function httpRequest(backend, request) { + return backend.createConnection(request).response; + } + function mergeOptions(defaultOpts, providedOpts, method, url) { + var newOptions = defaultOpts; + if (isPresent(providedOpts)) { + newOptions = newOptions.merge(new RequestOptions({ + method: providedOpts.method, + url: providedOpts.url, + headers: providedOpts.headers, + body: providedOpts.body, + mode: providedOpts.mode, + credentials: providedOpts.credentials, + cache: providedOpts.cache + })); + } + if (isPresent(method)) { + return newOptions.merge(new RequestOptions({ + method: method, + url: url + })); + } else { + return newOptions.merge(new RequestOptions({url: url})); + } + } + return { + setters: [function($__m) { + isString = $__m.isString; + isPresent = $__m.isPresent; + makeTypeError = $__m.makeTypeError; + }, function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + ConnectionBackend = $__m.ConnectionBackend; + }, function($__m) { + Request = $__m.Request; + }, function($__m) { + RequestOptions = $__m.RequestOptions; + }, function($__m) { + RequestMethods = $__m.RequestMethods; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Http = (($traceurRuntime.createClass)(function(_backend, _defaultOptions) { + this._backend = _backend; + this._defaultOptions = _defaultOptions; + }, { + request: function(url, options) { + var responseObservable; + if (isString(url)) { + responseObservable = httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions, options, RequestMethods.GET, url))); + } else if (url instanceof Request) { + responseObservable = httpRequest(this._backend, url); + } + return responseObservable; + }, + get: function(url, options) { + return httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions, options, RequestMethods.GET, url))); + }, + post: function(url, body, options) { + return httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions.merge(new RequestOptions({body: body})), options, RequestMethods.POST, url))); + }, + put: function(url, body, options) { + return httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions.merge(new RequestOptions({body: body})), options, RequestMethods.PUT, url))); + }, + delete: function(url, options) { + return httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions, options, RequestMethods.DELETE, url))); + }, + patch: function(url, body, options) { + return httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions.merge(new RequestOptions({body: body})), options, RequestMethods.PATCH, url))); + }, + head: function(url, options) { + return httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions, options, RequestMethods.HEAD, url))); + } + }, {})); + $__export("Http", Http); + $__export("Http", Http = __decorate([Injectable(), __metadata('design:paramtypes', [ConnectionBackend, RequestOptions])], Http)); + Jsonp = (function($__super) { + function $__0(backend, defaultOptions) { + $traceurRuntime.superConstructor($__0).call(this, backend, defaultOptions); + } + return ($traceurRuntime.createClass)($__0, {request: function(url, options) { + var responseObservable; + if (isString(url)) { + url = new Request(mergeOptions(this._defaultOptions, options, RequestMethods.GET, url)); + } + if (url instanceof Request) { + if (url.method !== RequestMethods.GET) { + makeTypeError('JSONP requests must use GET request method.'); + } + responseObservable = httpRequest(this._backend, url); + } + return responseObservable; + }}, {}, $__super); + }(Http)); + $__export("Jsonp", Jsonp); + $__export("Jsonp", Jsonp = __decorate([Injectable(), __metadata('design:paramtypes', [ConnectionBackend, RequestOptions])], Jsonp)); + } + }; +}); + +System.register("angular2/src/http/backends/xhr_backend", ["angular2/src/http/enums", "angular2/src/http/static_response", "angular2/src/http/base_response_options", "angular2/di", "angular2/src/http/backends/browser_xhr", "angular2/src/facade/async", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/backends/xhr_backend"; + var __decorate, + __metadata, + RequestMethodsMap, + Response, + ResponseOptions, + Injectable, + BrowserXhr, + EventEmitter, + ObservableWrapper, + isPresent, + ENUM_INDEX, + XHRConnection, + XHRBackend; + return { + setters: [function($__m) { + RequestMethodsMap = $__m.RequestMethodsMap; + }, function($__m) { + Response = $__m.Response; + }, function($__m) { + ResponseOptions = $__m.ResponseOptions; + }, function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + BrowserXhr = $__m.BrowserXhr; + }, function($__m) { + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + ENUM_INDEX = $__m.ENUM_INDEX; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + XHRConnection = (function() { + function XHRConnection(req, browserXHR, baseResponseOptions) { + var $__0 = this; + var requestMethodsMap = new RequestMethodsMap(); + this.request = req; + this.response = new EventEmitter(); + this._xhr = browserXHR.build(); + this._xhr.open(requestMethodsMap.getMethod(ENUM_INDEX(req.method)), req.url); + this._xhr.addEventListener('load', (function(_) { + var responseOptions = new ResponseOptions({body: isPresent($__0._xhr.response) ? $__0._xhr.response : $__0._xhr.responseText}); + if (isPresent(baseResponseOptions)) { + responseOptions = baseResponseOptions.merge(responseOptions); + } + ObservableWrapper.callNext($__0.response, new Response(responseOptions)); + ObservableWrapper.callReturn($__0.response); + })); + if (isPresent(req.headers)) { + req.headers.forEach((function(value, name) { + $__0._xhr.setRequestHeader(name, value); + })); + } + this._xhr.send(this.request.text()); + } + return ($traceurRuntime.createClass)(XHRConnection, {dispose: function() { + this._xhr.abort(); + }}, {}); + }()); + $__export("XHRConnection", XHRConnection); + XHRBackend = (($traceurRuntime.createClass)(function(_browserXHR, _baseResponseOptions) { + this._browserXHR = _browserXHR; + this._baseResponseOptions = _baseResponseOptions; + }, {createConnection: function(request) { + return new XHRConnection(request, this._browserXHR, this._baseResponseOptions); + }}, {})); + $__export("XHRBackend", XHRBackend); + $__export("XHRBackend", XHRBackend = __decorate([Injectable(), __metadata('design:paramtypes', [BrowserXhr, ResponseOptions])], XHRBackend)); + } + }; +}); + +System.register("angular2/forms", ["angular2/src/forms/model", "angular2/src/forms/directives/abstract_control_directive", "angular2/src/forms/directives/control_container", "angular2/src/forms/directives/ng_control_name", "angular2/src/forms/directives/ng_form_control", "angular2/src/forms/directives/ng_model", "angular2/src/forms/directives/ng_control", "angular2/src/forms/directives/ng_control_group", "angular2/src/forms/directives/ng_form_model", "angular2/src/forms/directives/ng_form", "angular2/src/forms/directives/default_value_accessor", "angular2/src/forms/directives/checkbox_value_accessor", "angular2/src/forms/directives/select_control_value_accessor", "angular2/src/forms/directives", "angular2/src/forms/validators", "angular2/src/forms/directives/validators", "angular2/src/forms/form_builder", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/forms"; + var FormBuilder, + CONST_EXPR, + formInjectables; + return { + setters: [function($__m) { + $__export("AbstractControl", $__m.AbstractControl); + $__export("Control", $__m.Control); + $__export("ControlGroup", $__m.ControlGroup); + $__export("ControlArray", $__m.ControlArray); + }, function($__m) { + $__export("AbstractControlDirective", $__m.AbstractControlDirective); + }, function($__m) { + $__export("ControlContainer", $__m.ControlContainer); + }, function($__m) { + $__export("NgControlName", $__m.NgControlName); + }, function($__m) { + $__export("NgFormControl", $__m.NgFormControl); + }, function($__m) { + $__export("NgModel", $__m.NgModel); + }, function($__m) { + $__export("NgControl", $__m.NgControl); + }, function($__m) { + $__export("NgControlGroup", $__m.NgControlGroup); + }, function($__m) { + $__export("NgFormModel", $__m.NgFormModel); + }, function($__m) { + $__export("NgForm", $__m.NgForm); + }, function($__m) { + $__export("DefaultValueAccessor", $__m.DefaultValueAccessor); + }, function($__m) { + $__export("CheckboxControlValueAccessor", $__m.CheckboxControlValueAccessor); + }, function($__m) { + $__export("NgSelectOption", $__m.NgSelectOption); + $__export("SelectControlValueAccessor", $__m.SelectControlValueAccessor); + }, function($__m) { + $__export("formDirectives", $__m.formDirectives); + }, function($__m) { + $__export("Validators", $__m.Validators); + }, function($__m) { + $__export("NgValidator", $__m.NgValidator); + $__export("NgRequiredValidator", $__m.NgRequiredValidator); + }, function($__m) { + FormBuilder = $__m.FormBuilder; + $__export("FormBuilder", $__m.FormBuilder); + }, function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }], + execute: function() { + formInjectables = CONST_EXPR([FormBuilder]); + $__export("formInjectables", formInjectables); + } + }; +}); + +System.register("angular2/src/di/injector", ["angular2/src/facade/collection", "angular2/src/di/binding", "angular2/src/di/exceptions", "angular2/src/facade/lang", "angular2/src/di/key", "angular2/src/di/forward_ref", "angular2/src/di/metadata"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/injector"; + var Map, + List, + MapWrapper, + ListWrapper, + ResolvedBinding, + Binding, + BindingBuilder, + bind, + AbstractBindingError, + NoBindingError, + CyclicDependencyError, + InstantiationError, + InvalidBindingError, + OutOfBoundsError, + Type, + isPresent, + CONST_EXPR, + Key, + resolveForwardRef, + DEFAULT_VISIBILITY, + SelfMetadata, + AncestorMetadata, + _constructing, + _notFound, + _MAX_CONSTRUCTION_COUNTER, + undefinedValue, + PUBLIC, + PRIVATE, + PUBLIC_AND_PRIVATE, + ProtoInjectorInlineStrategy, + ProtoInjectorDynamicStrategy, + ProtoInjector, + InjectorInlineStrategy, + InjectorDynamicStrategy, + BindingWithVisibility, + Injector, + INJECTOR_KEY; + function _resolveBindings(bindings) { + var resolvedList = ListWrapper.createFixedSize(bindings.length); + for (var i = 0; i < bindings.length; i++) { + var unresolved = resolveForwardRef(bindings[i]); + var resolved = void 0; + if (unresolved instanceof ResolvedBinding) { + resolved = unresolved; + } else if (unresolved instanceof Type) { + resolved = bind(unresolved).toClass(unresolved).resolve(); + } else if (unresolved instanceof Binding) { + resolved = unresolved.resolve(); + } else if (unresolved instanceof List) { + resolved = _resolveBindings(unresolved); + } else if (unresolved instanceof BindingBuilder) { + throw new InvalidBindingError(unresolved.token); + } else { + throw new InvalidBindingError(unresolved); + } + resolvedList[i] = resolved; + } + return resolvedList; + } + function _createListOfBindings(flattenedBindings) { + return MapWrapper.values(flattenedBindings); + } + function _flattenBindings(bindings, res) { + ListWrapper.forEach(bindings, function(b) { + if (b instanceof ResolvedBinding) { + res.set(b.key.id, b); + } else if (b instanceof List) { + _flattenBindings(b, res); + } + }); + return res; + } + function _mapBindings(injector, fn) { + var res = []; + for (var i = 0; i < injector._proto.numberOfBindings; ++i) { + res.push(fn(injector._proto.getBindingAtIndex(i))); + } + return res; + } + return { + setters: [function($__m) { + Map = $__m.Map; + List = $__m.List; + MapWrapper = $__m.MapWrapper; + ListWrapper = $__m.ListWrapper; + }, function($__m) { + ResolvedBinding = $__m.ResolvedBinding; + Binding = $__m.Binding; + BindingBuilder = $__m.BindingBuilder; + bind = $__m.bind; + }, function($__m) { + AbstractBindingError = $__m.AbstractBindingError; + NoBindingError = $__m.NoBindingError; + CyclicDependencyError = $__m.CyclicDependencyError; + InstantiationError = $__m.InstantiationError; + InvalidBindingError = $__m.InvalidBindingError; + OutOfBoundsError = $__m.OutOfBoundsError; + }, function($__m) { + Type = $__m.Type; + isPresent = $__m.isPresent; + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + Key = $__m.Key; + }, function($__m) { + resolveForwardRef = $__m.resolveForwardRef; + }, function($__m) { + DEFAULT_VISIBILITY = $__m.DEFAULT_VISIBILITY; + SelfMetadata = $__m.SelfMetadata; + AncestorMetadata = $__m.AncestorMetadata; + }], + execute: function() { + _constructing = CONST_EXPR(new Object()); + _notFound = CONST_EXPR(new Object()); + _MAX_CONSTRUCTION_COUNTER = 10; + undefinedValue = CONST_EXPR(new Object()); + $__export("undefinedValue", undefinedValue); + PUBLIC = 1; + $__export("PUBLIC", PUBLIC); + PRIVATE = 2; + $__export("PRIVATE", PRIVATE); + PUBLIC_AND_PRIVATE = 3; + $__export("PUBLIC_AND_PRIVATE", PUBLIC_AND_PRIVATE); + ProtoInjectorInlineStrategy = (function() { + function ProtoInjectorInlineStrategy(protoEI, bwv) { + this.binding0 = null; + this.binding1 = null; + this.binding2 = null; + this.binding3 = null; + this.binding4 = null; + this.binding5 = null; + this.binding6 = null; + this.binding7 = null; + this.binding8 = null; + this.binding9 = null; + this.keyId0 = null; + this.keyId1 = null; + this.keyId2 = null; + this.keyId3 = null; + this.keyId4 = null; + this.keyId5 = null; + this.keyId6 = null; + this.keyId7 = null; + this.keyId8 = null; + this.keyId9 = null; + this.visibility0 = null; + this.visibility1 = null; + this.visibility2 = null; + this.visibility3 = null; + this.visibility4 = null; + this.visibility5 = null; + this.visibility6 = null; + this.visibility7 = null; + this.visibility8 = null; + this.visibility9 = null; + var length = bwv.length; + if (length > 0) { + this.binding0 = bwv[0].binding; + this.keyId0 = bwv[0].getKeyId(); + this.visibility0 = bwv[0].visibility; + } + if (length > 1) { + this.binding1 = bwv[1].binding; + this.keyId1 = bwv[1].getKeyId(); + this.visibility1 = bwv[1].visibility; + } + if (length > 2) { + this.binding2 = bwv[2].binding; + this.keyId2 = bwv[2].getKeyId(); + this.visibility2 = bwv[2].visibility; + } + if (length > 3) { + this.binding3 = bwv[3].binding; + this.keyId3 = bwv[3].getKeyId(); + this.visibility3 = bwv[3].visibility; + } + if (length > 4) { + this.binding4 = bwv[4].binding; + this.keyId4 = bwv[4].getKeyId(); + this.visibility4 = bwv[4].visibility; + } + if (length > 5) { + this.binding5 = bwv[5].binding; + this.keyId5 = bwv[5].getKeyId(); + this.visibility5 = bwv[5].visibility; + } + if (length > 6) { + this.binding6 = bwv[6].binding; + this.keyId6 = bwv[6].getKeyId(); + this.visibility6 = bwv[6].visibility; + } + if (length > 7) { + this.binding7 = bwv[7].binding; + this.keyId7 = bwv[7].getKeyId(); + this.visibility7 = bwv[7].visibility; + } + if (length > 8) { + this.binding8 = bwv[8].binding; + this.keyId8 = bwv[8].getKeyId(); + this.visibility8 = bwv[8].visibility; + } + if (length > 9) { + this.binding9 = bwv[9].binding; + this.keyId9 = bwv[9].getKeyId(); + this.visibility9 = bwv[9].visibility; + } + } + return ($traceurRuntime.createClass)(ProtoInjectorInlineStrategy, { + getBindingAtIndex: function(index) { + if (index == 0) + return this.binding0; + if (index == 1) + return this.binding1; + if (index == 2) + return this.binding2; + if (index == 3) + return this.binding3; + if (index == 4) + return this.binding4; + if (index == 5) + return this.binding5; + if (index == 6) + return this.binding6; + if (index == 7) + return this.binding7; + if (index == 8) + return this.binding8; + if (index == 9) + return this.binding9; + throw new OutOfBoundsError(index); + }, + createInjectorStrategy: function(injector) { + return new InjectorInlineStrategy(injector, this); + } + }, {}); + }()); + $__export("ProtoInjectorInlineStrategy", ProtoInjectorInlineStrategy); + ProtoInjectorDynamicStrategy = (function() { + function ProtoInjectorDynamicStrategy(protoInj, bwv) { + var len = bwv.length; + this.bindings = ListWrapper.createFixedSize(len); + this.keyIds = ListWrapper.createFixedSize(len); + this.visibilities = ListWrapper.createFixedSize(len); + for (var i = 0; i < len; i++) { + this.bindings[i] = bwv[i].binding; + this.keyIds[i] = bwv[i].getKeyId(); + this.visibilities[i] = bwv[i].visibility; + } + } + return ($traceurRuntime.createClass)(ProtoInjectorDynamicStrategy, { + getBindingAtIndex: function(index) { + if (index < 0 || index >= this.bindings.length) { + throw new OutOfBoundsError(index); + } + return this.bindings[index]; + }, + createInjectorStrategy: function(ei) { + return new InjectorDynamicStrategy(this, ei); + } + }, {}); + }()); + $__export("ProtoInjectorDynamicStrategy", ProtoInjectorDynamicStrategy); + ProtoInjector = (function() { + function ProtoInjector(bwv) { + this.numberOfBindings = bwv.length; + this._strategy = bwv.length > _MAX_CONSTRUCTION_COUNTER ? new ProtoInjectorDynamicStrategy(this, bwv) : new ProtoInjectorInlineStrategy(this, bwv); + } + return ($traceurRuntime.createClass)(ProtoInjector, {getBindingAtIndex: function(index) { + return this._strategy.getBindingAtIndex(index); + }}, {}); + }()); + $__export("ProtoInjector", ProtoInjector); + InjectorInlineStrategy = (function() { + function InjectorInlineStrategy(injector, protoStrategy) { + this.injector = injector; + this.protoStrategy = protoStrategy; + this.obj0 = undefinedValue; + this.obj1 = undefinedValue; + this.obj2 = undefinedValue; + this.obj3 = undefinedValue; + this.obj4 = undefinedValue; + this.obj5 = undefinedValue; + this.obj6 = undefinedValue; + this.obj7 = undefinedValue; + this.obj8 = undefinedValue; + this.obj9 = undefinedValue; + } + return ($traceurRuntime.createClass)(InjectorInlineStrategy, { + resetConstructionCounter: function() { + this.injector._constructionCounter = 0; + }, + instantiateBinding: function(binding, visibility) { + return this.injector._new(binding, visibility); + }, + attach: function(parent, isBoundary) { + var inj = this.injector; + inj._parent = parent; + inj._isBoundary = isBoundary; + }, + getObjByKeyId: function(keyId, visibility) { + var p = this.protoStrategy; + var inj = this.injector; + if (p.keyId0 === keyId && (p.visibility0 & visibility) > 0) { + if (this.obj0 === undefinedValue) { + this.obj0 = inj._new(p.binding0, p.visibility0); + } + return this.obj0; + } + if (p.keyId1 === keyId && (p.visibility1 & visibility) > 0) { + if (this.obj1 === undefinedValue) { + this.obj1 = inj._new(p.binding1, p.visibility1); + } + return this.obj1; + } + if (p.keyId2 === keyId && (p.visibility2 & visibility) > 0) { + if (this.obj2 === undefinedValue) { + this.obj2 = inj._new(p.binding2, p.visibility2); + } + return this.obj2; + } + if (p.keyId3 === keyId && (p.visibility3 & visibility) > 0) { + if (this.obj3 === undefinedValue) { + this.obj3 = inj._new(p.binding3, p.visibility3); + } + return this.obj3; + } + if (p.keyId4 === keyId && (p.visibility4 & visibility) > 0) { + if (this.obj4 === undefinedValue) { + this.obj4 = inj._new(p.binding4, p.visibility4); + } + return this.obj4; + } + if (p.keyId5 === keyId && (p.visibility5 & visibility) > 0) { + if (this.obj5 === undefinedValue) { + this.obj5 = inj._new(p.binding5, p.visibility5); + } + return this.obj5; + } + if (p.keyId6 === keyId && (p.visibility6 & visibility) > 0) { + if (this.obj6 === undefinedValue) { + this.obj6 = inj._new(p.binding6, p.visibility6); + } + return this.obj6; + } + if (p.keyId7 === keyId && (p.visibility7 & visibility) > 0) { + if (this.obj7 === undefinedValue) { + this.obj7 = inj._new(p.binding7, p.visibility7); + } + return this.obj7; + } + if (p.keyId8 === keyId && (p.visibility8 & visibility) > 0) { + if (this.obj8 === undefinedValue) { + this.obj8 = inj._new(p.binding8, p.visibility8); + } + return this.obj8; + } + if (p.keyId9 === keyId && (p.visibility9 & visibility) > 0) { + if (this.obj9 === undefinedValue) { + this.obj9 = inj._new(p.binding9, p.visibility9); + } + return this.obj9; + } + return undefinedValue; + }, + getObjAtIndex: function(index) { + if (index == 0) + return this.obj0; + if (index == 1) + return this.obj1; + if (index == 2) + return this.obj2; + if (index == 3) + return this.obj3; + if (index == 4) + return this.obj4; + if (index == 5) + return this.obj5; + if (index == 6) + return this.obj6; + if (index == 7) + return this.obj7; + if (index == 8) + return this.obj8; + if (index == 9) + return this.obj9; + throw new OutOfBoundsError(index); + }, + getMaxNumberOfObjects: function() { + return _MAX_CONSTRUCTION_COUNTER; + } + }, {}); + }()); + $__export("InjectorInlineStrategy", InjectorInlineStrategy); + InjectorDynamicStrategy = (function() { + function InjectorDynamicStrategy(protoStrategy, injector) { + this.protoStrategy = protoStrategy; + this.injector = injector; + this.objs = ListWrapper.createFixedSize(protoStrategy.bindings.length); + ListWrapper.fill(this.objs, undefinedValue); + } + return ($traceurRuntime.createClass)(InjectorDynamicStrategy, { + resetConstructionCounter: function() { + this.injector._constructionCounter = 0; + }, + instantiateBinding: function(binding, visibility) { + return this.injector._new(binding, visibility); + }, + attach: function(parent, isBoundary) { + var inj = this.injector; + inj._parent = parent; + inj._isBoundary = isBoundary; + }, + getObjByKeyId: function(keyId, visibility) { + var p = this.protoStrategy; + for (var i = 0; i < p.keyIds.length; i++) { + if (p.keyIds[i] === keyId && (p.visibilities[i] & visibility) > 0) { + if (this.objs[i] === undefinedValue) { + this.objs[i] = this.injector._new(p.bindings[i], p.visibilities[i]); + } + return this.objs[i]; + } + } + return undefinedValue; + }, + getObjAtIndex: function(index) { + if (index < 0 || index >= this.objs.length) { + throw new OutOfBoundsError(index); + } + return this.objs[index]; + }, + getMaxNumberOfObjects: function() { + return this.objs.length; + } + }, {}); + }()); + $__export("InjectorDynamicStrategy", InjectorDynamicStrategy); + BindingWithVisibility = (function() { + function BindingWithVisibility(binding, visibility) { + this.binding = binding; + this.visibility = visibility; + } + return ($traceurRuntime.createClass)(BindingWithVisibility, {getKeyId: function() { + return this.binding.key.id; + }}, {}); + }()); + $__export("BindingWithVisibility", BindingWithVisibility); + Injector = (function() { + function Injector(_proto) { + var _parent = arguments[1] !== (void 0) ? arguments[1] : null; + var _depProvider = arguments[2] !== (void 0) ? arguments[2] : null; + var _debugContext = arguments[3] !== (void 0) ? arguments[3] : null; + this._proto = _proto; + this._parent = _parent; + this._depProvider = _depProvider; + this._debugContext = _debugContext; + this._isBoundary = false; + this._constructionCounter = 0; + this._strategy = _proto._strategy.createInjectorStrategy(this); + } + return ($traceurRuntime.createClass)(Injector, { + debugContext: function() { + return this._debugContext(); + }, + get: function(token) { + return this._getByKey(Key.get(token), DEFAULT_VISIBILITY, false, PUBLIC_AND_PRIVATE); + }, + getOptional: function(token) { + return this._getByKey(Key.get(token), DEFAULT_VISIBILITY, true, PUBLIC_AND_PRIVATE); + }, + getAt: function(index) { + return this._strategy.getObjAtIndex(index); + }, + get parent() { + return this._parent; + }, + get internalStrategy() { + return this._strategy; + }, + resolveAndCreateChild: function(bindings) { + var depProvider = arguments[1] !== (void 0) ? arguments[1] : null; + var resovledBindings = Injector.resolve(bindings); + return this.createChildFromResolved(resovledBindings, depProvider); + }, + createChildFromResolved: function(bindings) { + var depProvider = arguments[1] !== (void 0) ? arguments[1] : null; + var bd = bindings.map((function(b) { + return new BindingWithVisibility(b, PUBLIC); + })); + var proto = new ProtoInjector(bd); + var inj = new Injector(proto, null, depProvider); + inj._parent = this; + return inj; + }, + _new: function(binding, visibility) { + if (this._constructionCounter++ > this._strategy.getMaxNumberOfObjects()) { + throw new CyclicDependencyError(this, binding.key); + } + var factory = binding.factory; + var deps = binding.dependencies; + var length = deps.length; + var d0, + d1, + d2, + d3, + d4, + d5, + d6, + d7, + d8, + d9, + d10, + d11, + d12, + d13, + d14, + d15, + d16, + d17, + d18, + d19; + try { + d0 = length > 0 ? this._getByDependency(binding, deps[0], visibility) : null; + d1 = length > 1 ? this._getByDependency(binding, deps[1], visibility) : null; + d2 = length > 2 ? this._getByDependency(binding, deps[2], visibility) : null; + d3 = length > 3 ? this._getByDependency(binding, deps[3], visibility) : null; + d4 = length > 4 ? this._getByDependency(binding, deps[4], visibility) : null; + d5 = length > 5 ? this._getByDependency(binding, deps[5], visibility) : null; + d6 = length > 6 ? this._getByDependency(binding, deps[6], visibility) : null; + d7 = length > 7 ? this._getByDependency(binding, deps[7], visibility) : null; + d8 = length > 8 ? this._getByDependency(binding, deps[8], visibility) : null; + d9 = length > 9 ? this._getByDependency(binding, deps[9], visibility) : null; + d10 = length > 10 ? this._getByDependency(binding, deps[10], visibility) : null; + d11 = length > 11 ? this._getByDependency(binding, deps[11], visibility) : null; + d12 = length > 12 ? this._getByDependency(binding, deps[12], visibility) : null; + d13 = length > 13 ? this._getByDependency(binding, deps[13], visibility) : null; + d14 = length > 14 ? this._getByDependency(binding, deps[14], visibility) : null; + d15 = length > 15 ? this._getByDependency(binding, deps[15], visibility) : null; + d16 = length > 16 ? this._getByDependency(binding, deps[16], visibility) : null; + d17 = length > 17 ? this._getByDependency(binding, deps[17], visibility) : null; + d18 = length > 18 ? this._getByDependency(binding, deps[18], visibility) : null; + d19 = length > 19 ? this._getByDependency(binding, deps[19], visibility) : null; + } catch (e) { + if (e instanceof AbstractBindingError) { + e.addKey(this, binding.key); + } + throw e; + } + var obj; + try { + switch (length) { + case 0: + obj = factory(); + break; + case 1: + obj = factory(d0); + break; + case 2: + obj = factory(d0, d1); + break; + case 3: + obj = factory(d0, d1, d2); + break; + case 4: + obj = factory(d0, d1, d2, d3); + break; + case 5: + obj = factory(d0, d1, d2, d3, d4); + break; + case 6: + obj = factory(d0, d1, d2, d3, d4, d5); + break; + case 7: + obj = factory(d0, d1, d2, d3, d4, d5, d6); + break; + case 8: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7); + break; + case 9: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8); + break; + case 10: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9); + break; + case 11: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10); + break; + case 12: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11); + break; + case 13: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12); + break; + case 14: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13); + break; + case 15: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14); + break; + case 16: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15); + break; + case 17: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16); + break; + case 18: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17); + break; + case 19: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18); + break; + case 20: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18, d19); + break; + } + } catch (e) { + throw new InstantiationError(this, e, e.stack, binding.key); + } + return obj; + }, + _getByDependency: function(binding, dep, bindingVisibility) { + var special = isPresent(this._depProvider) ? this._depProvider.getDependency(this, binding, dep) : undefinedValue; + if (special !== undefinedValue) { + return special; + } else { + return this._getByKey(dep.key, dep.visibility, dep.optional, bindingVisibility); + } + }, + _getByKey: function(key, depVisibility, optional, bindingVisibility) { + if (key === INJECTOR_KEY) { + return this; + } + if (depVisibility instanceof SelfMetadata) { + return this._getByKeySelf(key, optional, bindingVisibility); + } else if (depVisibility instanceof AncestorMetadata) { + return this._getByKeyAncestor(key, optional, bindingVisibility, depVisibility.includeSelf); + } else { + return this._getByKeyUnbounded(key, optional, bindingVisibility, depVisibility.includeSelf); + } + }, + _throwOrNull: function(key, optional) { + if (optional) { + return null; + } else { + throw new NoBindingError(this, key); + } + }, + _getByKeySelf: function(key, optional, bindingVisibility) { + var obj = this._strategy.getObjByKeyId(key.id, bindingVisibility); + return (obj !== undefinedValue) ? obj : this._throwOrNull(key, optional); + }, + _getByKeyAncestor: function(key, optional, bindingVisibility, includeSelf) { + var inj = this; + if (!includeSelf) { + if (inj._isBoundary) { + return this._getPrivateDependency(key, optional, inj); + } else { + inj = inj._parent; + } + } + while (inj != null) { + var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility); + if (obj !== undefinedValue) + return obj; + if (isPresent(inj._parent) && inj._isBoundary) { + return this._getPrivateDependency(key, optional, inj); + } else { + inj = inj._parent; + } + } + return this._throwOrNull(key, optional); + }, + _getPrivateDependency: function(key, optional, inj) { + var obj = inj._parent._strategy.getObjByKeyId(key.id, PRIVATE); + return (obj !== undefinedValue) ? obj : this._throwOrNull(key, optional); + }, + _getByKeyUnbounded: function(key, optional, bindingVisibility, includeSelf) { + var inj = this; + if (!includeSelf) { + bindingVisibility = inj._isBoundary ? PUBLIC_AND_PRIVATE : PUBLIC; + inj = inj._parent; + } + while (inj != null) { + var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility); + if (obj !== undefinedValue) + return obj; + bindingVisibility = inj._isBoundary ? PUBLIC_AND_PRIVATE : PUBLIC; + inj = inj._parent; + } + return this._throwOrNull(key, optional); + }, + get displayName() { + return ("Injector(bindings: [" + _mapBindings(this, (function(b) { + return (" \"" + b.key.displayName + "\" "); + })).join(", ") + "])"); + }, + toString: function() { + return this.displayName; + } + }, { + resolve: function(bindings) { + var resolvedBindings = _resolveBindings(bindings); + var flatten = _flattenBindings(resolvedBindings, new Map()); + return _createListOfBindings(flatten); + }, + resolveAndCreate: function(bindings) { + var depProvider = arguments[1] !== (void 0) ? arguments[1] : null; + var resolvedBindings = Injector.resolve(bindings); + return Injector.fromResolvedBindings(resolvedBindings, depProvider); + }, + fromResolvedBindings: function(bindings) { + var depProvider = arguments[1] !== (void 0) ? arguments[1] : null; + var bd = bindings.map((function(b) { + return new BindingWithVisibility(b, PUBLIC); + })); + var proto = new ProtoInjector(bd); + var inj = new Injector(proto, null, depProvider); + return inj; + } + }); + }()); + $__export("Injector", Injector); + INJECTOR_KEY = Key.get(Injector); + } + }; +}); + +System.register("angular2/src/change_detection/change_detection_jit_generator", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/abstract_change_detector", "angular2/src/change_detection/change_detection_util", "angular2/src/change_detection/proto_record", "angular2/src/change_detection/codegen_name_util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/change_detection_jit_generator"; + var BaseException, + ListWrapper, + AbstractChangeDetector, + ChangeDetectionUtil, + RecordType, + CodegenNameUtil, + sanitizeName, + ABSTRACT_CHANGE_DETECTOR, + UTIL, + DISPATCHER_ACCESSOR, + PIPES_ACCESSOR, + PROTOS_ACCESSOR, + DIRECTIVES_ACCESSOR, + IS_CHANGED_LOCAL, + CHANGES_LOCAL, + LOCALS_ACCESSOR, + MODE_ACCESSOR, + CURRENT_PROTO, + ALREADY_CHECKED_ACCESSOR, + ChangeDetectorJITGenerator; + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + AbstractChangeDetector = $__m.AbstractChangeDetector; + }, function($__m) { + ChangeDetectionUtil = $__m.ChangeDetectionUtil; + }, function($__m) { + RecordType = $__m.RecordType; + }, function($__m) { + CodegenNameUtil = $__m.CodegenNameUtil; + sanitizeName = $__m.sanitizeName; + }], + execute: function() { + ABSTRACT_CHANGE_DETECTOR = "AbstractChangeDetector"; + UTIL = "ChangeDetectionUtil"; + DISPATCHER_ACCESSOR = "this.dispatcher"; + PIPES_ACCESSOR = "this.pipes"; + PROTOS_ACCESSOR = "this.protos"; + DIRECTIVES_ACCESSOR = "this.directiveRecords"; + IS_CHANGED_LOCAL = "isChanged"; + CHANGES_LOCAL = "changes"; + LOCALS_ACCESSOR = "this.locals"; + MODE_ACCESSOR = "this.mode"; + CURRENT_PROTO = "this.currentProto"; + ALREADY_CHECKED_ACCESSOR = "this.alreadyChecked"; + ChangeDetectorJITGenerator = (function() { + function ChangeDetectorJITGenerator(id, changeDetectionStrategy, records, directiveRecords, generateCheckNoChanges) { + this.id = id; + this.changeDetectionStrategy = changeDetectionStrategy; + this.records = records; + this.directiveRecords = directiveRecords; + this.generateCheckNoChanges = generateCheckNoChanges; + this._names = new CodegenNameUtil(this.records, this.directiveRecords, 'this._', UTIL); + this._typeName = sanitizeName(("ChangeDetector_" + this.id)); + } + return ($traceurRuntime.createClass)(ChangeDetectorJITGenerator, { + generate: function() { + var $__0 = this; + var classDefinition = ("\n var " + this._typeName + " = function " + this._typeName + "(dispatcher, protos, directiveRecords) {\n " + ABSTRACT_CHANGE_DETECTOR + ".call(this, " + JSON.stringify(this.id) + ", dispatcher);\n " + PROTOS_ACCESSOR + " = protos;\n " + DIRECTIVES_ACCESSOR + " = directiveRecords;\n " + LOCALS_ACCESSOR + " = null;\n " + CURRENT_PROTO + " = null;\n " + PIPES_ACCESSOR + " = null;\n " + ALREADY_CHECKED_ACCESSOR + " = false;\n this.dehydrateDirectives(false);\n }\n\n " + this._typeName + ".prototype = Object.create(" + ABSTRACT_CHANGE_DETECTOR + ".prototype);\n\n " + this._typeName + ".prototype.detectChangesInRecords = function(throwOnChange) {\n if (!this.hydrated()) {\n " + UTIL + ".throwDehydrated();\n }\n try {\n this.__detectChangesInRecords(throwOnChange);\n } catch (e) {\n this.throwError(" + CURRENT_PROTO + ", e, e.stack);\n }\n }\n\n " + this._typeName + ".prototype.__detectChangesInRecords = function(throwOnChange) {\n " + CURRENT_PROTO + " = null;\n\n " + this._names.genInitLocals() + "\n var " + IS_CHANGED_LOCAL + " = false;\n var " + CHANGES_LOCAL + " = null;\n\n context = " + this._names.getContextName() + ";\n\n " + this.records.map((function(r) { + return $__0._genRecord(r); + })).join("\n") + "\n\n " + ALREADY_CHECKED_ACCESSOR + " = true;\n }\n\n " + this._genCheckNoChanges() + "\n\n " + this._typeName + ".prototype.callOnAllChangesDone = function() {\n " + this._genCallOnAllChangesDoneBody() + "\n }\n\n " + this._typeName + ".prototype.hydrate = function(context, locals, directives, pipes) {\n " + MODE_ACCESSOR + " = \"" + ChangeDetectionUtil.changeDetectionMode(this.changeDetectionStrategy) + "\";\n " + this._names.getContextName() + " = context;\n " + LOCALS_ACCESSOR + " = locals;\n this.hydrateDirectives(directives);\n " + PIPES_ACCESSOR + " = pipes;\n " + ALREADY_CHECKED_ACCESSOR + " = false;\n }\n\n " + this._maybeGenHydrateDirectives() + "\n\n " + this._typeName + ".prototype.dehydrate = function() {\n this.dehydrateDirectives(true);\n " + LOCALS_ACCESSOR + " = null;\n " + PIPES_ACCESSOR + " = null;\n }\n\n " + this._maybeGenDehydrateDirectives() + "\n\n " + this._typeName + ".prototype.hydrated = function() {\n return " + this._names.getContextName() + " !== null;\n }\n\n return function(dispatcher) {\n return new " + this._typeName + "(dispatcher, protos, directiveRecords);\n }\n "); + return new Function('AbstractChangeDetector', 'ChangeDetectionUtil', 'protos', 'directiveRecords', classDefinition)(AbstractChangeDetector, ChangeDetectionUtil, this.records, this.directiveRecords); + }, + _maybeGenDehydrateDirectives: function() { + var destroyPipesCode = this._names.genPipeOnDestroy(); + if (destroyPipesCode) { + destroyPipesCode = ("if (destroyPipes) { " + destroyPipesCode + " }"); + } + var dehydrateFieldsCode = this._names.genDehydrateFields(); + if (!destroyPipesCode && !dehydrateFieldsCode) + return ''; + return (this._typeName + ".prototype.dehydrateDirectives = function(destroyPipes) {\n " + destroyPipesCode + "\n " + dehydrateFieldsCode + "\n }"); + }, + _maybeGenHydrateDirectives: function() { + var hydrateDirectivesCode = this._genHydrateDirectives(); + var hydrateDetectorsCode = this._genHydrateDetectors(); + if (!hydrateDirectivesCode && !hydrateDetectorsCode) + return ''; + return (this._typeName + ".prototype.hydrateDirectives = function(directives) {\n " + hydrateDirectivesCode + "\n " + hydrateDetectorsCode + "\n }"); + }, + _genHydrateDirectives: function() { + var directiveFieldNames = this._names.getAllDirectiveNames(); + var lines = ListWrapper.createFixedSize(directiveFieldNames.length); + for (var i = 0, + iLen = directiveFieldNames.length; i < iLen; ++i) { + lines[i] = (directiveFieldNames[i] + " = directives.getDirectiveFor(" + DIRECTIVES_ACCESSOR + "[" + i + "].directiveIndex);"); + } + return lines.join('\n'); + }, + _genHydrateDetectors: function() { + var detectorFieldNames = this._names.getAllDetectorNames(); + var lines = ListWrapper.createFixedSize(detectorFieldNames.length); + for (var i = 0, + iLen = detectorFieldNames.length; i < iLen; ++i) { + lines[i] = (detectorFieldNames[i] + " =\n directives.getDetectorFor(" + DIRECTIVES_ACCESSOR + "[" + i + "].directiveIndex);"); + } + return lines.join('\n'); + }, + _genCallOnAllChangesDoneBody: function() { + var notifications = []; + var dirs = this.directiveRecords; + for (var i = dirs.length - 1; i >= 0; --i) { + var dir = dirs[i]; + if (dir.callOnAllChangesDone) { + notifications.push((this._names.getDirectiveName(dir.directiveIndex) + ".onAllChangesDone();")); + } + } + var directiveNotifications = notifications.join("\n"); + return ("\n this.dispatcher.notifyOnAllChangesDone();\n " + directiveNotifications + "\n "); + }, + _genRecord: function(r) { + var rec; + if (r.isLifeCycleRecord()) { + rec = this._genDirectiveLifecycle(r); + } else if (r.isPipeRecord()) { + rec = this._genPipeCheck(r); + } else { + rec = this._genReferenceCheck(r); + } + return ("" + rec + this._maybeGenLastInDirective(r)); + }, + _genDirectiveLifecycle: function(r) { + if (r.name === "onCheck") { + return this._genOnCheck(r); + } else if (r.name === "onInit") { + return this._genOnInit(r); + } else if (r.name === "onChange") { + return this._genOnChange(r); + } else { + throw new BaseException(("Unknown lifecycle event '" + r.name + "'")); + } + }, + _genPipeCheck: function(r) { + var $__0 = this; + var context = this._names.getLocalName(r.contextIndex); + var argString = r.args.map((function(arg) { + return $__0._names.getLocalName(arg); + })).join(", "); + var oldValue = this._names.getFieldName(r.selfIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var change = this._names.getChangeName(r.selfIndex); + var pipe = this._names.getPipeName(r.selfIndex); + var cdRef = "this.ref"; + var protoIndex = r.selfIndex - 1; + var pipeType = r.name; + return ("\n " + CURRENT_PROTO + " = " + PROTOS_ACCESSOR + "[" + protoIndex + "];\n if (" + pipe + " === " + UTIL + ".uninitialized) {\n " + pipe + " = " + PIPES_ACCESSOR + ".get('" + pipeType + "', " + context + ", " + cdRef + ");\n } else if (!" + pipe + ".supports(" + context + ")) {\n " + pipe + ".onDestroy();\n " + pipe + " = " + PIPES_ACCESSOR + ".get('" + pipeType + "', " + context + ", " + cdRef + ");\n }\n\n " + newValue + " = " + pipe + ".transform(" + context + ", [" + argString + "]);\n if (" + oldValue + " !== " + newValue + ") {\n " + newValue + " = " + UTIL + ".unwrapValue(" + newValue + ");\n " + change + " = true;\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n "); + }, + _genReferenceCheck: function(r) { + var $__0 = this; + var oldValue = this._names.getFieldName(r.selfIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var protoIndex = r.selfIndex - 1; + var check = ("\n " + CURRENT_PROTO + " = " + PROTOS_ACCESSOR + "[" + protoIndex + "];\n " + this._genUpdateCurrentValue(r) + "\n if (" + newValue + " !== " + oldValue + ") {\n " + this._names.getChangeName(r.selfIndex) + " = true;\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n "); + if (r.isPureFunction()) { + var condition = r.args.map((function(a) { + return $__0._names.getChangeName(a); + })).join(" || "); + return ("if (" + condition + ") { " + check + " } else { " + newValue + " = " + oldValue + "; }"); + } else { + return check; + } + }, + _genUpdateCurrentValue: function(r) { + var $__0 = this; + var context = (r.contextIndex == -1) ? this._names.getDirectiveName(r.directiveIndex) : this._names.getLocalName(r.contextIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var argString = r.args.map((function(arg) { + return $__0._names.getLocalName(arg); + })).join(", "); + var rhs; + switch (r.mode) { + case RecordType.SELF: + rhs = context; + break; + case RecordType.CONST: + rhs = JSON.stringify(r.funcOrValue); + break; + case RecordType.PROPERTY: + rhs = (context + "." + r.name); + break; + case RecordType.SAFE_PROPERTY: + rhs = (UTIL + ".isValueBlank(" + context + ") ? null : " + context + "." + r.name); + break; + case RecordType.LOCAL: + rhs = (LOCALS_ACCESSOR + ".get('" + r.name + "')"); + break; + case RecordType.INVOKE_METHOD: + rhs = (context + "." + r.name + "(" + argString + ")"); + break; + case RecordType.SAFE_INVOKE_METHOD: + rhs = (UTIL + ".isValueBlank(" + context + ") ? null : " + context + "." + r.name + "(" + argString + ")"); + break; + case RecordType.INVOKE_CLOSURE: + rhs = (context + "(" + argString + ")"); + break; + case RecordType.PRIMITIVE_OP: + rhs = (UTIL + "." + r.name + "(" + argString + ")"); + break; + case RecordType.INTERPOLATE: + rhs = this._genInterpolation(r); + break; + case RecordType.KEYED_ACCESS: + rhs = (context + "[" + this._names.getLocalName(r.args[0]) + "]"); + break; + default: + throw new BaseException(("Unknown operation " + r.mode)); + } + return (newValue + " = " + rhs); + }, + _genInterpolation: function(r) { + var res = ""; + for (var i = 0; i < r.args.length; ++i) { + res += JSON.stringify(r.fixedArgs[i]); + res += " + "; + res += (UTIL + ".s(" + this._names.getLocalName(r.args[i]) + ")"); + res += " + "; + } + res += JSON.stringify(r.fixedArgs[r.args.length]); + return res; + }, + _genUpdateDirectiveOrElement: function(r) { + if (!r.lastInBinding) + return ""; + var newValue = this._names.getLocalName(r.selfIndex); + var oldValue = this._names.getFieldName(r.selfIndex); + var br = r.bindingRecord; + if (br.isDirective()) { + var directiveProperty = (this._names.getDirectiveName(br.directiveRecord.directiveIndex) + "." + br.propertyName); + return ("\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n " + directiveProperty + " = " + newValue + ";\n " + IS_CHANGED_LOCAL + " = true;\n "); + } else { + return ("\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n " + DISPATCHER_ACCESSOR + ".notifyOnBinding(" + CURRENT_PROTO + ".bindingRecord, " + newValue + ");\n "); + } + }, + _genThrowOnChangeCheck: function(oldValue, newValue) { + if (this.generateCheckNoChanges) { + return ("\n if(throwOnChange) {\n " + UTIL + ".throwOnChange(" + CURRENT_PROTO + ", " + UTIL + ".simpleChange(" + oldValue + ", " + newValue + "));\n }\n "); + } else { + return ''; + } + }, + _genCheckNoChanges: function() { + if (this.generateCheckNoChanges) { + return (this._typeName + ".prototype.checkNoChanges = function() { this.runDetectChanges(true); }"); + } else { + return ''; + } + }, + _genAddToChanges: function(r) { + var newValue = this._names.getLocalName(r.selfIndex); + var oldValue = this._names.getFieldName(r.selfIndex); + if (!r.bindingRecord.callOnChange()) + return ""; + return ("\n " + CHANGES_LOCAL + " = " + UTIL + ".addChange(\n " + CHANGES_LOCAL + ", " + CURRENT_PROTO + ".bindingRecord.propertyName,\n " + UTIL + ".simpleChange(" + oldValue + ", " + newValue + "));\n "); + }, + _maybeGenLastInDirective: function(r) { + if (!r.lastInDirective) + return ""; + return ("\n " + CHANGES_LOCAL + " = null;\n " + this._genNotifyOnPushDetectors(r) + "\n " + IS_CHANGED_LOCAL + " = false;\n "); + }, + _genOnCheck: function(r) { + var br = r.bindingRecord; + return ("if (!throwOnChange) " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onCheck();"); + }, + _genOnInit: function(r) { + var br = r.bindingRecord; + return ("if (!throwOnChange && !" + ALREADY_CHECKED_ACCESSOR + ") " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onInit();"); + }, + _genOnChange: function(r) { + var br = r.bindingRecord; + return ("if (!throwOnChange && " + CHANGES_LOCAL + ") " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onChange(" + CHANGES_LOCAL + ");"); + }, + _genNotifyOnPushDetectors: function(r) { + var br = r.bindingRecord; + if (!r.lastInDirective || !br.isOnPushChangeDetection()) + return ""; + var retVal = ("\n if(" + IS_CHANGED_LOCAL + ") {\n " + this._names.getDetectorName(br.directiveRecord.directiveIndex) + ".markAsCheckOnce();\n }\n "); + return retVal; + } + }, {}); + }()); + $__export("ChangeDetectorJITGenerator", ChangeDetectorJITGenerator); + } + }; +}); + +System.register("angular2/src/core/compiler/element_injector", ["angular2/src/facade/lang", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/di", "angular2/src/di/injector", "angular2/src/core/annotations_impl/di", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/annotations_impl/annotations", "angular2/src/core/compiler/directive_lifecycle_reflector", "angular2/src/change_detection/change_detection", "angular2/src/core/compiler/query_list", "angular2/src/reflection/reflection", "angular2/src/render/api"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/element_injector"; + var isPresent, + isBlank, + BaseException, + stringify, + StringWrapper, + ObservableWrapper, + ListWrapper, + MapWrapper, + Injector, + ProtoInjector, + PUBLIC_AND_PRIVATE, + PUBLIC, + PRIVATE, + undefinedValue, + Key, + Dependency, + Binding, + ResolvedBinding, + NoBindingError, + InjectorInlineStrategy, + BindingWithVisibility, + Attribute, + Query, + avmModule, + ViewContainerRef, + ElementRef, + TemplateRef, + Directive, + Component, + LifecycleEvent, + hasLifecycleHook, + ChangeDetectorRef, + Pipes, + QueryList, + reflector, + DirectiveMetadata, + _staticKeys, + StaticKeys, + TreeNode, + DirectiveDependency, + DirectiveBinding, + PreBuiltObjects, + EventEmitterAccessor, + HostActionAccessor, + ProtoElementInjector, + _Context, + ElementInjector, + ElementInjectorInlineStrategy, + ElementInjectorDynamicStrategy, + QueryError, + QueryRef; + function _createEventEmitterAccessors(bwv) { + var binding = bwv.binding; + if (!(binding instanceof DirectiveBinding)) + return []; + var db = binding; + return ListWrapper.map(db.eventEmitters, (function(eventConfig) { + var fieldName; + var eventName; + var colonIdx = eventConfig.indexOf(':'); + if (colonIdx > -1) { + fieldName = StringWrapper.substring(eventConfig, 0, colonIdx).trim(); + eventName = StringWrapper.substring(eventConfig, colonIdx + 1).trim(); + } else { + fieldName = eventName = eventConfig; + } + return new EventEmitterAccessor(eventName, reflector.getter(fieldName)); + })); + } + function _createHostActionAccessors(bwv) { + var binding = bwv.binding; + if (!(binding instanceof DirectiveBinding)) + return []; + var res = []; + var db = binding; + MapWrapper.forEach(db.hostActions, (function(actionExpression, actionName) { + res.push(new HostActionAccessor(actionExpression, reflector.getter(actionName))); + })); + return res; + } + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + stringify = $__m.stringify; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + MapWrapper = $__m.MapWrapper; + }, function($__m) { + Injector = $__m.Injector; + ProtoInjector = $__m.ProtoInjector; + PUBLIC_AND_PRIVATE = $__m.PUBLIC_AND_PRIVATE; + PUBLIC = $__m.PUBLIC; + PRIVATE = $__m.PRIVATE; + undefinedValue = $__m.undefinedValue; + Key = $__m.Key; + Dependency = $__m.Dependency; + Binding = $__m.Binding; + ResolvedBinding = $__m.ResolvedBinding; + NoBindingError = $__m.NoBindingError; + }, function($__m) { + InjectorInlineStrategy = $__m.InjectorInlineStrategy; + BindingWithVisibility = $__m.BindingWithVisibility; + }, function($__m) { + Attribute = $__m.Attribute; + Query = $__m.Query; + }, function($__m) { + avmModule = $__m; + }, function($__m) { + ViewContainerRef = $__m.ViewContainerRef; + }, function($__m) { + ElementRef = $__m.ElementRef; + }, function($__m) { + TemplateRef = $__m.TemplateRef; + }, function($__m) { + Directive = $__m.Directive; + Component = $__m.Component; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + hasLifecycleHook = $__m.hasLifecycleHook; + }, function($__m) { + ChangeDetectorRef = $__m.ChangeDetectorRef; + Pipes = $__m.Pipes; + }, function($__m) { + QueryList = $__m.QueryList; + }, function($__m) { + reflector = $__m.reflector; + }, function($__m) { + DirectiveMetadata = $__m.DirectiveMetadata; + }], + execute: function() { + StaticKeys = (function() { + function StaticKeys() { + this.viewManagerId = Key.get(avmModule.AppViewManager).id; + this.templateRefId = Key.get(TemplateRef).id; + this.viewContainerId = Key.get(ViewContainerRef).id; + this.changeDetectorRefId = Key.get(ChangeDetectorRef).id; + this.elementRefId = Key.get(ElementRef).id; + this.pipesKey = Key.get(Pipes); + } + return ($traceurRuntime.createClass)(StaticKeys, {}, {instance: function() { + if (isBlank(_staticKeys)) + _staticKeys = new StaticKeys(); + return _staticKeys; + }}); + }()); + $__export("StaticKeys", StaticKeys); + TreeNode = (function() { + function TreeNode(parent) { + this._head = null; + this._tail = null; + this._next = null; + if (isPresent(parent)) + parent.addChild(this); + } + return ($traceurRuntime.createClass)(TreeNode, { + addChild: function(child) { + if (isPresent(this._tail)) { + this._tail._next = child; + this._tail = child; + } else { + this._tail = this._head = child; + } + child._next = null; + child._parent = this; + }, + addChildAfter: function(child, prevSibling) { + if (isBlank(prevSibling)) { + var prevHead = this._head; + this._head = child; + child._next = prevHead; + if (isBlank(this._tail)) + this._tail = child; + } else if (isBlank(prevSibling._next)) { + this.addChild(child); + return ; + } else { + child._next = prevSibling._next; + prevSibling._next = child; + } + child._parent = this; + }, + remove: function() { + if (isBlank(this.parent)) + return ; + var nextSibling = this._next; + var prevSibling = this._findPrev(); + if (isBlank(prevSibling)) { + this.parent._head = this._next; + } else { + prevSibling._next = this._next; + } + if (isBlank(nextSibling)) { + this._parent._tail = prevSibling; + } + this._parent = null; + this._next = null; + }, + _findPrev: function() { + var node = this.parent._head; + if (node == this) + return null; + while (node._next !== this) + node = node._next; + return node; + }, + get parent() { + return this._parent; + }, + get children() { + var res = []; + var child = this._head; + while (child != null) { + res.push(child); + child = child._next; + } + return res; + } + }, {}); + }()); + $__export("TreeNode", TreeNode); + DirectiveDependency = (function($__super) { + function DirectiveDependency(key, optional, visibility, properties, attributeName, queryDecorator) { + $traceurRuntime.superConstructor(DirectiveDependency).call(this, key, optional, visibility, properties); + this.attributeName = attributeName; + this.queryDecorator = queryDecorator; + this._verify(); + } + return ($traceurRuntime.createClass)(DirectiveDependency, {_verify: function() { + var count = 0; + if (isPresent(this.queryDecorator)) + count++; + if (isPresent(this.attributeName)) + count++; + if (count > 1) + throw new BaseException('A directive injectable can contain only one of the following @Attribute or @Query.'); + }}, { + createFrom: function(d) { + return new DirectiveDependency(d.key, d.optional, d.visibility, d.properties, DirectiveDependency._attributeName(d.properties), DirectiveDependency._query(d.properties)); + }, + _attributeName: function(properties) { + var p = ListWrapper.find(properties, (function(p) { + return p instanceof Attribute; + })); + return isPresent(p) ? p.attributeName : null; + }, + _query: function(properties) { + return ListWrapper.find(properties, (function(p) { + return p instanceof Query; + })); + } + }, $__super); + }(Dependency)); + $__export("DirectiveDependency", DirectiveDependency); + DirectiveBinding = (function($__super) { + function DirectiveBinding(key, factory, dependencies, resolvedHostInjectables, resolvedViewInjectables, metadata) { + $traceurRuntime.superConstructor(DirectiveBinding).call(this, key, factory, dependencies); + this.resolvedHostInjectables = resolvedHostInjectables; + this.resolvedViewInjectables = resolvedViewInjectables; + this.metadata = metadata; + } + return ($traceurRuntime.createClass)(DirectiveBinding, { + get callOnDestroy() { + return this.metadata.callOnDestroy; + }, + get callOnChange() { + return this.metadata.callOnChange; + }, + get callOnAllChangesDone() { + return this.metadata.callOnAllChangesDone; + }, + get displayName() { + return this.key.displayName; + }, + get eventEmitters() { + return isPresent(this.metadata) && isPresent(this.metadata.events) ? this.metadata.events : []; + }, + get hostActions() { + return isPresent(this.metadata) && isPresent(this.metadata.hostActions) ? this.metadata.hostActions : new Map(); + }, + get changeDetection() { + return this.metadata.changeDetection; + } + }, { + createFromBinding: function(binding, ann) { + if (isBlank(ann)) { + ann = new Directive(); + } + var rb = binding.resolve(); + var deps = ListWrapper.map(rb.dependencies, DirectiveDependency.createFrom); + var resolvedHostInjectables = isPresent(ann.hostInjector) ? Injector.resolve(ann.hostInjector) : []; + var resolvedViewInjectables = ann instanceof Component && isPresent(ann.viewInjector) ? Injector.resolve(ann.viewInjector) : []; + var metadata = DirectiveMetadata.create({ + id: stringify(rb.key.token), + type: ann instanceof Component ? DirectiveMetadata.COMPONENT_TYPE : DirectiveMetadata.DIRECTIVE_TYPE, + selector: ann.selector, + compileChildren: ann.compileChildren, + events: ann.events, + host: isPresent(ann.host) ? MapWrapper.createFromStringMap(ann.host) : null, + properties: ann.properties, + readAttributes: DirectiveBinding._readAttributes(deps), + callOnDestroy: hasLifecycleHook(LifecycleEvent.onDestroy, rb.key.token, ann), + callOnChange: hasLifecycleHook(LifecycleEvent.onChange, rb.key.token, ann), + callOnCheck: hasLifecycleHook(LifecycleEvent.onCheck, rb.key.token, ann), + callOnInit: hasLifecycleHook(LifecycleEvent.onInit, rb.key.token, ann), + callOnAllChangesDone: hasLifecycleHook(LifecycleEvent.onAllChangesDone, rb.key.token, ann), + changeDetection: ann instanceof Component ? ann.changeDetection : null, + exportAs: ann.exportAs + }); + return new DirectiveBinding(rb.key, rb.factory, deps, resolvedHostInjectables, resolvedViewInjectables, metadata); + }, + _readAttributes: function(deps) { + var readAttributes = []; + ListWrapper.forEach(deps, (function(dep) { + if (isPresent(dep.attributeName)) { + readAttributes.push(dep.attributeName); + } + })); + return readAttributes; + }, + createFromType: function(type, annotation) { + var binding = new Binding(type, {toClass: type}); + return DirectiveBinding.createFromBinding(binding, annotation); + } + }, $__super); + }(ResolvedBinding)); + $__export("DirectiveBinding", DirectiveBinding); + PreBuiltObjects = (function() { + function PreBuiltObjects(viewManager, view, elementRef, templateRef) { + this.viewManager = viewManager; + this.view = view; + this.elementRef = elementRef; + this.templateRef = templateRef; + } + return ($traceurRuntime.createClass)(PreBuiltObjects, {}, {}); + }()); + $__export("PreBuiltObjects", PreBuiltObjects); + EventEmitterAccessor = (function() { + function EventEmitterAccessor(eventName, getter) { + this.eventName = eventName; + this.getter = getter; + } + return ($traceurRuntime.createClass)(EventEmitterAccessor, {subscribe: function(view, boundElementIndex, directive) { + var $__0 = this; + var eventEmitter = this.getter(directive); + return ObservableWrapper.subscribe(eventEmitter, (function(eventObj) { + return view.triggerEventHandlers($__0.eventName, eventObj, boundElementIndex); + })); + }}, {}); + }()); + $__export("EventEmitterAccessor", EventEmitterAccessor); + HostActionAccessor = (function() { + function HostActionAccessor(methodName, getter) { + this.methodName = methodName; + this.getter = getter; + } + return ($traceurRuntime.createClass)(HostActionAccessor, {subscribe: function(view, boundElementIndex, directive) { + var $__0 = this; + var eventEmitter = this.getter(directive); + return ObservableWrapper.subscribe(eventEmitter, (function(actionArgs) { + return view.invokeElementMethod(boundElementIndex, $__0.methodName, actionArgs); + })); + }}, {}); + }()); + $__export("HostActionAccessor", HostActionAccessor); + ProtoElementInjector = (function() { + function ProtoElementInjector(parent, index, bwv, distanceToParent, _firstBindingIsComponent, directiveVariableBindings) { + this.parent = parent; + this.index = index; + this.distanceToParent = distanceToParent; + this._firstBindingIsComponent = _firstBindingIsComponent; + this.directiveVariableBindings = directiveVariableBindings; + var length = bwv.length; + this.protoInjector = new ProtoInjector(bwv); + this.eventEmitterAccessors = ListWrapper.createFixedSize(length); + this.hostActionAccessors = ListWrapper.createFixedSize(length); + for (var i = 0; i < length; ++i) { + this.eventEmitterAccessors[i] = _createEventEmitterAccessors(bwv[i]); + this.hostActionAccessors[i] = _createHostActionAccessors(bwv[i]); + } + } + return ($traceurRuntime.createClass)(ProtoElementInjector, { + instantiate: function(parent) { + return new ElementInjector(this, parent); + }, + directParent: function() { + return this.distanceToParent < 2 ? this.parent : null; + }, + get hasBindings() { + return this.eventEmitterAccessors.length > 0; + }, + getBindingAtIndex: function(index) { + return this.protoInjector.getBindingAtIndex(index); + } + }, { + create: function(parent, index, bindings, firstBindingIsComponent, distanceToParent, directiveVariableBindings) { + var bd = []; + ProtoElementInjector._createDirectiveBindingWithVisibility(bindings, bd, firstBindingIsComponent); + if (firstBindingIsComponent) { + ProtoElementInjector._createViewInjectorBindingWithVisibility(bindings, bd); + } + ProtoElementInjector._createHostInjectorBindingWithVisibility(bindings, bd, firstBindingIsComponent); + return new ProtoElementInjector(parent, index, bd, distanceToParent, firstBindingIsComponent, directiveVariableBindings); + }, + _createDirectiveBindingWithVisibility: function(dirBindings, bd, firstBindingIsComponent) { + ListWrapper.forEach(dirBindings, (function(dirBinding) { + bd.push(ProtoElementInjector._createBindingWithVisibility(firstBindingIsComponent, dirBinding, dirBindings, dirBinding)); + })); + }, + _createHostInjectorBindingWithVisibility: function(dirBindings, bd, firstBindingIsComponent) { + ListWrapper.forEach(dirBindings, (function(dirBinding) { + ListWrapper.forEach(dirBinding.resolvedHostInjectables, (function(b) { + bd.push(ProtoElementInjector._createBindingWithVisibility(firstBindingIsComponent, dirBinding, dirBindings, b)); + })); + })); + }, + _createBindingWithVisibility: function(firstBindingIsComponent, dirBinding, dirBindings, binding) { + var isComponent = firstBindingIsComponent && dirBindings[0] === dirBinding; + return new BindingWithVisibility(binding, isComponent ? PUBLIC_AND_PRIVATE : PUBLIC); + }, + _createViewInjectorBindingWithVisibility: function(bindings, bd) { + var db = bindings[0]; + ListWrapper.forEach(db.resolvedViewInjectables, (function(b) { + return bd.push(new BindingWithVisibility(b, PRIVATE)); + })); + } + }); + }()); + $__export("ProtoElementInjector", ProtoElementInjector); + _Context = (function() { + function _Context(element, componentElement, injector) { + this.element = element; + this.componentElement = componentElement; + this.injector = injector; + } + return ($traceurRuntime.createClass)(_Context, {}, {}); + }()); + ElementInjector = (function($__super) { + function ElementInjector(_proto, parent) { + var $__0; + $traceurRuntime.superConstructor(ElementInjector).call(this, parent); + this._proto = _proto; + this._preBuiltObjects = null; + this._injector = new Injector(this._proto.protoInjector, null, this, ($__0 = this, function() { + return $__0._debugContext(); + })); + var injectorStrategy = this._injector.internalStrategy; + this._strategy = injectorStrategy instanceof InjectorInlineStrategy ? new ElementInjectorInlineStrategy(injectorStrategy, this) : new ElementInjectorDynamicStrategy(injectorStrategy, this); + this.hydrated = false; + this._buildQueries(); + this._addParentQueries(); + } + return ($traceurRuntime.createClass)(ElementInjector, { + dehydrate: function() { + this.hydrated = false; + this._host = null; + this._preBuiltObjects = null; + this._strategy.callOnDestroy(); + this._strategy.dehydrate(); + }, + onAllChangesDone: function() { + if (isPresent(this._query0) && this._query0.originator === this) { + this._query0.list.fireCallbacks(); + } + if (isPresent(this._query1) && this._query1.originator === this) { + this._query1.list.fireCallbacks(); + } + if (isPresent(this._query2) && this._query2.originator === this) { + this._query2.list.fireCallbacks(); + } + }, + hydrate: function(imperativelyCreatedInjector, host, preBuiltObjects) { + this._host = host; + this._preBuiltObjects = preBuiltObjects; + this._reattachInjectors(imperativelyCreatedInjector); + this._strategy.hydrate(); + if (isPresent(host)) { + this._addViewQueries(host); + } + this._addDirectivesToQueries(); + this._addVarBindingsToQueries(); + this.hydrated = true; + }, + _debugContext: function() { + var p = this._preBuiltObjects; + var index = p.elementRef.boundElementIndex - p.view.elementOffset; + var c = this._preBuiltObjects.view.getDebugContext(index, null); + return isPresent(c) ? new _Context(c.element, c.componentElement, c.injector) : null; + }, + _reattachInjectors: function(imperativelyCreatedInjector) { + if (isPresent(this._parent)) { + if (isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, false); + this._reattachInjector(imperativelyCreatedInjector, this._parent._injector, false); + } else { + this._reattachInjector(this._injector, this._parent._injector, false); + } + } else if (isPresent(this._host)) { + if (isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, false); + this._reattachInjector(imperativelyCreatedInjector, this._host._injector, true); + } else { + this._reattachInjector(this._injector, this._host._injector, true); + } + } else { + if (isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, true); + } + } + }, + _reattachInjector: function(injector, parentInjector, isBoundary) { + injector.internalStrategy.attach(parentInjector, isBoundary); + }, + getPipes: function() { + var pipesKey = StaticKeys.instance().pipesKey; + return this._injector.getOptional(pipesKey); + }, + hasVariableBinding: function(name) { + var vb = this._proto.directiveVariableBindings; + return isPresent(vb) && vb.has(name); + }, + getVariableBinding: function(name) { + var index = this._proto.directiveVariableBindings.get(name); + return isPresent(index) ? this.getDirectiveAtIndex(index) : this.getElementRef(); + }, + get: function(token) { + return this._injector.get(token); + }, + hasDirective: function(type) { + return isPresent(this._injector.getOptional(type)); + }, + getEventEmitterAccessors: function() { + return this._proto.eventEmitterAccessors; + }, + getHostActionAccessors: function() { + return this._proto.hostActionAccessors; + }, + getDirectiveVariableBindings: function() { + return this._proto.directiveVariableBindings; + }, + getComponent: function() { + return this._strategy.getComponent(); + }, + getInjector: function() { + return this._injector; + }, + getElementRef: function() { + return this._preBuiltObjects.elementRef; + }, + getViewContainerRef: function() { + return new ViewContainerRef(this._preBuiltObjects.viewManager, this.getElementRef()); + }, + directParent: function() { + return this._proto.distanceToParent < 2 ? this.parent : null; + }, + isComponentKey: function(key) { + return this._strategy.isComponentKey(key); + }, + getDependency: function(injector, binding, dep) { + var key = dep.key; + if (!(dep instanceof DirectiveDependency)) + return undefinedValue; + if (!(binding instanceof DirectiveBinding)) + return undefinedValue; + var dirDep = dep; + var dirBin = binding; + var staticKeys = StaticKeys.instance(); + if (key.id === staticKeys.viewManagerId) + return this._preBuiltObjects.viewManager; + if (isPresent(dirDep.attributeName)) + return this._buildAttribute(dirDep); + if (isPresent(dirDep.queryDecorator)) + return this._findQuery(dirDep.queryDecorator).list; + if (dirDep.key.id === StaticKeys.instance().changeDetectorRefId) { + if (dirBin.metadata.type === DirectiveMetadata.COMPONENT_TYPE) { + var componentView = this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex); + return componentView.changeDetector.ref; + } else { + return this._preBuiltObjects.view.changeDetector.ref; + } + } + if (dirDep.key.id === StaticKeys.instance().elementRefId) { + return this.getElementRef(); + } + if (dirDep.key.id === StaticKeys.instance().viewContainerId) { + return this.getViewContainerRef(); + } + if (dirDep.key.id === StaticKeys.instance().templateRefId) { + if (isBlank(this._preBuiltObjects.templateRef)) { + if (dirDep.optional) { + return null; + } + throw new NoBindingError(null, dirDep.key); + } + return this._preBuiltObjects.templateRef; + } + return undefinedValue; + }, + _buildAttribute: function(dep) { + var attributes = this._proto.attributes; + if (isPresent(attributes) && attributes.has(dep.attributeName)) { + return attributes.get(dep.attributeName); + } else { + return null; + } + }, + _buildQueriesForDeps: function(deps) { + for (var i = 0; i < deps.length; i++) { + var dep = deps[i]; + if (isPresent(dep.queryDecorator)) { + this._createQueryRef(dep.queryDecorator); + } + } + }, + _addViewQueries: function(host) { + if (isPresent(host._query0) && host._query0.originator == host && host._query0.query.isViewQuery) + this._addViewQuery(host._query0); + if (isPresent(host._query1) && host._query1.originator == host && host._query1.query.isViewQuery) + this._addViewQuery(host._query1); + if (isPresent(host._query2) && host._query2.originator == host && host._query2.query.isViewQuery) + this._addViewQuery(host._query2); + }, + _addViewQuery: function(queryRef) { + if (!queryRef.query.descendants && isPresent(this.parent)) + return ; + this._assignQueryRef(queryRef); + }, + _addVarBindingsToQueries: function() { + this._addVarBindingsToQuery(this._query0); + this._addVarBindingsToQuery(this._query1); + this._addVarBindingsToQuery(this._query2); + }, + _addDirectivesToQueries: function() { + this._addDirectivesToQuery(this._query0); + this._addDirectivesToQuery(this._query1); + this._addDirectivesToQuery(this._query2); + }, + _addVarBindingsToQuery: function(queryRef) { + if (isBlank(queryRef) || !queryRef.query.isVarBindingQuery) + return ; + var vb = queryRef.query.varBindings; + for (var i = 0; i < vb.length; ++i) { + if (this.hasVariableBinding(vb[i])) { + queryRef.list.add(this.getVariableBinding(vb[i])); + } + } + }, + _addDirectivesToQuery: function(queryRef) { + if (isBlank(queryRef) || queryRef.query.isVarBindingQuery) + return ; + var matched = []; + this.addDirectivesMatchingQuery(queryRef.query, matched); + matched.forEach((function(s) { + return queryRef.list.add(s); + })); + }, + _createQueryRef: function(query) { + var queryList = new QueryList(); + if (isBlank(this._query0)) { + this._query0 = new QueryRef(query, queryList, this); + } else if (isBlank(this._query1)) { + this._query1 = new QueryRef(query, queryList, this); + } else if (isBlank(this._query2)) { + this._query2 = new QueryRef(query, queryList, this); + } else { + throw new QueryError(); + } + }, + addDirectivesMatchingQuery: function(query, list) { + this._strategy.addDirectivesMatchingQuery(query, list); + }, + _buildQueries: function() { + if (isPresent(this._proto)) { + this._strategy.buildQueries(); + } + }, + _findQuery: function(query) { + if (isPresent(this._query0) && this._query0.query === query) { + return this._query0; + } + if (isPresent(this._query1) && this._query1.query === query) { + return this._query1; + } + if (isPresent(this._query2) && this._query2.query === query) { + return this._query2; + } + throw new BaseException(("Cannot find query for directive " + query + ".")); + }, + _hasQuery: function(query) { + return this._query0 == query || this._query1 == query || this._query2 == query; + }, + link: function(parent) { + parent.addChild(this); + this._addParentQueries(); + }, + linkAfter: function(parent, prevSibling) { + parent.addChildAfter(this, prevSibling); + this._addParentQueries(); + }, + _addParentQueries: function() { + if (isBlank(this.parent)) + return ; + if (isPresent(this.parent._query0) && !this.parent._query0.query.isViewQuery) { + this._addQueryToTree(this.parent._query0); + if (this.hydrated) + this.parent._query0.update(); + } + if (isPresent(this.parent._query1) && !this.parent._query1.query.isViewQuery) { + this._addQueryToTree(this.parent._query1); + if (this.hydrated) + this.parent._query1.update(); + } + if (isPresent(this.parent._query2) && !this.parent._query2.query.isViewQuery) { + this._addQueryToTree(this.parent._query2); + if (this.hydrated) + this.parent._query2.update(); + } + }, + unlink: function() { + var queriesToUpdate = []; + if (isPresent(this.parent._query0)) { + this._pruneQueryFromTree(this.parent._query0); + queriesToUpdate.push(this.parent._query0); + } + if (isPresent(this.parent._query1)) { + this._pruneQueryFromTree(this.parent._query1); + queriesToUpdate.push(this.parent._query1); + } + if (isPresent(this.parent._query2)) { + this._pruneQueryFromTree(this.parent._query2); + queriesToUpdate.push(this.parent._query2); + } + this.remove(); + ListWrapper.forEach(queriesToUpdate, (function(q) { + return q.update(); + })); + }, + _pruneQueryFromTree: function(query) { + this._removeQueryRef(query); + var child = this._head; + while (isPresent(child)) { + child._pruneQueryFromTree(query); + child = child._next; + } + }, + _addQueryToTree: function(queryRef) { + if (queryRef.query.descendants == false) { + if (this == queryRef.originator) { + this._addQueryToTreeSelfAndRecurse(queryRef); + } else if (this.parent == queryRef.originator) { + this._assignQueryRef(queryRef); + } + } else { + this._addQueryToTreeSelfAndRecurse(queryRef); + } + }, + _addQueryToTreeSelfAndRecurse: function(queryRef) { + this._assignQueryRef(queryRef); + var child = this._head; + while (isPresent(child)) { + child._addQueryToTree(queryRef); + child = child._next; + } + }, + _assignQueryRef: function(query) { + if (isBlank(this._query0)) { + this._query0 = query; + return ; + } else if (isBlank(this._query1)) { + this._query1 = query; + return ; + } else if (isBlank(this._query2)) { + this._query2 = query; + return ; + } + throw new QueryError(); + }, + _removeQueryRef: function(query) { + if (this._query0 == query) + this._query0 = null; + if (this._query1 == query) + this._query1 = null; + if (this._query2 == query) + this._query2 = null; + }, + getDirectiveAtIndex: function(index) { + return this._injector.getAt(index); + }, + hasInstances: function() { + return this._proto.hasBindings && this.hydrated; + }, + getHost: function() { + return this._host; + }, + getBoundElementIndex: function() { + return this._proto.index; + } + }, {}, $__super); + }(TreeNode)); + $__export("ElementInjector", ElementInjector); + ElementInjectorInlineStrategy = (function() { + function ElementInjectorInlineStrategy(injectorStrategy, _ei) { + this.injectorStrategy = injectorStrategy; + this._ei = _ei; + } + return ($traceurRuntime.createClass)(ElementInjectorInlineStrategy, { + hydrate: function() { + var i = this.injectorStrategy; + var p = i.protoStrategy; + i.resetConstructionCounter(); + if (p.binding0 instanceof DirectiveBinding && isPresent(p.keyId0) && i.obj0 === undefinedValue) + i.obj0 = i.instantiateBinding(p.binding0, p.visibility0); + if (p.binding1 instanceof DirectiveBinding && isPresent(p.keyId1) && i.obj1 === undefinedValue) + i.obj1 = i.instantiateBinding(p.binding1, p.visibility1); + if (p.binding2 instanceof DirectiveBinding && isPresent(p.keyId2) && i.obj2 === undefinedValue) + i.obj2 = i.instantiateBinding(p.binding2, p.visibility2); + if (p.binding3 instanceof DirectiveBinding && isPresent(p.keyId3) && i.obj3 === undefinedValue) + i.obj3 = i.instantiateBinding(p.binding3, p.visibility3); + if (p.binding4 instanceof DirectiveBinding && isPresent(p.keyId4) && i.obj4 === undefinedValue) + i.obj4 = i.instantiateBinding(p.binding4, p.visibility4); + if (p.binding5 instanceof DirectiveBinding && isPresent(p.keyId5) && i.obj5 === undefinedValue) + i.obj5 = i.instantiateBinding(p.binding5, p.visibility5); + if (p.binding6 instanceof DirectiveBinding && isPresent(p.keyId6) && i.obj6 === undefinedValue) + i.obj6 = i.instantiateBinding(p.binding6, p.visibility6); + if (p.binding7 instanceof DirectiveBinding && isPresent(p.keyId7) && i.obj7 === undefinedValue) + i.obj7 = i.instantiateBinding(p.binding7, p.visibility7); + if (p.binding8 instanceof DirectiveBinding && isPresent(p.keyId8) && i.obj8 === undefinedValue) + i.obj8 = i.instantiateBinding(p.binding8, p.visibility8); + if (p.binding9 instanceof DirectiveBinding && isPresent(p.keyId9) && i.obj9 === undefinedValue) + i.obj9 = i.instantiateBinding(p.binding9, p.visibility9); + }, + dehydrate: function() { + var i = this.injectorStrategy; + i.obj0 = undefinedValue; + i.obj1 = undefinedValue; + i.obj2 = undefinedValue; + i.obj3 = undefinedValue; + i.obj4 = undefinedValue; + i.obj5 = undefinedValue; + i.obj6 = undefinedValue; + i.obj7 = undefinedValue; + i.obj8 = undefinedValue; + i.obj9 = undefinedValue; + }, + callOnDestroy: function() { + var i = this.injectorStrategy; + var p = i.protoStrategy; + if (p.binding0 instanceof DirectiveBinding && p.binding0.callOnDestroy) { + i.obj0.onDestroy(); + } + if (p.binding1 instanceof DirectiveBinding && p.binding1.callOnDestroy) { + i.obj1.onDestroy(); + } + if (p.binding2 instanceof DirectiveBinding && p.binding2.callOnDestroy) { + i.obj2.onDestroy(); + } + if (p.binding3 instanceof DirectiveBinding && p.binding3.callOnDestroy) { + i.obj3.onDestroy(); + } + if (p.binding4 instanceof DirectiveBinding && p.binding4.callOnDestroy) { + i.obj4.onDestroy(); + } + if (p.binding5 instanceof DirectiveBinding && p.binding5.callOnDestroy) { + i.obj5.onDestroy(); + } + if (p.binding6 instanceof DirectiveBinding && p.binding6.callOnDestroy) { + i.obj6.onDestroy(); + } + if (p.binding7 instanceof DirectiveBinding && p.binding7.callOnDestroy) { + i.obj7.onDestroy(); + } + if (p.binding8 instanceof DirectiveBinding && p.binding8.callOnDestroy) { + i.obj8.onDestroy(); + } + if (p.binding9 instanceof DirectiveBinding && p.binding9.callOnDestroy) { + i.obj9.onDestroy(); + } + }, + getComponent: function() { + return this.injectorStrategy.obj0; + }, + isComponentKey: function(key) { + return this._ei._proto._firstBindingIsComponent && isPresent(key) && key.id === this.injectorStrategy.protoStrategy.keyId0; + }, + buildQueries: function() { + var p = this.injectorStrategy.protoStrategy; + if (p.binding0 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding0.dependencies); + } + if (p.binding1 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding1.dependencies); + } + if (p.binding2 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding2.dependencies); + } + if (p.binding3 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding3.dependencies); + } + if (p.binding4 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding4.dependencies); + } + if (p.binding5 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding5.dependencies); + } + if (p.binding6 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding6.dependencies); + } + if (p.binding7 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding7.dependencies); + } + if (p.binding8 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding8.dependencies); + } + if (p.binding9 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding9.dependencies); + } + }, + addDirectivesMatchingQuery: function(query, list) { + var i = this.injectorStrategy; + var p = i.protoStrategy; + if (isPresent(p.binding0) && p.binding0.key.token === query.selector) { + if (i.obj0 === undefinedValue) + i.obj0 = i.instantiateBinding(p.binding0, p.visibility0); + list.push(i.obj0); + } + if (isPresent(p.binding1) && p.binding1.key.token === query.selector) { + if (i.obj1 === undefinedValue) + i.obj1 = i.instantiateBinding(p.binding1, p.visibility1); + list.push(i.obj1); + } + if (isPresent(p.binding2) && p.binding2.key.token === query.selector) { + if (i.obj2 === undefinedValue) + i.obj2 = i.instantiateBinding(p.binding2, p.visibility2); + list.push(i.obj2); + } + if (isPresent(p.binding3) && p.binding3.key.token === query.selector) { + if (i.obj3 === undefinedValue) + i.obj3 = i.instantiateBinding(p.binding3, p.visibility3); + list.push(i.obj3); + } + if (isPresent(p.binding4) && p.binding4.key.token === query.selector) { + if (i.obj4 === undefinedValue) + i.obj4 = i.instantiateBinding(p.binding4, p.visibility4); + list.push(i.obj4); + } + if (isPresent(p.binding5) && p.binding5.key.token === query.selector) { + if (i.obj5 === undefinedValue) + i.obj5 = i.instantiateBinding(p.binding5, p.visibility5); + list.push(i.obj5); + } + if (isPresent(p.binding6) && p.binding6.key.token === query.selector) { + if (i.obj6 === undefinedValue) + i.obj6 = i.instantiateBinding(p.binding6, p.visibility6); + list.push(i.obj6); + } + if (isPresent(p.binding7) && p.binding7.key.token === query.selector) { + if (i.obj7 === undefinedValue) + i.obj7 = i.instantiateBinding(p.binding7, p.visibility7); + list.push(i.obj7); + } + if (isPresent(p.binding8) && p.binding8.key.token === query.selector) { + if (i.obj8 === undefinedValue) + i.obj8 = i.instantiateBinding(p.binding8, p.visibility8); + list.push(i.obj8); + } + if (isPresent(p.binding9) && p.binding9.key.token === query.selector) { + if (i.obj9 === undefinedValue) + i.obj9 = i.instantiateBinding(p.binding9, p.visibility9); + list.push(i.obj9); + } + }, + getComponentBinding: function() { + var p = this.injectorStrategy.protoStrategy; + return p.binding0; + } + }, {}); + }()); + ElementInjectorDynamicStrategy = (function() { + function ElementInjectorDynamicStrategy(injectorStrategy, _ei) { + this.injectorStrategy = injectorStrategy; + this._ei = _ei; + } + return ($traceurRuntime.createClass)(ElementInjectorDynamicStrategy, { + hydrate: function() { + var inj = this.injectorStrategy; + var p = inj.protoStrategy; + for (var i = 0; i < p.keyIds.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding && isPresent(p.keyIds[i]) && inj.objs[i] === undefinedValue) { + inj.objs[i] = inj.instantiateBinding(p.bindings[i], p.visibilities[i]); + } + } + }, + dehydrate: function() { + var inj = this.injectorStrategy; + ListWrapper.fill(inj.objs, undefinedValue); + }, + callOnDestroy: function() { + var ist = this.injectorStrategy; + var p = ist.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding && p.bindings[i].callOnDestroy) { + ist.objs[i].onDestroy(); + } + } + }, + getComponent: function() { + return this.injectorStrategy.objs[0]; + }, + isComponentKey: function(key) { + var p = this.injectorStrategy.protoStrategy; + return this._ei._proto._firstBindingIsComponent && isPresent(key) && key.id === p.keyIds[0]; + }, + buildQueries: function() { + var inj = this.injectorStrategy; + var p = inj.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.bindings[i].dependencies); + } + } + }, + addDirectivesMatchingQuery: function(query, list) { + var ist = this.injectorStrategy; + var p = ist.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i].key.token === query.selector) { + if (ist.objs[i] === undefinedValue) { + ist.objs[i] = ist.instantiateBinding(p.bindings[i], p.visibilities[i]); + } + list.push(ist.objs[i]); + } + } + }, + getComponentBinding: function() { + var p = this.injectorStrategy.protoStrategy; + return p.bindings[0]; + } + }, {}); + }()); + QueryError = (function($__super) { + function QueryError() { + $traceurRuntime.superConstructor(QueryError).call(this); + this.message = 'Only 3 queries can be concurrently active in a template.'; + } + return ($traceurRuntime.createClass)(QueryError, {toString: function() { + return this.message; + }}, {}, $__super); + }(BaseException)); + $__export("QueryError", QueryError); + QueryRef = (function() { + function QueryRef(query, list, originator) { + this.query = query; + this.list = list; + this.originator = originator; + } + return ($traceurRuntime.createClass)(QueryRef, { + update: function() { + var aggregator = []; + this.visit(this.originator, aggregator); + this.list.reset(aggregator); + }, + visit: function(inj, aggregator) { + if (isBlank(inj) || !inj._hasQuery(this)) + return ; + if (this.query.isVarBindingQuery) { + this._aggregateVariableBindings(inj, aggregator); + } else { + this._aggregateDirective(inj, aggregator); + } + var child = inj._head; + while (isPresent(child)) { + this.visit(child, aggregator); + child = child._next; + } + }, + _aggregateVariableBindings: function(inj, aggregator) { + var vb = this.query.varBindings; + for (var i = 0; i < vb.length; ++i) { + if (inj.hasVariableBinding(vb[i])) { + aggregator.push(inj.getVariableBinding(vb[i])); + } + } + }, + _aggregateDirective: function(inj, aggregator) { + inj.addDirectivesMatchingQuery(this.query, aggregator); + } + }, {}); + }()); + $__export("QueryRef", QueryRef); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/compiler", ["angular2/di", "angular2/src/facade/async", "angular2/src/facade/lang", "angular2/src/dom/dom_adapter", "angular2/src/render/api", "angular2/src/render/dom/compiler/compile_pipeline", "angular2/src/render/dom/compiler/view_loader", "angular2/src/render/dom/compiler/compile_step_factory", "angular2/src/change_detection/change_detection", "angular2/src/render/dom/view/proto_view_merger", "angular2/src/render/dom/dom_tokens", "angular2/src/render/dom/view/shared_styles_host", "angular2/src/render/dom/util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/compiler"; + var __decorate, + __metadata, + __param, + Injectable, + PromiseWrapper, + BaseException, + DOM, + ViewDefinition, + ViewType, + RenderCompiler, + ViewEncapsulation, + CompilePipeline, + ViewLoader, + TemplateAndStyles, + DefaultStepFactory, + Parser, + pvm, + APP_ID_TOKEN, + Inject, + SharedStylesHost, + prependAll, + DomCompiler, + DefaultDomCompiler; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + Inject = $__m.Inject; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }, function($__m) { + BaseException = $__m.BaseException; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + ViewDefinition = $__m.ViewDefinition; + ViewType = $__m.ViewType; + RenderCompiler = $__m.RenderCompiler; + ViewEncapsulation = $__m.ViewEncapsulation; + }, function($__m) { + CompilePipeline = $__m.CompilePipeline; + }, function($__m) { + ViewLoader = $__m.ViewLoader; + TemplateAndStyles = $__m.TemplateAndStyles; + }, function($__m) { + DefaultStepFactory = $__m.DefaultStepFactory; + }, function($__m) { + Parser = $__m.Parser; + }, function($__m) { + pvm = $__m; + }, function($__m) { + APP_ID_TOKEN = $__m.APP_ID_TOKEN; + }, function($__m) { + SharedStylesHost = $__m.SharedStylesHost; + }, function($__m) { + prependAll = $__m.prependAll; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + DomCompiler = (function($__super) { + function DomCompiler(_stepFactory, _viewLoader, _sharedStylesHost) { + $traceurRuntime.superConstructor(DomCompiler).call(this); + this._stepFactory = _stepFactory; + this._viewLoader = _viewLoader; + this._sharedStylesHost = _sharedStylesHost; + } + return ($traceurRuntime.createClass)(DomCompiler, { + compile: function(view) { + var $__0 = this; + var tplPromise = this._viewLoader.load(view); + return PromiseWrapper.then(tplPromise, (function(tplAndStyles) { + return $__0._compileView(view, tplAndStyles, ViewType.COMPONENT); + }), (function(e) { + throw new BaseException(("Failed to load the template for \"" + view.componentId + "\" : " + e)); + return null; + })); + }, + compileHost: function(directiveMetadata) { + var hostViewDef = new ViewDefinition({ + componentId: directiveMetadata.id, + templateAbsUrl: null, + template: null, + styles: null, + styleAbsUrls: null, + directives: [directiveMetadata], + encapsulation: ViewEncapsulation.NONE + }); + return this._compileView(hostViewDef, new TemplateAndStyles(("<" + directiveMetadata.selector + ">"), []), ViewType.HOST); + }, + mergeProtoViewsRecursively: function(protoViewRefs) { + return PromiseWrapper.resolve(pvm.mergeProtoViewsRecursively(protoViewRefs)); + }, + _compileView: function(viewDef, templateAndStyles, protoViewType) { + if (viewDef.encapsulation === ViewEncapsulation.EMULATED && templateAndStyles.styles.length === 0) { + viewDef = this._normalizeViewEncapsulationIfThereAreNoStyles(viewDef); + } + var pipeline = new CompilePipeline(this._stepFactory.createSteps(viewDef)); + var compiledStyles = pipeline.processStyles(templateAndStyles.styles); + var compileElements = pipeline.processElements(DOM.createTemplate(templateAndStyles.template), protoViewType, viewDef); + if (viewDef.encapsulation === ViewEncapsulation.NATIVE) { + prependAll(DOM.content(compileElements[0].element), compiledStyles.map((function(style) { + return DOM.createStyleElement(style); + }))); + } else { + this._sharedStylesHost.addStyles(compiledStyles); + } + return PromiseWrapper.resolve(compileElements[0].inheritedProtoView.build()); + }, + _normalizeViewEncapsulationIfThereAreNoStyles: function(viewDef) { + if (viewDef.encapsulation === ViewEncapsulation.EMULATED) { + return new ViewDefinition({ + componentId: viewDef.componentId, + templateAbsUrl: viewDef.templateAbsUrl, + template: viewDef.template, + styleAbsUrls: viewDef.styleAbsUrls, + styles: viewDef.styles, + directives: viewDef.directives, + encapsulation: ViewEncapsulation.NONE + }); + } else { + return viewDef; + } + } + }, {}, $__super); + }(RenderCompiler)); + $__export("DomCompiler", DomCompiler); + DefaultDomCompiler = (function($__super) { + function $__1(parser, viewLoader, sharedStylesHost, appId) { + $traceurRuntime.superConstructor($__1).call(this, new DefaultStepFactory(parser, appId), viewLoader, sharedStylesHost); + } + return ($traceurRuntime.createClass)($__1, {}, {}, $__super); + }(DomCompiler)); + $__export("DefaultDomCompiler", DefaultDomCompiler); + $__export("DefaultDomCompiler", DefaultDomCompiler = __decorate([Injectable(), __param(3, Inject(APP_ID_TOKEN)), __metadata('design:paramtypes', [Parser, ViewLoader, SharedStylesHost, Object])], DefaultDomCompiler)); + } + }; +}); + +System.register("angular2/http", ["angular2/di", "angular2/src/http/http", "angular2/src/http/backends/xhr_backend", "angular2/src/http/backends/jsonp_backend", "angular2/src/http/backends/browser_xhr", "angular2/src/http/backends/browser_jsonp", "angular2/src/http/base_request_options", "angular2/src/http/interfaces", "angular2/src/http/base_response_options", "angular2/src/http/backends/mock_backend", "angular2/src/http/static_request", "angular2/src/http/static_response", "angular2/src/http/headers", "angular2/src/http/enums", "angular2/src/http/url_search_params"], function($__export) { + "use strict"; + var __moduleName = "angular2/http"; + var bind, + Http, + Jsonp, + XHRBackend, + JSONPBackend, + BrowserXhr, + BrowserJsonp, + BaseRequestOptions, + RequestOptions, + ConnectionBackend, + BaseResponseOptions, + ResponseOptions, + httpInjectables, + jsonpInjectables; + return { + setters: [function($__m) { + bind = $__m.bind; + }, function($__m) { + Http = $__m.Http; + Jsonp = $__m.Jsonp; + $__export("Http", $__m.Http); + $__export("Jsonp", $__m.Jsonp); + }, function($__m) { + XHRBackend = $__m.XHRBackend; + $__export("XHRBackend", $__m.XHRBackend); + $__export("XHRConnection", $__m.XHRConnection); + }, function($__m) { + JSONPBackend = $__m.JSONPBackend; + $__export("JSONPBackend", $__m.JSONPBackend); + $__export("JSONPConnection", $__m.JSONPConnection); + }, function($__m) { + BrowserXhr = $__m.BrowserXhr; + $__export("BrowserXhr", $__m.BrowserXhr); + }, function($__m) { + BrowserJsonp = $__m.BrowserJsonp; + }, function($__m) { + BaseRequestOptions = $__m.BaseRequestOptions; + RequestOptions = $__m.RequestOptions; + $__export("BaseRequestOptions", $__m.BaseRequestOptions); + $__export("RequestOptions", $__m.RequestOptions); + }, function($__m) { + ConnectionBackend = $__m.ConnectionBackend; + $__export("Connection", $__m.Connection); + $__export("ConnectionBackend", $__m.ConnectionBackend); + }, function($__m) { + BaseResponseOptions = $__m.BaseResponseOptions; + ResponseOptions = $__m.ResponseOptions; + $__export("BaseResponseOptions", $__m.BaseResponseOptions); + $__export("ResponseOptions", $__m.ResponseOptions); + }, function($__m) { + $__export("MockConnection", $__m.MockConnection); + $__export("MockBackend", $__m.MockBackend); + }, function($__m) { + $__export("Request", $__m.Request); + }, function($__m) { + $__export("Response", $__m.Response); + }, function($__m) { + $__export("Headers", $__m.Headers); + }, function($__m) { + $__export("ResponseTypes", $__m.ResponseTypes); + $__export("ReadyStates", $__m.ReadyStates); + $__export("RequestMethods", $__m.RequestMethods); + $__export("RequestCredentialsOpts", $__m.RequestCredentialsOpts); + $__export("RequestCacheOpts", $__m.RequestCacheOpts); + $__export("RequestModesOpts", $__m.RequestModesOpts); + }, function($__m) { + $__export("URLSearchParams", $__m.URLSearchParams); + }], + execute: function() { + httpInjectables = [bind(ConnectionBackend).toClass(XHRBackend), BrowserXhr, bind(RequestOptions).toClass(BaseRequestOptions), bind(ResponseOptions).toClass(BaseResponseOptions), Http]; + $__export("httpInjectables", httpInjectables); + jsonpInjectables = [bind(ConnectionBackend).toClass(JSONPBackend), BrowserJsonp, bind(RequestOptions).toClass(BaseRequestOptions), bind(ResponseOptions).toClass(BaseResponseOptions), Jsonp]; + $__export("jsonpInjectables", jsonpInjectables); + } + }; +}); + +System.register("angular2/di", ["angular2/src/di/metadata", "angular2/src/di/decorators", "angular2/src/di/forward_ref", "angular2/src/di/injector", "angular2/src/di/binding", "angular2/src/di/key", "angular2/src/di/exceptions", "angular2/src/di/opaque_token"], function($__export) { + "use strict"; + var __moduleName = "angular2/di"; + var $__exportNames = {undefined: true}; + return { + setters: [function($__m) { + $__export("InjectMetadata", $__m.InjectMetadata); + $__export("OptionalMetadata", $__m.OptionalMetadata); + $__export("InjectableMetadata", $__m.InjectableMetadata); + $__export("VisibilityMetadata", $__m.VisibilityMetadata); + $__export("SelfMetadata", $__m.SelfMetadata); + $__export("AncestorMetadata", $__m.AncestorMetadata); + $__export("UnboundedMetadata", $__m.UnboundedMetadata); + $__export("DependencyMetadata", $__m.DependencyMetadata); + $__export("DEFAULT_VISIBILITY", $__m.DEFAULT_VISIBILITY); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + $__export("forwardRef", $__m.forwardRef); + $__export("resolveForwardRef", $__m.resolveForwardRef); + }, function($__m) { + $__export("Injector", $__m.Injector); + $__export("ProtoInjector", $__m.ProtoInjector); + $__export("BindingWithVisibility", $__m.BindingWithVisibility); + $__export("PUBLIC_AND_PRIVATE", $__m.PUBLIC_AND_PRIVATE); + $__export("PUBLIC", $__m.PUBLIC); + $__export("PRIVATE", $__m.PRIVATE); + $__export("undefinedValue", $__m.undefinedValue); + }, function($__m) { + $__export("Binding", $__m.Binding); + $__export("BindingBuilder", $__m.BindingBuilder); + $__export("ResolvedBinding", $__m.ResolvedBinding); + $__export("Dependency", $__m.Dependency); + $__export("bind", $__m.bind); + }, function($__m) { + $__export("Key", $__m.Key); + $__export("KeyRegistry", $__m.KeyRegistry); + $__export("TypeLiteral", $__m.TypeLiteral); + }, function($__m) { + $__export("NoBindingError", $__m.NoBindingError); + $__export("AbstractBindingError", $__m.AbstractBindingError); + $__export("CyclicDependencyError", $__m.CyclicDependencyError); + $__export("InstantiationError", $__m.InstantiationError); + $__export("InvalidBindingError", $__m.InvalidBindingError); + $__export("NoAnnotationError", $__m.NoAnnotationError); + $__export("OutOfBoundsError", $__m.OutOfBoundsError); + }, function($__m) { + $__export("OpaqueToken", $__m.OpaqueToken); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/change_detection/jit_proto_change_detector", ["angular2/src/facade/collection", "angular2/src/change_detection/change_detection_jit_generator", "angular2/src/change_detection/coalesce", "angular2/src/change_detection/proto_change_detector"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/jit_proto_change_detector"; + var ListWrapper, + ChangeDetectorJITGenerator, + coalesce, + ProtoRecordBuilder, + JitProtoChangeDetector; + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + ChangeDetectorJITGenerator = $__m.ChangeDetectorJITGenerator; + }, function($__m) { + coalesce = $__m.coalesce; + }, function($__m) { + ProtoRecordBuilder = $__m.ProtoRecordBuilder; + }], + execute: function() { + JitProtoChangeDetector = (function() { + function JitProtoChangeDetector(definition) { + this.definition = definition; + this._factory = this._createFactory(definition); + } + return ($traceurRuntime.createClass)(JitProtoChangeDetector, { + instantiate: function(dispatcher) { + return this._factory(dispatcher); + }, + _createFactory: function(definition) { + var recordBuilder = new ProtoRecordBuilder(); + ListWrapper.forEach(definition.bindingRecords, (function(b) { + recordBuilder.add(b, definition.variableNames); + })); + var records = coalesce(recordBuilder.records); + return new ChangeDetectorJITGenerator(definition.id, definition.strategy, records, this.definition.directiveRecords, this.definition.generateCheckNoChanges).generate(); + } + }, {isSupported: function() { + return true; + }}); + }()); + $__export("JitProtoChangeDetector", JitProtoChangeDetector); + } + }; +}); + +System.register("angular2/src/render/render", ["angular2/src/render/dom/compiler/view_loader", "angular2/src/render/dom/view/shared_styles_host", "angular2/src/render/dom/compiler/compiler", "angular2/src/render/dom/dom_renderer", "angular2/src/render/dom/dom_tokens", "angular2/src/render/api"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/render"; + var $__exportNames = {}; + var $__exportNames = {}; + var $__exportNames = {}; + var $__exportNames = {}; + var $__exportNames = {}; + var $__exportNames = {}; + return { + setters: [function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/change_detection/change_detection", ["angular2/src/change_detection/jit_proto_change_detector", "angular2/src/change_detection/pregen_proto_change_detector", "angular2/src/change_detection/proto_change_detector", "angular2/src/change_detection/pipes/pipes", "angular2/src/change_detection/pipes/iterable_changes", "angular2/src/change_detection/pipes/keyvalue_changes", "angular2/src/change_detection/pipes/observable_pipe", "angular2/src/change_detection/pipes/promise_pipe", "angular2/src/change_detection/pipes/uppercase_pipe", "angular2/src/change_detection/pipes/lowercase_pipe", "angular2/src/change_detection/pipes/json_pipe", "angular2/src/change_detection/pipes/limit_to_pipe", "angular2/src/change_detection/pipes/date_pipe", "angular2/src/change_detection/pipes/number_pipe", "angular2/src/change_detection/pipes/null_pipe", "angular2/src/change_detection/interfaces", "angular2/di", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/change_detection/parser/ast", "angular2/src/change_detection/parser/lexer", "angular2/src/change_detection/parser/parser", "angular2/src/change_detection/parser/locals", "angular2/src/change_detection/exceptions", "angular2/src/change_detection/constants", "angular2/src/change_detection/binding_record", "angular2/src/change_detection/directive_record", "angular2/src/change_detection/dynamic_change_detector", "angular2/src/change_detection/change_detector_ref", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/change_detection"; + var __decorate, + __metadata, + __param, + JitProtoChangeDetector, + PregenProtoChangeDetector, + DynamicProtoChangeDetector, + Pipes, + IterableChangesFactory, + KeyValueChangesFactory, + ObservablePipeFactory, + PromisePipeFactory, + UpperCasePipe, + LowerCasePipe, + JsonPipe, + LimitToPipeFactory, + DatePipe, + DecimalPipe, + PercentPipe, + CurrencyPipe, + NullPipeFactory, + ChangeDetection, + Inject, + Injectable, + OpaqueToken, + Optional, + StringMapWrapper, + CONST, + CONST_EXPR, + isPresent, + keyValDiff, + iterableDiff, + async, + uppercase, + lowercase, + json, + limitTo, + decimal, + percent, + currency, + date, + defaultPipes, + preGeneratedProtoDetectors, + PROTO_CHANGE_DETECTOR_KEY, + PreGeneratedChangeDetection, + DynamicChangeDetection, + JitChangeDetection; + return { + setters: [function($__m) { + JitProtoChangeDetector = $__m.JitProtoChangeDetector; + }, function($__m) { + PregenProtoChangeDetector = $__m.PregenProtoChangeDetector; + }, function($__m) { + DynamicProtoChangeDetector = $__m.DynamicProtoChangeDetector; + $__export("DynamicProtoChangeDetector", $__m.DynamicProtoChangeDetector); + }, function($__m) { + Pipes = $__m.Pipes; + $__export("Pipes", $__m.Pipes); + }, function($__m) { + IterableChangesFactory = $__m.IterableChangesFactory; + }, function($__m) { + KeyValueChangesFactory = $__m.KeyValueChangesFactory; + }, function($__m) { + ObservablePipeFactory = $__m.ObservablePipeFactory; + }, function($__m) { + PromisePipeFactory = $__m.PromisePipeFactory; + }, function($__m) { + UpperCasePipe = $__m.UpperCasePipe; + }, function($__m) { + LowerCasePipe = $__m.LowerCasePipe; + }, function($__m) { + JsonPipe = $__m.JsonPipe; + }, function($__m) { + LimitToPipeFactory = $__m.LimitToPipeFactory; + }, function($__m) { + DatePipe = $__m.DatePipe; + }, function($__m) { + DecimalPipe = $__m.DecimalPipe; + PercentPipe = $__m.PercentPipe; + CurrencyPipe = $__m.CurrencyPipe; + }, function($__m) { + NullPipeFactory = $__m.NullPipeFactory; + $__export("NullPipe", $__m.NullPipe); + $__export("NullPipeFactory", $__m.NullPipeFactory); + }, function($__m) { + ChangeDetection = $__m.ChangeDetection; + $__export("ChangeDetection", $__m.ChangeDetection); + $__export("ChangeDetectorDefinition", $__m.ChangeDetectorDefinition); + }, function($__m) { + Inject = $__m.Inject; + Injectable = $__m.Injectable; + OpaqueToken = $__m.OpaqueToken; + Optional = $__m.Optional; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + CONST = $__m.CONST; + CONST_EXPR = $__m.CONST_EXPR; + isPresent = $__m.isPresent; + }, function($__m) { + $__export("ASTWithSource", $__m.ASTWithSource); + $__export("AST", $__m.AST); + $__export("AstTransformer", $__m.AstTransformer); + $__export("AccessMember", $__m.AccessMember); + $__export("LiteralArray", $__m.LiteralArray); + $__export("ImplicitReceiver", $__m.ImplicitReceiver); + }, function($__m) { + $__export("Lexer", $__m.Lexer); + }, function($__m) { + $__export("Parser", $__m.Parser); + }, function($__m) { + $__export("Locals", $__m.Locals); + }, function($__m) { + $__export("DehydratedException", $__m.DehydratedException); + $__export("ExpressionChangedAfterItHasBeenCheckedException", $__m.ExpressionChangedAfterItHasBeenCheckedException); + $__export("ChangeDetectionError", $__m.ChangeDetectionError); + }, function($__m) { + $__export("CHECK_ONCE", $__m.CHECK_ONCE); + $__export("CHECK_ALWAYS", $__m.CHECK_ALWAYS); + $__export("DETACHED", $__m.DETACHED); + $__export("CHECKED", $__m.CHECKED); + $__export("ON_PUSH", $__m.ON_PUSH); + $__export("DEFAULT", $__m.DEFAULT); + }, function($__m) { + $__export("BindingRecord", $__m.BindingRecord); + }, function($__m) { + $__export("DirectiveIndex", $__m.DirectiveIndex); + $__export("DirectiveRecord", $__m.DirectiveRecord); + }, function($__m) { + $__export("DynamicChangeDetector", $__m.DynamicChangeDetector); + }, function($__m) { + $__export("ChangeDetectorRef", $__m.ChangeDetectorRef); + }, function($__m) { + $__export("WrappedValue", $__m.WrappedValue); + $__export("BasePipe", $__m.BasePipe); + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + keyValDiff = CONST_EXPR([CONST_EXPR(new KeyValueChangesFactory()), CONST_EXPR(new NullPipeFactory())]); + $__export("keyValDiff", keyValDiff); + iterableDiff = CONST_EXPR([CONST_EXPR(new IterableChangesFactory()), CONST_EXPR(new NullPipeFactory())]); + $__export("iterableDiff", iterableDiff); + async = CONST_EXPR([CONST_EXPR(new ObservablePipeFactory()), CONST_EXPR(new PromisePipeFactory()), CONST_EXPR(new NullPipeFactory())]); + $__export("async", async); + uppercase = CONST_EXPR([CONST_EXPR(new UpperCasePipe()), CONST_EXPR(new NullPipeFactory())]); + $__export("uppercase", uppercase); + lowercase = CONST_EXPR([CONST_EXPR(new LowerCasePipe()), CONST_EXPR(new NullPipeFactory())]); + $__export("lowercase", lowercase); + json = CONST_EXPR([CONST_EXPR(new JsonPipe()), CONST_EXPR(new NullPipeFactory())]); + $__export("json", json); + limitTo = CONST_EXPR([CONST_EXPR(new LimitToPipeFactory()), CONST_EXPR(new NullPipeFactory())]); + $__export("limitTo", limitTo); + decimal = CONST_EXPR([CONST_EXPR(new DecimalPipe()), CONST_EXPR(new NullPipeFactory())]); + $__export("decimal", decimal); + percent = CONST_EXPR([CONST_EXPR(new PercentPipe()), CONST_EXPR(new NullPipeFactory())]); + $__export("percent", percent); + currency = CONST_EXPR([CONST_EXPR(new CurrencyPipe()), CONST_EXPR(new NullPipeFactory())]); + $__export("currency", currency); + date = CONST_EXPR([CONST_EXPR(new DatePipe()), CONST_EXPR(new NullPipeFactory())]); + $__export("date", date); + defaultPipes = CONST_EXPR(new Pipes({ + "iterableDiff": iterableDiff, + "keyValDiff": keyValDiff, + "async": async, + "uppercase": uppercase, + "lowercase": lowercase, + "json": json, + "limitTo": limitTo, + "number": decimal, + "percent": percent, + "currency": currency, + "date": date + })); + $__export("defaultPipes", defaultPipes); + preGeneratedProtoDetectors = {}; + $__export("preGeneratedProtoDetectors", preGeneratedProtoDetectors); + PROTO_CHANGE_DETECTOR_KEY = CONST_EXPR(new OpaqueToken('ProtoChangeDetectors')); + $__export("PROTO_CHANGE_DETECTOR_KEY", PROTO_CHANGE_DETECTOR_KEY); + PreGeneratedChangeDetection = (function($__super) { + function $__0(protoChangeDetectorsForTest) { + $traceurRuntime.superConstructor($__0).call(this); + this._dynamicChangeDetection = new DynamicChangeDetection(); + this._protoChangeDetectorFactories = isPresent(protoChangeDetectorsForTest) ? protoChangeDetectorsForTest : preGeneratedProtoDetectors; + } + return ($traceurRuntime.createClass)($__0, {createProtoChangeDetector: function(definition) { + var id = definition.id; + if (StringMapWrapper.contains(this._protoChangeDetectorFactories, id)) { + return StringMapWrapper.get(this._protoChangeDetectorFactories, id)(definition); + } + return this._dynamicChangeDetection.createProtoChangeDetector(definition); + }}, {isSupported: function() { + return PregenProtoChangeDetector.isSupported(); + }}, $__super); + }(ChangeDetection)); + $__export("PreGeneratedChangeDetection", PreGeneratedChangeDetection); + $__export("PreGeneratedChangeDetection", PreGeneratedChangeDetection = __decorate([Injectable(), __param(0, Inject(PROTO_CHANGE_DETECTOR_KEY)), __param(0, Optional()), __metadata('design:paramtypes', [Object])], PreGeneratedChangeDetection)); + DynamicChangeDetection = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, {createProtoChangeDetector: function(definition) { + return new DynamicProtoChangeDetector(definition); + }}, {}, $__super); + }(ChangeDetection)); + $__export("DynamicChangeDetection", DynamicChangeDetection); + $__export("DynamicChangeDetection", DynamicChangeDetection = __decorate([Injectable(), __metadata('design:paramtypes', [])], DynamicChangeDetection)); + JitChangeDetection = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, {createProtoChangeDetector: function(definition) { + return new JitProtoChangeDetector(definition); + }}, {isSupported: function() { + return JitProtoChangeDetector.isSupported(); + }}, $__super); + }(ChangeDetection)); + $__export("JitChangeDetection", JitChangeDetection); + $__export("JitChangeDetection", JitChangeDetection = __decorate([Injectable(), CONST(), __metadata('design:paramtypes', [])], JitChangeDetection)); + } + }; +}); + +System.register("angular2/change_detection", ["angular2/src/change_detection/change_detection"], function($__export) { + "use strict"; + var __moduleName = "angular2/change_detection"; + return { + setters: [function($__m) { + $__export("CHECK_ONCE", $__m.CHECK_ONCE); + $__export("CHECK_ALWAYS", $__m.CHECK_ALWAYS); + $__export("DETACHED", $__m.DETACHED); + $__export("CHECKED", $__m.CHECKED); + $__export("ON_PUSH", $__m.ON_PUSH); + $__export("DEFAULT", $__m.DEFAULT); + $__export("ExpressionChangedAfterItHasBeenCheckedException", $__m.ExpressionChangedAfterItHasBeenCheckedException); + $__export("ChangeDetectionError", $__m.ChangeDetectionError); + $__export("ChangeDetectorRef", $__m.ChangeDetectorRef); + $__export("WrappedValue", $__m.WrappedValue); + $__export("Pipes", $__m.Pipes); + $__export("BasePipe", $__m.BasePipe); + $__export("NullPipe", $__m.NullPipe); + $__export("NullPipeFactory", $__m.NullPipeFactory); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/core/annotations_impl/annotations", ["angular2/src/facade/lang", "angular2/src/di/metadata", "angular2/change_detection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/annotations_impl/annotations"; + var __decorate, + __metadata, + CONST, + InjectableMetadata, + DEFAULT, + Directive, + Component, + LifecycleEvent; + return { + setters: [function($__m) { + CONST = $__m.CONST; + }, function($__m) { + InjectableMetadata = $__m.InjectableMetadata; + }, function($__m) { + DEFAULT = $__m.DEFAULT; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Directive = (function($__super) { + function $__0() { + var $__3; + var $__2 = arguments[0] !== (void 0) ? arguments[0] : {}, + selector = $__2.selector, + properties = $__2.properties, + events = $__2.events, + host = $__2.host, + lifecycle = $__2.lifecycle, + hostInjector = $__2.hostInjector, + exportAs = $__2.exportAs, + compileChildren = ($__3 = $__2.compileChildren) === void 0 ? true : $__3; + $traceurRuntime.superConstructor($__0).call(this); + this.selector = selector; + this.properties = properties; + this.events = events; + this.host = host; + this.exportAs = exportAs; + this.lifecycle = lifecycle; + this.compileChildren = compileChildren; + this.hostInjector = hostInjector; + } + return ($traceurRuntime.createClass)($__0, {}, {}, $__super); + }(InjectableMetadata)); + $__export("Directive", Directive); + $__export("Directive", Directive = __decorate([CONST(), __metadata('design:paramtypes', [Object])], Directive)); + Component = (function($__super) { + function $__0() { + var $__3, + $__4; + var $__2 = arguments[0] !== (void 0) ? arguments[0] : {}, + selector = $__2.selector, + properties = $__2.properties, + events = $__2.events, + host = $__2.host, + exportAs = $__2.exportAs, + lifecycle = $__2.lifecycle, + hostInjector = $__2.hostInjector, + viewInjector = $__2.viewInjector, + changeDetection = ($__3 = $__2.changeDetection) === void 0 ? DEFAULT : $__3, + compileChildren = ($__4 = $__2.compileChildren) === void 0 ? true : $__4; + $traceurRuntime.superConstructor($__0).call(this, { + selector: selector, + properties: properties, + events: events, + host: host, + exportAs: exportAs, + hostInjector: hostInjector, + lifecycle: lifecycle, + compileChildren: compileChildren + }); + this.changeDetection = changeDetection; + this.viewInjector = viewInjector; + } + return ($traceurRuntime.createClass)($__0, {}, {}, $__super); + }(Directive)); + $__export("Component", Component); + $__export("Component", Component = __decorate([CONST(), __metadata('design:paramtypes', [Object])], Component)); + $__export("LifecycleEvent", LifecycleEvent); + (function(LifecycleEvent) { + LifecycleEvent[LifecycleEvent["onDestroy"] = 0] = "onDestroy"; + LifecycleEvent[LifecycleEvent["onChange"] = 1] = "onChange"; + LifecycleEvent[LifecycleEvent["onCheck"] = 2] = "onCheck"; + LifecycleEvent[LifecycleEvent["onInit"] = 3] = "onInit"; + LifecycleEvent[LifecycleEvent["onAllChangesDone"] = 4] = "onAllChangesDone"; + })(LifecycleEvent || ($__export("LifecycleEvent", LifecycleEvent = {}))); + } + }; +}); + +System.register("angular2/src/core/compiler/directive_resolver", ["angular2/di", "angular2/src/facade/lang", "angular2/src/core/annotations_impl/annotations", "angular2/src/reflection/reflection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/directive_resolver"; + var __decorate, + __metadata, + resolveForwardRef, + Injectable, + isPresent, + BaseException, + stringify, + Directive, + reflector, + DirectiveResolver; + return { + setters: [function($__m) { + resolveForwardRef = $__m.resolveForwardRef; + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + stringify = $__m.stringify; + }, function($__m) { + Directive = $__m.Directive; + }, function($__m) { + reflector = $__m.reflector; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + DirectiveResolver = (($traceurRuntime.createClass)(function() {}, {resolve: function(type) { + var annotations = reflector.annotations(resolveForwardRef(type)); + if (isPresent(annotations)) { + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + if (annotation instanceof Directive) { + return annotation; + } + } + } + throw new BaseException(("No Directive annotation found on " + stringify(type))); + }}, {})); + $__export("DirectiveResolver", DirectiveResolver); + $__export("DirectiveResolver", DirectiveResolver = __decorate([Injectable(), __metadata('design:paramtypes', [])], DirectiveResolver)); + } + }; +}); + +System.register("angular2/src/core/compiler/compiler", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/view", "angular2/src/core/compiler/element_injector", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/proto_view_factory", "angular2/src/services/url_resolver", "angular2/src/services/app_root_url", "angular2/src/render/api"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/compiler"; + var __decorate, + __metadata, + Binding, + resolveForwardRef, + Injectable, + Type, + isBlank, + isType, + isPresent, + BaseException, + normalizeBlank, + stringify, + isArray, + isPromise, + PromiseWrapper, + ListWrapper, + Map, + MapWrapper, + DirectiveResolver, + AppProtoViewMergeMapping, + DirectiveBinding, + ViewResolver, + ComponentUrlMapper, + ProtoViewFactory, + UrlResolver, + AppRootUrl, + renderApi, + CompilerCache, + Compiler; + return { + setters: [function($__m) { + Binding = $__m.Binding; + resolveForwardRef = $__m.resolveForwardRef; + Injectable = $__m.Injectable; + }, function($__m) { + Type = $__m.Type; + isBlank = $__m.isBlank; + isType = $__m.isType; + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + normalizeBlank = $__m.normalizeBlank; + stringify = $__m.stringify; + isArray = $__m.isArray; + isPromise = $__m.isPromise; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + Map = $__m.Map; + MapWrapper = $__m.MapWrapper; + }, function($__m) { + DirectiveResolver = $__m.DirectiveResolver; + }, function($__m) { + AppProtoViewMergeMapping = $__m.AppProtoViewMergeMapping; + }, function($__m) { + DirectiveBinding = $__m.DirectiveBinding; + }, function($__m) { + ViewResolver = $__m.ViewResolver; + }, function($__m) { + ComponentUrlMapper = $__m.ComponentUrlMapper; + }, function($__m) { + ProtoViewFactory = $__m.ProtoViewFactory; + }, function($__m) { + UrlResolver = $__m.UrlResolver; + }, function($__m) { + AppRootUrl = $__m.AppRootUrl; + }, function($__m) { + renderApi = $__m; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + CompilerCache = (($traceurRuntime.createClass)(function() { + this._cache = new Map(); + this._hostCache = new Map(); + }, { + set: function(component, protoView) { + this._cache.set(component, protoView); + }, + get: function(component) { + var result = this._cache.get(component); + return normalizeBlank(result); + }, + setHost: function(component, protoView) { + this._hostCache.set(component, protoView); + }, + getHost: function(component) { + var result = this._hostCache.get(component); + return normalizeBlank(result); + }, + clear: function() { + this._cache.clear(); + this._hostCache.clear(); + } + }, {})); + $__export("CompilerCache", CompilerCache); + $__export("CompilerCache", CompilerCache = __decorate([Injectable(), __metadata('design:paramtypes', [])], CompilerCache)); + Compiler = (($traceurRuntime.createClass)(function(reader, cache, viewResolver, componentUrlMapper, urlResolver, render, protoViewFactory, appUrl) { + this._reader = reader; + this._compilerCache = cache; + this._compiling = new Map(); + this._viewResolver = viewResolver; + this._componentUrlMapper = componentUrlMapper; + this._urlResolver = urlResolver; + this._appUrl = appUrl.value; + this._render = render; + this._protoViewFactory = protoViewFactory; + }, { + _bindDirective: function(directiveTypeOrBinding) { + if (directiveTypeOrBinding instanceof DirectiveBinding) { + return directiveTypeOrBinding; + } else if (directiveTypeOrBinding instanceof Binding) { + var annotation = this._reader.resolve(directiveTypeOrBinding.token); + return DirectiveBinding.createFromBinding(directiveTypeOrBinding, annotation); + } else { + var annotation$__3 = this._reader.resolve(directiveTypeOrBinding); + return DirectiveBinding.createFromType(directiveTypeOrBinding, annotation$__3); + } + }, + compileInHost: function(componentTypeOrBinding) { + var $__0 = this; + var componentType = isType(componentTypeOrBinding) ? componentTypeOrBinding : componentTypeOrBinding.token; + var hostAppProtoView = this._compilerCache.getHost(componentType); + var hostPvPromise; + if (isPresent(hostAppProtoView)) { + hostPvPromise = PromiseWrapper.resolve(hostAppProtoView); + } else { + var componentBinding = this._bindDirective(componentTypeOrBinding); + Compiler._assertTypeIsComponent(componentBinding); + var directiveMetadata = componentBinding.metadata; + hostPvPromise = this._render.compileHost(directiveMetadata).then((function(hostRenderPv) { + var protoViews = $__0._protoViewFactory.createAppProtoViews(componentBinding, hostRenderPv, [componentBinding]); + return $__0._compileNestedProtoViews(protoViews, componentType, new Map()); + })).then((function(appProtoView) { + $__0._compilerCache.setHost(componentType, appProtoView); + return appProtoView; + })); + } + return hostPvPromise.then((function(hostAppProtoView) { + return hostAppProtoView.ref; + })); + }, + _compile: function(componentBinding, componentPath) { + var $__0 = this; + var component = componentBinding.key.token; + var protoView = this._compilerCache.get(component); + if (isPresent(protoView)) { + return protoView; + } + var resultPromise = this._compiling.get(component); + if (isPresent(resultPromise)) { + return resultPromise; + } + var view = this._viewResolver.resolve(component); + var directives = this._flattenDirectives(view); + for (var i = 0; i < directives.length; i++) { + if (!Compiler._isValidDirective(directives[i])) { + throw new BaseException(("Unexpected directive value '" + stringify(directives[i]) + "' on the View of component '" + stringify(component) + "'")); + } + } + var boundDirectives = this._removeDuplicatedDirectives(ListWrapper.map(directives, (function(directive) { + return $__0._bindDirective(directive); + }))); + var renderTemplate = this._buildRenderTemplate(component, view, boundDirectives); + resultPromise = this._render.compile(renderTemplate).then((function(renderPv) { + var protoViews = $__0._protoViewFactory.createAppProtoViews(componentBinding, renderPv, boundDirectives); + return $__0._compileNestedProtoViews(protoViews, component, componentPath); + })).then((function(appProtoView) { + $__0._compilerCache.set(component, appProtoView); + MapWrapper.delete($__0._compiling, component); + return appProtoView; + })); + this._compiling.set(component, resultPromise); + return resultPromise; + }, + _removeDuplicatedDirectives: function(directives) { + var directivesMap = new Map(); + directives.forEach((function(dirBinding) { + directivesMap.set(dirBinding.key.id, dirBinding); + })); + return MapWrapper.values(directivesMap); + }, + _compileNestedProtoViews: function(appProtoViews, componentType, componentPath) { + var $__0 = this; + var nestedPVPromises = []; + componentPath = MapWrapper.clone(componentPath); + if (appProtoViews[0].type === renderApi.ViewType.COMPONENT) { + componentPath.set(componentType, appProtoViews[0]); + } + appProtoViews.forEach((function(appProtoView) { + $__0._collectComponentElementBinders(appProtoView).forEach((function(elementBinder) { + var nestedComponent = elementBinder.componentDirective; + var nestedComponentType = nestedComponent.key.token; + var elementBinderDone = (function(nestedPv) { + elementBinder.nestedProtoView = nestedPv; + }); + if (componentPath.has(nestedComponentType)) { + if (appProtoView.isEmbeddedFragment) { + throw new BaseException((" is used within the recursive path of " + stringify(nestedComponentType))); + } else if (appProtoView.type === renderApi.ViewType.COMPONENT) { + throw new BaseException(("Unconditional component cycle in " + stringify(nestedComponentType))); + } else { + elementBinderDone(componentPath.get(nestedComponentType)); + } + } else { + var nestedCall = $__0._compile(nestedComponent, componentPath); + if (isPromise(nestedCall)) { + nestedPVPromises.push(nestedCall.then(elementBinderDone)); + } else { + elementBinderDone(nestedCall); + } + } + })); + })); + return PromiseWrapper.all(nestedPVPromises).then((function(_) { + return PromiseWrapper.all(appProtoViews.map((function(appProtoView) { + return $__0._mergeProtoView(appProtoView); + }))); + })).then((function(_) { + return appProtoViews[0]; + })); + }, + _mergeProtoView: function(appProtoView) { + if (appProtoView.type !== renderApi.ViewType.HOST && appProtoView.type !== renderApi.ViewType.EMBEDDED) { + return null; + } + return this._render.mergeProtoViewsRecursively(this._collectMergeRenderProtoViews(appProtoView)).then((function(mergeResult) { + appProtoView.mergeMapping = new AppProtoViewMergeMapping(mergeResult); + })); + }, + _collectMergeRenderProtoViews: function(appProtoView) { + var result = [appProtoView.render]; + for (var i = 0; i < appProtoView.elementBinders.length; i++) { + var binder = appProtoView.elementBinders[i]; + if (isPresent(binder.nestedProtoView)) { + if (binder.hasStaticComponent() || (binder.hasEmbeddedProtoView() && binder.nestedProtoView.isEmbeddedFragment)) { + result.push(this._collectMergeRenderProtoViews(binder.nestedProtoView)); + } else { + result.push(null); + } + } + } + return result; + }, + _collectComponentElementBinders: function(appProtoView) { + var componentElementBinders = []; + appProtoView.elementBinders.forEach((function(elementBinder) { + if (isPresent(elementBinder.componentDirective)) { + componentElementBinders.push(elementBinder); + } + })); + return componentElementBinders; + }, + _buildRenderTemplate: function(component, view, directives) { + var $__0 = this; + var componentUrl = this._urlResolver.resolve(this._appUrl, this._componentUrlMapper.getUrl(component)); + var templateAbsUrl = null; + var styleAbsUrls = null; + if (isPresent(view.templateUrl)) { + templateAbsUrl = this._urlResolver.resolve(componentUrl, view.templateUrl); + } else if (isPresent(view.template)) { + templateAbsUrl = componentUrl; + } + if (isPresent(view.styleUrls)) { + styleAbsUrls = ListWrapper.map(view.styleUrls, (function(url) { + return $__0._urlResolver.resolve(componentUrl, url); + })); + } + return new renderApi.ViewDefinition({ + componentId: stringify(component), + templateAbsUrl: templateAbsUrl, + template: view.template, + styleAbsUrls: styleAbsUrls, + styles: view.styles, + directives: ListWrapper.map(directives, (function(directiveBinding) { + return directiveBinding.metadata; + })), + encapsulation: view.encapsulation + }); + }, + _flattenDirectives: function(template) { + if (isBlank(template.directives)) + return []; + var directives = []; + this._flattenList(template.directives, directives); + return directives; + }, + _flattenList: function(tree, out) { + for (var i = 0; i < tree.length; i++) { + var item = resolveForwardRef(tree[i]); + if (isArray(item)) { + this._flattenList(item, out); + } else { + out.push(item); + } + } + } + }, { + _isValidDirective: function(value) { + return isPresent(value) && (value instanceof Type || value instanceof Binding); + }, + _assertTypeIsComponent: function(directiveBinding) { + if (directiveBinding.metadata.type !== renderApi.DirectiveMetadata.COMPONENT_TYPE) { + throw new BaseException(("Could not load '" + stringify(directiveBinding.key.token) + "' because it is not a component.")); + } + } + })); + $__export("Compiler", Compiler); + $__export("Compiler", Compiler = __decorate([Injectable(), __metadata('design:paramtypes', [DirectiveResolver, CompilerCache, ViewResolver, ComponentUrlMapper, UrlResolver, renderApi.RenderCompiler, ProtoViewFactory, AppRootUrl])], Compiler)); + } + }; +}); + +System.register("angular2/src/core/application_common", ["angular2/di", "angular2/src/facade/lang", "angular2/src/dom/browser_adapter", "angular2/src/dom/dom_adapter", "angular2/src/core/compiler/compiler", "angular2/src/reflection/reflection", "angular2/src/change_detection/change_detection", "angular2/src/core/exception_handler", "angular2/src/render/dom/compiler/view_loader", "angular2/src/render/dom/compiler/style_url_resolver", "angular2/src/render/dom/compiler/style_inliner", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/directive_resolver", "angular2/src/facade/collection", "angular2/src/facade/async", "angular2/src/core/zone/ng_zone", "angular2/src/core/life_cycle/life_cycle", "angular2/src/render/xhr", "angular2/src/render/xhr_impl", "angular2/src/render/dom/events/event_manager", "angular2/src/render/dom/events/key_events", "angular2/src/render/dom/events/hammer_gestures", "angular2/src/core/compiler/component_url_mapper", "angular2/src/services/url_resolver", "angular2/src/services/app_root_url", "angular2/src/services/anchor_based_app_root_url", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/testability/testability", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_listener", "angular2/src/core/compiler/proto_view_factory", "angular2/src/render/api", "angular2/src/render/render", "angular2/src/render/dom/view/shared_styles_host", "angular2/src/core/compiler/view_ref", "angular2/src/core/application_tokens"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/application_common"; + var Injector, + bind, + isBlank, + isPresent, + assertionsEnabled, + isDart, + BrowserDomAdapter, + DOM, + Compiler, + CompilerCache, + Reflector, + reflector, + Parser, + Lexer, + ChangeDetection, + DynamicChangeDetection, + JitChangeDetection, + PreGeneratedChangeDetection, + Pipes, + defaultPipes, + ExceptionHandler, + ViewLoader, + StyleUrlResolver, + StyleInliner, + ViewResolver, + DirectiveResolver, + ListWrapper, + PromiseWrapper, + NgZone, + LifeCycle, + XHR, + XHRImpl, + EventManager, + DomEventsPlugin, + KeyEventsPlugin, + HammerGesturesPlugin, + ComponentUrlMapper, + UrlResolver, + AppRootUrl, + AnchorBasedAppRootUrl, + DynamicComponentLoader, + TestabilityRegistry, + Testability, + AppViewPool, + APP_VIEW_POOL_CAPACITY, + AppViewManager, + AppViewManagerUtils, + AppViewListener, + ProtoViewFactory, + Renderer, + RenderCompiler, + DomRenderer, + DOCUMENT_TOKEN, + DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES, + DefaultDomCompiler, + APP_ID_RANDOM_BINDING, + SharedStylesHost, + DomSharedStylesHost, + internalView, + appComponentRefPromiseToken, + appComponentTypeToken, + _rootInjector, + _rootBindings, + ApplicationRef; + function _injectorBindings(appComponentType) { + var bestChangeDetection = DynamicChangeDetection; + if (PreGeneratedChangeDetection.isSupported()) { + bestChangeDetection = PreGeneratedChangeDetection; + } else if (JitChangeDetection.isSupported()) { + bestChangeDetection = JitChangeDetection; + } + return [bind(DOCUMENT_TOKEN).toValue(DOM.defaultDoc()), bind(DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES).toValue(false), bind(appComponentTypeToken).toValue(appComponentType), bind(appComponentRefPromiseToken).toFactory((function(dynamicComponentLoader, injector, testability, registry) { + return dynamicComponentLoader.loadAsRoot(appComponentType, null, injector).then((function(componentRef) { + registry.registerApplication(componentRef.location.nativeElement, testability); + return componentRef; + })); + }), [DynamicComponentLoader, Injector, Testability, TestabilityRegistry]), bind(appComponentType).toFactory((function(p) { + return p.then((function(ref) { + return ref.instance; + })); + }), [appComponentRefPromiseToken]), bind(LifeCycle).toFactory((function(exceptionHandler) { + return new LifeCycle(null, assertionsEnabled()); + }), [ExceptionHandler]), bind(EventManager).toFactory((function(ngZone) { + var plugins = [new HammerGesturesPlugin(), new KeyEventsPlugin(), new DomEventsPlugin()]; + return new EventManager(plugins, ngZone); + }), [NgZone]), DomRenderer, bind(Renderer).toAlias(DomRenderer), APP_ID_RANDOM_BINDING, DefaultDomCompiler, bind(RenderCompiler).toAlias(DefaultDomCompiler), DomSharedStylesHost, bind(SharedStylesHost).toAlias(DomSharedStylesHost), ProtoViewFactory, AppViewPool, bind(APP_VIEW_POOL_CAPACITY).toValue(10000), AppViewManager, AppViewManagerUtils, AppViewListener, Compiler, CompilerCache, ViewResolver, bind(Pipes).toValue(defaultPipes), bind(ChangeDetection).toClass(bestChangeDetection), ViewLoader, DirectiveResolver, Parser, Lexer, bind(ExceptionHandler).toFactory((function() { + return new ExceptionHandler(DOM, isDart ? false : true); + }), []), bind(XHR).toValue(new XHRImpl()), ComponentUrlMapper, UrlResolver, StyleUrlResolver, StyleInliner, DynamicComponentLoader, Testability, AnchorBasedAppRootUrl, bind(AppRootUrl).toAlias(AnchorBasedAppRootUrl)]; + } + function createNgZone(handler) { + var bootstrapErrorReporter = (function(exception, stackTrace) { + return handler.call(exception, stackTrace); + }); + var zone = new NgZone({enableLongStackTrace: assertionsEnabled()}); + zone.overrideOnErrorHandler(bootstrapErrorReporter); + return zone; + } + function commonBootstrap(appComponentType) { + var componentInjectableBindings = arguments[1] !== (void 0) ? arguments[1] : null; + BrowserDomAdapter.makeCurrent(); + var bootstrapProcess = PromiseWrapper.completer(); + var zone = createNgZone(new ExceptionHandler(DOM, isDart ? false : true)); + zone.run((function() { + var appInjector = _createAppInjector(appComponentType, componentInjectableBindings, zone); + var exceptionHandler = appInjector.get(ExceptionHandler); + zone.overrideOnErrorHandler((function(e, s) { + return exceptionHandler.call(e, s); + })); + try { + var compRefToken = appInjector.get(appComponentRefPromiseToken); + var tick = (function(componentRef) { + var appChangeDetector = internalView(componentRef.hostView).changeDetector; + var lc = appInjector.get(LifeCycle); + lc.registerWith(zone, appChangeDetector); + lc.tick(); + bootstrapProcess.resolve(new ApplicationRef(componentRef, appComponentType, appInjector)); + }); + var tickResult = PromiseWrapper.then(compRefToken, tick); + PromiseWrapper.then(tickResult, (function(_) {})); + PromiseWrapper.then(tickResult, null, (function(err, stackTrace) { + bootstrapProcess.reject(err, stackTrace); + })); + } catch (e) { + bootstrapProcess.reject(e, e.stack); + } + })); + return bootstrapProcess.promise; + } + function _createAppInjector(appComponentType, bindings, zone) { + if (isBlank(_rootInjector)) + _rootInjector = Injector.resolveAndCreate(_rootBindings); + var mergedBindings = isPresent(bindings) ? ListWrapper.concat(_injectorBindings(appComponentType), bindings) : _injectorBindings(appComponentType); + mergedBindings.push(bind(NgZone).toValue(zone)); + return _rootInjector.resolveAndCreateChild(mergedBindings); + } + $__export("createNgZone", createNgZone); + $__export("commonBootstrap", commonBootstrap); + return { + setters: [function($__m) { + Injector = $__m.Injector; + bind = $__m.bind; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + assertionsEnabled = $__m.assertionsEnabled; + isDart = $__m.isDart; + }, function($__m) { + BrowserDomAdapter = $__m.BrowserDomAdapter; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + Compiler = $__m.Compiler; + CompilerCache = $__m.CompilerCache; + }, function($__m) { + Reflector = $__m.Reflector; + reflector = $__m.reflector; + }, function($__m) { + Parser = $__m.Parser; + Lexer = $__m.Lexer; + ChangeDetection = $__m.ChangeDetection; + DynamicChangeDetection = $__m.DynamicChangeDetection; + JitChangeDetection = $__m.JitChangeDetection; + PreGeneratedChangeDetection = $__m.PreGeneratedChangeDetection; + Pipes = $__m.Pipes; + defaultPipes = $__m.defaultPipes; + }, function($__m) { + ExceptionHandler = $__m.ExceptionHandler; + }, function($__m) { + ViewLoader = $__m.ViewLoader; + }, function($__m) { + StyleUrlResolver = $__m.StyleUrlResolver; + }, function($__m) { + StyleInliner = $__m.StyleInliner; + }, function($__m) { + ViewResolver = $__m.ViewResolver; + }, function($__m) { + DirectiveResolver = $__m.DirectiveResolver; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }, function($__m) { + NgZone = $__m.NgZone; + }, function($__m) { + LifeCycle = $__m.LifeCycle; + }, function($__m) { + XHR = $__m.XHR; + }, function($__m) { + XHRImpl = $__m.XHRImpl; + }, function($__m) { + EventManager = $__m.EventManager; + DomEventsPlugin = $__m.DomEventsPlugin; + }, function($__m) { + KeyEventsPlugin = $__m.KeyEventsPlugin; + }, function($__m) { + HammerGesturesPlugin = $__m.HammerGesturesPlugin; + }, function($__m) { + ComponentUrlMapper = $__m.ComponentUrlMapper; + }, function($__m) { + UrlResolver = $__m.UrlResolver; + }, function($__m) { + AppRootUrl = $__m.AppRootUrl; + }, function($__m) { + AnchorBasedAppRootUrl = $__m.AnchorBasedAppRootUrl; + }, function($__m) { + DynamicComponentLoader = $__m.DynamicComponentLoader; + }, function($__m) { + TestabilityRegistry = $__m.TestabilityRegistry; + Testability = $__m.Testability; + }, function($__m) { + AppViewPool = $__m.AppViewPool; + APP_VIEW_POOL_CAPACITY = $__m.APP_VIEW_POOL_CAPACITY; + }, function($__m) { + AppViewManager = $__m.AppViewManager; + }, function($__m) { + AppViewManagerUtils = $__m.AppViewManagerUtils; + }, function($__m) { + AppViewListener = $__m.AppViewListener; + }, function($__m) { + ProtoViewFactory = $__m.ProtoViewFactory; + }, function($__m) { + Renderer = $__m.Renderer; + RenderCompiler = $__m.RenderCompiler; + }, function($__m) { + DomRenderer = $__m.DomRenderer; + DOCUMENT_TOKEN = $__m.DOCUMENT_TOKEN; + DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES = $__m.DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES; + DefaultDomCompiler = $__m.DefaultDomCompiler; + APP_ID_RANDOM_BINDING = $__m.APP_ID_RANDOM_BINDING; + }, function($__m) { + SharedStylesHost = $__m.SharedStylesHost; + DomSharedStylesHost = $__m.DomSharedStylesHost; + }, function($__m) { + internalView = $__m.internalView; + }, function($__m) { + appComponentRefPromiseToken = $__m.appComponentRefPromiseToken; + appComponentTypeToken = $__m.appComponentTypeToken; + }], + execute: function() { + _rootBindings = [bind(Reflector).toValue(reflector), TestabilityRegistry]; + ApplicationRef = (function() { + function ApplicationRef(hostComponent, hostComponentType, injector) { + this._hostComponent = hostComponent; + this._injector = injector; + this._hostComponentType = hostComponentType; + } + return ($traceurRuntime.createClass)(ApplicationRef, { + get hostComponentType() { + return this._hostComponentType; + }, + get hostComponent() { + return this._hostComponent.instance; + }, + dispose: function() { + this._hostComponent.dispose(); + }, + get injector() { + return this._injector; + } + }, {}); + }()); + $__export("ApplicationRef", ApplicationRef); + } + }; +}); + +System.register("angular2/angular2", ["angular2/src/core/application_common", "angular2/annotations", "angular2/change_detection", "angular2/core", "angular2/di", "angular2/directives", "angular2/http", "angular2/forms", "angular2/render"], function($__export) { + "use strict"; + var __moduleName = "angular2/angular2"; + var $__exportNames = {undefined: true}; + var $__exportNames = {undefined: true}; + var $__exportNames = {undefined: true}; + var $__exportNames = {undefined: true}; + var $__exportNames = {undefined: true}; + var $__exportNames = {undefined: true}; + var $__exportNames = {undefined: true}; + var $__exportNames = {undefined: true}; + return { + setters: [function($__m) { + $__export("bootstrap", $__m.commonBootstrap); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }], + execute: function() {} + }; +}); + +//# sourceMappingURLDisabled=angular2.js.map \ No newline at end of file diff --git a/2.0.0-alpha.33/angular2.min.js b/2.0.0-alpha.33/angular2.min.js new file mode 100644 index 0000000000..edef12d0c8 --- /dev/null +++ b/2.0.0-alpha.33/angular2.min.js @@ -0,0 +1,22 @@ +!function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[s]={exports:{}};t[s][0].call(l.exports,function(e){var n=t[s][1][e];return i(n?n:e)},l,l.exports,e,t,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s-1;if(s&&!a){var c=Promise.resolve();o._setScheduler(function(e){c.then(e)})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"es6-promise":15}],4:[function(e,t,n){(function(n){"use strict";function r(){i.patchSetClearFunction(n,["timeout","interval","immediate"]),i.patchSetFunction(n,["requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame"]),i.patchFunction(n,["alert","prompt"]),u.apply(),l.apply(),o.apply(),s.patchClass("MutationObserver"),s.patchClass("WebKitMutationObserver"),a.apply(),c.apply(),f.apply()}var i=e("./functions"),o=e("./promise"),s=e("./mutation-observer"),a=e("./define-property"),c=e("./register-element"),u=(e("./websocket"),e("./event-target")),l=e("./property-descriptor"),f=e("./geolocation");t.exports={apply:r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./define-property":5,"./event-target":6,"./functions":7,"./geolocation":8,"./mutation-observer":9,"./promise":10,"./property-descriptor":11,"./register-element":12,"./websocket":13}],5:[function(e,t,n){"use strict";function r(){Object.defineProperty=function(e,t,n){if(o(e,t))throw new TypeError("Cannot assign to read only property '"+t+"' of "+e);return"prototype"!==t&&(n=s(e,t,n)),a(e,t,n)},Object.defineProperties=function(e,t){return Object.keys(t).forEach(function(n){Object.defineProperty(e,n,t[n])}),e},Object.create=function(e,t){return"object"==typeof t&&Object.keys(t).forEach(function(n){t[n]=s(e,n,t[n])}),u(e,t)},Object.getOwnPropertyDescriptor=function(e,t){var n=c(e,t);return o(e,t)&&(n.configurable=!1),n}}function i(e,t,n){return n=s(e,t,n),a(e,t,n)}function o(e,t){return e&&e.__unconfigurables&&e.__unconfigurables[t]}function s(e,t,n){return n.configurable=!0,n.configurable||(e.__unconfigurables||a(e,"__unconfigurables",{writable:!0,value:{}}),e.__unconfigurables[t]=!0),n}var a=Object.defineProperty,c=Object.getOwnPropertyDescriptor,u=Object.create;t.exports={apply:r,_redefineProperty:i}},{}],6:[function(e,t,n){(function(n){"use strict";function r(){if(n.EventTarget)i.patchEventTargetMethods(n.EventTarget.prototype);else{var e=["ApplicationCache","EventSource","FileReader","InputMethodContext","MediaController","MessagePort","Node","Performance","SVGElementInstance","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebKitNamedFlow","Window","Worker","WorkerGlobalScope","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"];e.forEach(function(e){n[e]&&i.patchEventTargetMethods(n[e].prototype)})}}var i=e("../utils");t.exports={apply:r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils":14}],7:[function(e,t,n){(function(n){"use strict";function r(e,t){t.map(function(e){return e[0].toUpperCase()+e.substr(1)}).forEach(function(t){var r="set"+t,i=e[r];if(i){var o="clear"+t,a={},c="setInterval"===r?s.bindArguments:s.bindArgumentsOnce;n.zone[r]=function(t){var n,r=t;arguments[0]=function(){return delete a[n],r.apply(this,arguments)};var o=c(arguments);return n=i.apply(e,o),a[n]=!0,n},e[r]=function(){return n.zone[r].apply(this,arguments)};var u=e[o];n.zone[o]=function(e){return a[e]&&(delete a[e],n.zone.dequeueTask()),u.apply(this,arguments)},e[o]=function(){return n.zone[o].apply(this,arguments)}}})}function i(e,t){t.forEach(function(t){var r=e[t];r&&(n.zone[t]=function(t){var n=t;arguments[0]=function(){return n.apply(this,arguments)};var i=s.bindArgumentsOnce(arguments);return r.apply(e,i)},e[t]=function(){return zone[t].apply(this,arguments)})})}function o(e,t){t.forEach(function(t){var r=e[t];n.zone[t]=function(){return r.apply(e,arguments)},e[t]=function(){return n.zone[t].apply(this,arguments)}})}var s=e("../utils");t.exports={patchSetClearFunction:r,patchSetFunction:i,patchFunction:o}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils":14}],8:[function(e,t,n){(function(n){"use strict";function r(){n.navigator&&n.navigator.geolocation&&i.patchPrototype(n.navigator.geolocation,["getCurrentPosition","watchPosition"])}var i=e("../utils");t.exports={apply:r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils":14}],9:[function(e,t,n){(function(e){"use strict";function n(t){var n=e[t];if(n){e[t]=function(t){this._o=new n(e.zone.bind(t,!0)),this._creationZone=e.zone};var r=new n(function(){});e[t].prototype.disconnect=function(){var e=this._o.disconnect.apply(this._o,arguments);return this._active&&(this._creationZone.dequeueTask(),this._active=!1),e},e[t].prototype.observe=function(){return this._active||(this._creationZone.enqueueTask(),this._active=!0),this._o.observe.apply(this._o,arguments)};var i;for(i in r)!function(n){void 0===typeof e[t].prototype&&("function"==typeof r[n]?e[t].prototype[n]=function(){return this._o[n].apply(this._o,arguments)}:Object.defineProperty(e[t].prototype,n,{set:function(t){this._o[n]="function"==typeof t?e.zone.bind(t):t},get:function(){return this._o[n]}}))}(i)}}t.exports={patchClass:n}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],10:[function(e,t,n){(function(n){"use strict";function r(e,t){var r=n,i=e.every(function(e){return r=r[e]});i&&t.forEach(function(e){var t=r[e];t&&(r[e]=s(t))})}function i(e){var t=e.then;e.then=function(){var n=a.bindArguments(arguments),r=t.apply(e,n);return i(r)};var n=e["catch"];return e["catch"]=function(){var t=a.bindArguments(arguments),r=n.apply(e,t);return i(r)},e}function o(){if(n.Promise){a.patchPrototype(Promise.prototype,["then","catch"]);var e=[[[],["fetch"]],[["Response","prototype"],["arrayBuffer","blob","json","text"]]];e.forEach(function(e){r(e[0],e[1])})}}var s,a=e("../utils");s=n.Promise?function(e){return function(){var t=e.apply(this,arguments);return t instanceof Promise?t:new Promise(function(e,n){t.then(e,n)})}}:function(e){return function(){return i(e.apply(this,arguments))}},t.exports={apply:o,bindPromiseFn:s}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils":14}],11:[function(e,t,n){(function(n){"use strict";function r(){if(i()){var e=c.map(function(e){return"on"+e});a.patchProperties(HTMLElement.prototype,e),a.patchProperties(XMLHttpRequest.prototype),"undefined"!=typeof WebSocket&&a.patchProperties(WebSocket.prototype)}else o(),a.patchClass("XMLHttpRequest"),s.apply()}function i(){if(!Object.getOwnPropertyDescriptor(HTMLElement.prototype,"onclick")&&"undefined"!=typeof Element){var e=Object.getOwnPropertyDescriptor(Element.prototype,"onclick");if(e&&!e.configurable)return!1}Object.defineProperty(HTMLElement.prototype,"onclick",{get:function(){return!0}});var t=document.createElement("div"),n=!!t.onclick;return Object.defineProperty(HTMLElement.prototype,"onclick",{}),n}function o(){c.forEach(function(e){var t="on"+e;document.addEventListener(e,function(e){for(var r,i=e.target;i;)i[t]&&!i[t]._unbound&&(r=n.zone.bind(i[t]),r._unbound=i[t],i[t]=r),i=i.parentElement},!0)})}var s=e("./websocket"),a=e("../utils"),c="copy cut paste abort blur focus canplay canplaythrough change click contextmenu dblclick drag dragend dragenter dragleave dragover dragstart drop durationchange emptied ended input invalid keydown keypress keyup load loadeddata loadedmetadata loadstart message mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup pause play playing progress ratechange reset scroll seeked seeking select show stalled submit suspend timeupdate volumechange waiting mozfullscreenchange mozfullscreenerror mozpointerlockchange mozpointerlockerror error webglcontextrestored webglcontextlost webglcontextcreationerror".split(" ");t.exports={apply:r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils":14,"./websocket":13}],12:[function(e,t,n){(function(n){"use strict";function r(){if("registerElement"in n.document){var e=document.registerElement,t=["createdCallback","attachedCallback","detachedCallback","attributeChangedCallback"];document.registerElement=function(r,o){return o&&o.prototype&&t.forEach(function(e){if(o.prototype.hasOwnProperty(e)){var t=Object.getOwnPropertyDescriptor(o.prototype,e);t.value?(t.value=n.zone.bind(t.value),i(o.prototype,e,t)):o.prototype[e]=n.zone.bind(o.prototype[e])}else o.prototype[e]&&(o.prototype[e]=n.zone.bind(o.prototype[e]))}),e.apply(document,[r,o])}}}var i=e("./define-property")._redefineProperty;t.exports={apply:r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./define-property":5}],13:[function(e,t,n){(function(n){"use strict";function r(){var e=n.WebSocket;i.patchEventTargetMethods(e.prototype),n.WebSocket=function(t,n){var r,o=arguments.length>1?new e(t,n):new e(t),s=Object.getOwnPropertyDescriptor(o,"onmessage");return s&&s.configurable===!1?(r=Object.create(o),["addEventListener","removeEventListener","send","close"].forEach(function(e){r[e]=function(){return o[e].apply(o,arguments)}})):r=o,i.patchProperties(r,["onclose","onerror","onmessage","onopen"]),r}}var i=e("../utils");t.exports={apply:r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils":14}],14:[function(e,t,n){(function(e){"use strict";function n(t){for(var n=t.length-1;n>=0;n--)"function"==typeof t[n]&&(t[n]=e.zone.bind(t[n]));return t}function r(t){for(var n=t.length-1;n>=0;n--)"function"==typeof t[n]&&(t[n]=e.zone.bindOnce(t[n]));return t}function i(e,t){t.forEach(function(t){var r=e[t];r&&(e[t]=function(){return r.apply(this,n(arguments))})})}function o(e,t){var n=Object.getOwnPropertyDescriptor(e,t)||{enumerable:!0,configurable:!0};delete n.writable,delete n.value;var r=t.substr(2),i="_"+t;n.set=function(e){this[i]&&this.removeEventListener(r,this[i]),"function"==typeof e?(this[i]=e,this.addEventListener(r,e,!1)):this[i]=null},n.get=function(){return this[i]},Object.defineProperty(e,t,n)}function s(e,t){(t||function(){var t=[];for(var n in e)t.push(n);return t}().filter(function(e){return"on"===e.substr(0,2)})).forEach(function(t){o(e,t)})}function a(t){var n=t.addEventListener;t.addEventListener=function(e,t){return t._bound=t._bound||{},arguments[1]=t._bound[e]=zone.bind(t),n.apply(this,arguments)};var r=t.removeEventListener;t.removeEventListener=function(t,n){if(arguments[1]._bound&&arguments[1]._bound[t]){var i=arguments[1]._bound;arguments[1]=i[t],delete i[t]}var o=r.apply(this,arguments);return e.zone.dequeueTask(n),o}}function c(t){var r=e[t];if(r){e[t]=function(){var e=n(arguments);switch(e.length){case 0:this._o=new r;break;case 1:this._o=new r(e[0]);break;case 2:this._o=new r(e[0],e[1]);break;case 3:this._o=new r(e[0],e[1],e[2]);break;case 4:this._o=new r(e[0],e[1],e[2],e[3]);break;default:throw new Error("what are you even doing?")}};var i,o=new r;for(i in o)!function(n){"function"==typeof o[n]?e[t].prototype[n]=function(){return this._o[n].apply(this._o,arguments)}:Object.defineProperty(e[t].prototype,n,{set:function(t){this._o[n]="function"==typeof t?e.zone.bind(t):t},get:function(){return this._o[n]}})}(i);for(i in r)"prototype"!==i&&r.hasOwnProperty(i)&&(e[t][i]=r[i])}}t.exports={bindArguments:n,bindArgumentsOnce:r,patchPrototype:i,patchProperty:o,patchProperties:s,patchEventTargetMethods:a,patchClass:c}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],15:[function(e,t,n){(function(n,r){(function(){"use strict";function i(e){return"function"==typeof e||"object"==typeof e&&null!==e}function o(e){return"function"==typeof e}function s(e){return"object"==typeof e&&null!==e}function a(e){U=e}function c(e){G=e}function u(){var e=n.nextTick,t=n.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);return Array.isArray(t)&&"0"===t[1]&&"10"===t[2]&&(e=setImmediate),function(){e(p)}}function l(){return function(){q(p)}}function f(){var e=0,t=new X(p),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}function h(){var e=new MessageChannel;return e.port1.onmessage=p,function(){e.port2.postMessage(0)}}function d(){return function(){setTimeout(p,1)}}function p(){for(var e=0;Q>e;e+=2){var t=te[e],n=te[e+1];t(n),te[e]=void 0,te[e+1]=void 0}Q=0}function g(){try{var t=e,n=t("vertx");return q=n.runOnLoop||n.runOnContext,l()}catch(r){return d()}}function m(){}function v(){return new TypeError("You cannot resolve a promise with itself")}function _(){return new TypeError("A promises callback cannot return that same promise.")}function y(e){try{return e.then}catch(t){return oe.error=t,oe}}function b(e,t,n,r){try{e.call(t,n,r)}catch(i){return i}}function w(e,t,n){G(function(e){var r=!1,i=b(n,t,function(n){r||(r=!0,t!==n?E(e,n):S(e,n))},function(t){r||(r=!0,O(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&i&&(r=!0,O(e,i))},e)}function C(e,t){t._state===re?S(e,t._result):t._state===ie?O(e,t._result):A(t,void 0,function(t){E(e,t)},function(t){O(e,t)})}function R(e,t){if(t.constructor===e.constructor)C(e,t);else{var n=y(t);n===oe?O(e,oe.error):void 0===n?S(e,t):o(n)?w(e,t,n):S(e,t)}}function E(e,t){e===t?O(e,v()):i(t)?R(e,t):S(e,t)}function x(e){e._onerror&&e._onerror(e._result),D(e)}function S(e,t){e._state===ne&&(e._result=t,e._state=re,0!==e._subscribers.length&&G(D,e))}function O(e,t){e._state===ne&&(e._state=ie,e._result=t,G(x,e))}function A(e,t,n,r){var i=e._subscribers,o=i.length;e._onerror=null,i[o]=t,i[o+re]=n,i[o+ie]=r,0===o&&e._state&&G(D,e)}function D(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r,i,o=e._result,s=0;ss;s++)A(r.resolve(e[s]),void 0,t,n);return i}function M(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(m);return E(n,e),n}function B(e){var t=this,n=new t(m);return O(n,e),n}function L(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function $(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function F(e){this._id=he++,this._state=void 0,this._result=void 0,this._subscribers=[],m!==e&&(o(e)||L(),this instanceof F||$(),T(this,e))}function H(){var e;if("undefined"!=typeof r)e=r;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=e.Promise;(!n||"[object Promise]"!==Object.prototype.toString.call(n.resolve())||n.cast)&&(e.Promise=de)}var W;W=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var q,U,K,z=W,Q=0,G=({}.toString,function(e,t){te[Q]=e,te[Q+1]=t,Q+=2,2===Q&&(U?U(p):K())}),Y="undefined"!=typeof window?window:void 0,J=Y||{},X=J.MutationObserver||J.WebKitMutationObserver,Z="undefined"!=typeof n&&"[object process]"==={}.toString.call(n),ee="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,te=new Array(1e3);K=Z?u():X?f():ee?h():void 0===Y&&"function"==typeof e?g():d();var ne=void 0,re=1,ie=2,oe=new I,se=new I;N.prototype._validateInput=function(e){return z(e)},N.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},N.prototype._init=function(){this._result=new Array(this.length)};var ae=N;N.prototype._enumerate=function(){for(var e=this,t=e.length,n=e.promise,r=e._input,i=0;n._state===ne&&t>i;i++)e._eachEntry(r[i],i)},N.prototype._eachEntry=function(e,t){var n=this,r=n._instanceConstructor;s(e)?e.constructor===r&&e._state!==ne?(e._onerror=null,n._settledAt(e._state,t,e._result)):n._willSettleAt(r.resolve(e),t):(n._remaining--,n._result[t]=e)},N.prototype._settledAt=function(e,t,n){var r=this,i=r.promise;i._state===ne&&(r._remaining--,e===ie?O(i,n):r._result[t]=n),0===r._remaining&&S(i,r._result)},N.prototype._willSettleAt=function(e,t){var n=this;A(e,void 0,function(e){n._settledAt(re,t,e)},function(e){n._settledAt(ie,t,e)})};var ce=V,ue=k,le=M,fe=B,he=0,de=F;F.all=ce,F.race=ue,F.resolve=le,F.reject=fe,F._setScheduler=a,F._setAsap=c,F._asap=G,F.prototype={constructor:F,then:function(e,t){var n=this,r=n._state;if(r===re&&!e||r===ie&&!t)return this;var i=new this.constructor(m),o=n._result;if(r){var s=arguments[r-1];G(function(){P(r,i,s,o)})}else A(n,i,e,t);return i},"catch":function(e){return this.then(null,e)}};var pe=H,ge={Promise:de,polyfill:pe};"function"==typeof define&&define.amd?define(function(){return ge}):"undefined"!=typeof t&&t.exports?t.exports=ge:"undefined"!=typeof this&&(this.ES6Promise=ge),pe()}).call(this)}).call(this,{},"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1]);var Reflect;!function(e){function t(e,t,n,r){if(C(r)){if(C(n)){if(!R(e))throw new TypeError;if(!x(t))throw new TypeError;return f(e,t)}if(!R(e))throw new TypeError;if(!E(t))throw new TypeError;return n=O(n),d(e,t,n)}if(!R(e))throw new TypeError;if(!E(t))throw new TypeError;if(C(n))throw new TypeError;if(!E(r))throw new TypeError;return n=O(n),h(e,t,n,r)}function n(e,t){function n(n,r){if(C(r)){if(!x(n))throw new TypeError;y(e,t,n,void 0)}else{if(!E(n))throw new TypeError;r=O(r),y(e,t,n,r)}}return n}function r(e,t,n,r){if(!E(n))throw new TypeError;return C(r)||(r=O(r)),y(e,t,n,r)}function i(e,t,n){if(!E(t))throw new TypeError;return C(n)||(n=O(n)),g(e,t,n)}function o(e,t,n){if(!E(t))throw new TypeError;return C(n)||(n=O(n)),m(e,t,n)}function s(e,t,n){if(!E(t))throw new TypeError;return C(n)||(n=O(n)),v(e,t,n)}function a(e,t,n){if(!E(t))throw new TypeError;return C(n)||(n=O(n)),_(e,t,n)}function c(e,t){if(!E(e))throw new TypeError;return C(t)||(t=O(t)),b(e,t)}function u(e,t){if(!E(e))throw new TypeError;return C(t)||(t=O(t)),w(e,t)}function l(e,t,n){if(!E(t))throw new TypeError;C(n)||(n=O(n));var r=p(t,n,!1);if(C(r))return!1;if(!r["delete"](e))return!1;if(r.size>0)return!0;var i=k.get(t);return i["delete"](n),i.size>0?!0:(k["delete"](t),!0)}function f(e,t){for(var n=e.length-1;n>=0;--n){var r=e[n],i=r(t);if(!C(i)){if(!x(i))throw new TypeError;t=i}}return t}function h(e,t,n,r){for(var i=e.length-1;i>=0;--i){var o=e[i],s=o(t,n,r);if(!C(s)){if(!E(s))throw new TypeError;r=s}}return r}function d(e,t,n){for(var r=e.length-1;r>=0;--r){var i=e[r];i(t,n)}}function p(e,t,n){var r=k.get(e);if(!r){if(!n)return void 0;r=new T,k.set(e,r)}var i=r.get(t);if(!i){if(!n)return void 0;i=new T,r.set(t,i)}return i}function g(e,t,n){var r=m(e,t,n);if(r)return!0;var i=A(t);return null!==i?g(e,i,n):!1}function m(e,t,n){var r=p(t,n,!1);return void 0===r?!1:Boolean(r.has(e))}function v(e,t,n){var r=m(e,t,n);if(r)return _(e,t,n);var i=A(t);return null!==i?v(e,i,n):void 0}function _(e,t,n){var r=p(t,n,!1);return void 0===r?void 0:r.get(e)}function y(e,t,n,r){var i=p(n,r,!0);i.set(e,t)}function b(e,t){var n=w(e,t),r=A(e);if(null===r)return n;var i=b(r,t);if(i.length<=0)return n;if(n.length<=0)return i;for(var o=new N,s=[],a=0;a=0?(this._cache=e,!0):!1},get:function(e){var t=this._find(e);return t>=0?(this._cache=e,this._values[t]):void 0},set:function(e,t){return this["delete"](e),this._keys.push(e),this._values.push(t),this._cache=e,this},"delete":function(e){var n=this._find(e);return n>=0?(this._keys.splice(n,1),this._values.splice(n,1),this._cache=t,!0):!1},clear:function(){this._keys.length=0,this._values.length=0,this._cache=t},forEach:function(e,t){for(var n=this.size,r=0;n>r;++r){var i=this._keys[r],o=this._values[r];this._cache=i,e.call(this,o,i,this)}},_find:function(e){for(var t=this._keys,n=t.length,r=0;n>r;++r)if(t[r]===e)return r;return-1}},e}function I(){function e(){this._map=new T}return e.prototype={get size(){return this._map.length},has:function(e){return this._map.has(e)},add:function(e){return this._map.set(e,e),this},"delete":function(e){return this._map["delete"](e)},clear:function(){this._map.clear()},forEach:function(e,t){this._map.forEach(e,t)}},e}function j(){function e(){this._key=i()}function t(e,t){for(var n=0;t>n;++n)e[n]=255*Math.random()|0}function n(e){if(c){var n=c.randomBytes(e);return n}if("function"==typeof Uint8Array){var n=new Uint8Array(e);return"undefined"!=typeof crypto?crypto.getRandomValues(n):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(n):t(n,e),n}var n=new Array(e);return t(n,e),n}function r(){var e=n(s);e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var t="",r=0;s>r;++r){var i=e[r];(4===r||6===r||8===r)&&(t+="-"),16>i&&(t+="0"),t+=i.toString(16).toLowerCase()}return t}function i(){var e;do e="@@WeakMap@@"+r();while(u.call(l,e));return l[e]=!0,e}function o(e,t){if(!u.call(e,f)){if(!t)return void 0;Object.defineProperty(e,f,{value:Object.create(null)})}return e[f]}var s=16,a="undefined"!=typeof global&&"object"==typeof module&&"object"==typeof module.exports&&"function"==typeof require,c=a&&require("crypto"),u=Object.prototype.hasOwnProperty,l={},f=i();return e.prototype={has:function(e){var t=o(e,!1);return t?this._key in t:!1},get:function(e){var t=o(e,!1);return t?t[this._key]:void 0},set:function(e,t){var n=o(e,!0);return n[this._key]=t,this},"delete":function(e){var t=o(e,!1);return t&&this._key in t?delete t[this._key]:!1},clear:function(){this._key=i()}},e}var P=Object.getPrototypeOf(Function),T="function"==typeof Map?Map:D(),N="function"==typeof Set?Set:I(),V="function"==typeof WeakMap?WeakMap:j(),k=new V;e.decorate=t,e.metadata=n,e.defineMetadata=r,e.hasMetadata=i,e.hasOwnMetadata=o,e.getMetadata=s,e.getOwnMetadata=a,e.getMetadataKeys=c,e.getOwnMetadataKeys=u,e.deleteMetadata=l,function(t){if("undefined"!=typeof t.Reflect){if(t.Reflect!==e)for(var n in e)t.Reflect[n]=e[n]}else t.Reflect=e}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:"undefined"!=typeof global?global:Function("return this;")())}(Reflect||(Reflect={})),System.register("rx",[],!0,function(e,t,n){var r=System.global,i=r.define;return r.define=void 0,function(e){function i(e){for(var t=[],n=0,r=e.length;r>n;n++)t.push(e[n]);return t}function o(e,t){if(ae&&t.stack&&"object"==typeof e&&null!==e&&e.stack&&-1===e.stack.indexOf(fe)){for(var n=[],r=t;r;r=r.source)r.stack&&n.unshift(r.stack);n.unshift(e.stack);var i=n.join("\n"+fe+"\n");e.stack=a(i)}}function a(e){for(var t=e.split("\n"),n=[],r=0,i=t.length;i>r;r++){var o=t[r];c(o)||u(o)||!o||n.push(o)}return n.join("\n")}function c(e){var t=f(e);if(!t)return!1;var n=t[0],r=t[1];return n===ue&&r>=le&&wn>=r}function u(e){return-1!==e.indexOf("(module.js:")||-1!==e.indexOf("(node.js:")}function l(){if(ae)try{throw new Error}catch(e){var t=e.stack.split("\n"),n=t[0].indexOf("@")>0?t[1]:t[2],r=f(n);if(!r)return;return ue=r[0],r[1]}}function f(e){var t=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(e);if(t)return[t[1],Number(t[2])];var n=/at ([^ ]+):(\d+):(?:\d+)$/.exec(e);if(n)return[n[1],Number(n[2])];var r=/.*@(.+):(\d+)$/.exec(e);return r?[r[1],Number(r[2])]:void 0}function h(e){var t=[];if(!Ke(e))return t;Ue.nonEnumArgs&&e.length&&ze(e)&&(e=Ye.call(e));var n=Ue.enumPrototypes&&"function"==typeof e,r=Ue.enumErrorProps&&(e===$e||e instanceof Error);for(var i in e)n&&"prototype"==i||r&&("message"==i||"name"==i)||t.push(i);if(Ue.nonEnumShadows&&e!==Fe){var o=e.constructor,s=-1,a=Se;if(e===(o&&o.prototype))var c=e===He?ke:e===$e?je:Me.call(e),u=qe[c];for(;++s-1:void 0});return n.pop(),r.pop(),d}function v(e,t){for(var n=new Array(e),r=0;e>r;r++)n[r]=t();return n}function _(){try{return Qe.apply(this,arguments)}catch(e){return et.e=e,et}}function y(e){if(!se(e))throw new TypeError("fn must be a function");return Qe=e,_}function b(e){throw e}function w(e,t){this.id=e,this.value=t}function C(e,t){this.scheduler=e,this.disposable=t,this.isDisposed=!1}function R(e,t){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())}function E(e){this.observer=e,this.a=[],this.isStopped=!1}function x(e){this._s=s}function S(e){this._s=s,this._l=s.length,this._i=0}function O(e){this._a=e}function A(e){this._a=e,this._l=P(e),this._i=0}function D(e){return"number"==typeof e&&K.isFinite(e)}function I(t){var n,r=t[ye];if(!r&&"string"==typeof t)return n=new x(t),n[ye]();if(!r&&t.length!==e)return n=new O(t),n[ye]();if(!r)throw new TypeError("Object is not iterable");return t[ye]()}function j(e){var t=+e;return 0===t?t:isNaN(t)?t:0>t?-1:1}function P(e){var t=+e.length;return isNaN(t)?0:0!==t&&D(t)?(t=j(t)*Math.floor(Math.abs(t)),0>=t?0:t>Qt?Qt:t):t}function T(e,t){this.observer=e,this.parent=t}function N(e,t){return Z(e)||(e=yt),new Yt(t,e)}function V(e,t){return new mn(function(n){var r=new lt,i=new ft;return i.setDisposable(r),r.setDisposable(e.subscribe(function(e){n.onNext(e)},function(e){try{var r=t(e)}catch(o){return n.onError(o)}oe(r)&&(r=Ht(r));var s=new lt;i.setDisposable(s),s.setDisposable(r.subscribe(n))},function(e){n.onCompleted(e)})),i},e)}function k(e,t){var n=this;return new mn(function(r){var i=0,o=e.length;return n.subscribe(function(n){if(o>i){var s,a=e[i++];try{s=t(n,a)}catch(c){return r.onError(c)}r.onNext(s)}else r.onCompleted()},function(e){r.onError(e)},function(){r.onCompleted()})},n)}function M(){return!1}function B(){return[]}function L(e,t,n){var r=Ee(t,n,3);return e.map(function(t,n){var i=r(t,n,e);return oe(i)&&(i=Ht(i)),(Ce(i)||we(i))&&(i=Gt(i)),i}).concatAll()}function $(e,t,n){for(var r=0,i=e.length;i>r;r++)if(n(e[r],t))return r;return-1}function F(e){this.comparer=e,this.set=[]}function H(e,t,n){this.observer=e,this.selector=t,this.source=n,this.i=0,this.isStopped=!1}function W(e,t,n){var r=Ee(t,n,3);return e.map(function(t,n){var i=r(t,n,e);return oe(i)&&(i=Ht(i)),(Ce(i)||we(i))&&(i=Gt(i)),i}).mergeAll()}function q(e,t,n){this.observer=e,this.predicate=t,this.source=n,this.i=0,this.isStopped=!1; + +}var U={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},K=U[typeof window]&&window||this,z=U[typeof t]&&t&&!t.nodeType&&t,Q=U[typeof n]&&n&&!n.nodeType&&n,G=Q&&Q.exports===z&&z,Y=U[typeof r]&&r;!Y||Y.global!==Y&&Y.window!==Y||(K=Y);var J={internals:{},config:{Promise:K.Promise},helpers:{}},X=J.helpers.noop=function(){},Z=(J.helpers.notDefined=function(e){return"undefined"==typeof e},J.helpers.isScheduler=function(e){return e instanceof J.Scheduler}),ee=J.helpers.identity=function(e){return e},te=(J.helpers.pluck=function(e){return function(t){return t[e]}},J.helpers.just=function(e){return function(){return e}},J.helpers.defaultNow=Date.now),ne=J.helpers.defaultComparer=function(e,t){return Ge(e,t)},re=J.helpers.defaultSubComparer=function(e,t){return e>t?1:t>e?-1:0},ie=(J.helpers.defaultKeySerializer=function(e){return e.toString()},J.helpers.defaultError=function(e){throw e}),oe=J.helpers.isPromise=function(e){return!!e&&"function"==typeof e.then},se=(J.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},J.helpers.not=function(e){return!e},J.helpers.isFunction=function(){var e=function(e){return"function"==typeof e||!1};return e(/x/)&&(e=function(e){return"function"==typeof e&&"[object Function]"==Me.call(e)}),e}());J.config.longStackSupport=!1;var ae=!1;try{throw new Error}catch(ce){ae=!!ce.stack}var ue,le=l(),fe="From previous event:",he=J.EmptyError=function(){this.message="Sequence contains no elements.",Error.call(this)};he.prototype=Error.prototype;var de=J.ObjectDisposedError=function(){this.message="Object has been disposed",Error.call(this)};de.prototype=Error.prototype;var pe=J.ArgumentOutOfRangeError=function(){this.message="Argument out of range",Error.call(this)};pe.prototype=Error.prototype;var ge=J.NotSupportedError=function(e){this.message=e||"This operation is not supported",Error.call(this)};ge.prototype=Error.prototype;var me=J.NotImplementedError=function(e){this.message=e||"This operation is not implemented",Error.call(this)};me.prototype=Error.prototype;var ve=J.helpers.notImplemented=function(){throw new me},_e=J.helpers.notSupported=function(){throw new ge},ye="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";K.Set&&"function"==typeof(new K.Set)["@@iterator"]&&(ye="@@iterator");var be=J.doneEnumerator={done:!0,value:e},we=J.helpers.isIterable=function(t){return t[ye]!==e},Ce=J.helpers.isArrayLike=function(t){return t&&t.length!==e};J.helpers.iterator=ye;var Re,Ee=J.internals.bindCallback=function(e,t,n){if("undefined"==typeof t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}},xe=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Se=xe.length,Oe="[object Arguments]",Ae="[object Array]",De="[object Boolean]",Ie="[object Date]",je="[object Error]",Pe="[object Function]",Te="[object Number]",Ne="[object Object]",Ve="[object RegExp]",ke="[object String]",Me=Object.prototype.toString,Be=Object.prototype.hasOwnProperty,Le=Me.call(arguments)==Oe,$e=Error.prototype,Fe=Object.prototype,He=String.prototype,We=Fe.propertyIsEnumerable;try{Re=!(Me.call(document)==Ne&&!({toString:0}+""))}catch(ce){Re=!0}var qe={};qe[Ae]=qe[Ie]=qe[Te]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},qe[De]=qe[ke]={constructor:!0,toString:!0,valueOf:!0},qe[je]=qe[Pe]=qe[Ve]={constructor:!0,toString:!0},qe[Ne]={constructor:!0};var Ue={};!function(){var e=function(){this.x=1},t=[];e.prototype={valueOf:1,y:1};for(var n in new e)t.push(n);for(n in arguments);Ue.enumErrorProps=We.call($e,"message")||We.call($e,"name"),Ue.enumPrototypes=We.call(e,"prototype"),Ue.nonEnumArgs=0!=n,Ue.nonEnumShadows=!/valueOf/.test(t)}(1);var Ke=J.internals.isObject=function(e){var t=typeof e;return e&&("function"==t||"object"==t)||!1},ze=function(e){return e&&"object"==typeof e?Me.call(e)==Oe:!1};Le||(ze=function(e){return e&&"object"==typeof e?Be.call(e,"callee"):!1});var Qe,Ge=J.internals.isEqual=function(e,t){return m(e,t,[],[])},Ye=({}.hasOwnProperty,Array.prototype.slice),Je=this.inherits=J.internals.inherits=function(e,t){function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n},Xe=J.internals.addProperties=function(e){for(var t=[],n=1,r=arguments.length;r>n;n++)t.push(arguments[n]);for(var i=0,o=t.length;o>i;i++){var s=t[i];for(var a in s)e[a]=s[a]}},Ze=J.internals.addRef=function(e,t){return new mn(function(n){return new rt(t.getDisposable(),e.subscribe(n))})},et={e:{}};w.prototype.compareTo=function(e){var t=this.value.compareTo(e.value);return 0===t&&(t=this.id-e.id),t};var tt=J.internals.PriorityQueue=function(e){this.items=new Array(e),this.length=0},nt=tt.prototype;nt.isHigherPriority=function(e,t){return this.items[e].compareTo(this.items[t])<0},nt.percolate=function(e){if(!(e>=this.length||0>e)){var t=e-1>>1;if(!(0>t||t===e)&&this.isHigherPriority(e,t)){var n=this.items[e];this.items[e]=this.items[t],this.items[t]=n,this.percolate(t)}}},nt.heapify=function(e){if(+e||(e=0),!(e>=this.length||0>e)){var t=2*e+1,n=2*e+2,r=e;if(te;e++)n[e]=arguments[e];for(e=0;t>e;e++)if(!ct(n[e]))throw new TypeError("Not a disposable");this.disposables=n,this.isDisposed=!1,this.length=n.length},it=rt.prototype;it.add=function(e){this.isDisposed?e.dispose():(this.disposables.push(e),this.length++)},it.remove=function(e){var t=!1;if(!this.isDisposed){var n=this.disposables.indexOf(e);-1!==n&&(t=!0,this.disposables.splice(n,1),this.length--,e.dispose())}return t},it.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var e=this.disposables.length,t=new Array(e),n=0;e>n;n++)t[n]=this.disposables[n];for(this.disposables=[],this.length=0,n=0;e>n;n++)t[n].dispose()}};var ot=J.Disposable=function(e){this.isDisposed=!1,this.action=e||X};ot.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var st=ot.create=function(e){return new ot(e)},at=ot.empty={dispose:X},ct=ot.isDisposable=function(e){return e&&se(e.dispose)},ut=ot.checkDisposed=function(e){if(e.isDisposed)throw new de},lt=J.SingleAssignmentDisposable=function(){function e(){this.isDisposed=!1,this.current=null}var t=e.prototype;return t.getDisposable=function(){return this.current},t.setDisposable=function(e){var t=this.isDisposed;if(!t){var n=this.current;this.current=e}n&&n.dispose(),t&&e&&e.dispose()},t.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.current;this.current=null}e&&e.dispose()},e}(),ft=J.SerialDisposable=lt,ht=J.RefCountDisposable=function(){function e(e){this.disposable=e,this.disposable.count++,this.isInnerDisposed=!1}function t(e){this.underlyingDisposable=e,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return e.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},t.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},t.prototype.getDisposable=function(){return this.isDisposed?at:new e(this)},t}();C.prototype.dispose=function(){this.scheduler.scheduleWithState(this,R)};var dt=J.internals.ScheduledItem=function(e,t,n,r,i){this.scheduler=e,this.state=t,this.action=n,this.dueTime=r,this.comparer=i||re,this.disposable=new lt};dt.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},dt.prototype.compareTo=function(e){return this.comparer(this.dueTime,e.dueTime)},dt.prototype.isCancelled=function(){return this.disposable.isDisposed},dt.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var pt=J.Scheduler=function(){function e(e,t,n,r){this.now=e,this._schedule=t,this._scheduleRelative=n,this._scheduleAbsolute=r}function t(e,t){return t(),at}var n=e.prototype;return n.schedule=function(e){return this._schedule(e,t)},n.scheduleWithState=function(e,t){return this._schedule(e,t)},n.scheduleWithRelative=function(e,n){return this._scheduleRelative(n,e,t)},n.scheduleWithRelativeAndState=function(e,t,n){return this._scheduleRelative(e,t,n)},n.scheduleWithAbsolute=function(e,n){return this._scheduleAbsolute(n,e,t)},n.scheduleWithAbsoluteAndState=function(e,t,n){return this._scheduleAbsolute(e,t,n)},e.now=te,e.normalize=function(e){return 0>e&&(e=0),e},e}(),gt=pt.normalize;!function(e){function t(e,t){function n(t){i(t,function(t){var r=!1,i=!1,s=e.scheduleWithState(t,function(e,t){return r?o.remove(s):i=!0,n(t),at});i||(o.add(s),r=!0)})}var r=t[0],i=t[1],o=new rt;return n(r),o}function n(e,t,n){function r(t){o(t,function(t,i){var o=!1,a=!1,c=e[n](t,i,function(e,t){return o?s.remove(c):a=!0,r(t),at});a||(s.add(c),o=!0)})}var i=t[0],o=t[1],s=new rt;return r(i),s}function r(e,t){e(function(n){t(e,n)})}e.scheduleRecursive=function(e){return this.scheduleRecursiveWithState(e,function(e,t){e(function(){t(e)})})},e.scheduleRecursiveWithState=function(e,n){return this.scheduleWithState([e,n],t)},e.scheduleRecursiveWithRelative=function(e,t){return this.scheduleRecursiveWithRelativeAndState(t,e,r)},e.scheduleRecursiveWithRelativeAndState=function(e,t,r){return this._scheduleRelative([e,r],t,function(e,t){return n(e,t,"scheduleWithRelativeAndState")})},e.scheduleRecursiveWithAbsolute=function(e,t){return this.scheduleRecursiveWithAbsoluteAndState(t,e,r)},e.scheduleRecursiveWithAbsoluteAndState=function(e,t,r){return this._scheduleAbsolute([e,r],t,function(e,t){return n(e,t,"scheduleWithAbsoluteAndState")})}}(pt.prototype),function(e){pt.prototype.schedulePeriodic=function(e,t){return this.schedulePeriodicWithState(null,e,t)},pt.prototype.schedulePeriodicWithState=function(e,t,n){if("undefined"==typeof K.setInterval)throw new ge;t=gt(t);var r=e,i=K.setInterval(function(){r=n(r)},t);return st(function(){K.clearInterval(i)})}}(pt.prototype),function(e){e.catchError=e["catch"]=function(e){return new Rt(this,e)}}(pt.prototype);var mt,vt,_t=(J.internals.SchedulePeriodicRecursive=function(){function e(e,t){t(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function t(e,t,n,r){this._scheduler=e,this._state=t,this._period=n,this._action=r}return t.prototype.start=function(){var t=new lt;return this._cancel=t,t.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,e.bind(this))),t},t}(),pt.immediate=function(){function e(e,t){return t(this,e)}return new pt(te,e,_e,_e)}()),yt=pt.currentThread=function(){function e(){for(;n.length>0;){var e=n.dequeue();!e.isCancelled()&&e.invoke()}}function t(t,r){var i=new dt(this,t,r,this.now());if(n)n.enqueue(i);else{n=new tt(4),n.enqueue(i);var o=y(e)();if(n=null,o===et)return b(o.e)}return i.disposable}var n,r=new pt(te,t,_e,_e);return r.scheduleRequired=function(){return!n},r}(),bt=function(){var e,t=X;if(K.WScript)e=function(e,t){K.WScript.Sleep(t),e()};else{if(!K.setTimeout)throw new ge;e=K.setTimeout,t=K.clearTimeout}return{setTimeout:e,clearTimeout:t}}(),wt=bt.setTimeout,Ct=bt.clearTimeout;!function(){function e(t){if(o)wt(function(){e(t)},0);else{var n=i[t];if(n){o=!0;var r=y(n)();if(vt(t),o=!1,r===et)return b(r.e)}}}function t(){if(!K.postMessage||K.importScripts)return!1;var e=!1,t=K.onmessage;return K.onmessage=function(){e=!0},K.postMessage("","*"),K.onmessage=t,e}function n(t){"string"==typeof t.data&&t.data.substring(0,c.length)===c&&e(t.data.substring(c.length))}var r=1,i={},o=!1;vt=function(e){delete i[e]};var s=RegExp("^"+String(Me).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),a="function"==typeof(a=Y&&G&&Y.setImmediate)&&!s.test(a)&&a;if(se(a))mt=function(t){var n=r++;return i[n]=t,a(function(){e(n)}),n};else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))mt=function(t){var n=r++;return i[n]=t,process.nextTick(function(){e(n)}),n};else if(t()){var c="ms.rx.schedule"+Math.random();K.addEventListener?K.addEventListener("message",n,!1):K.attachEvent("onmessage",n,!1),mt=function(e){var t=r++;return i[t]=e,K.postMessage(c+currentId,"*"),t}}else if(K.MessageChannel){var u=new K.MessageChannel;u.port1.onmessage=function(t){e(t.data)},mt=function(e){var t=r++;return i[t]=e,u.port2.postMessage(t),t}}else mt="document"in K&&"onreadystatechange"in K.document.createElement("script")?function(t){var n=K.document.createElement("script"),o=r++;return i[o]=t,n.onreadystatechange=function(){e(o),n.onreadystatechange=null,n.parentNode.removeChild(n),n=null},K.document.documentElement.appendChild(n),o}:function(t){var n=r++;return i[n]=t,wt(function(){e(n)},0),n}}();var Rt=(pt.timeout=pt["default"]=function(){function e(e,t){var n=this,r=new lt,i=mt(function(){r.isDisposed||r.setDisposable(t(n,e))});return new rt(r,st(function(){vt(i)}))}function t(e,t,n){var r=this,i=pt.normalize(t);if(0===i)return r.scheduleWithState(e,n);var o=new lt,s=wt(function(){o.isDisposed||o.setDisposable(n(r,e))},i);return new rt(o,st(function(){Ct(s)}))}function n(e,t,n){return this.scheduleWithRelativeAndState(e,t-this.now(),n)}return new pt(te,e,t,n)}(),function(e){function t(e,t){return this._scheduler.scheduleWithState(e,this._wrap(t))}function n(e,t,n){return this._scheduler.scheduleWithRelativeAndState(e,t,this._wrap(n))}function r(e,t,n){return this._scheduler.scheduleWithAbsoluteAndState(e,t,this._wrap(n))}function i(i,o){this._scheduler=i,this._handler=o,this._recursiveOriginal=null,this._recursiveWrapper=null,e.call(this,this._scheduler.now.bind(this._scheduler),t,n,r)}return Je(i,e),i.prototype._clone=function(e){return new i(e,this._handler)},i.prototype._wrap=function(e){var t=this;return function(n,r){try{return e(t._getRecursiveWrapper(n),r)}catch(i){if(!t._handler(i))throw i;return at}}},i.prototype._getRecursiveWrapper=function(e){if(this._recursiveOriginal!==e){this._recursiveOriginal=e;var t=this._clone(e);t._recursiveOriginal=e,t._recursiveWrapper=t,this._recursiveWrapper=t}return this._recursiveWrapper},i.prototype.schedulePeriodicWithState=function(e,t,n){var r=this,i=!1,o=new lt;return o.setDisposable(this._scheduler.schedulePeriodicWithState(e,t,function(e){if(i)return null;try{return n(e)}catch(t){if(i=!0,!r._handler(t))throw t;return o.dispose(),null}})),o},i}(pt)),Et=J.Notification=function(){function e(e,t,n,r,i,o){this.kind=e,this.value=t,this.exception=n,this._accept=r,this._acceptObservable=i,this.toString=o}return e.prototype.accept=function(e,t,n){return e&&"object"==typeof e?this._acceptObservable(e):this._accept(e,t,n)},e.prototype.toObservable=function(e){var t=this;return Z(e)||(e=_t),new mn(function(n){return e.scheduleWithState(t,function(e,t){t._acceptObservable(n),"N"===t.kind&&n.onCompleted()})})},e}(),xt=Et.createOnNext=function(){function e(e){return e(this.value)}function t(e){return e.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){return new Et("N",r,null,e,t,n)}}(),St=Et.createOnError=function(){function e(e,t){return t(this.exception)}function t(e){return e.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){return new Et("E",null,r,e,t,n)}}(),Ot=Et.createOnCompleted=function(){function e(e,t,n){return n()}function t(e){return e.onCompleted()}function n(){return"OnCompleted()"}return function(){return new Et("C",null,null,e,t,n)}}(),At=J.internals.Enumerator=function(e){this._next=e};At.prototype.next=function(){return this._next()},At.prototype[ye]=function(){return this};var Dt=J.internals.Enumerable=function(e){this._iterator=e};Dt.prototype[ye]=function(){return this._iterator()},Dt.prototype.concat=function(){var e=this;return new mn(function(t){var n,r=e[ye](),i=new ft,o=_t.scheduleRecursive(function(e){if(!n){try{var o=r.next()}catch(s){return t.onError(s)}if(o.done)return t.onCompleted();var a=o.value;oe(a)&&(a=Ht(a));var c=new lt;i.setDisposable(c),c.setDisposable(a.subscribe(function(e){t.onNext(e)},function(e){t.onError(e)},e))}});return new rt(i,o,st(function(){n=!0}))})},Dt.prototype.catchError=function(){var e=this;return new mn(function(t){var n,r=e[ye](),i=new ft,o=_t.scheduleRecursiveWithState(null,function(e,o){if(!n){try{var s=r.next()}catch(a){return observer.onError(a)}if(s.done)return void(null!==e?t.onError(e):t.onCompleted());var c=s.value;oe(c)&&(c=Ht(c));var u=new lt;i.setDisposable(u),u.setDisposable(c.subscribe(function(e){t.onNext(e)},o,function(){t.onCompleted()}))}});return new rt(i,o,st(function(){n=!0}))})},Dt.prototype.catchErrorWhen=function(e){var t=this;return new mn(function(n){var r,i,o=new yn,s=new yn,a=e(o),c=a.subscribe(s),u=t[ye](),l=new ft,f=_t.scheduleRecursive(function(e){if(!r){try{var t=u.next()}catch(a){return n.onError(a)}if(t.done)return void(i?n.onError(i):n.onCompleted());var c=t.value;oe(c)&&(c=Ht(c));var f=new lt,h=new lt;l.setDisposable(new rt(h,f)),f.setDisposable(c.subscribe(function(e){n.onNext(e)},function(t){h.setDisposable(s.subscribe(e,function(e){n.onError(e)},function(){n.onCompleted()})),o.onNext(t)},function(){n.onCompleted()}))}});return new rt(c,l,f,st(function(){r=!0}))})};var It=Dt.repeat=function(e,t){return null==t&&(t=-1),new Dt(function(){var n=t;return new At(function(){return 0===n?be:(n>0&&n--,{done:!1,value:e})})})},jt=Dt.of=function(e,t,n){if(t)var r=Ee(t,n,3);return new Dt(function(){var n=-1;return new At(function(){return++n0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(e){var n;if(!(t.queue.length>0))return void(t.isAcquired=!1);n=t.queue.shift();try{n()}catch(r){throw t.queue=[],t.hasFaulted=!0,r}e()}))},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposable.dispose()},t}(Vt),Lt=function(e){function t(t,n,r){e.call(this,t,n),this._cancel=r}return Je(t,e),t.prototype.next=function(t){e.prototype.next.call(this,t),this.ensureActive()},t.prototype.error=function(t){e.prototype.error.call(this,t),this.ensureActive()},t.prototype.completed=function(){e.prototype.completed.call(this),this.ensureActive()},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},t}(Bt),$t=J.Observable=function(){function e(e){if(J.config.longStackSupport&&ae){try{throw new Error}catch(t){this.stack=t.stack.substring(t.stack.indexOf("\n")+1)}var n=this;this._subscribe=function(t){var r=t.onError.bind(t);return t.onError=function(e){o(e,n),r(e)},e.call(n,t)}}else this._subscribe=e}return Nt=e.prototype,Nt.subscribe=Nt.forEach=function(e,t,n){return this._subscribe("object"==typeof e?e:Tt(e,t,n))},Nt.subscribeOnNext=function(e,t){return this._subscribe(Tt("undefined"!=typeof t?function(n){e.call(t,n)}:e))},Nt.subscribeOnError=function(e,t){return this._subscribe(Tt(null,"undefined"!=typeof t?function(n){e.call(t,n)}:e))},Nt.subscribeOnCompleted=function(e,t){return this._subscribe(Tt(null,null,"undefined"!=typeof t?function(){e.call(t)}:e))},e}(),Ft=J.ObservableBase=function(e){function t(e){return e&&se(e.dispose)?e:se(e)?st(e):at}function n(e,n){var r=n[0],i=n[1],o=y(i.subscribeCore).call(i,r);return o!==et||r.fail(et.e)?void r.setDisposable(t(o)):b(et.e)}function r(e){var t=new vn(e),r=[t,this];return yt.scheduleRequired()?yt.scheduleWithState(r,n):n(null,r),t}function i(){e.call(this,r)}return Je(i,e),i.prototype.subscribeCore=ve,i}($t);Nt.observeOn=function(e){var t=this;return new mn(function(n){return t.subscribe(new Lt(e,n))},t)},Nt.subscribeOn=function(e){var t=this;return new mn(function(n){var r=new lt,i=new ft;return i.setDisposable(r),r.setDisposable(e.schedule(function(){i.setDisposable(new C(e,t.subscribe(n)))})),i},t)};var Ht=$t.fromPromise=function(e){return qt(function(){var t=new J.AsyncSubject;return e.then(function(e){t.onNext(e),t.onCompleted()},t.onError.bind(t)),t})};Nt.toPromise=function(e){if(e||(e=J.config.Promise),!e)throw new ge("Promise type not provided nor in Rx.config.Promise");var t=this;return new e(function(e,n){var r,i=!1;t.subscribe(function(e){r=e,i=!0},n,function(){i&&e(r)})})};var Wt=function(e){function t(t){this.source=t,e.call(this)}return Je(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new E(e))},t}(Ft);E.prototype.onNext=function(e){this.isStopped||this.a.push(e)},E.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.observer.onError(e))},E.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.observer.onNext(this.a),this.observer.onCompleted())},E.prototype.dispose=function(){this.isStopped=!0},E.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(e),!0)},Nt.toArray=function(){return new Wt(this)},$t.create=$t.createWithDisposable=function(e,t){return new mn(e,t)};var qt=$t.defer=function(e){return new mn(function(t){var n;try{n=e()}catch(r){return nn(r).subscribe(t)}return oe(n)&&(n=Ht(n)),n.subscribe(t)})},Ut=$t.empty=function(e){return Z(e)||(e=_t),new mn(function(t){return e.scheduleWithState(null,function(){t.onCompleted()})})},Kt=function(e){function t(t,n,r){this.iterable=t,this.mapper=n,this.scheduler=r,e.call(this)}return Je(t,e),t.prototype.subscribeCore=function(e){var t=new zt(e,this);return t.run()},t}(Ft),zt=function(){function e(e,t){this.observer=e,this.parent=t}return e.prototype.run=function(){function e(e,t){try{var o=n.next()}catch(s){return r.onError(s)}if(o.done)return r.onCompleted();var a=o.value;if(i)try{a=i(a,e)}catch(s){return r.onError(s)}r.onNext(a),t(e+1)}var t=Object(this.parent.iterable),n=I(t),r=this.observer,i=this.parent.mapper;return this.parent.scheduler.scheduleRecursiveWithState(0,e)},e}(),Qt=Math.pow(2,53)-1;x.prototype[ye]=function(){return new S(this._s)},S.prototype[ye]=function(){return this},S.prototype.next=function(){return this._ie?(t.onNext(n[e]),i(e+1)):t.onCompleted()}var t=this.observer,n=this.parent.args,r=n.length;return this.parent.scheduler.scheduleRecursiveWithState(0,e)};var Jt=$t.fromArray=function(e,t){return Z(t)||(t=yt),new Yt(e,t)};$t.generate=function(e,t,n,r,i){return Z(i)||(i=yt),new mn(function(o){var s=!0;return i.scheduleRecursiveWithState(e,function(e,i){var a,c;try{s?s=!1:e=n(e),a=t(e),a&&(c=r(e))}catch(u){return o.onError(u)}a?(o.onNext(c),i(e)):o.onCompleted()})})};var Xt=$t.never=function(){return new mn(function(){return at})};$t.of=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return new Yt(t,yt)},$t.ofWithScheduler=function(e){for(var t=arguments.length,n=new Array(t-1),r=1;t>r;r++)n[r-1]=arguments[r];return new Yt(n,e)},$t.pairs=function(e,t){return t||(t=J.Scheduler.currentThread),new mn(function(n){var r=Object.keys(e),i=r.length;return t.scheduleRecursiveWithState(0,function(t,o){if(i>t){var s=r[t];n.onNext([s,e[s]]),o(t+1)}else n.onCompleted()})})};var Zt=function(e){function t(t,n,r){this.start=t,this.count=n,this.scheduler=r,e.call(this)}return Je(t,e),t.prototype.subscribeCore=function(e){var t=new en(e,this);return t.run()},t}(Ft),en=function(){function e(e,t){this.observer=e,this.parent=t}return e.prototype.run=function(){function e(e,i){n>e?(r.onNext(t+e),i(e+1)):r.onCompleted()}var t=this.parent.start,n=this.parent.count,r=this.observer;return this.parent.scheduler.scheduleRecursiveWithState(0,e)},e}();$t.range=function(e,t,n){return Z(n)||(n=yt),new Zt(e,t,n)},$t.repeat=function(e,t,n){return Z(n)||(n=yt),tn(e,n).repeat(null==t?-1:t)};var tn=$t["return"]=$t.just=$t.returnValue=function(e,t){return Z(t)||(t=_t),new mn(function(n){return t.scheduleWithState(e,function(e,t){n.onNext(t),n.onCompleted()})})},nn=$t["throw"]=$t.throwError=function(e,t){return Z(t)||(t=_t),new mn(function(n){return t.schedule(function(){n.onError(e)})})};$t.throwException=function(){return $t.throwError.apply(null,arguments)},$t.using=function(e,t){return new mn(function(n){var r,i,o=at;try{r=e(),r&&(o=r),i=t(r)}catch(s){return new rt(nn(s).subscribe(n),o)}return new rt(i.subscribe(n),o)})},Nt.amb=function(e){var t=this;return new mn(function(n){function r(){o||(o=s,u.dispose())}function i(){o||(o=a,c.dispose())}var o,s="L",a="R",c=new lt,u=new lt;return oe(e)&&(e=Ht(e)),c.setDisposable(t.subscribe(function(e){r(),o===s&&n.onNext(e)},function(e){r(),o===s&&n.onError(e)},function(){r(),o===s&&n.onCompleted()})),u.setDisposable(e.subscribe(function(e){i(),o===a&&n.onNext(e)},function(e){i(),o===a&&n.onError(e)},function(){i(),o===a&&n.onCompleted()})),new rt(c,u)})},$t.amb=function(){function e(e,t){return e.amb(t)}var t=Xt(),n=[];if(Array.isArray(arguments[0]))n=arguments[0];else for(var r=0,i=arguments.length;i>r;r++)n.push(arguments[r]);for(var r=0,i=n.length;i>r;r++)t=e(t,n[r]);return t},Nt["catch"]=Nt.catchError=Nt.catchException=function(e){return"function"==typeof e?V(this,e):rn([this,e])};var rn=$t.catchError=$t["catch"]=$t.catchException=function(){var e=[];if(Array.isArray(arguments[0]))e=arguments[0];else for(var t=0,n=arguments.length;n>t;t++)e.push(arguments[t]);return jt(e).catchError()};Nt.combineLatest=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),on.apply(this,t)};var on=$t.combineLatest=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=t.pop();return Array.isArray(t[0])&&(t=t[0]),new mn(function(e){function n(t){if(a[t]=!0,c||(c=a.every(ee))){try{var n=r.apply(null,l)}catch(i){return e.onError(i)}e.onNext(n)}else u.filter(function(e,n){return n!==t}).every(ee)&&e.onCompleted()}function i(t){u[t]=!0,u.every(ee)&&e.onCompleted()}for(var o=t.length,s=function(){return!1},a=v(o,s),c=!1,u=v(o,s),l=new Array(o),f=new Array(o),h=0;o>h;h++)!function(r){var o=t[r],s=new lt;oe(o)&&(o=Ht(o)),s.setDisposable(o.subscribe(function(e){l[r]=e,n(r)},function(t){e.onError(t)},function(){i(r)})),f[r]=s}(h);return new rt(f)},this)};Nt.concat=function(){for(var e=[],t=0,n=arguments.length;n>t;t++)e.push(arguments[t]);return e.unshift(this),sn.apply(null,e)};var sn=$t.concat=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{e=new Array(arguments.length);for(var t=0,n=arguments.length;n>t;t++)e[t]=arguments[t]}return jt(e).concat()};Nt.concatAll=Nt.concatObservable=function(){return this.merge(1)};var an=function(e){function t(t,n){this.source=t,this.maxConcurrent=n,e.call(this)}return Je(t,e),t.prototype.subscribeCore=function(e){var t=new rt;return t.add(this.source.subscribe(new cn(e,this.maxConcurrent,t))),t},t}(Ft),cn=function(){function e(e,t,n){this.o=e,this.max=t,this.g=n,this.done=!1,this.q=[],this.activeCount=0,this.isStopped=!1}function t(e,t){this.parent=e,this.sad=t,this.isStopped=!1}return e.prototype.handleSubscribe=function(e){var n=new lt;this.g.add(n),oe(e)&&(e=Ht(e)),n.setDisposable(e.subscribe(new t(this,n)))},e.prototype.onNext=function(e){this.isStopped||(this.activeCount0?e.handleSubscribe(e.q.shift()):(e.activeCount--,e.done&&0===e.activeCount&&e.o.onCompleted())}},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.parent.o.onError(e),!0)},e}();Nt.merge=function(e){return"number"!=typeof e?un(this,e):new an(this,e)};var un=$t.merge=function(){var e,t,n=[],r=arguments.length;if(arguments[0])if(Z(arguments[0]))for(e=arguments[0],t=1;r>t;t++)n.push(arguments[t]);else for(e=_t,t=0;r>t;t++)n.push(arguments[t]);else for(e=_t,t=1;r>t;t++)n.push(arguments[t]);return Array.isArray(n[0])&&(n=n[0]),N(e,n).mergeAll()},ln=J.CompositeError=function(e){this.name="NotImplementedError",this.innerErrors=e,this.message="This contains multiple errors. Check the innerErrors",Error.call(this)};ln.prototype=Error.prototype,$t.mergeDelayError=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{var t=arguments.length;e=new Array(t);for(var n=0;t>n;n++)e[n]=arguments[n]}var r=N(null,e);return new mn(function(e){function t(){0===s.length?e.onCompleted():e.onError(1===s.length?s[0]:new ln(s))}var n=new rt,i=new lt,o=!1,s=[];return n.add(i),i.setDisposable(r.subscribe(function(r){var i=new lt;n.add(i),oe(r)&&(r=Ht(r)),i.setDisposable(r.subscribe(function(t){e.onNext(t)},function(e){s.push(e),n.remove(i),o&&1===n.length&&t()},function(){n.remove(i),o&&1===n.length&&t()}))},function(e){s.push(e),o=!0,1===n.length&&t()},function(){o=!0,1===n.length&&t()})),n})};var fn=function(e){function t(t){this.source=t,e.call(this)}return Je(t,e),t.prototype.subscribeCore=function(e){var t=new rt,n=new lt;return t.add(n),n.setDisposable(this.source.subscribe(new hn(e,t))),t},t}(Ft),hn=function(){function e(e,t){this.o=e,this.g=t,this.isStopped=!1,this.done=!1}function t(e,t,n){this.parent=e,this.g=t,this.sad=n,this.isStopped=!1}return e.prototype.onNext=function(e){if(!this.isStopped){var n=new lt;this.g.add(n),oe(e)&&(e=Ht(e)),n.setDisposable(e.subscribe(new t(this,this.g,n)))}},e.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},e.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.done=!0,1===this.g.length&&this.o.onCompleted())},e.prototype.dispose=function(){this.isStopped=!0},e.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(e),!0)},t.prototype.onNext=function(e){this.isStopped||this.parent.o.onNext(e)},t.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.parent.o.onError(e))},t.prototype.onCompleted=function(){if(!this.isStopped){var e=this.parent;this.isStopped=!0,e.g.remove(this.sad),e.done&&1===e.g.length&&e.o.onCompleted()}},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.parent.o.onError(e),!0)},e}();Nt.mergeAll=Nt.mergeObservable=function(){return new fn(this)},Nt.onErrorResumeNext=function(e){if(!e)throw new Error("Second observable is required");return dn([this,e])};var dn=$t.onErrorResumeNext=function(){var e=[];if(Array.isArray(arguments[0]))e=arguments[0];else for(var t=0,n=arguments.length;n>t;t++)e.push(arguments[t]);return new mn(function(t){var n=0,r=new ft,i=_t.scheduleRecursive(function(i){var o,s;nn;n++)t[n]=arguments[n];var r=t.pop(),i=this;if("undefined"==typeof i)throw new Error("Source observable not found for withLatestFrom().");if("function"!=typeof r)throw new Error("withLatestFrom() expects a resultSelector function.");return Array.isArray(t[0])&&(t=t[0]),new mn(function(e){for(var n=function(){return!1},o=t.length,s=v(o,n),a=!1,c=new Array(o),u=new Array(o+1),l=0;o>l;l++)!function(n){var r=t[n],i=new lt;oe(r)&&(r=Ht(r)),i.setDisposable(r.subscribe(function(e){c[n]=e,s[n]=!0,a=s.every(ee)},e.onError.bind(e),function(){})),u[n]=i}(l);var f=new lt;return f.setDisposable(i.subscribe(function(t){var n,i=[t].concat(c);if(a){try{n=r.apply(null,i)}catch(o){return void e.onError(o)}e.onNext(n)}},e.onError.bind(e),function(){e.onCompleted()})),u[o]=f,new rt(u)},this)},Nt.zip=function(){if(Array.isArray(arguments[0]))return k.apply(this,arguments);for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=this,i=t.pop();return t.unshift(r),new mn(function(e){function n(t){var n,o;if(a.every(function(e){return e.length>0})){try{o=a.map(function(e){return e.shift()}),n=i.apply(r,o)}catch(s){return void e.onError(s)}e.onNext(n)}else c.filter(function(e,n){return n!==t}).every(ee)&&e.onCompleted()}function o(t){c[t]=!0,c.every(function(e){return e})&&e.onCompleted()}for(var s=t.length,a=v(s,B),c=v(s,M),u=new Array(s),l=0;s>l;l++)!function(r){var i=t[r],s=new lt;oe(i)&&(i=Ht(i)),s.setDisposable(i.subscribe(function(e){a[r].push(e),n(r)},function(t){e.onError(t)},function(){o(r)})),u[r]=s}(l);return new rt(u)},r)},$t.zip=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=t.shift();return r.zip.apply(r,t)},$t.zipArray=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{var t=arguments.length;e=new Array(t);for(var n=0;t>n;n++)e[n]=arguments[n]}return new mn(function(t){function n(e){if(o.every(function(e){return e.length>0})){var n=o.map(function(e){return e.shift()});t.onNext(n)}else if(s.filter(function(t,n){return n!==e}).every(ee))return void t.onCompleted()}function r(e){return s[e]=!0,s.every(ee)?void t.onCompleted():void 0}for(var i=e.length,o=v(i,function(){return[]}),s=v(i,function(){return!1}),a=new Array(i),c=0;i>c;c++)!function(i){a[i]=new lt,a[i].setDisposable(e[i].subscribe(function(e){o[i].push(e),n(i)},function(e){t.onError(e)},function(){r(i)}))}(c);return new rt(a)})},Nt.asObservable=function(){var e=this;return new mn(function(t){return e.subscribe(t)},this)},Nt.bufferWithCount=function(e,t){return"number"!=typeof t&&(t=e),this.windowWithCount(e,t).selectMany(function(e){return e.toArray()}).where(function(e){return e.length>0})},Nt.dematerialize=function(){var e=this;return new mn(function(t){return e.subscribe(function(e){return e.accept(t)},function(e){t.onError(e)},function(){t.onCompleted()})},this)},Nt.distinctUntilChanged=function(e,t){var n=this;return t||(t=ne),new mn(function(r){var i,o=!1;return n.subscribe(function(n){var s=n;if(e)try{s=e(n)}catch(a){return void r.onError(a)}if(o)try{var c=t(i,s)}catch(a){return void r.onError(a)}o&&c||(o=!0,i=s,r.onNext(n))},function(e){r.onError(e)},function(){r.onCompleted()})},this)},Nt["do"]=Nt.tap=Nt.doAction=function(e,t,n){var r=this;return new mn(function(i){var o=!e||se(e)?Tt(e||X,t||X,n||X):e;return r.subscribe(function(e){try{o.onNext(e)}catch(t){i.onError(t)}i.onNext(e)},function(e){try{o.onError(e)}catch(t){i.onError(t)}i.onError(e)},function(){try{o.onCompleted()}catch(e){i.onError(e)}i.onCompleted()})},this)},Nt.doOnNext=Nt.tapOnNext=function(e,t){return this.tap("undefined"!=typeof t?function(n){e.call(t,n)}:e)},Nt.doOnError=Nt.tapOnError=function(e,t){return this.tap(X,"undefined"!=typeof t?function(n){e.call(t,n)}:e)},Nt.doOnCompleted=Nt.tapOnCompleted=function(e,t){return this.tap(X,null,"undefined"!=typeof t?function(){e.call(t)}:e)},Nt["finally"]=Nt.ensure=function(e){var t=this;return new mn(function(n){var r;try{r=t.subscribe(n)}catch(i){throw e(),i}return st(function(){try{r.dispose()}catch(t){throw t}finally{e()}})},this)},Nt.finallyAction=function(e){return this.ensure(e)},Nt.ignoreElements=function(){var e=this;return new mn(function(t){return e.subscribe(X,function(e){t.onError(e)},function(){t.onCompleted()})},e)},Nt.materialize=function(){var e=this;return new mn(function(t){return e.subscribe(function(e){t.onNext(xt(e))},function(e){t.onNext(St(e)),t.onCompleted()},function(){t.onNext(Ot()),t.onCompleted()})},e)},Nt.repeat=function(e){return It(this,e).concat()},Nt.retry=function(e){return It(this,e).catchError()},Nt.retryWhen=function(e){return It(this).catchErrorWhen(e)},Nt.scan=function(){var e,t,n=!1,r=this;return 2===arguments.length?(n=!0,e=arguments[0],t=arguments[1]):t=arguments[0],new mn(function(i){var o,s,a;return r.subscribe(function(r){!a&&(a=!0);try{o?s=t(s,r):(s=n?t(e,r):r,o=!0)}catch(c){return void i.onError(c)}i.onNext(s)},function(e){i.onError(e)},function(){!a&&n&&i.onNext(e),i.onCompleted()})},r)},Nt.skipLast=function(e){if(0>e)throw new pe;var t=this;return new mn(function(n){var r=[];return t.subscribe(function(t){r.push(t),r.length>e&&n.onNext(r.shift())},function(e){n.onError(e)},function(){n.onCompleted()})},t)},Nt.startWith=function(){var e,t=0;arguments.length&&Z(arguments[0])?(e=arguments[0],t=1):e=_t;for(var n=[],r=t,i=arguments.length;i>r;r++)n.push(arguments[r]);return jt([Jt(n,e),this]).concat()},Nt.takeLast=function(e){if(0>e)throw new pe;var t=this;return new mn(function(n){var r=[];return t.subscribe(function(t){r.push(t),r.length>e&&r.shift()},function(e){n.onError(e)},function(){for(;r.length>0;)n.onNext(r.shift());n.onCompleted()})},t)},Nt.takeLastBuffer=function(e){var t=this;return new mn(function(n){var r=[];return t.subscribe(function(t){r.push(t),r.length>e&&r.shift()},function(e){n.onError(e)},function(){n.onNext(r),n.onCompleted()})},t)},Nt.windowWithCount=function(e,t){var n=this;if(+e||(e=0),Math.abs(e)===1/0&&(e=0),0>=e)throw new pe;if(null==t&&(t=e),+t||(t=0),Math.abs(t)===1/0&&(t=0),0>=t)throw new pe;return new mn(function(r){function i(){var e=new yn;c.push(e),r.onNext(Ze(e,s))}var o=new lt,s=new ht(o),a=0,c=[];return i(),o.setDisposable(n.subscribe(function(n){for(var r=0,o=c.length;o>r;r++)c[r].onNext(n);var s=a-e+1;s>=0&&s%t===0&&c.shift().onCompleted(),++a%t===0&&i()},function(e){for(;c.length>0;)c.shift().onError(e);r.onError(e)},function(){for(;c.length>0;)c.shift().onCompleted();r.onCompleted()})),s},n)},Nt.selectConcat=Nt.concatMap=function(e,t,n){return se(e)&&se(t)?this.concatMap(function(n,r){var i=e(n,r);return oe(i)&&(i=Ht(i)),(Ce(i)||we(i))&&(i=Gt(i)),i.map(function(e,i){return t(n,e,r,i)})}):se(e)?L(this,e,n):L(this,function(){return e})},Nt.concatMapObserver=Nt.selectConcatObserver=function(e,t,n,r){var i=this,o=Ee(e,r,2),s=Ee(t,r,1),a=Ee(n,r,0);return new mn(function(e){var t=0;return i.subscribe(function(n){var r;try{r=o(n,t++)}catch(i){return void e.onError(i)}oe(r)&&(r=Ht(r)),e.onNext(r)},function(t){var n;try{n=s(t)}catch(r){return void e.onError(r)}oe(n)&&(n=Ht(n)),e.onNext(n),e.onCompleted()},function(){var t;try{t=a()}catch(n){return void e.onError(n)}oe(t)&&(t=Ht(t)),e.onNext(t),e.onCompleted()})},this).concatAll()},Nt.defaultIfEmpty=function(t){var n=this;return t===e&&(t=null),new mn(function(e){var r=!1;return n.subscribe(function(t){r=!0,e.onNext(t)},function(t){e.onError(t)},function(){!r&&e.onNext(t),e.onCompleted()})},n)},F.prototype.push=function(e){var t=-1===$(this.set,e,this.comparer);return t&&this.set.push(e),t},Nt.distinct=function(e,t){var n=this;return t||(t=ne),new mn(function(r){var i=new F(t);return n.subscribe(function(t){var n=t;if(e)try{n=e(t)}catch(o){return void r.onError(o)}i.push(n)&&r.onNext(t)},function(e){r.onError(e)},function(){r.onCompleted()})},this)};var pn=function(e){function t(t,n,r){this.source=t,this.selector=Ee(n,r,3),e.call(this)}return Je(t,e),t.prototype.internalMap=function(e,n){var r=this;return new t(this.source,function(t,n,i){return e.call(this,r.selector(t,n,i),n,i)},n)},t.prototype.subscribeCore=function(e){return this.source.subscribe(new H(e,this.selector,this))},t}(Ft);H.prototype.onNext=function(e){if(!this.isStopped){var t=y(this.selector).call(this,e,this.i++,this.source);return t===et?this.observer.onError(t.e):void this.observer.onNext(t)}},H.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.observer.onError(e))},H.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.observer.onCompleted())},H.prototype.dispose=function(){this.isStopped=!0},H.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(e),!0)},Nt.map=Nt.select=function(e,t){var n="function"==typeof e?e:function(){return e};return this instanceof pn?this.internalMap(n,t):new pn(this,n,t)},Nt.pluck=function(){var t=arguments,n=arguments.length;if(0===n)throw new Error("List of properties cannot be empty.");return this.map(function(r){for(var i=r,o=0;n>o;o++){var s=i[t[o]];if("undefined"==typeof s)return e;i=s}return i})},Nt.flatMapObserver=Nt.selectManyObserver=function(e,t,n,r){var i=this;return new mn(function(o){var s=0;return i.subscribe(function(t){var n;try{n=e.call(r,t,s++)}catch(i){return void o.onError(i)}oe(n)&&(n=Ht(n)),o.onNext(n)},function(e){var n;try{n=t.call(r,e)}catch(i){return void o.onError(i)}oe(n)&&(n=Ht(n)),o.onNext(n),o.onCompleted()},function(){var e;try{e=n.call(r)}catch(t){return void o.onError(t)}oe(e)&&(e=Ht(e)),o.onNext(e),o.onCompleted()})},i).mergeAll()},Nt.selectMany=Nt.flatMap=function(e,t,n){return se(e)&&se(t)?this.flatMap(function(n,r){var i=e(n,r);return oe(i)&&(i=Ht(i)),(Ce(i)||we(i))&&(i=Gt(i)),i.map(function(e,i){return t(n,e,r,i)})},n):se(e)?W(this,e,n):W(this,function(){return e})},Nt.selectSwitch=Nt.flatMapLatest=Nt.switchMap=function(e,t){return this.select(e,t).switchLatest()},Nt.skip=function(e){if(0>e)throw new pe;var t=this;return new mn(function(n){var r=e;return t.subscribe(function(e){0>=r?n.onNext(e):r--},function(e){n.onError(e)},function(){n.onCompleted()})},t)},Nt.skipWhile=function(e,t){var n=this,r=Ee(e,t,3);return new mn(function(e){var t=0,i=!1;return n.subscribe(function(o){if(!i)try{i=!r(o,t++,n)}catch(s){return void e.onError(s)}i&&e.onNext(o)},function(t){e.onError(t)},function(){e.onCompleted()})},n)},Nt.take=function(e,t){if(0>e)throw new pe;if(0===e)return Ut(t);var n=this;return new mn(function(t){var r=e;return n.subscribe(function(e){r-->0&&(t.onNext(e),0===r&&t.onCompleted())},function(e){t.onError(e)},function(){t.onCompleted()})},n)},Nt.takeWhile=function(e,t){var n=this,r=Ee(e,t,3);return new mn(function(e){var t=0,i=!0;return n.subscribe(function(o){if(i){try{i=r(o,t++,n)}catch(s){return void e.onError(s)}i?e.onNext(o):e.onCompleted()}},function(t){e.onError(t)},function(){e.onCompleted()})},n)};var gn=function(e){function t(t,n,r){this.source=t,this.predicate=Ee(n,r,3),e.call(this)}return Je(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new q(e,this.predicate,this))},t.prototype.internalFilter=function(e,n){var r=this;return new t(this.source,function(t,n,i){return r.predicate(t,n,i)&&e.call(this,t,n,i)},n)},t}(Ft);q.prototype.onNext=function(e){if(!this.isStopped){var t=y(this.predicate).call(this,e,this.i++,this.source);return t===et?this.observer.onError(t.e):void(t&&this.observer.onNext(e))}},q.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.observer.onError(e))},q.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.observer.onCompleted())},q.prototype.dispose=function(){this.isStopped=!0},q.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(e),!0)},Nt.filter=Nt.where=function(e,t){return this instanceof gn?this.internalFilter(e,t):new gn(this,e,t)},Nt.transduce=function(e){function t(e){return{"@@transducer/init":function(){return e},"@@transducer/step":function(e,t){return e.onNext(t)},"@@transducer/result":function(e){return e.onCompleted()}}}var n=this;return new mn(function(r){var i=e(t(r));return n.subscribe(function(e){try{i["@@transducer/step"](r,e)}catch(t){r.onError(t)}},function(e){r.onError(e)},function(){i["@@transducer/result"](r)})},n)};var mn=J.AnonymousObservable=function(e){function t(e){return e&&se(e.dispose)?e:se(e)?st(e):at}function n(e,n){var r=n[0],i=n[1],o=y(i)(r);return o!==et||r.fail(et.e)?void r.setDisposable(t(o)):b(et.e)}function r(t,r){function i(e){var r=new vn(e),i=[r,t];return yt.scheduleRequired()?yt.scheduleWithState(i,n):n(null,i),r}this.source=r,e.call(this,i)}return Je(r,e),r}($t),vn=function(e){function t(t){e.call(this),this.observer=t,this.m=new lt}Je(t,e);var n=t.prototype;return n.next=function(e){var t=y(this.observer.onNext).call(this.observer,e);t===et&&(this.dispose(),b(t.e))},n.error=function(e){var t=y(this.observer.onError).call(this.observer,e);this.dispose(),t===et&&b(t.e)},n.completed=function(){var e=y(this.observer.onCompleted).call(this.observer);this.dispose(),e===et&&b(e.e)},n.setDisposable=function(e){this.m.setDisposable(e)},n.getDisposable=function(){return this.m.getDisposable()},n.dispose=function(){e.prototype.dispose.call(this),this.m.dispose()},t}(Vt),_n=function(e,t){this.subject=e,this.observer=t};_n.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var e=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(e,1),this.observer=null}};var yn=J.Subject=function(e){function t(e){return ut(this),this.isStopped?this.hasError?(e.onError(this.error),at):(e.onCompleted(),at):(this.observers.push(e),new _n(this,e))}function n(){e.call(this,t),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return Je(n,e),Xe(n.prototype,Pt.prototype,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(ut(this),!this.isStopped){this.isStopped=!0;for(var e=0,t=i(this.observers),n=t.length;n>e;e++)t[e].onCompleted();this.observers.length=0}},onError:function(e){if(ut(this),!this.isStopped){this.isStopped=!0,this.error=e,this.hasError=!0;for(var t=0,n=i(this.observers),r=n.length;r>t;t++)n[t].onError(e);this.observers.length=0}},onNext:function(e){if(ut(this),!this.isStopped)for(var t=0,n=i(this.observers),r=n.length;r>t;t++)n[t].onNext(e)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(e,t){return new bn(e,t)},n}($t),bn=(J.AsyncSubject=function(e){function t(e){return ut(this),this.isStopped?(this.hasError?e.onError(this.error):this.hasValue?(e.onNext(this.value),e.onCompleted()):e.onCompleted(),at):(this.observers.push(e),new _n(this,e))}function n(){e.call(this,t),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return Je(n,e),Xe(n.prototype,Pt,{hasObservers:function(){return ut(this),this.observers.length>0},onCompleted:function(){var e,t;if(ut(this),!this.isStopped){this.isStopped=!0;var n=i(this.observers),t=n.length;if(this.hasValue)for(e=0;t>e;e++){var r=n[e];r.onNext(this.value),r.onCompleted()}else for(e=0;t>e;e++)n[e].onCompleted();this.observers.length=0}},onError:function(e){if(ut(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=e;for(var t=0,n=i(this.observers),r=n.length;r>t;t++)n[t].onError(e);this.observers.length=0}},onNext:function(e){ut(this),this.isStopped||(this.value=e,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}($t),J.AnonymousSubject=function(e){function t(e){return this.observable.subscribe(e)}function n(n,r){this.observer=n,this.observable=r,e.call(this,t)}return Je(n,e),Xe(n.prototype,Pt.prototype,{onCompleted:function(){this.observer.onCompleted()},onError:function(e){this.observer.onError(e)},onNext:function(e){this.observer.onNext(e)}}),n}($t));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(K.Rx=J,define(function(){return J})):z&&Q?G?(Q.exports=J).Rx=J:z.Rx=J:K.Rx=J;var wn=l()}.call(this),r.define=i,n.exports}),System.register("angular2/src/facade/lang",[],function(e){"use strict";function t(e){return e.name}function n(e){return new TypeError(e)}function r(){return N}function i(e){return e}function o(e){return e}function s(){return function(e){return e}}function a(){return function(e){return e}}function c(e){return function(e){return e}}function u(e){return void 0!==e&&null!==e}function l(e){return void 0===e||null===e}function f(e){return"string"==typeof e}function h(e){return"function"==typeof e}function d(e){return h(e)}function p(e){return"object"==typeof e&&null!==e}function g(e){return e instanceof A.Promise}function m(e){return Array.isArray(e)}function v(e){return"number"==typeof e}function _(e){return e instanceof T&&!isNaN(e.valueOf())}function y(e){if("string"==typeof e)return e;if(void 0===e||null===e)return""+e;if(e.name)return e.name;var t=e.toString(),n=t.indexOf("\n");return-1===n?t:t.substring(0,n)}function b(e){return e}function w(e,t){return e}function C(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)}function R(e){return e}function E(e){return l(e)?null:e}function x(e){return l(e)?!1:e}function S(e){return null!==e&&("function"==typeof e||"object"==typeof e)}function O(e){console.log(e instanceof j?e.stack:e)}var A,D,I,j,P,T,N,V,k,M,B,L,$,F,H,W,q;return e("getTypeNameForDebugging",t),e("makeTypeError",n),e("assertionsEnabled",r),e("ENUM_INDEX",i),e("CONST_EXPR",o),e("CONST",s),e("ABSTRACT",a),e("IMPLEMENTS",c),e("isPresent",u),e("isBlank",l),e("isString",f),e("isFunction",h),e("isType",d),e("isStringMap",p),e("isPromise",g),e("isArray",m),e("isNumber",v),e("isDate",_),e("stringify",y),e("serializeEnum",b),e("deserializeEnum",w),e("looseIdentical",C),e("getMapKey",R),e("normalizeBlank",E),e("normalizeBool",x),e("isJsObject",S),e("print",O),{setters:[],execute:function(){A="undefined"==typeof window?global:window,e("global",A),D=Function,e("Type",D),I=!1,e("isDart",I),j=function(e){function t(e,n,r,i){$traceurRuntime.superConstructor(t).call(this,e),this.message=e,this._originalException=n,this._originalStack=r,this._context=i,this.stack=new Error(e).stack}return $traceurRuntime.createClass(t,{get originalException(){return this._originalException},get originalStack(){return this._originalStack},get context(){return this._context},toString:function(){return this.message}},{},e)}(Error),e("BaseException",j),P=A.Math,e("Math",P),T=A.Date,e("Date",T),N="undefined"!=typeof A.assert,A.assert=function(e){N&&A.assert.call(e)},V=function(){function e(){}return $traceurRuntime.createClass(e,{},{fromCharCode:function(e){return String.fromCharCode(e)},charCodeAt:function(e,t){return e.charCodeAt(t)},split:function(e,t){return e.split(t)},equals:function(e,t){return e===t},replace:function(e,t,n){return e.replace(t,n)},replaceAll:function(e,t,n){return e.replace(t,n)},toUpperCase:function(e){return e.toUpperCase()},toLowerCase:function(e){return e.toLowerCase()},startsWith:function(e,t){return e.startsWith(t)},substring:function(e,t){var n=void 0!==arguments[2]?arguments[2]:null;return e.substring(t,null===n?void 0:n)},replaceAllMapped:function(e,t,n){return e.replace(t,function(){for(var e=[],t=0;te?-1:e>t?1:0}})}(),e("StringWrapper",V),k=function(){function e(){var e=void 0!==arguments[0]?arguments[0]:[];this.parts=e}return $traceurRuntime.createClass(e,{add:function(e){this.parts.push(e)},toString:function(){return this.parts.join("")}},{})}(),e("StringJoiner",k),M=function(e){function t(e){$traceurRuntime.superConstructor(t).call(this),this.message=e}return $traceurRuntime.createClass(t,{toString:function(){return this.message}},{},e)}(j),e("NumberParseError",M),B=function(){function e(){}return $traceurRuntime.createClass(e,{},{toFixed:function(e,t){return e.toFixed(t)},equal:function(e,t){return e===t},parseIntAutoRadix:function(e){var t=parseInt(e);if(isNaN(t))throw new M("Invalid integer literal when parsing "+e);return t},parseInt:function(e,t){if(10==t){if(/^(\-|\+)?[0-9]+$/.test(e))return parseInt(e,t)}else if(16==t){if(/^(\-|\+)?[0-9ABCDEFabcdef]+$/.test(e))return parseInt(e,t)}else{var n=parseInt(e,t);if(!isNaN(n))return n}throw new M("Invalid integer literal when parsing "+e+" in base "+t)},parseFloat:function(e){return parseFloat(e)},get NaN(){return 0/0},isNaN:function(e){return isNaN(e)},isInteger:function(e){return Number.isInteger(e)}})}(),e("NumberWrapper",B),L=A.RegExp,e("RegExp",L),$=function(){function e(){}return $traceurRuntime.createClass(e,{},{create:function(e){var t=void 0!==arguments[1]?arguments[1]:"";return t=t.replace(/g/g,""),new A.RegExp(e,t+"g")},firstMatch:function(e,t){return e.lastIndex=0,e.exec(t)},test:function(e,t){return e.test(t)},matcher:function(e,t){return e.lastIndex=0,{re:e,input:t}}})}(),e("RegExpWrapper",$),F=function(){function e(){}return $traceurRuntime.createClass(e,{},{next:function(e){return e.re.exec(e.input)}})}(),e("RegExpMatcherWrapper",F),H=function(){function e(){}return $traceurRuntime.createClass(e,{},{apply:function(e,t){return e.apply(null,t)}})}(),e("FunctionWrapper",H),W=function(){function e(){}return $traceurRuntime.createClass(e,{},{parse:function(e){return A.JSON.parse(e)},stringify:function(e){return A.JSON.stringify(e,null,2)}})}(),e("Json",W),q=function(){function e(){}return $traceurRuntime.createClass(e,{},{create:function(e){var t=void 0!==arguments[1]?arguments[1]:1,n=void 0!==arguments[2]?arguments[2]:1,r=void 0!==arguments[3]?arguments[3]:0,i=void 0!==arguments[4]?arguments[4]:0,o=void 0!==arguments[5]?arguments[5]:0,s=void 0!==arguments[6]?arguments[6]:0;return new T(e,t-1,n,r,i,o,s)},fromMillis:function(e){return new T(e)},toMillis:function(e){return e.getTime()},now:function(){return new T},toJson:function(e){return e.toJSON()}})}(),e("DateWrapper",q)}}}),System.register("angular2/src/util/decorators",["angular2/src/facade/lang"],function(e){"use strict";function t(e){return a(e)&&e.hasOwnProperty("annotation")&&(e=e.annotation),e}function n(e,n){if(e===Object||e===String||e===Function||e===Number||e===Array)throw new Error("Can not use native "+c(e)+" as constructor");if(a(e))return e;if(e instanceof Array){var r=e,i=e[e.length-1];if(!a(i))throw new Error("Last position of Class method array must be Function in key "+n+" was '"+c(i)+"'");var o=r.length-1;if(o!=i.length)throw new Error("Number of annotations ("+o+") does not match number of arguments ("+i.length+") in the function: "+c(i));for(var s=[],l=0,f=r.length-1;f>l;l++){var h=[];s.push(h);var d=r[l];if(d instanceof Array)for(var p=0;p-1?(e.splice(n,1),!0):!1},clear:function(e){e.splice(0,e.length)},join:function(e,t){return e.join(t)},isEmpty:function(e){return 0==e.length},fill:function(e,t){var n=void 0!==arguments[2]?arguments[2]:0,r=void 0!==arguments[3]?arguments[3]:null;e.fill(t,n,null===r?void 0:r)},equals:function(e,t){if(e.length!=t.length)return!1;for(var n=0;n1){var n=t(r.reversed(e)),o=r.map(n,function(e){return i(e.token)});return" ("+o.join(" -> ")+")"}return""}var r,i,o,s,a,c,u,l,f,h,d;return{setters:[function(e){r=e.ListWrapper},function(e){i=e.stringify,o=e.BaseException,s=e.isBlank}],execute:function(){a=function(e){function t(e,n,r,i,o){$traceurRuntime.superConstructor(t).call(this,"DI Exception",i,o,null),this.keys=[n],this.injectors=[e],this.constructResolvingMessage=r,this.message=this.constructResolvingMessage(this.keys)}return $traceurRuntime.createClass(t,{addKey:function(e,t){this.injectors.push(e),this.keys.push(t),this.message=this.constructResolvingMessage(this.keys)},get context(){return this.injectors[this.injectors.length-1].debugContext()},toString:function(){return this.message}},{},e)}(o),e("AbstractBindingError",a),c=function(e){function t(e,o){$traceurRuntime.superConstructor(t).call(this,e,o,function(e){var t=i(r.first(e).token);return"No provider for "+t+"!"+n(e)})}return $traceurRuntime.createClass(t,{},{},e)}(a),e("NoBindingError",c),u=function(e){function t(e,r){$traceurRuntime.superConstructor(t).call(this,e,r,function(e){return"Cannot instantiate cyclic dependency!"+n(e)})}return $traceurRuntime.createClass(t,{},{},e)}(a),e("CyclicDependencyError",u),l=function(e){function t(e,o,s,a){$traceurRuntime.superConstructor(t).call(this,e,a,function(e){var t=i(r.first(e).token);return"Error during instantiation of "+t+"!"+n(e)+"."},o,s),this.causeKey=a}return $traceurRuntime.createClass(t,{},{},e)}(a),e("InstantiationError",l),f=function(e){function t(e){$traceurRuntime.superConstructor(t).call(this),this.message="Invalid binding - only instances of Binding and Type are allowed, got: "+e.toString()}return $traceurRuntime.createClass(t,{toString:function(){return this.message}},{},e)}(o),e("InvalidBindingError",f),h=function(e){function t(e,n){$traceurRuntime.superConstructor(t).call(this);for(var o=[],a=0,c=n.length;c>a;a++){var u=n[a];o.push(s(u)||0==u.length?"?":r.map(u,i).join(" "))}this.message="Cannot resolve all parameters for "+i(e)+"("+o.join(", ")+"). Make sure they all have valid type or annotations."}return $traceurRuntime.createClass(t,{toString:function(){return this.message}},{},e)}(o),e("NoAnnotationError",h),d=function(e){function t(e){$traceurRuntime.superConstructor(t).call(this),this.message="Index "+e+" is out-of-bounds."}return $traceurRuntime.createClass(t,{toString:function(){return this.message}},{},e)}(o),e("OutOfBoundsError",d)}}}),System.register("angular2/src/di/opaque_token",["angular2/src/facade/lang"],function(e){"use strict";var t,n,r,i;return{setters:[function(e){r=e.CONST}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},i=$traceurRuntime.createClass(function(e){this._desc="Token("+e+")"},{toString:function(){return this._desc}},{}),e("OpaqueToken",i),e("OpaqueToken",i=t([r(),n("design:paramtypes",[String])],i))}}}),System.register("angular2/src/dom/dom_adapter",["angular2/src/facade/lang"],function(e){"use strict";function t(t){i(o)&&e("DOM",o=t)}function n(){return new r("This method is abstract")}var r,i,o,s;return e("setRootDomAdapter",t),{setters:[function(e){r=e.BaseException,i=e.isBlank}],execute:function(){e("DOM",o),s=function(){function e(){}return $traceurRuntime.createClass(e,{hasProperty:function(e,t){throw n()},setProperty:function(e,t,r){throw n()},getProperty:function(e,t){throw n()},invoke:function(e,t,r){throw n()},logError:function(e){throw n()},log:function(e){throw n()},logGroup:function(e){throw n()},logGroupEnd:function(){throw n()},get attrToPropMap(){throw n()},parse:function(e){throw n()},query:function(e){throw n()},querySelector:function(e,t){throw n()},querySelectorAll:function(e,t){throw n()},on:function(e,t,r){throw n()},onAndCancel:function(e,t,r){throw n()},dispatchEvent:function(e,t){throw n()},createMouseEvent:function(e){throw n()},createEvent:function(e){throw n()},preventDefault:function(e){throw n()},getInnerHTML:function(e){throw n()},getOuterHTML:function(e){throw n()},nodeName:function(e){throw n()},nodeValue:function(e){throw n()},type:function(e){throw n()},content:function(e){throw n()},firstChild:function(e){throw n()},nextSibling:function(e){throw n()},parentElement:function(e){throw n()},childNodes:function(e){throw n()},childNodesAsList:function(e){throw n()},clearNodes:function(e){throw n()},appendChild:function(e,t){throw n()},removeChild:function(e,t){throw n()},replaceChild:function(e,t,r){throw n()},remove:function(e){throw n()},insertBefore:function(e,t){throw n()},insertAllBefore:function(e,t){throw n()},insertAfter:function(e,t){throw n()},setInnerHTML:function(e,t){throw n()},getText:function(e){throw n()},setText:function(e,t){throw n()},getValue:function(e){throw n()},setValue:function(e,t){throw n()},getChecked:function(e){throw n()},setChecked:function(e,t){throw n()},createTemplate:function(e){throw n()},createElement:function(e){throw void 0!==arguments[1]?arguments[1]:null,n()},createTextNode:function(e){throw void 0!==arguments[1]?arguments[1]:null,n()},createScriptTag:function(e,t){throw void 0!==arguments[2]?arguments[2]:null,n()},createStyleElement:function(e){throw void 0!==arguments[1]?arguments[1]:null,n()},createShadowRoot:function(e){throw n()},getShadowRoot:function(e){throw n()},getHost:function(e){throw n()},getDistributedNodes:function(e){throw n()},clone:function(e){throw n()},getElementsByClassName:function(e,t){throw n()},getElementsByTagName:function(e,t){throw n()},classList:function(e){throw n()},addClass:function(e,t){throw n()},removeClass:function(e,t){throw n()},hasClass:function(e,t){throw n()},setStyle:function(e,t,r){throw n()},removeStyle:function(e,t){throw n()},getStyle:function(e,t){throw n()},tagName:function(e){throw n()},attributeMap:function(e){throw n()},hasAttribute:function(e,t){throw n()},getAttribute:function(e,t){throw n()},setAttribute:function(e,t,r){throw n()},removeAttribute:function(e,t){throw n()},templateAwareRoot:function(e){throw n()},createHtmlDocument:function(){throw n()},defaultDoc:function(){throw n()},getBoundingClientRect:function(e){throw n()},getTitle:function(){throw n()},setTitle:function(e){throw n()},elementMatches:function(e,t){throw n()},isTemplateElement:function(e){throw n()},isTextNode:function(e){throw n()},isCommentNode:function(e){throw n()},isElementNode:function(e){throw n()},hasShadowRoot:function(e){throw n()},isShadowRoot:function(e){throw n()},importIntoDoc:function(e){throw n()},isPageRule:function(e){throw n()},isStyleRule:function(e){throw n()},isMediaRule:function(e){throw n()},isKeyframesRule:function(e){throw n()},getHref:function(e){throw n()},getEventKey:function(e){throw n()},resolveAndSetHref:function(e,t,r){throw n()},cssToRules:function(e){throw n()},supportsDOMEvents:function(){throw n()},supportsNativeShadowDOM:function(){throw n()},getGlobalEventTarget:function(e){throw n()},getHistory:function(){throw n()},getLocation:function(){throw n()},getBaseHref:function(){throw n()},getUserAgent:function(){throw n()},setData:function(e,t,r){throw n()},getData:function(e,t){throw n()},setGlobalVar:function(e,t){throw n()}},{})}(),e("DomAdapter",s)}}}),System.register("angular2/src/dom/generic_browser_adapter",["angular2/src/facade/collection","angular2/src/facade/lang","angular2/src/dom/dom_adapter"],function(e){"use strict";var t,n,r,i,o;return{setters:[function(e){t=e.ListWrapper},function(e){n=e.isPresent,r=e.isFunction},function(e){i=e.DomAdapter}],execute:function(){o=function(e){function i(){$traceurRuntime.superConstructor(i).apply(this,arguments)}return $traceurRuntime.createClass(i,{getDistributedNodes:function(e){return e.getDistributedNodes()},resolveAndSetHref:function(e,t,n){e.href=null==n?t:t+"/../"+n},cssToRules:function(e){var r=this.createStyleElement(e);this.appendChild(this.defaultDoc().head,r);var i=[];if(n(r.sheet))try{var o=r.sheet.cssRules;i=t.createFixedSize(o.length);for(var s=0;sa;++a)this._sanitizedNames[a+1]=t(""+this.records[a].name+a)}return $traceurRuntime.createClass(e,{getContextName:function(){return this.getFieldName(o)},getLocalName:function(e){return this._sanitizedNames[e]},getChangeName:function(e){return"c_"+this._sanitizedNames[e]},genInitLocals:function(){for(var e=[],t=[],n=0,r=this.getFieldCount();r>n;++n){var o=this.getChangeName(n);e.push(this.getLocalName(n)+","+o),t.push(o)}return"var "+i.join(e,",")+";"+(i.join(t,"=")+" = false;")},getFieldCount:function(){return this._sanitizedNames.length},getFieldName:function(e){return""+this.fieldPrefix+this._sanitizedNames[e]},getAllFieldNames:function(){for(var e=[],t=0,n=this.getFieldCount();n>t;++t)e.push(this.getFieldName(t));for(var r=0,i=this.records.length;i>r;++r){var o=this.records[r];o.isPipeRecord()&&e.push(this.getPipeName(o.selfIndex))}for(var s=0,a=this.directiveRecords.length;a>s;++s){var c=this.directiveRecords[s];e.push(this.getDirectiveName(c.directiveIndex)),c.isOnPushChangeDetection()&&e.push(this.getDetectorName(c.directiveIndex))}return e},genDeclareFields:function(){var e=this.getAllFieldNames();return i.removeAt(e,o),i.isEmpty(e)?"":"var "+i.join(e,", ")+";"},genDehydrateFields:function(){var e=this.getAllFieldNames();return i.removeAt(e,o),i.isEmpty(e)||e.push(this.utilName+".uninitialized;"),this.getContextName()+" = null; "+i.join(e," = ")},genPipeOnDestroy:function(){var e=this;return i.join(i.map(i.filter(this.records,function(e){return e.isPipeRecord()}),function(t){return e.getPipeName(t.selfIndex)+".onDestroy();"}),"\n")},getPipeName:function(e){return""+this.fieldPrefix+this._sanitizedNames[e]+"_pipe"},getAllDirectiveNames:function(){var e=this;return i.map(this.directiveRecords,function(t){return e.getDirectiveName(t.directiveIndex)})},getDirectiveName:function(e){return this.fieldPrefix+"directive_"+e.name},getAllDetectorNames:function(){var e=this;return i.map(i.filter(this.directiveRecords,function(e){return e.isOnPushChangeDetection()}),function(t){return e.getDetectorName(t.directiveIndex)})},getDetectorName:function(e){return this.fieldPrefix+"detector_"+e.name}},{})}(),e("CodegenNameUtil",a)}}}),System.register("angular2/src/change_detection/coalesce",["angular2/src/facade/lang","angular2/src/facade/collection","angular2/src/change_detection/proto_record"],function(e){"use strict";function t(e){for(var t=[],i=new f,s=0;s10)throw new o("Cannot have more than 10 argument");for(var i=j[r],s=0;r>s;s++)i[s]=n[s].eval(e,t);return i}var n,r,i,o,s,a,c,u,l,f,h,d,p,g,m,v,_,y,b,w,C,R,E,x,S,O,A,D,I,j;return{setters:[function(e){n=e.isBlank,r=e.isPresent,i=e.FunctionWrapper,o=e.BaseException},function(e){s=e.ListWrapper,a=e.StringMapWrapper}],execute:function(){c=function(){function e(){}return $traceurRuntime.createClass(e,{eval:function(e,t){throw new o("Not supported")},get isAssignable(){return!1},assign:function(e,t,n){throw new o("Not supported")},visit:function(e){return null},toString:function(){return"AST"}},{})}(),e("AST",c),u=function(e){function t(){$traceurRuntime.superConstructor(t).apply(this,arguments)}return $traceurRuntime.createClass(t,{eval:function(e,t){return null},visit:function(e){}},{},e)}(c),e("EmptyExpr",u),l=function(e){function t(){$traceurRuntime.superConstructor(t).apply(this,arguments)}return $traceurRuntime.createClass(t,{eval:function(e,t){return e},visit:function(e){return e.visitImplicitReceiver(this)}},{},e)}(c),e("ImplicitReceiver",l),f=function(e){function t(e){$traceurRuntime.superConstructor(t).call(this),this.expressions=e}return $traceurRuntime.createClass(t,{eval:function(e,t){for(var n,i=0;in;case">":return n>r;case"<=":return r>=n;case">=":return n>=r;case"^":return n^r;case"&":return n&r}throw"Internal error [$operation] not handled"},visit:function(e){return e.visitBinary(this)}},{},e)}(c),e("Binary",C),R=function(e){function t(e){$traceurRuntime.superConstructor(t).call(this),this.expression=e}return $traceurRuntime.createClass(t,{eval:function(e,t){return!this.expression.eval(e,t)},visit:function(e){return e.visitPrefixNot(this)}},{},e)}(c),e("PrefixNot",R),E=function(e){function t(e,n){$traceurRuntime.superConstructor(t).call(this),this.target=e,this.value=n}return $traceurRuntime.createClass(t,{eval:function(e,t){return this.target.assign(e,t,this.value.eval(e,t))},visit:function(e){return e.visitAssignment(this)}},{},e)}(c),e("Assignment",E),x=function(e){function n(e,t,r,i){$traceurRuntime.superConstructor(n).call(this),this.receiver=e,this.name=t,this.fn=r,this.args=i}return $traceurRuntime.createClass(n,{eval:function(e,n){var o=t(e,n,this.args);if(this.receiver instanceof l&&r(n)&&n.contains(this.name)){var s=n.get(this.name);return i.apply(s,o)}var a=this.receiver.eval(e,n);return this.fn(a,o)},visit:function(e){return e.visitMethodCall(this)}},{},e)}(c),e("MethodCall",x),S=function(e){function r(e,t,n,i){$traceurRuntime.superConstructor(r).call(this),this.receiver=e,this.name=t,this.fn=n,this.args=i}return $traceurRuntime.createClass(r,{ +eval:function(e,r){var i=this.receiver.eval(e,r);if(n(i))return null;var o=t(e,r,this.args);return this.fn(i,o)},visit:function(e){return e.visitSafeMethodCall(this)}},{},e)}(c),e("SafeMethodCall",S),O=function(e){function n(e,t){$traceurRuntime.superConstructor(n).call(this),this.target=e,this.args=t}return $traceurRuntime.createClass(n,{eval:function(e,n){var r=this.target.eval(e,n);if(!(r instanceof Function))throw new o(r+" is not a function");return i.apply(r,t(e,n,this.args))},visit:function(e){return e.visitFunctionCall(this)}},{},e)}(c),e("FunctionCall",O),A=function(e){function t(e,n,r){$traceurRuntime.superConstructor(t).call(this),this.ast=e,this.source=n,this.location=r}return $traceurRuntime.createClass(t,{eval:function(e,t){return this.ast.eval(e,t)},get isAssignable(){return this.ast.isAssignable},assign:function(e,t,n){return this.ast.assign(e,t,n)},visit:function(e){return this.ast.visit(e)},toString:function(){return this.source+" in "+this.location}},{},e)}(c),e("ASTWithSource",A),D=function(){function e(e,t,n,r){this.key=e,this.keyIsVar=t,this.name=n,this.expression=r}return $traceurRuntime.createClass(e,{},{})}(),e("TemplateBinding",D),I=function(){function e(){}return $traceurRuntime.createClass(e,{visitImplicitReceiver:function(e){return e},visitInterpolation:function(e){return new w(e.strings,this.visitAll(e.expressions))},visitLiteralPrimitive:function(e){return new _(e.value)},visitAccessMember:function(e){return new p(e.receiver.visit(this),e.name,e.getter,e.setter)},visitSafeAccessMember:function(e){return new g(e.receiver.visit(this),e.name,e.getter,e.setter)},visitMethodCall:function(e){return new x(e.receiver.visit(this),e.name,e.fn,this.visitAll(e.args))},visitSafeMethodCall:function(e){return new S(e.receiver.visit(this),e.name,e.fn,this.visitAll(e.args))},visitFunctionCall:function(e){return new O(e.target.visit(this),this.visitAll(e.args))},visitLiteralArray:function(e){return new y(this.visitAll(e.expressions))},visitLiteralMap:function(e){return new b(e.keys,this.visitAll(e.values))},visitBinary:function(e){return new C(e.operation,e.left.visit(this),e.right.visit(this))},visitPrefixNot:function(e){return new R(e.expression.visit(this))},visitConditional:function(e){return new h(e.condition.visit(this),e.trueExp.visit(this),e.falseExp.visit(this))},visitPipe:function(e){return new v(e.exp.visit(this),e.name,this.visitAll(e.args))},visitKeyedAccess:function(e){return new m(e.obj.visit(this),e.key.visit(this))},visitAll:function(e){for(var t=s.createFixedSize(e.length),n=0;n=0;--t){var n=e[t];n.callOnAllChangesDone&&this._getDirectiveFor(n.directiveIndex).onAllChangesDone()}},_updateDirectiveOrElement:function(e,t){if(r(t.directiveRecord))this.dispatcher.notifyOnBinding(t,e.currentValue);else{var n=t.directiveRecord.directiveIndex;t.setter(this._getDirectiveFor(n),e.currentValue)}},_addChange:function(e,t,n){return e.callOnChange()?c.addChange(n,e.propertyName,t):n},_getDirectiveFor:function(e){return this.directives.getDirectiveFor(e)},_getDetectorFor:function(e){return this.directives.getDetectorFor(e)},_check:function(e,t){try{return e.isPipeRecord()?this._pipeCheck(e,t):this._referenceCheck(e,t)}catch(n){this.throwError(e,n,n.stack)}},_referenceCheck:function(e,n){if(this._pureFuncAndArgsDidNotChange(e))return this._setChanged(e,!1),null;var r=this._readSelf(e),i=this._calculateCurrValue(e);if(t(r,i))return this._setChanged(e,!1),null;if(e.lastInBinding){var o=c.simpleChange(r,i);return n&&c.throwOnChange(e,o),this._writeSelf(e,i),this._setChanged(e,!0),o}return this._writeSelf(e,i),this._setChanged(e,!0),null},_calculateCurrValue:function(e){switch(e.mode){case u.SELF:return this._readContext(e);case u.CONST:return e.funcOrValue;case u.PROPERTY:var t=this._readContext(e);return e.funcOrValue(t);case u.SAFE_PROPERTY:var t=this._readContext(e);return r(t)?null:e.funcOrValue(t);case u.LOCAL:return this.locals.get(e.name);case u.INVOKE_METHOD:var t=this._readContext(e),n=this._readArgs(e);return e.funcOrValue(t,n);case u.SAFE_INVOKE_METHOD:var t=this._readContext(e);if(r(t))return null;var n=this._readArgs(e);return e.funcOrValue(t,n);case u.KEYED_ACCESS:var s=this._readArgs(e)[0];return this._readContext(e)[s];case u.INVOKE_CLOSURE:return o.apply(this._readContext(e),this._readArgs(e));case u.INTERPOLATE:case u.PRIMITIVE_OP:return o.apply(e.funcOrValue,this._readArgs(e));default:throw new i("Unknown operation "+e.mode)}},_pipeCheck:function(e,n){var r=this._readContext(e),i=this._readArgs(e),o=this._pipeFor(e,r),s=this._readSelf(e),a=o.transform(r,i);if(t(s,a))return this._setChanged(e,!1),null;if(a=c.unwrapValue(a),e.lastInBinding){var u=c.simpleChange(s,a);return n&&c.throwOnChange(e,u),this._writeSelf(e,a),this._setChanged(e,!0),u}return this._writeSelf(e,a),this._setChanged(e,!0),null},_pipeFor:function(e,t){var r=this._readPipe(e);if(n(r)&&r.supports(t))return r;n(r)&&r.onDestroy();var i=this.pipes.get(e.name,t,this.ref);return this._writePipe(e,i),i},_readContext:function(e){return-1==e.contextIndex?this._getDirectiveFor(e.directiveIndex):this.values[e.contextIndex]},_readSelf:function(e){return this.values[e.selfIndex]},_writeSelf:function(e,t){this.values[e.selfIndex]=t},_readPipe:function(e){return this.localPipes[e.selfIndex]},_writePipe:function(e,t){this.localPipes[e.selfIndex]=t},_setChanged:function(e,t){this.changes[e.selfIndex]=t},_pureFuncAndArgsDidNotChange:function(e){return e.isPureFunction()&&!this._argsChanged(e)},_argsChanged:function(e){for(var t=e.args,n=0;n"+u(this.currentIndex)+"]"}},{})}(),e("CollectionChangeRecord",v),_=function(){function e(){this._head=null,this._tail=null}return $traceurRuntime.createClass(e,{add:function(e){null===this._head?(this._head=this._tail=e,e._nextDup=null,e._prevDup=null):(this._tail._nextDup=e,e._prevDup=this._tail,e._nextDup=null,this._tail=e)},get:function(e,t){var n;for(n=this._head;null!==n;n=n._nextDup)if((null===t||t"+o(this.currentValue)+"]"}},{})}(),e("KVChangeRecord",d)}}}),System.register("angular2/src/change_detection/pipes/observable_pipe",["angular2/src/facade/async","angular2/src/facade/lang","angular2/src/change_detection/pipes/pipe"],function(e){"use strict";var t,n,r,i,o,s,a,c,u;return{setters:[function(e){r=e.ObservableWrapper},function(e){i=e.isBlank,o=e.isPresent,s=e.CONST},function(e){a=e.WrappedValue}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=function(){function e(e){this._ref=e,this._latestValue=null,this._latestReturnedValue=null,this._subscription=null,this._observable=null}return $traceurRuntime.createClass(e,{supports:function(e){return r.isObservable(e)},onDestroy:function(){o(this._subscription)&&this._dispose()},transform:function(e){return void 0!==arguments[1]?arguments[1]:null,i(this._subscription)?(this._subscribe(e),null):e!==this._observable?(this._dispose(),this.transform(e)):this._latestValue===this._latestReturnedValue?this._latestReturnedValue:(this._latestReturnedValue=this._latestValue,a.wrap(this._latestValue))},_subscribe:function(e){var t=this;this._observable=e,this._subscription=r.subscribe(e,function(e){return t._updateLatestValue(e)},function(e){throw e})},_dispose:function(){r.dispose(this._subscription),this._latestValue=null,this._latestReturnedValue=null,this._subscription=null,this._observable=null},_updateLatestValue:function(e){this._latestValue=e,this._ref.requestCheck()}},{})}(),e("ObservablePipe",c),u=$traceurRuntime.createClass(function(){},{supports:function(e){return r.isObservable(e)},create:function(e){return new c(e)}},{}),e("ObservablePipeFactory",u),e("ObservablePipeFactory",u=t([s(),n("design:paramtypes",[])],u))}}}),System.register("angular2/src/change_detection/pipes/promise_pipe",["angular2/src/facade/lang","angular2/src/change_detection/pipes/pipe"],function(e){"use strict";var t,n,r,i,o,s,a,c,u;return{setters:[function(e){r=e.isBlank,i=e.isPresent,o=e.isPromise,s=e.CONST},function(e){a=e.WrappedValue}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=function(){function e(e){this._ref=e,this._latestValue=null,this._latestReturnedValue=null}return $traceurRuntime.createClass(e,{supports:function(e){return o(e)},onDestroy:function(){i(this._sourcePromise)&&(this._latestValue=null,this._latestReturnedValue=null,this._sourcePromise=null)},transform:function(e){var t=(void 0!==arguments[1]?arguments[1]:null,this);return r(this._sourcePromise)?(this._sourcePromise=e,e.then(function(n){t._sourcePromise===e&&t._updateLatestValue(n)}),null):e!==this._sourcePromise?(this._sourcePromise=null,this.transform(e)):this._latestValue===this._latestReturnedValue?this._latestReturnedValue:(this._latestReturnedValue=this._latestValue,a.wrap(this._latestValue))},_updateLatestValue:function(e){this._latestValue=e,this._ref.requestCheck()}},{})}(),e("PromisePipe",c),u=$traceurRuntime.createClass(function(){},{supports:function(e){return o(e)},create:function(e){return new c(e)}},{}),e("PromisePipeFactory",u),e("PromisePipeFactory",u=t([s(),n("design:paramtypes",[])],u))}}}),System.register("angular2/src/change_detection/pipes/uppercase_pipe",["angular2/src/facade/lang","angular2/src/change_detection/pipes/pipe"],function(e){"use strict";var t,n,r,i,o,s,a;return{setters:[function(e){r=e.isString,i=e.StringWrapper,o=e.CONST},function(e){s=e.BasePipe}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},a=function(e){function t(){$traceurRuntime.superConstructor(t).apply(this,arguments)}return $traceurRuntime.createClass(t,{supports:function(e){return r(e)},transform:function(e){return void 0!==arguments[1]?arguments[1]:null,i.toUpperCase(e)},create:function(e){return this}},{},e)}(s),e("UpperCasePipe",a),e("UpperCasePipe",a=t([o(),n("design:paramtypes",[])],a))}}}),System.register("angular2/src/change_detection/pipes/lowercase_pipe",["angular2/src/facade/lang","angular2/src/change_detection/pipes/pipe"],function(e){"use strict";var t,n,r,i,o,s,a;return{setters:[function(e){r=e.isString,i=e.StringWrapper,o=e.CONST},function(e){s=e.BasePipe}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},a=function(e){function t(){$traceurRuntime.superConstructor(t).apply(this,arguments)}return $traceurRuntime.createClass(t,{supports:function(e){return r(e)},transform:function(e){return void 0!==arguments[1]?arguments[1]:null,i.toLowerCase(e)},create:function(e){return this}},{},e)}(s),e("LowerCasePipe",a), +e("LowerCasePipe",a=t([o(),n("design:paramtypes",[])],a))}}}),System.register("angular2/src/change_detection/pipes/json_pipe",["angular2/src/facade/lang","angular2/src/change_detection/pipes/pipe"],function(e){"use strict";var t,n,r,i,o,s;return{setters:[function(e){r=e.Json,i=e.CONST},function(e){o=e.BasePipe}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=function(e){function t(){$traceurRuntime.superConstructor(t).apply(this,arguments)}return $traceurRuntime.createClass(t,{transform:function(e){return void 0!==arguments[1]?arguments[1]:null,r.stringify(e)},create:function(e){return this}},{},e)}(o),e("JsonPipe",s),e("JsonPipe",s=t([i(),n("design:paramtypes",[])],s))}}}),System.register("angular2/src/facade/math",["angular2/src/facade/lang"],function(e){"use strict";var t,n,r;return{setters:[function(e){t=e.global}],execute:function(){n=t.Math,e("Math",n),r=typeof r,e("NaN",r)}}}),System.register("angular2/src/facade/intl",[],function(e){"use strict";function t(e){return 2==e?"2-digit":"numeric"}function n(e){return 4>e?"short":"long"}function r(e){for(var r,i={},o=0;o=3?n(s):t(s);break;case"d":i.day=t(s);break;case"E":i.weekday=n(s);break;case"j":i.hour=t(s);break;case"h":i.hour=t(s),i.hour12=!0;break;case"H":i.hour=t(s),i.hour12=!1;break;case"m":i.minute=t(s);break;case"s":i.second=t(s);break;case"z":i.timeZoneName="long";break;case"Z":i.timeZoneName="short"}o=r}return i}var i,o,s,a;return{setters:[],execute:function(){e("NumberFormatStyle",i),function(e){e[e.DECIMAL=0]="DECIMAL",e[e.PERCENT=1]="PERCENT",e[e.CURRENCY=2]="CURRENCY"}(i||e("NumberFormatStyle",i={})),o=function(){function e(){}return $traceurRuntime.createClass(e,{},{format:function(e,t,n){var r,o,s,a,c=void 0!==arguments[3]?arguments[3]:{},u=void 0===(r=c.minimumIntegerDigits)?1:r,l=void 0===(o=c.minimumFractionDigits)?0:o,f=void 0===(s=c.maximumFractionDigits)?3:s,h=c.currency,d=void 0===(a=c.currencyAsSymbol)?!1:a,p={minimumIntegerDigits:u,minimumFractionDigits:l,maximumFractionDigits:f};return p.style=i[n].toLowerCase(),n==i.CURRENCY&&(p.currency=h,p.currencyDisplay=d?"symbol":"code"),new Intl.NumberFormat(t,p).format(e)}})}(),e("NumberFormatter",o),s=new Map,a=function(){function e(){}return $traceurRuntime.createClass(e,{},{format:function(e,t,n){var i=t+n;if(s.has(i))return s.get(i).format(e);var o=new Intl.DateTimeFormat(t,r(n));return s.set(i,o),o.format(e)}})}(),e("DateFormatter",a)}}}),System.register("angular2/src/change_detection/pipes/number_pipe",["angular2/src/facade/lang","angular2/src/facade/intl","angular2/src/facade/collection","angular2/src/change_detection/pipes/pipe"],function(e){"use strict";var t,n,r,i,o,s,a,c,u,l,f,h,d,p,g,m,v,_,y;return{setters:[function(e){r=e.isNumber,i=e.isPresent,o=e.isBlank,s=e.NumberWrapper,a=e.RegExpWrapper,c=e.BaseException,u=e.CONST},function(e){l=e.NumberFormatter,f=e.NumberFormatStyle},function(e){h=e.ListWrapper},function(e){d=e.BasePipe}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},p="en-US",g=a.create("^(\\d+)?\\.((\\d+)(\\-(\\d+))?)?$"),m=function(e){function t(){$traceurRuntime.superConstructor(t).apply(this,arguments)}return $traceurRuntime.createClass(t,{supports:function(e){return r(e)},create:function(e){return this}},{_format:function(e,t,n){var r=void 0!==arguments[3]?arguments[3]:null,u=void 0!==arguments[4]?arguments[4]:!1,f=1,h=0,d=3;if(i(n)){var m=a.firstMatch(g,n);if(o(m))throw new c(n+" is not a valid digit info for number pipes");i(m[1])&&(f=s.parseIntAutoRadix(m[1])),i(m[3])&&(h=s.parseIntAutoRadix(m[3])),i(m[5])&&(d=s.parseIntAutoRadix(m[5]))}return l.format(e,p,t,{minimumIntegerDigits:f,minimumFractionDigits:h,maximumFractionDigits:d,currency:r,currencyAsSymbol:u})}},e)}(d),e("NumberPipe",m),e("NumberPipe",m=t([u(),n("design:paramtypes",[])],m)),v=function(e){function t(){$traceurRuntime.superConstructor(t).apply(this,arguments)}return $traceurRuntime.createClass(t,{transform:function(e,t){var n=h.first(t);return m._format(e,f.DECIMAL,n)}},{},e)}(m),e("DecimalPipe",v),e("DecimalPipe",v=t([u(),n("design:paramtypes",[])],v)),_=function(e){function t(){$traceurRuntime.superConstructor(t).apply(this,arguments)}return $traceurRuntime.createClass(t,{transform:function(e,t){var n=h.first(t);return m._format(e,f.PERCENT,n)}},{},e)}(m),e("PercentPipe",_),e("PercentPipe",_=t([u(),n("design:paramtypes",[])],_)),y=function(e){function t(){$traceurRuntime.superConstructor(t).apply(this,arguments)}return $traceurRuntime.createClass(t,{transform:function(e,t){var n=i(t)&&t.length>0?t[0]:"USD",r=i(t)&&t.length>1?t[1]:!1,o=i(t)&&t.length>2?t[2]:null;return m._format(e,f.CURRENCY,o,n,r)}},{},e)}(m),e("CurrencyPipe",y),e("CurrencyPipe",y=t([u(),n("design:paramtypes",[])],y))}}}),System.register("angular2/src/change_detection/pipes/null_pipe",["angular2/src/facade/lang","angular2/src/change_detection/pipes/pipe"],function(e){"use strict";var t,n,r,i,o,s,a,c;return{setters:[function(e){r=e.isBlank,i=e.CONST},function(e){o=e.BasePipe,s=e.WrappedValue}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},a=$traceurRuntime.createClass(function(){},{supports:function(e){return c.supportsObj(e)},create:function(e){return new c}},{}),e("NullPipeFactory",a),e("NullPipeFactory",a=t([i(),n("design:paramtypes",[])],a)),c=function(e){function t(){for(var e,n=[],r=0;r=A&&T>=e||e==Re}function c(e){return e>=fe&&ye>=e||e>=re&&oe>=e||e==le||e==M}function u(e){return e>=fe&&ye>=e||e>=re&&oe>=e||e>=te&&ne>=e||e==le||e==M}function l(e){return e>=te&&ne>=e}function f(e){return e==he||e==ie}function h(e){return e==K||e==q}function d(e){switch(e){case pe:return D;case de:return j;case ge:return P;case me:return A;case _e:return I;default:return e}}var p,g,m,v,_,y,b,w,C,R,E,x,S,O,A,D,I,j,P,T,N,V,k,M,B,L,$,F,H,W,q,U,K,z,Q,G,Y,J,X,Z,ee,te,ne,re,ie,oe,se,ae,ce,ue,le,fe,he,de,pe,ge,me,ve,_e,ye,be,we,Ce,Re,Ee,xe,Se,Oe;return{setters:[function(e){m=e.Injectable},function(e){v=e.SetWrapper},function(e){_=e.NumberWrapper,y=e.StringJoiner,b=e.StringWrapper,w=e.BaseException,C=e.isPresent}],execute:function(){p=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},g=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},e("TokenType",R),function(e){e[e.CHARACTER=0]="CHARACTER",e[e.IDENTIFIER=1]="IDENTIFIER",e[e.KEYWORD=2]="KEYWORD",e[e.STRING=3]="STRING",e[e.OPERATOR=4]="OPERATOR",e[e.NUMBER=5]="NUMBER"}(R||e("TokenType",R={})),E=$traceurRuntime.createClass(function(){},{tokenize:function(e){for(var t=new xe(e),n=[],r=t.scanToken();null!=r;)n.push(r),r=t.scanToken();return n}},{}),e("Lexer",E),e("Lexer",E=p([m(),g("design:paramtypes",[])],E)),x=function(){function e(e,t,n,r){this.index=e,this.type=t,this.numValue=n,this.strValue=r}return $traceurRuntime.createClass(e,{isCharacter:function(e){return this.type==R.CHARACTER&&this.numValue==e},isNumber:function(){return this.type==R.NUMBER},isString:function(){return this.type==R.STRING},isOperator:function(e){return this.type==R.OPERATOR&&this.strValue==e},isIdentifier:function(){return this.type==R.IDENTIFIER},isKeyword:function(){return this.type==R.KEYWORD},isKeywordVar:function(){return this.type==R.KEYWORD&&"var"==this.strValue},isKeywordNull:function(){return this.type==R.KEYWORD&&"null"==this.strValue},isKeywordUndefined:function(){return this.type==R.KEYWORD&&"undefined"==this.strValue},isKeywordTrue:function(){return this.type==R.KEYWORD&&"true"==this.strValue},isKeywordIf:function(){return this.type==R.KEYWORD&&"if"==this.strValue},isKeywordElse:function(){return this.type==R.KEYWORD&&"else"==this.strValue},isKeywordFalse:function(){return this.type==R.KEYWORD&&"false"==this.strValue},toNumber:function(){return this.type==R.NUMBER?this.numValue:-1},toString:function(){switch(this.type){case R.CHARACTER:case R.STRING:case R.IDENTIFIER:case R.KEYWORD:return this.strValue;case R.NUMBER:return this.numValue.toString();default:return null}}},{})}(),e("Token",x),S=new x(-1,R.CHARACTER,0,""),e("EOF",S),O=0,e("$EOF",O),A=9,e("$TAB",A),D=10,e("$LF",D),I=11,e("$VTAB",I),j=12,e("$FF",j),P=13,e("$CR",P),T=32,e("$SPACE",T),N=33,e("$BANG",N),V=34,e("$DQ",V),k=35,e("$HASH",k),M=36,e("$$",M),B=37,e("$PERCENT",B),L=38,e("$AMPERSAND",L),$=39,e("$SQ",$),F=40,e("$LPAREN",F),H=41,e("$RPAREN",H),W=42,e("$STAR",W),q=43,e("$PLUS",q),U=44,e("$COMMA",U),K=45,e("$MINUS",K),z=46,e("$PERIOD",z),Q=47,e("$SLASH",Q),G=58,e("$COLON",G),Y=59,e("$SEMICOLON",Y),J=60,e("$LT",J),X=61,e("$EQ",X),Z=62,e("$GT",Z),ee=63,e("$QUESTION",ee),te=48,ne=57,re=65,ie=69,oe=90,se=91,e("$LBRACKET",se),ae=92,e("$BACKSLASH",ae),ce=93,e("$RBRACKET",ce),ue=94,le=95,fe=97,he=101,de=102,pe=110,ge=114,me=116,ve=117,_e=118,ye=122,be=123,e("$LBRACE",be),we=124,e("$BAR",we),Ce=125,e("$RBRACE",Ce),Re=160,Ee=function(e){function t(e){$traceurRuntime.superConstructor(t).call(this),this.message=e}return $traceurRuntime.createClass(t,{toString:function(){return this.message}},{},e)}(w),e("ScannerError",Ee),xe=function(){function e(e){this.input=e,this.peek=0,this.index=-1,this.length=e.length,this.advance()}return $traceurRuntime.createClass(e,{advance:function(){this.peek=++this.index>=this.length?O:b.charCodeAt(this.input,this.index)},scanToken:function(){for(var e=this.input,n=this.length,r=this.peek,i=this.index;T>=r;){if(++i>=n){r=O;break}r=b.charCodeAt(e,i)}if(this.peek=r,this.index=i,i>=n)return null;if(c(r))return this.scanIdentifier();if(l(r))return this.scanNumber(i);var o=i;switch(r){case z:return this.advance(),l(this.peek)?this.scanNumber(o):t(o,z);case F:case H:case be:case Ce:case se:case ce:case U:case G:case Y:return this.scanCharacter(o,r);case $:case V:return this.scanString();case k:case q:case K:case W:case Q:case B:case ue:return this.scanOperator(o,b.fromCharCode(r));case ee:return this.scanComplexOperator(o,"?",z,".");case J:case Z:return this.scanComplexOperator(o,b.fromCharCode(r),X,"=");case N:case X:return this.scanComplexOperator(o,b.fromCharCode(r),X,"=",X,"=");case L:return this.scanComplexOperator(o,"&",L,"&");case we:return this.scanComplexOperator(o,"|",we,"|");case Re:for(;a(this.peek);)this.advance();return this.scanToken()}return this.error("Unexpected character ["+b.fromCharCode(r)+"]",0),null},scanCharacter:function(e,n){return assert(this.peek==n),this.advance(),t(e,n)},scanOperator:function(e,t){return assert(this.peek==b.charCodeAt(t,0)),assert(v.has(Se,t)),this.advance(),i(e,t)},scanComplexOperator:function(e,t,n,r,o,s){assert(this.peek==b.charCodeAt(t,0)),this.advance();var a=t;return this.peek==n&&(this.advance(),a+=r),C(o)&&this.peek==o&&(this.advance(),a+=s),assert(v.has(Se,a)),i(e,a)},scanIdentifier:function(){assert(c(this.peek));var e=this.index;for(this.advance();u(this.peek);)this.advance();var t=this.input.substring(e,this.index);return v.has(Oe,t)?r(e,t):n(e,t)},scanNumber:function(e){assert(l(this.peek));var t=this.index===e;for(this.advance();;){if(l(this.peek));else if(this.peek==z)t=!1;else{if(!f(this.peek))break;this.advance(),h(this.peek)&&this.advance(),l(this.peek)||this.error("Invalid exponent",-1),t=!1}this.advance()}var n=this.input.substring(e,this.index),r=t?_.parseIntAutoRadix(n):_.parseFloat(n);return s(e,r)},scanString:function(){assert(this.peek==$||this.peek==V);var e=this.index,t=this.peek;this.advance();for(var n,r=this.index,i=this.input;this.peek!=t;)if(this.peek==ae){null==n&&(n=new y),n.add(i.substring(r,this.index)),this.advance();var s=void 0;if(this.peek==ve){var a=i.substring(this.index+1,this.index+5);try{s=_.parseInt(a,16)}catch(c){this.error("Invalid unicode escape [\\u"+a+"]",0)}for(var u=0;5>u;u++)this.advance()}else s=d(this.peek),this.advance();n.add(b.fromCharCode(s)),r=this.index}else this.peek==O?this.error("Unterminated quote",0):this.advance();var l=i.substring(r,this.index);this.advance();var f=l;return null!=n&&(n.add(l),f=n.toString()),o(e,f)},error:function(e,t){var n=this.index+t;throw new Ee("Lexer Error: "+e+" at column "+n+" in expression ["+this.input+"]")}},{})}(),Se=v.createFromList(["+","-","*","/","%","^","=","==","!=","===","!==","<",">","<=",">=","&&","||","&","|","!","?","#","?."]),Oe=v.createFromList(["var","null","undefined","true","false","if","else"])}}}),System.register("angular2/src/change_detection/parser/parser",["angular2/src/di/decorators","angular2/src/facade/lang","angular2/src/facade/collection","angular2/src/change_detection/parser/lexer","angular2/src/reflection/reflection","angular2/src/change_detection/parser/ast"],function(e){"use strict";var t,n,r,i,o,s,a,c,u,l,f,h,d,p,g,m,v,_,y,b,w,C,R,E,x,S,O,A,D,I,j,P,T,N,V,k,M,B,L,$,F,H,W,q,U,K,z,Q;return{setters:[function(e){r=e.Injectable},function(e){i=e.isBlank,o=e.isPresent,s=e.BaseException,a=e.StringWrapper},function(e){c=e.ListWrapper},function(e){u=e.Lexer,l=e.EOF,f=e.$PERIOD,h=e.$COLON,d=e.$SEMICOLON,p=e.$LBRACKET,g=e.$RBRACKET,m=e.$COMMA,v=e.$LBRACE,_=e.$RBRACE,y=e.$LPAREN,b=e.$RPAREN},function(e){w=e.reflector,C=e.Reflector},function(e){R=e.EmptyExpr,E=e.ImplicitReceiver,x=e.AccessMember,S=e.SafeAccessMember,O=e.LiteralPrimitive,A=e.Binary,D=e.PrefixNot,I=e.Conditional,j=e.If,P=e.BindingPipe,T=e.Assignment,N=e.Chain,V=e.KeyedAccess,k=e.LiteralArray,M=e.LiteralMap,B=e.Interpolation,L=e.MethodCall,$=e.SafeMethodCall,F=e.FunctionCall,H=e.TemplateBinding,W=e.ASTWithSource}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},q=new E,U=/\{\{(.*?)\}\}/g,K=$traceurRuntime.createClass(function(e){var t=void 0!==arguments[1]?arguments[1]:null;this._lexer=e,this._reflector=o(t)?t:w},{parseAction:function(e,t){var n=this._lexer.tokenize(e),r=new z(e,t,n,this._reflector,!0).parseChain();return new W(r,e,t)},parseBinding:function(e,t){var n=this._lexer.tokenize(e),r=new z(e,t,n,this._reflector,!1).parseChain();return new W(r,e,t)},parseSimpleBinding:function(e,t){var n=this._lexer.tokenize(e),r=new z(e,t,n,this._reflector,!1).parseSimpleBinding();return new W(r,e,t)},parseTemplateBindings:function(e,t){var n=this._lexer.tokenize(e);return new z(e,t,n,this._reflector,!1).parseTemplateBindings()},parseInterpolation:function(e,t){var n=a.split(e,U);if(n.length<=1)return null;for(var r=[],i=[],o=0;o"))e=new A(">",e,this.parseAdditive());else if(this.optionalOperator("<="))e=new A("<=",e,this.parseAdditive());else{if(!this.optionalOperator(">="))return e;e=new A(">=",e,this.parseAdditive())}},parseAdditive:function(){for(var e=this.parseMultiplicative();;)if(this.optionalOperator("+"))e=new A("+",e,this.parseMultiplicative());else{if(!this.optionalOperator("-"))return e;e=new A("-",e,this.parseMultiplicative())}},parseMultiplicative:function(){for(var e=this.parsePrefix();;)if(this.optionalOperator("*"))e=new A("*",e,this.parsePrefix());else if(this.optionalOperator("%"))e=new A("%",e,this.parsePrefix());else{if(!this.optionalOperator("/"))return e;e=new A("/",e,this.parsePrefix())}},parsePrefix:function(){return this.optionalOperator("+")?this.parsePrefix():this.optionalOperator("-")?new A("-",new O(0),this.parsePrefix()):this.optionalOperator("!")?new D(this.parsePrefix()):this.parseCallChain()},parseCallChain:function(){for(var e=this.parsePrimary();;)if(this.optionalCharacter(f))e=this.parseAccessMemberOrMethodCall(e,!1);else if(this.optionalOperator("?."))e=this.parseAccessMemberOrMethodCall(e,!0);else if(this.optionalCharacter(p)){var t=this.parsePipe();this.expectCharacter(g),e=new V(e,t)}else{if(!this.optionalCharacter(y))return e;var n=this.parseCallArguments();this.expectCharacter(b),e=new F(e,n)}},parsePrimary:function(){if(this.optionalCharacter(y)){var e=this.parsePipe();return this.expectCharacter(b),e}if(this.next.isKeywordNull()||this.next.isKeywordUndefined())return this.advance(),new O(null);if(this.next.isKeywordTrue())return this.advance(),new O(!0);if(this.next.isKeywordFalse())return this.advance(),new O(!1);if(this.parseAction&&this.next.isKeywordIf()){this.advance(),this.expectCharacter(y);var t=this.parseExpression();this.expectCharacter(b);var n,r=this.parseExpressionOrBlock();return this.next.isKeywordElse()&&(this.advance(),n=this.parseExpressionOrBlock()),new j(t,r,n)}if(this.optionalCharacter(p)){var i=this.parseExpressionList(g);return this.expectCharacter(g),new k(i)}if(this.next.isCharacter(v))return this.parseLiteralMap();if(this.next.isIdentifier())return this.parseAccessMemberOrMethodCall(q,!1);if(this.next.isNumber()){var o=this.next.toNumber();return this.advance(),new O(o)}if(this.next.isString()){var a=this.next.toString();return this.advance(),new O(a)}throw this.error(this.index>=this.tokens.length?"Unexpected end of expression: "+this.input:"Unexpected token "+this.next),new s("Fell through all cases in parsePrimary")},parseExpressionList:function(e){var t=[];if(!this.next.isCharacter(e))do t.push(this.parsePipe());while(this.optionalCharacter(m));return t},parseLiteralMap:function(){var e=[],t=[];if(this.expectCharacter(v),!this.optionalCharacter(_)){do{var n=this.expectIdentifierOrKeywordOrString();e.push(n),this.expectCharacter(h),t.push(this.parsePipe())}while(this.optionalCharacter(m));this.expectCharacter(_)}return new M(e,t)},parseAccessMemberOrMethodCall:function(e){var t=void 0!==arguments[1]?arguments[1]:!1,n=this.expectIdentifierOrKeyword();if(this.optionalCharacter(y)){var r=this.parseCallArguments();this.expectCharacter(b);var i=this.reflector.method(n);return t?new $(e,n,i,r):new L(e,n,i,r)}var o=this.reflector.getter(n),s=this.reflector.setter(n);return t?new S(e,n,o,s):new x(e,n,o,s)},parseCallArguments:function(){if(this.next.isCharacter(b))return[];var e=[];do e.push(this.parsePipe());while(this.optionalCharacter(m));return e},parseExpressionOrBlock:function(){if(this.optionalCharacter(v)){var e=this.parseBlockContent();return this.expectCharacter(_),e}return this.parseExpression()},parseBlockContent:function(){this.parseAction||this.error("Binding expression cannot contain chained expression");for(var e=[];this.index0?a.removeLast(t):null},returnView:function(e){var t=e.proto,n=this._pooledViewsPerProtoView.get(t);l(n)&&(n=[],this._pooledViewsPerProtoView.set(t,n));var r=n.length=0;e--)this.remove(e)},get:function(e){return this._getViews()[e].ref},get length(){return this._getViews().length},createEmbeddedView:function(e){var t=void 0!==arguments[1]?arguments[1]:-1;return-1==t&&(t=this.length),this.viewManager.createEmbeddedViewInContainer(this.element,t,e)},createHostView:function(){var e=void 0!==arguments[0]?arguments[0]:null,t=void 0!==arguments[1]?arguments[1]:-1,n=void 0!==arguments[2]?arguments[2]:null;return-1==t&&(t=this.length),this.viewManager.createHostViewInContainer(this.element,t,e,n)},insert:function(e){var t=void 0!==arguments[1]?arguments[1]:-1;return-1==t&&(t=this.length),this.viewManager.attachViewInContainer(this.element,t,e)},indexOf:function(e){return t.indexOf(this._getViews(),r(e))},remove:function(){var e=void 0!==arguments[0]?arguments[0]:-1;-1==e&&(e=this.length-1),this.viewManager.destroyViewInContainer(this.element,e)},detach:function(){var e=void 0!==arguments[0]?arguments[0]:-1;return-1==e&&(e=this.length-1),this.viewManager.detachViewInContainer(this.element,e)}},{})}(),e("ViewContainerRef",i)}}}),System.register("angular2/src/core/compiler/directive_lifecycle_reflector",["angular2/src/facade/lang","angular2/src/core/annotations_impl/annotations"],function(e){"use strict";function t(e,t,o){if(r(o.lifecycle))return-1!==o.lifecycle.indexOf(e);if(!(t instanceof n))return!1;var s=t.prototype;switch(e){case i.onAllChangesDone:return!!s.onAllChangesDone;case i.onChange:return!!s.onChange;case i.onCheck:return!!s.onCheck;case i.onDestroy:return!!s.onDestroy;case i.onInit:return!!s.onInit;default:return!1}}var n,r,i;return e("hasLifecycleHook",t),{setters:[function(e){n=e.Type,r=e.isPresent},function(e){i=e.LifecycleEvent}],execute:function(){}}}),System.register("angular2/src/core/compiler/query_list",["angular2/src/facade/collection"],function(e){"use strict";var t,n;return{setters:[function(e){t=e.ListWrapper}],execute:function(){n=function(){function e(){this._results=[],this._callbacks=[],this._dirty=!1}var n;return $traceurRuntime.createClass(e,(n={},Object.defineProperty(n,"reset",{value:function(e){this._results=e,this._dirty=!0},configurable:!0,enumerable:!0,writable:!0}),Object.defineProperty(n,"add",{value:function(e){this._results.push(e),this._dirty=!0},configurable:!0,enumerable:!0,writable:!0}),Object.defineProperty(n,"fireCallbacks",{value:function(){this._dirty&&(t.forEach(this._callbacks,function(e){return e()}),this._dirty=!1)},configurable:!0,enumerable:!0,writable:!0}),Object.defineProperty(n,"onChange",{value:function(e){this._callbacks.push(e)},configurable:!0,enumerable:!0,writable:!0}),Object.defineProperty(n,"removeCallback",{value:function(e){t.remove(this._callbacks,e)},configurable:!0,enumerable:!0,writable:!0}),Object.defineProperty(n,"length",{get:function(){return this._results.length},configurable:!0,enumerable:!0}),Object.defineProperty(n,"first",{get:function(){return t.first(this._results)},configurable:!0,enumerable:!0}),Object.defineProperty(n,"last",{get:function(){return t.last(this._results)},configurable:!0,enumerable:!0}),Object.defineProperty(n,"map",{value:function(e){return this._results.map(e)},configurable:!0,enumerable:!0,writable:!0}),Object.defineProperty(n,Symbol.iterator,{value:function(){return this._results[Symbol.iterator]()},configurable:!0,enumerable:!0,writable:!0}),n),{})}(),e("QueryList",n)}}}),System.register("angular2/src/core/annotations_impl/view",["angular2/src/facade/lang","angular2/src/render/api"],function(e){"use strict";var t,n,r,i;return{setters:[function(e){r=e.CONST},function(t){e("ViewEncapsulation",t.ViewEncapsulation)}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},i=$traceurRuntime.createClass(function(){var e=void 0!==arguments[0]?arguments[0]:{},t=e.templateUrl,n=e.template,r=e.directives,i=e.encapsulation,o=e.styles,s=e.styleUrls;this.templateUrl=t,this.template=n,this.styleUrls=s,this.styles=o,this.directives=r,this.encapsulation=i},{},{}),e("View",i),e("View",i=t([r(),n("design:paramtypes",[Object])],i))}}}),System.register("angular2/src/core/compiler/component_url_mapper",["angular2/di","angular2/src/facade/lang","angular2/src/facade/collection"],function(e){"use strict";var t,n,r,i,o,s,a;return{setters:[function(e){r=e.Injectable},function(e){i=e.isPresent},function(e){o=e.Map}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=$traceurRuntime.createClass(function(){},{getUrl:function(e){return"./"}},{}),e("ComponentUrlMapper",s),e("ComponentUrlMapper",s=t([r(),n("design:paramtypes",[])],s)),a=function(e){function t(){$traceurRuntime.superConstructor(t).call(this),this._componentUrls=new o}return $traceurRuntime.createClass(t,{setComponentUrl:function(e,t){this._componentUrls.set(e,t)},getUrl:function(e){var n=this._componentUrls.get(e);return i(n)?n:$traceurRuntime.superGet(this,t.prototype,"getUrl").call(this,e)}},{},e)}(s),e("RuntimeComponentUrlMapper",a)}}}),System.register("angular2/src/core/compiler/proto_view_factory",["angular2/di","angular2/src/facade/collection","angular2/src/facade/lang","angular2/src/reflection/reflection","angular2/src/change_detection/change_detection","angular2/src/render/api","angular2/src/core/compiler/view","angular2/src/core/compiler/element_injector"],function(e){"use strict";function t(e,t,i){var o=n(t),s=a(o);return r(e,o,s,i)}function n(e){var t=void 0!==arguments[1]?arguments[1]:null,r=void 0!==arguments[2]?arguments[2]:null,i=void 0!==arguments[3]?arguments[3]:null;E(i)&&(i=[]),i.push(new L(e,i.length,t,r));var o=i.length-1,s=0;return w.forEach(e.elementBinders,function(e){R(e.nestedProtoView)&&n(e.nestedProtoView,o,s,i),s++}),i}function r(e,t,n,r){return w.map(t,function(t){var i,o=t.renderProtoView.elementBinders,s=new M,a=s.getBindingRecords(t.renderProtoView.textBindings,o,r),c=s.getDirectiveRecords(o,r),u=P;t.renderProtoView.type===N.ViewType.COMPONENT?(u=e.changeDetection,i="comp"):i=t.renderProtoView.type===N.ViewType.HOST?"host":"embedded";var l=e.id+"_"+i+"_"+t.index,f=n[t.index];return new T(l,u,f,a,c,S())})}function i(e,t,n,r){var i=e.elementBinders,o=new V(e.type,e.transitiveNgContentCount>0,e.render,t,n,u(i),e.textBindings.length);return l(o,i,r),v(o,i),o}function o(e){return w.map(e,function(e){return s(e.renderProtoView)})}function s(e){var t=new Map;return C.forEach(e.variableBindings,function(e,n){t.set(n,e)}),t}function a(e){var t=w.createFixedSize(e.length);return w.forEach(e,function(e){var n=R(e.parentIndex)?t[e.parentIndex]:null;t[e.index]=c(n,e.renderProtoView)}),t}function c(e,t){var n=E(e)?[]:w.clone(e);return C.forEach(t.variableBindings,function(e,t){n.push(e)}),w.forEach(t.elementBinders,function(e){C.forEach(e.variableBindings,function(e,t){n.push(e)})}),n}function u(e){for(var t=new Map,n=0;n0&&a[0].metadata.type===N.DirectiveMetadata.COMPONENT_TYPE&&(c=a[0]);var u=h(r,s,i,c,a);d(e,r,i,u,c,a)}}function f(e,t,n){var r=0;do{var i=n[e];if(e=i.parentIndex,-1!==e){r+=i.distanceToParent;var o=t[e];if(R(o.protoElementInjector))return new $(o.protoElementInjector,r)}}while(-1!==e);return new $(null,0)}function h(e,t,n,r,i){var o=null,s=C.size(n.variableBindings)>0;if(i.length>0||s){var a=p(n,i);o=k.create(t.protoElementInjector,e,i,R(r),t.distance,a),o.attributes=n.readAttributes}return o}function d(e,t,n,r,i,o){var s=null;-1!==n.parentIndex&&(s=e.elementBinders[n.parentIndex]);var a=e.bindElement(s,n.distanceToParent,r,i);return e.bindEvent(n.eventBindings,t,-1),C.forEach(n.variableBindings,function(t,n){e.protoLocals.set(t,null)}),a}function p(e,t){var n=new Map;return C.forEach(e.variableBindings,function(r,i){var o=g(e,t,i);n.set(r,o)}),n}function g(e,t,n){for(var r,i=null,o=0;o0?h.removeAt(i,i.length-1):o++;break;default:i.push(a)}}if(""==t){for(;o-->0;)h.insert(i,0,"..");0===i.length&&i.push(".")}return t+i.join("/")+n}function i(e){var n=e[g.PATH];return n=l(n)?"":r(n),e[g.PATH]=n,t(e[g.SCHEME],e[g.USER_INFO],e[g.DOMAIN],e[g.PORT],n,e[g.QUERY_DATA],e[g.FRAGMENT])}function o(e,t){var r=n(t),o=n(e);if(u(r[g.SCHEME]))return i(r);r[g.SCHEME]=o[g.SCHEME];for(var s=g.SCHEME;s<=g.PORT;s++)l(r[s])&&(r[s]=o[s]);if("/"==r[g.PATH][0])return i(r);var a=o[g.PATH];l(a)&&(a="/");var c=a.lastIndexOf("/");return a=a.substring(0,c+1)+r[g.PATH],r[g.PATH]=a,i(r)}var s,a,c,u,l,f,h,d,p,g;return{setters:[function(e){c=e.Injectable},function(e){u=e.isPresent,l=e.isBlank,f=e.RegExpWrapper},function(e){h=e.ListWrapper}],execute:function(){s=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},d=$traceurRuntime.createClass(function(){},{resolve:function(e,t){return o(e,t)}},{}),e("UrlResolver",d),e("UrlResolver",d=s([c(),a("design:paramtypes",[])],d)),p=f.create("^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([\\w\\d\\-\\u0100-\\uffff.%]*)(?::([0-9]+))?)?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$"),function(e){e[e.SCHEME=1]="SCHEME",e[e.USER_INFO=2]="USER_INFO",e[e.DOMAIN=3]="DOMAIN",e[e.PORT=4]="PORT",e[e.PATH=5]="PATH",e[e.QUERY_DATA=6]="QUERY_DATA",e[e.FRAGMENT=7]="FRAGMENT"}(g||(g={}))}}}),System.register("angular2/src/services/app_root_url",["angular2/di"],function(e){"use strict";var t,n,r,i;return{setters:[function(e){r=e.Injectable}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},i=$traceurRuntime.createClass(function(e){this._value=e},{get value(){return this._value},set value(e){this._value=e}},{}),e("AppRootUrl",i),e("AppRootUrl",i=t([r(),n("design:paramtypes",[String])],i))}}}),System.register("angular2/src/core/exception_handler",["angular2/di","angular2/src/facade/lang","angular2/src/facade/collection"],function(e){"use strict";var t,n,r,i,o,s,a,c,u;return{setters:[function(e){r=e.Injectable},function(e){i=e.isPresent,o=e.isBlank,s=e.BaseException},function(e){a=e.isListLikeIterable}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=function(){function e(){this.res=[]}return $traceurRuntime.createClass(e,{log:function(e){this.res.push(e)},logGroup:function(e){this.res.push(e)},logGroupEnd:function(){}},{})}(),u=$traceurRuntime.createClass(function(e){var t=void 0!==arguments[1]?arguments[1]:!0;this.logger=e,this.rethrowException=t},{call:function(e){var t=void 0!==arguments[1]?arguments[1]:null,n=void 0!==arguments[2]?arguments[2]:null,r=this._findOriginalException(e),s=this._findOriginalStack(e),a=this._findContext(e);if(this.logger.logGroup("EXCEPTION: "+e),i(t)&&o(s)&&(this.logger.log("STACKTRACE:"),this.logger.log(this._longStackTrace(t))),i(n)&&this.logger.log("REASON: "+n),i(r)&&this.logger.log("ORIGINAL EXCEPTION: "+r),i(s)&&(this.logger.log("ORIGINAL STACKTRACE:"),this.logger.log(this._longStackTrace(s))),i(a)&&(this.logger.log("ERROR CONTEXT:"),this.logger.log(a)),this.logger.logGroupEnd(),this.rethrowException)throw e},_longStackTrace:function(e){return a(e)?e.join("\n\n-----async gap-----\n"):e.toString()},_findContext:function(e){try{return e instanceof s?i(e.context)?e.context:this._findContext(e.originalException):null; + +}catch(t){return null}},_findOriginalException:function(e){if(!(e instanceof s))return null;for(var t=e.originalException;t instanceof s&&i(t.originalException);)t=t.originalException;return t},_findOriginalStack:function(e){if(!(e instanceof s))return null;for(var t=e,n=e.originalStack;t instanceof s&&i(t.originalException);)t=t.originalException,t instanceof s&&i(t.originalException)&&(n=t.originalStack);return n}},{exceptionToString:function(e){var t=void 0!==arguments[1]?arguments[1]:null,n=void 0!==arguments[2]?arguments[2]:null,r=new c,i=new u(r,!1);return i.call(e,t,n),r.res.join("\n")}}),e("ExceptionHandler",u),e("ExceptionHandler",u=t([r(),n("design:paramtypes",[Object,Boolean])],u))}}}),System.register("angular2/src/render/xhr",[],function(e){"use strict";var t;return{setters:[],execute:function(){t=function(){function e(){}return $traceurRuntime.createClass(e,{get:function(e){return null}},{})}(),e("XHR",t)}}}),System.register("angular2/src/render/dom/compiler/style_url_resolver",["angular2/di","angular2/src/facade/lang","angular2/src/services/url_resolver"],function(e){"use strict";var t,n,r,i,o,s,a,c,u;return{setters:[function(e){r=e.Injectable},function(e){i=e.StringWrapper},function(e){o=e.UrlResolver}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=$traceurRuntime.createClass(function(e){this._resolver=e},{resolveUrls:function(e,t){return e=this._replaceUrls(e,a,t),e=this._replaceUrls(e,c,t)},_replaceUrls:function(e,t,n){var r=this;return i.replaceAllMapped(e,t,function(e){var t=e[1],o=i.replaceAll(e[2],u,""),s=e[3],a=r._resolver.resolve(n,o);return t+"'"+a+"'"+s})}},{}),e("StyleUrlResolver",s),e("StyleUrlResolver",s=t([r(),n("design:paramtypes",[o])],s)),a=/(url\()([^)]*)(\))/g,c=/(@import[\s]+(?!url\())['"]([^'"]*)['"](.*;)/g,u=/['"]/g}}}),System.register("angular2/src/core/zone/ng_zone",["angular2/src/facade/collection","angular2/src/facade/lang"],function(e){"use strict";var t,n,r,i,o,s;return{setters:[function(e){t=e.ListWrapper,n=e.StringMapWrapper},function(e){r=e.normalizeBlank,i=e.isPresent,o=e.global}],execute:function(){s=function(){function e(e){var t=e.enableLongStackTrace;this._inVmTurnDone=!1,this._pendingTimeouts=[],this._onTurnStart=null,this._onTurnDone=null,this._onEventDone=null,this._onErrorHandler=null,this._pendingMicrotasks=0,this._hasExecutedCodeInInnerZone=!1,this._nestedRun=0,o.zone?(this._disabled=!1,this._mountZone=o.zone,this._innerZone=this._createInnerZone(this._mountZone,t)):(this._disabled=!0,this._mountZone=null)}return $traceurRuntime.createClass(e,{overrideOnTurnStart:function(e){this._onTurnStart=r(e)},overrideOnTurnDone:function(e){this._onTurnDone=r(e)},overrideOnEventDone:function(e,t){var n=this,i=r(e);this._onEventDone=t?function(){n._pendingTimeouts.length||i()}:i},overrideOnErrorHandler:function(e){this._onErrorHandler=r(e)},run:function(e){return this._disabled?e():this._innerZone.run(e)},runOutsideAngular:function(e){return this._disabled?e():this._mountZone.run(e)},_createInnerZone:function(e,r){var o,s=this;return o=r?n.merge(Zone.longStackTraceZone,{onError:function(e){s._onError(this,e)}}):{onError:function(e){s._onError(this,e)}},e.fork(o).fork({$run:function(e){return function(){try{return s._nestedRun++,s._hasExecutedCodeInInnerZone||(s._hasExecutedCodeInInnerZone=!0,s._onTurnStart&&e.call(s._innerZone,s._onTurnStart)),e.apply(this,arguments)}finally{if(s._nestedRun--,0==s._pendingMicrotasks&&0==s._nestedRun&&!this._inVmTurnDone&&s._onTurnDone&&s._hasExecutedCodeInInnerZone)try{this._inVmTurnDone=!0,e.call(s._innerZone,s._onTurnDone),0===s._pendingMicrotasks&&i(s._onEventDone)&&s.runOutsideAngular(s._onEventDone)}finally{this._inVmTurnDone=!1,s._hasExecutedCodeInInnerZone=!1}}}},$scheduleMicrotask:function(e){return function(t){s._pendingMicrotasks++;var n=function(){try{t()}finally{s._pendingMicrotasks--}};e.call(this,n)}},$setTimeout:function(e){return function(n,r){for(var i=[],o=2;o=200&&300>=i?t.resolve(r):t.reject("Failed to load "+e,null)},n.onerror=function(){t.reject("Failed to load "+e,null)},n.send(),t.promise}},{},e)}(o),e("XHRImpl",s),e("XHRImpl",s=t([r(),n("design:paramtypes",[])],s))}}}),System.register("angular2/src/render/dom/events/event_manager",["angular2/src/facade/lang","angular2/src/dom/dom_adapter"],function(e){"use strict";var t,n,r,i,o,s,a;return{setters:[function(e){t=e.BaseException,n=e.StringWrapper},function(e){r=e.DOM}],execute:function(){i="^",o=function(){function e(e,t){this._plugins=e,this._zone=t;for(var n=0;n"),t.toString()}function n(e,t,n){s(n)&&e.add(0===n.length?" "+t:" "+t+'="'+n+'"')}var r,i,o,s,a,c,u;return{setters:[function(e){r=e.MapWrapper},function(e){i=e.DOM},function(e){o=e.isBlank,s=e.isPresent,a=e.StringJoiner,c=e.assertionsEnabled}],execute:function(){u=function(){function e(e){var n=void 0!==arguments[1]?arguments[1]:"";this.element=e,this._attrs=null,this._classList=null,this.isViewRoot=!1,this.inheritedProtoView=null,this.distanceToInheritedBinder=0,this.inheritedElementBinder=null,this.compileChildren=!0;var r=c()?t(e):null;""!==n?(this.elementDescription=n,s(r)&&(this.elementDescription+=": "+r)):this.elementDescription=r}return $traceurRuntime.createClass(e,{isBound:function(){return s(this.inheritedElementBinder)&&0===this.distanceToInheritedBinder},bindElement:function(){if(!this.isBound()){var e=this.inheritedElementBinder;this.inheritedElementBinder=this.inheritedProtoView.bindElement(this.element,this.elementDescription),s(e)&&this.inheritedElementBinder.setParent(e,this.distanceToInheritedBinder),this.distanceToInheritedBinder=0}return this.inheritedElementBinder},refreshAttrs:function(){this._attrs=null},attrs:function(){return o(this._attrs)&&(this._attrs=i.attributeMap(this.element)),this._attrs},refreshClassList:function(){this._classList=null},classList:function(){if(o(this._classList)){this._classList=[];for(var e=i.classList(this.element),t=0;t0)for(var a=d.childNodes(e),c=0;c0)for(var f=d.childNodes(l),h=0;h0&&(e+="="+o),e+="]"}return n.forEach(this.notSelectors,function(t){e+=":not("+t.toString()+")"}),e}},{parse:function(t){for(var a,u=[],f=function(e,t){t.notSelectors.length>0&&i(t.element)&&n.isEmpty(t.classNames)&&n.isEmpty(t.attrs)&&(t.element="*"),e.push(t)},h=new e,d=o.matcher(l,t),p=h,g=!1;r(a=s.next(d));){if(r(a[1])){if(g)throw new c("Nesting :not is not allowed in a selector");g=!0,p=new e,h.notSelectors.push(p)}if(r(a[2])&&p.setElement(a[2]),r(a[3])&&p.addClassName(a[3]),r(a[4])&&p.addAttribute(a[4],a[5]),r(a[6])&&(g=!1,p=h),r(a[7])){if(g)throw new c("Multiple selectors in :not are not supported");f(u,h),h=p=new e}}return f(u,h),u}})}(),e("CssSelector",f),h=function(){function e(){this._elementMap=new t,this._elementPartialMap=new t,this._classMap=new t,this._classPartialMap=new t,this._attrValueMap=new t,this._attrValuePartialMap=new t,this._listContexts=[]}return $traceurRuntime.createClass(e,{addSelectables:function(e,t){var n=null;e.length>1&&(n=new d(e),this._listContexts.push(n));for(var r=0;r0&&(i(this.listContext)||!this.listContext.alreadyMatched)){var o=h.createNotMatcher(this.notSelectors);n=!o.match(e,null)}return n&&r(t)&&(i(this.listContext)||!this.listContext.alreadyMatched)&&(r(this.listContext)&&(this.listContext.alreadyMatched=!0), +t(this.selector,this.cbContext)),n}},{})}(),e("SelectorContext",p)}}}),System.register("angular2/src/render/dom/compiler/view_splitter",["angular2/src/facade/lang","angular2/src/dom/dom_adapter","angular2/src/facade/collection","angular2/src/render/dom/compiler/compile_element","angular2/src/render/dom/util"],function(e){"use strict";var t,n,r,i,o,s,a,c;return{setters:[function(e){t=e.isPresent,n=e.BaseException,r=e.StringWrapper},function(e){i=e.DOM},function(e){o=e.MapWrapper},function(e){s=e.CompileElement},function(e){a=e.dashCaseToCamelCase}],execute:function(){c=function(){function e(e){this._parser=e}return $traceurRuntime.createClass(e,{processStyle:function(e){return e},processElement:function(e,a,c){var u=a.attrs(),l=u.get("template"),f=t(l);if(o.forEach(u,function(e,t){if(r.startsWith(t,"*")){var i=r.substring(t,1);if(f)throw new n("Only one template directive per element is allowed: "+(l+" and "+i+" cannot be used simultaneously ")+("in "+a.elementDescription));l=0==e.length?i:i+" "+e,f=!0}}),t(e)){if(i.isTemplateElement(a.element)&&!a.isViewRoot){var h=new s(i.createTemplate(""));h.inheritedProtoView=a.bindElement().bindNestedProtoView(h.element),h.elementDescription=a.elementDescription,h.isViewRoot=!0,this._moveChildNodes(i.content(a.element),i.content(h.element)),c.addChild(h)}if(f){var d=new s(i.createTemplate(""));d.inheritedProtoView=a.inheritedProtoView,d.inheritedElementBinder=a.inheritedElementBinder,d.distanceToInheritedBinder=a.distanceToInheritedBinder,d.elementDescription=a.elementDescription;var h=new s(i.createTemplate(""));h.inheritedProtoView=d.bindElement().bindNestedProtoView(h.element),h.elementDescription=a.elementDescription,h.isViewRoot=!0,a.inheritedProtoView=h.inheritedProtoView,a.inheritedElementBinder=null,a.distanceToInheritedBinder=0,this._parseTemplateBindings(l,d),i.insertBefore(a.element,d.element),c.addParent(d),i.appendChild(i.content(h.element),a.element),c.addParent(h)}}},_moveChildNodes:function(e,n){for(var r=i.firstChild(e);t(r);)i.appendChild(n,r),r=i.firstChild(e)},_parseTemplateBindings:function(e,n){for(var r=this._parser.parseTemplateBindings(e,n.elementDescription),o=0;o","+","~"],a=e,u="["+t+"]",l=0;l0&&!i.contains(r,t)&&!o.contains(t,u)){var n=/([^:]*)(:*)(.*)/g,a=s.firstMatch(n,t);c(a)&&(e=a[1]+u+a[2]+a[3])}return e}).join(f)}return a},_insertPolyfillHostInCssText:function(e){return e=o.replaceAll(e,E,g),e=o.replaceAll(e,R,p)},_propertiesFromRule:function(e){var t=e.style.cssText,n=/['"]+|attr/g;if(e.style.content.length>0&&!c(s.firstMatch(n,e.style.content))){var r=/content:[^;]*;/g;t=o.replaceAll(t,r,"content: '"+e.style.content+"';")}return t}},{})}(),e("ShadowCss",l),f=/polyfill-next-selector[^}]*content:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim,h=/(polyfill-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim,d=/(polyfill-unscoped-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim,p="-shadowcsshost",g="-shadowcsscontext",m=")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)",v=s.create("("+p+m,"im"),_=s.create("("+g+m,"im"),y=p+"-no-combinator",b=[/>>>/g,/::shadow/g,/::content/g,/\/deep\//g,/\/shadow-deep\//g,/\/shadow\//g],w="([>\\s~+[.,{:][\\s\\S]*)?$",C=s.create(p,"im"),R=/:host/gim,E=/:host-context/gim}}}),System.register("angular2/src/render/dom/view/proto_view_merger",["angular2/src/dom/dom_adapter","angular2/src/facade/lang","angular2/src/facade/collection","angular2/src/render/dom/view/proto_view","angular2/src/render/dom/view/element_binder","angular2/src/render/api","angular2/src/render/dom/util"],function(e){"use strict";function t(e){var t=[],s=[];n(e,t,s);var c=t[0];o(t,s);var u=[],l=new Set;a(t,s,u,l),r(t);var f=m(u),h=u.map(function(e){return e.length}),d=S.content(f),p=W(d,!1),g=new Map,y=i(t),b=v(d,y,g),x=_(t,p,l,y,g),O=w(t,p),A=C(t,g),D=R(t,s),I=E(s),j=T.create(c.original.type,f,c.original.encapsulation,h,b,x,new Map);return new M(new N(j),h.length,O,p.length,A,D,I)}function n(e,t,r){var i=V(e[0]),o=t.length;t.push(H(i,!1)),0===r.length&&r.push([null,null]);for(var s=1,a=0;a=1;n--){var r=e[n];O(r)&&(t[r[0]]+=t[n]+1)}return t}function x(e){for(var t=new Map,n=0;n")),e("appComponentRefPromiseToken",r),i=n(new t("RootComponent")),e("appComponentTypeToken",i)}}}),System.register("angular2/src/core/annotations/annotations",["angular2/src/core/annotations_impl/annotations"],function(e){"use strict";return{setters:[function(t){e("ComponentAnnotation",t.Component),e("DirectiveAnnotation",t.Directive),e("LifecycleEvent",t.LifecycleEvent)}],execute:function(){}}}),System.register("angular2/src/core/annotations/view",["angular2/src/core/annotations_impl/view"],function(e){"use strict";return{setters:[function(t){e("ViewAnnotation",t.View),e("ViewEncapsulation",t.ViewEncapsulation)}],execute:function(){}}}),System.register("angular2/src/core/annotations/di",["angular2/src/core/annotations_impl/di"],function(e){"use strict";return{setters:[function(t){e("QueryAnnotation",t.Query),e("ViewQueryAnnotation",t.ViewQuery),e("AttributeAnnotation",t.Attribute)}],execute:function(){}}}),System.register("angular2/src/core/annotations/decorators",["angular2/src/core/annotations/annotations","angular2/src/core/annotations/view","angular2/src/core/annotations/di","angular2/src/util/decorators"],function(e){"use strict";var t,n,r,i,o,s,a,c,u,l,f,h,d,p;return{setters:[function(e){t=e.ComponentAnnotation,n=e.DirectiveAnnotation},function(e){r=e.ViewAnnotation},function(e){i=e.AttributeAnnotation,o=e.QueryAnnotation,s=e.ViewQueryAnnotation},function(e){a=e.makeDecorator,c=e.makeParamDecorator}],execute:function(){u=a(t,function(e){return e.View=f}),e("Component",u),l=a(n),e("Directive",l),f=a(r,function(e){return e.View=f}),e("View",f),h=c(i),e("Attribute",h),d=c(o),e("Query",d),p=c(s),e("ViewQuery",p)}}}),System.register("angular2/core",["angular2/src/core/application_tokens","angular2/src/core/application_common","angular2/src/services/app_root_url","angular2/src/services/url_resolver","angular2/src/core/compiler/component_url_mapper","angular2/src/core/compiler/directive_resolver","angular2/src/core/compiler/compiler","angular2/src/core/compiler/view_manager","angular2/src/core/compiler/query_list","angular2/src/core/compiler/dynamic_component_loader","angular2/src/core/compiler/element_ref","angular2/src/core/compiler/template_ref","angular2/src/core/compiler/view_ref","angular2/src/core/compiler/view_container_ref","angular2/src/core/zone/ng_zone","angular2/src/facade/async"],function(e){"use strict";return{setters:[function(t){e("appComponentTypeToken",t.appComponentTypeToken)},function(t){e("ApplicationRef",t.ApplicationRef)},function(t){e("AppRootUrl",t.AppRootUrl)},function(t){e("UrlResolver",t.UrlResolver)},function(t){e("ComponentUrlMapper",t.ComponentUrlMapper)},function(t){e("DirectiveResolver",t.DirectiveResolver)},function(t){e("Compiler",t.Compiler)},function(t){e("AppViewManager",t.AppViewManager)},function(t){e("QueryList",t.QueryList)},function(t){e("DynamicComponentLoader",t.DynamicComponentLoader),e("ComponentRef",t.ComponentRef)},function(t){e("ElementRef",t.ElementRef)},function(t){e("TemplateRef",t.TemplateRef)},function(t){e("ViewRef",t.ViewRef),e("ProtoViewRef",t.ProtoViewRef)},function(t){e("ViewContainerRef",t.ViewContainerRef)},function(t){e("NgZone",t.NgZone)},function(t){e("Observable",t.Observable),e("EventEmitter",t.EventEmitter)}],execute:function(){}}}),System.register("angular2/src/directives/ng_for",["angular2/annotations","angular2/core","angular2/change_detection","angular2/src/facade/lang"],function(e){"use strict";var t,n,r,i,o,s,a,c,u,l,f,h;return{setters:[function(e){r=e.Directive,i=e.LifecycleEvent},function(e){o=e.ViewContainerRef,s=e.TemplateRef},function(e){a=e.ChangeDetectorRef,c=e.Pipes},function(e){u=e.isPresent,l=e.isBlank}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},f=$traceurRuntime.createClass(function(e,t,n,r){this.viewContainer=e,this.templateRef=t,this.pipes=n,this.cdr=r},{set ngForOf(e){this._ngForOf=e,this._pipe=this.pipes.get("iterableDiff",e,this.cdr,this._pipe)},onCheck:function(){var e=this._pipe.transform(this._ngForOf,null);u(e)&&this._applyChanges(e.wrapped)},_applyChanges:function(e){if(l(e))return void this.viewContainer.clear();var t=[];e.forEachRemovedItem(function(e){return t.push(new h(e,null))}),e.forEachMovedItem(function(e){return t.push(new h(e,null))});var n=f.bulkRemove(t,this.viewContainer);e.forEachAddedItem(function(e){return n.push(new h(e,null))}),f.bulkInsert(n,this.viewContainer,this.templateRef);for(var r=0;r=0;r--){var i=e[r];u(i.record.currentIndex)?(i.view=t.detach(i.record.previousIndex),n.push(i)):t.remove(i.record.previousIndex)}return n},bulkInsert:function(e,t,n){e.sort(function(e,t){return e.record.currentIndex-t.record.currentIndex});for(var r=0;r0)throw new h(e+" pending connections to be resolved")},resolveAllConnections:function(){c.subscribe(this.connections,function(e){return e.readyState=4})},createConnection:function(e){if(!(l(e)&&e instanceof i))throw new h("createConnection requires an instance of Request, got "+e);var t=new d(e);return c.callNext(this.connections,t),t}},{}),e("MockBackend",p),e("MockBackend",p=t([r(),f(a),n("design:paramtypes",[])],p))}}}),System.register("angular2/src/http/url_search_params",["angular2/src/facade/lang","angular2/src/facade/collection"],function(e){"use strict";function t(e){var t=new i,o=r.split(e,new RegExp("&"));return s.forEach(o,function(e){var i=r.split(e,new RegExp("=")),o=s.get(i,0),a=s.get(i,1),c=n(t.get(o))?t.get(o):[];c.push(a),t.set(o,c)}),t}var n,r,i,o,s,a,c;return{setters:[function(e){n=e.isPresent,r=e.StringWrapper},function(e){i=e.Map,o=e.MapWrapper,s=e.ListWrapper,a=e.isListLikeIterable}],execute:function(){c=function(){function e(e){this.rawParams=e,this.paramsMap=t(e)}return $traceurRuntime.createClass(e,{has:function(e){return this.paramsMap.has(e)},get:function(e){var t=this.paramsMap.get(e);return a(t)?s.first(t):null},getAll:function(e){var t=this.paramsMap.get(e);return n(t)?t:[]},append:function(e,t){var r=this.paramsMap.get(e),i=n(r)?r:[];i.push(t),this.paramsMap.set(e,i)},toString:function(){var e=[];return o.forEach(this.paramsMap,function(t,n){s.forEach(t,function(t){e.push(n+"="+t)})}),s.join(e,"&")},"delete":function(e){o["delete"](this.paramsMap,e)}},{})}(),e("URLSearchParams",c)}}}),System.register("angular2/src/forms/validators",["angular2/src/facade/lang","angular2/src/facade/collection"],function(e){"use strict";var t,n,r,i,o;return{setters:[function(e){t=e.isBlank,n=e.isPresent},function(e){r=e.ListWrapper,i=e.StringMapWrapper}],execute:function(){o=function(){function e(){}return $traceurRuntime.createClass(e,{},{required:function(e){return t(e.value)||""==e.value?{required:!0}:null},nullValidator:function(e){return null},compose:function(e){return function(t){var o=r.reduce(e,function(e,r){var o=r(t);return n(o)?i.merge(e,o):e},{});return i.isEmpty(o)?null:o}},group:function(t){var r={};return i.forEach(t.controls,function(i,o){t.contains(o)&&n(i.errors)&&e._mergeErrors(i,r)}),i.isEmpty(r)?null:r},array:function(t){var o={};return r.forEach(t.controls,function(t){n(t.errors)&&e._mergeErrors(t,o)}),i.isEmpty(o)?null:o},_mergeErrors:function(e,t){i.forEach(e.errors,function(n,r){i.contains(t,r)||(t[r]=[]);var o=t[r];o.push(e)})}})}(),e("Validators",o)}}}),System.register("angular2/src/forms/directives/abstract_control_directive",[],function(e){"use strict";var t;return{setters:[],execute:function(){t=function(){function e(){}return $traceurRuntime.createClass(e,{get control(){return null},get value(){return this.control.value},get valid(){return this.control.valid},get errors(){return this.control.errors},get pristine(){return this.control.pristine},get dirty(){return this.control.dirty},get touched(){return this.control.touched},get untouched(){return this.control.untouched}},{})}(),e("AbstractControlDirective",t)}}}),System.register("angular2/src/forms/directives/control_container",["angular2/src/forms/directives/abstract_control_directive"],function(e){"use strict";var t,n;return{setters:[function(e){t=e.AbstractControlDirective}],execute:function(){n=function(e){function t(){$traceurRuntime.superConstructor(t).apply(this,arguments)}return $traceurRuntime.createClass(t,{get formDirective(){return null},get path(){return null}},{},e)}(t),e("ControlContainer",n)}}}),System.register("angular2/src/forms/directives/ng_control",["angular2/src/forms/directives/abstract_control_directive"],function(e){"use strict";var t,n;return{setters:[function(e){t=e.AbstractControlDirective}],execute:function(){n=function(e){function t(){for(var e,n=[],r=0;r ");throw new l(t+" '"+n+"'")}function o(e,t,n,r){e.setElementProperty(t,n,r)}function s(e,t){if(!c.contains(e,"model"))return!1;var n=e.model;return n.isFirstChange()?!0:!f(t,n.currentValue)}var a,c,u,l,f,h;return e("controlPath",t),e("setUpControl",n),e("composeNgValidator",r),e("setProperty",o),e("isPropertyUpdated",s),{setters:[function(e){a=e.ListWrapper,c=e.StringMapWrapper},function(e){u=e.isBlank,l=e.BaseException,f=e.looseIdentical},function(e){h=e.Validators}],execute:function(){}}}),System.register("angular2/src/forms/directives/ng_form_control",["angular2/src/facade/lang","angular2/src/facade/async","angular2/core","angular2/annotations","angular2/di","angular2/src/forms/directives/ng_control","angular2/src/forms/directives/validators","angular2/src/forms/directives/shared"],function(e){"use strict";var t,n,r,i,o,s,a,c,u,l,f,h,d,p,g,m,v,_,y;return{setters:[function(e){i=e.CONST_EXPR},function(e){o=e.EventEmitter,s=e.ObservableWrapper},function(e){a=e.QueryList},function(e){c=e.Query,u=e.Directive,l=e.LifecycleEvent},function(e){f=e.forwardRef,h=e.Binding},function(e){d=e.NgControl},function(e){p=e.NgValidator},function(e){g=e.setUpControl,m=e.composeNgValidator,v=e.isPropertyUpdated}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},r=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}},_=i(new h(d,{toAlias:f(function(){return y})})),y=function(e){function t(e){$traceurRuntime.superConstructor(t).call(this),this.update=new o,this._added=!1,this.ngValidators=e}return $traceurRuntime.createClass(t,{onChange:function(e){this._added||(g(this.form,this),this.form.updateValidity(),this._added=!0),v(e,this.viewModel)&&this.form.updateValue(this.model)},get path(){return[]},get control(){return this.form},get validator(){return m(this.ngValidators)},viewToModelUpdate:function(e){this.viewModel=e,s.callNext(this.update,e)}},{},e)}(d),e("NgFormControl",y),e("NgFormControl",y=t([u({selector:"[ng-form-control]",hostInjector:[_],properties:["form: ngFormControl","model: ngModel"],events:["update: ngModel"],lifecycle:[l.onChange],exportAs:"form"}),r(0,c(p)),n("design:paramtypes",[a])],y))}}}),System.register("angular2/src/forms/directives/ng_model",["angular2/src/facade/lang","angular2/src/facade/async","angular2/core","angular2/annotations","angular2/di","angular2/src/forms/directives/ng_control","angular2/src/forms/model","angular2/src/forms/directives/validators","angular2/src/forms/directives/shared"],function(e){"use strict";var t,n,r,i,o,s,a,c,u,l,f,h,d,p,g,m,v,_,y,b;return{setters:[function(e){i=e.CONST_EXPR},function(e){o=e.EventEmitter,s=e.ObservableWrapper},function(e){a=e.QueryList},function(e){c=e.Query,u=e.Directive,l=e.LifecycleEvent},function(e){f=e.forwardRef,h=e.Binding},function(e){d=e.NgControl},function(e){p=e.Control},function(e){g=e.NgValidator},function(e){m=e.setUpControl,v=e.composeNgValidator,_=e.isPropertyUpdated}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},r=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}},y=i(new h(d,{toAlias:f(function(){return b})})),b=function(e){function t(e){$traceurRuntime.superConstructor(t).call(this),this._control=new p,this._added=!1,this.update=new o,this.ngValidators=e}return $traceurRuntime.createClass(t,{onChange:function(e){this._added||(m(this._control,this),this._control.updateValidity(),this._added=!0),_(e,this.viewModel)&&this._control.updateValue(this.model)},get control(){return this._control},get path(){return[]},get validator(){return v(this.ngValidators)},viewToModelUpdate:function(e){this.viewModel=e,s.callNext(this.update,e)}},{},e)}(d),e("NgModel",b),e("NgModel",b=t([u({selector:"[ng-model]:not([ng-control]):not([ng-form-control])",hostInjector:[y],properties:["model: ngModel"],events:["update: ngModel"],lifecycle:[l.onChange],exportAs:"form"}),r(0,c(g)),n("design:paramtypes",[a])],b))}}}),System.register("angular2/src/forms/directives/ng_control_group",["angular2/annotations","angular2/di","angular2/src/facade/lang","angular2/src/forms/directives/control_container","angular2/src/forms/directives/shared"],function(e){"use strict";var t,n,r,i,o,s,a,c,u,l,f,h,d;return{setters:[function(e){i=e.Directive,o=e.LifecycleEvent},function(e){s=e.Ancestor,a=e.forwardRef,c=e.Binding},function(e){u=e.CONST_EXPR},function(e){l=e.ControlContainer},function(e){f=e.controlPath}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},r=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}},h=u(new c(l,{toAlias:a(function(){return d})})),d=function(e){function t(e){$traceurRuntime.superConstructor(t).call(this),this._parent=e}return $traceurRuntime.createClass(t,{onInit:function(){this.formDirective.addControlGroup(this)},onDestroy:function(){this.formDirective.removeControlGroup(this)},get control(){return this.formDirective.getControlGroup(this)},get path(){return f(this.name,this._parent)},get formDirective(){return this._parent.formDirective}},{},e)}(l),e("NgControlGroup",d),e("NgControlGroup",d=t([i({selector:"[ng-control-group]",hostInjector:[h],properties:["name: ng-control-group"],lifecycle:[o.onInit,o.onDestroy],exportAs:"form"}),r(0,s()),n("design:paramtypes",[l])],d))}}}),System.register("angular2/src/forms/directives/ng_form_model",["angular2/src/facade/lang","angular2/src/facade/collection","angular2/src/facade/async","angular2/annotations","angular2/di","angular2/src/forms/directives/control_container","angular2/src/forms/directives/shared"],function(e){"use strict";var t,n,r,i,o,s,a,c,u,l,f,h,d,p;return{setters:[function(e){r=e.CONST_EXPR},function(e){i=e.ListWrapper},function(e){o=e.ObservableWrapper,s=e.EventEmitter},function(e){a=e.Directive,c=e.LifecycleEvent},function(e){u=e.forwardRef,l=e.Binding},function(e){f=e.ControlContainer},function(e){h=e.setUpControl}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},d=r(new l(f,{toAlias:u(function(){return p})})),p=function(e){function t(){for(var e,n=[],r=0;r1?e[1]:null;return this.control(t,n)}return this.control(e)}},{}),e("FormBuilder",u),e("FormBuilder",u=t([r(),n("design:paramtypes",[])],u))}}}),System.register("angular2/src/di/metadata",["angular2/src/facade/lang"],function(e){"use strict";var t,n,r,i,o,s,a,c,u,l,f,h,d,p,g;return{setters:[function(e){r=e.CONST,i=e.CONST_EXPR,o=e.stringify,s=e.isBlank}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},a=$traceurRuntime.createClass(function(e){this.token=e},{toString:function(){return"@Inject("+o(this.token)+")"}},{}),e("InjectMetadata",a),e("InjectMetadata",a=t([r(),n("design:paramtypes",[Object])],a)),c=$traceurRuntime.createClass(function(){},{toString:function(){return"@Optional()"}},{}),e("OptionalMetadata",c),e("OptionalMetadata",c=t([r(),n("design:paramtypes",[])],c)),u=$traceurRuntime.createClass(function(){},{get token(){return null}},{}),e("DependencyMetadata",u),e("DependencyMetadata",u=t([r(),n("design:paramtypes",[])],u)),l=$traceurRuntime.createClass(function(){},{},{}),e("InjectableMetadata",l),e("InjectableMetadata",l=t([r(),n("design:paramtypes",[])],l)),f=$traceurRuntime.createClass(function(e,t){this.crossBoundaries=e,this._includeSelf=t},{get includeSelf(){return s(this._includeSelf)?!1:this._includeSelf},toString:function(){return"@Visibility(crossBoundaries: "+this.crossBoundaries+", includeSelf: "+this.includeSelf+"})"}},{}),e("VisibilityMetadata",f),e("VisibilityMetadata",f=t([r(),n("design:paramtypes",[Boolean,Boolean])],f)),h=function(e){function t(){$traceurRuntime.superConstructor(t).call(this,!1,!0)}return $traceurRuntime.createClass(t,{toString:function(){return"@Self()"}},{},e)}(f),e("SelfMetadata",h),e("SelfMetadata",h=t([r(),n("design:paramtypes",[])],h)),d=function(e){function t(){var e=(void 0!==arguments[0]?arguments[0]:{}).self;$traceurRuntime.superConstructor(t).call(this,!1,e)}return $traceurRuntime.createClass(t,{toString:function(){return"@Ancestor(self: "+this.includeSelf+"})"}},{},e)}(f),e("AncestorMetadata",d),e("AncestorMetadata",d=t([r(),n("design:paramtypes",[Object])],d)),p=function(e){function t(){var e=(void 0!==arguments[0]?arguments[0]:{}).self;$traceurRuntime.superConstructor(t).call(this,!0,e)}return $traceurRuntime.createClass(t,{toString:function(){return"@Unbounded(self: "+this.includeSelf+"})"}},{},e)}(f),e("UnboundedMetadata",p),e("UnboundedMetadata",p=t([r(),n("design:paramtypes",[Object])],p)),g=i(new p({self:!0})),e("DEFAULT_VISIBILITY",g)}}}),System.register("angular2/src/di/decorators",["angular2/src/di/metadata","angular2/src/util/decorators"],function(e){"use strict";var t,n,r,i,o,s,a,c,u,l,f,h,d,p;return{setters:[function(e){t=e.InjectMetadata,n=e.OptionalMetadata,r=e.InjectableMetadata,i=e.SelfMetadata,o=e.AncestorMetadata,s=e.UnboundedMetadata},function(e){a=e.makeDecorator,c=e.makeParamDecorator}],execute:function(){u=c(t),e("Inject",u),l=c(n),e("Optional",l),f=a(r),e("Injectable",f),h=c(i),e("Self",h),d=c(o),e("Ancestor",d),p=c(s),e("Unbounded",p)}}}),System.register("angular2/src/reflection/reflection",["angular2/src/reflection/reflector","angular2/src/reflection/reflection_capabilities"],function(e){"use strict";var t,n,r;return{setters:[function(n){t=n.Reflector,e("Reflector",n.Reflector),e("ReflectionInfo",n.ReflectionInfo)},function(e){n=e.ReflectionCapabilities}],execute:function(){r=new t(new n),e("reflector",r)}}}),System.register("angular2/src/di/key",["angular2/src/facade/collection","angular2/src/facade/lang","angular2/src/di/type_literal","angular2/src/di/forward_ref"],function(e){"use strict";var t,n,r,i,o,s,a,c,u;return{setters:[function(e){t=e.MapWrapper},function(e){n=e.stringify,r=e.isBlank,i=e.BaseException},function(t){o=t.TypeLiteral,e("TypeLiteral",t.TypeLiteral)},function(e){s=e.resolveForwardRef}],execute:function(){a=function(){function e(e,t){if(this.token=e,this.id=t,r(e))throw new i("Token must be defined!")}return $traceurRuntime.createClass(e,{get displayName(){return n(this.token)}},{get:function(e){return u.get(s(e))},get numberOfKeys(){return u.numberOfKeys}})}(),e("Key",a),c=function(){function e(){this._allKeys=new Map}return $traceurRuntime.createClass(e,{get:function(e){if(e instanceof a)return e;var t=e;if(e instanceof o&&(t=e.type),e=t,this._allKeys.has(e))return this._allKeys.get(e);var n=new a(e,a.numberOfKeys);return this._allKeys.set(e,n),n},get numberOfKeys(){return t.size(this._allKeys)}},{})}(),e("KeyRegistry",c),u=new c}}}),System.register("angular2/src/dom/browser_adapter",["angular2/src/facade/collection","angular2/src/facade/lang","angular2/src/dom/dom_adapter","angular2/src/dom/generic_browser_adapter"],function(e){"use strict";function t(){return i(p)&&(p=document.querySelector("base"),i(p))?null:p.attr("href")}function n(e){return i(g)&&(g=document.createElement("a")),g.setAttribute("href",e),"/"===g.pathname.charAt(0)?g.pathname:"/"+g.pathname}var r,i,o,s,a,c,u,l,f,h,d,p,g;return{setters:[function(e){r=e.ListWrapper},function(e){i=e.isBlank,o=e.isPresent,s=e.global},function(e){a=e.setRootDomAdapter},function(e){c=e.GenericBrowserDomAdapter}],execute:function(){u={innerHtml:"innerHTML",readonly:"readOnly",tabindex:"tabIndex"},l=3,f={"\b":"Backspace"," ":"Tab","":"Delete","":"Escape",Del:"Delete",Esc:"Escape",Left:"ArrowLeft",Right:"ArrowRight",Up:"ArrowUp",Down:"ArrowDown",Menu:"ContextMenu",Scroll:"ScrollLock",Win:"OS"},h={A:"1",B:"2",C:"3",D:"4",E:"5",F:"6",G:"7",H:"8",I:"9",J:"*",K:"+",M:"-",N:".",O:"/","`":"0","":"NumLock"},d=function(e){function c(){$traceurRuntime.superConstructor(c).apply(this,arguments)}return $traceurRuntime.createClass(c,{hasProperty:function(e,t){return t in e},setProperty:function(e,t,n){e[t]=n},getProperty:function(e,t){return e[t]},invoke:function(e,t,n){e[t].apply(e,n)},logError:function(e){window.console.error(e)},log:function(e){window.console.log(e)},logGroup:function(e){window.console.group?window.console.group(e):window.console.log(e)},logGroupEnd:function(){window.console.groupEnd&&window.console.groupEnd()},get attrToPropMap(){return u},query:function(e){return document.querySelector(e)},querySelector:function(e,t){return e.querySelector(t)},querySelectorAll:function(e,t){return e.querySelectorAll(t)},on:function(e,t,n){e.addEventListener(t,n,!1)},onAndCancel:function(e,t,n){return e.addEventListener(t,n,!1),function(){e.removeEventListener(t,n,!1)}},dispatchEvent:function(e,t){e.dispatchEvent(t)},createMouseEvent:function(e){var t=document.createEvent("MouseEvent");return t.initEvent(e,!0,!0),t},createEvent:function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!0),t},preventDefault:function(e){e.preventDefault(),e.returnValue=!1},getInnerHTML:function(e){return e.innerHTML},getOuterHTML:function(e){return e.outerHTML},nodeName:function(e){return e.nodeName},nodeValue:function(e){return e.nodeValue},type:function(e){return e.type},content:function(e){return this.hasProperty(e,"content")?e.content:e},firstChild:function(e){return e.firstChild},nextSibling:function(e){return e.nextSibling},parentElement:function(e){return e.parentElement},childNodes:function(e){return e.childNodes},childNodesAsList:function(e){for(var t=e.childNodes,n=r.createFixedSize(t.length),i=0;ie},operation_greater_then:function(e,t){return e>t},operation_less_or_equals_then:function(e,t){return t>=e},operation_greater_or_equals_then:function(e,t){return e>=t},operation_logical_and:function(e,t){return e&&t},operation_logical_or:function(e,t){return e||t},cond:function(e,t,n){return e?t:n},mapFn:function(e){function t(t){for(var n=s.create(),r=0;r":return"operation_greater_then";case"<=":return"operation_less_or_equals_then";case">=":return"operation_greater_or_equals_then";case"&&":return"operation_logical_and";case"||":return"operation_logical_or";default:throw new a("Unsupported operation "+e)}}function i(e){switch(e){case"+":return h.operation_add;case"-":return h.operation_subtract;case"*":return h.operation_multiply;case"/":return h.operation_divide;case"%":return h.operation_remainder;case"==":return h.operation_equals;case"!=":return h.operation_not_equals;case"===":return h.operation_identical;case"!==":return h.operation_not_identical;case"<":return h.operation_less_then;case">":return h.operation_greater_then;case"<=":return h.operation_less_or_equals_then;case">=":return h.operation_greater_or_equals_then;case"&&":return h.operation_logical_and;case"||":return h.operation_logical_or;default:throw new a("Unsupported operation "+e)}}function o(e){return c(e)?""+e:""}function s(e){var t=e.length,n=t>0?e[0]:null,r=t>1?e[1]:null,i=t>2?e[2]:null,s=t>3?e[3]:null,c=t>4?e[4]:null,u=t>5?e[5]:null,l=t>6?e[6]:null,f=t>7?e[7]:null,h=t>8?e[8]:null,d=t>9?e[9]:null;switch(t-1){case 1:return function(e){return n+o(e)+r};case 2:return function(e,t){return n+o(e)+r+o(t)+i};case 3:return function(e,t,a){return n+o(e)+r+o(t)+i+o(a)+s};case 4:return function(e,t,a,u){return n+o(e)+r+o(t)+i+o(a)+s+o(u)+c};case 5:return function(e,t,a,l,f){return n+o(e)+r+o(t)+i+o(a)+s+o(l)+c+o(f)+u};case 6:return function(e,t,a,f,h,d){return n+o(e)+r+o(t)+i+o(a)+s+o(f)+c+o(h)+u+o(d)+l};case 7:return function(e,t,a,h,d,p,g){return n+o(e)+r+o(t)+i+o(a)+s+o(h)+c+o(d)+u+o(p)+l+o(g)+f};case 8:return function(e,t,a,d,p,g,m,v){return n+o(e)+r+o(t)+i+o(a)+s+o(d)+c+o(p)+u+o(g)+l+o(m)+f+o(v)+h};case 9:return function(e,t,a,p,g,m,v,_,y){return n+o(e)+r+o(t)+i+o(a)+s+o(p)+c+o(g)+u+o(m)+l+o(v)+f+o(_)+h+o(y)+d};default:throw new a("Does not support more than 9 expressions")}}var a,c,u,l,f,h,d,p,g,m,v,_,y,b;return{setters:[function(e){a=e.BaseException,c=e.isPresent,u=e.isString},function(e){l=e.ListWrapper},function(e){f=e.ImplicitReceiver},function(e){h=e.ChangeDetectionUtil},function(e){d=e.DynamicChangeDetector},function(e){p=e.DirectiveIndex},function(e){g=e.coalesce},function(e){m=e.ProtoRecord,v=e.RecordType}],execute:function(){_=function(){function e(e){this.definition=e,this._records=this._createRecords(e)}return $traceurRuntime.createClass(e,{instantiate:function(e){return new d(this.definition.id,this.definition.strategy,e,this._records,this.definition.directiveRecords)},_createRecords:function(e){var t=new y;return l.forEach(e.bindingRecords,function(n){t.add(n,e.variableNames)}),g(t.records)}},{})}(),e("DynamicProtoChangeDetector",_),y=function(){function e(){this.records=[]}return $traceurRuntime.createClass(e,{add:function(e){var t=void 0!==arguments[1]?arguments[1]:null,n=l.last(this.records);c(n)&&n.bindingRecord.directiveRecord==e.directiveRecord&&(n.lastInDirective=!1),this._appendRecords(e,t);var r=l.last(this.records);c(r)&&r!==n&&(r.lastInBinding=!0,r.lastInDirective=!0)},_appendRecords:function(e,t){e.isDirectiveLifecycle()?this.records.push(new m(v.DIRECTIVE_LIFECYCLE,e.lifecycleEvent,null,[],[],-1,null,this.records.length+1,e,null,!1,!1)):b.append(this.records,e,t)}},{})}(),e("ProtoRecordBuilder",y),b=function(){function e(e,t,n,r){this._records=e,this._bindingRecord=t,this._expressionAsString=n,this._variableNames=r}return $traceurRuntime.createClass(e,{visitImplicitReceiver:function(e){return this._bindingRecord.implicitReceiver},visitInterpolation:function(e){var t=this._visitAll(e.expressions);return this._addRecord(v.INTERPOLATE,"interpolate",s(e.strings),t,e.strings,0)},visitLiteralPrimitive:function(e){return this._addRecord(v.CONST,"literal",e.value,[],null,0)},visitAccessMember:function(e){var t=e.receiver.visit(this);return c(this._variableNames)&&l.contains(this._variableNames,e.name)&&e.receiver instanceof f?this._addRecord(v.LOCAL,e.name,e.name,[],null,t):this._addRecord(v.PROPERTY,e.name,e.getter,[],null,t)},visitSafeAccessMember:function(e){var t=e.receiver.visit(this);return this._addRecord(v.SAFE_PROPERTY,e.name,e.getter,[],null,t)},visitMethodCall:function(e){var t=e.receiver.visit(this),n=this._visitAll(e.args);if(c(this._variableNames)&&l.contains(this._variableNames,e.name)){var r=this._addRecord(v.LOCAL,e.name,e.name,[],null,t);return this._addRecord(v.INVOKE_CLOSURE,"closure",null,n,null,r)}return this._addRecord(v.INVOKE_METHOD,e.name,e.fn,n,null,t)},visitSafeMethodCall:function(e){var t=e.receiver.visit(this),n=this._visitAll(e.args);return this._addRecord(v.SAFE_INVOKE_METHOD,e.name,e.fn,n,null,t)},visitFunctionCall:function(e){var t=e.target.visit(this),n=this._visitAll(e.args);return this._addRecord(v.INVOKE_CLOSURE,"closure",null,n,null,t)},visitLiteralArray:function(e){var n="arrayFn"+e.expressions.length;return this._addRecord(v.PRIMITIVE_OP,n,t(e.expressions.length),this._visitAll(e.expressions),null,0)},visitLiteralMap:function(e){return this._addRecord(v.PRIMITIVE_OP,n(e.keys),h.mapFn(e.keys),this._visitAll(e.values),null,0)},visitBinary:function(e){var t=e.left.visit(this),n=e.right.visit(this);return this._addRecord(v.PRIMITIVE_OP,r(e.operation),i(e.operation),[t,n],null,0)},visitPrefixNot:function(e){var t=e.expression.visit(this);return this._addRecord(v.PRIMITIVE_OP,"operation_negate",h.operation_negate,[t],null,0)},visitConditional:function(e){var t=e.condition.visit(this),n=e.trueExp.visit(this),r=e.falseExp.visit(this);return this._addRecord(v.PRIMITIVE_OP,"cond",h.cond,[t,n,r],null,0)},visitPipe:function(e){var t=e.exp.visit(this),n=this._visitAll(e.args);return this._addRecord(v.PIPE,e.name,e.name,n,null,t)},visitKeyedAccess:function(e){var t=e.obj.visit(this),n=e.key.visit(this);return this._addRecord(v.KEYED_ACCESS,"keyedAccess",h.keyedAccess,[n],null,t)},visitAssignment:function(e){throw new a("Not supported")},visitChain:function(e){throw new a("Not supported")},visitIf:function(e){throw new a("Not supported")},_visitAll:function(e){for(var t=l.createFixedSize(e.length),n=0;nn&&(o=l.max(0,e.length+n),c=e.length),i(e)?s.substring(e,o,c):u.slice(e,o,c)},onDestroy:function(){}},{supportsObj:function(e){return i(e)||o(e)}})}(),e("LimitToPipe",f),h=$traceurRuntime.createClass(function(){},{supports:function(e){return f.supportsObj(e)},create:function(e){return new f}},{}),e("LimitToPipeFactory",h),e("LimitToPipeFactory",h=t([c(),n("design:paramtypes",[])],h))}}}),System.register("angular2/src/change_detection/pipes/date_pipe",["angular2/src/facade/lang","angular2/src/facade/intl","angular2/src/facade/collection","angular2/src/change_detection/pipes/pipe"],function(e){"use strict";var t,n,r,i,o,s,a,c,u,l,f,h;return{setters:[function(e){r=e.isDate,i=e.isNumber,o=e.isPresent,s=e.DateWrapper,a=e.CONST},function(e){c=e.DateFormatter},function(e){u=e.StringMapWrapper},function(e){l=e.BasePipe}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},f="en-US",h=function(e){function t(){$traceurRuntime.superConstructor(t).apply(this,arguments); + +}return $traceurRuntime.createClass(t,{transform:function(e,t){var n=o(t)&&t.length>0?t[0]:"mediumDate";return i(e)&&(e=s.fromMillis(e)),u.contains(h._ALIASES,n)&&(n=u.get(h._ALIASES,n)),c.format(e,f,n)},supports:function(e){return r(e)||i(e)},create:function(e){return this}},{},e)}(l),e("DatePipe",h),h._ALIASES={medium:"yMMMdjms","short":"yMdjm",fullDate:"yMMMMEEEEd",longDate:"yMMMMd",mediumDate:"yMMMd",shortDate:"yMd",mediumTime:"jms",shortTime:"jm"},e("DatePipe",h=t([a(),n("design:paramtypes",[])],h))}}}),System.register("angular2/src/core/compiler/view",["angular2/src/facade/collection","angular2/src/change_detection/change_detection","angular2/src/core/compiler/element_binder","angular2/src/facade/lang","angular2/src/core/compiler/view_ref"],function(e){"use strict";function t(e,t){for(var n=r.createGrowableSize(t),i=0;i=0;n--)u(t[n+this.elementOffset])&&t[n+this.elementOffset].onAllChangesDone()},getDirectiveFor:function(e){var t=this.elementInjectors[this.elementOffset+e.elementIndex];return t.getDirectiveAtIndex(e.directiveIndex)},getNestedView:function(e){var t=this.mainMergeMapping.nestedViewIndicesByElementIndex[e];return u(t)?this.views[t]:null},getHostElement:function(){var e=this.mainMergeMapping.hostElementIndicesByViewIndex[this.viewOffset];return u(e)?this.elementRefs[e]:null},getDebugContext:function(e,t){try{var r=this.elementOffset+e,i=rE;E++){var x=e.mergeMapping.hostElementIndicesByViewIndex[E],S=c(x)?f(m[x].parentView):null,O=c(x)?S.proto.elementBinders[x-S.elementOffset].nestedProtoView:e,A=null;(0===E||O.type===p.EMBEDDED)&&(A=i[R++]);var D=new l.AppView(r,O,e.mergeMapping,E,w,C,O.protoLocals,s,A);b[E]=D;for(var I=[],j=0;j=0;d--)c(h.parent)?s.rootElementInjectors[d].linkAfter(h.parent,f):n.rootElementInjectors.push(s.rootElementInjectors[d])},detachViewInContainer:function(e,t,n){var r=e.viewContainers[t],i=r.views[n];i.changeDetector.remove(),o.removeAt(r.views,n);for(var s=0;s=0&&o.removeAt(e.rootElementInjectors,u)}}},hydrateViewInContainer:function(e,t,n,i,o,s){u(n)&&(n=e,i=t);var a=e.viewContainers[t],l=a.views[o],f=n.elementInjectors[i],h=c(s)?r.fromResolvedBindings(s):null;this._hydrateView(l,h,f.getHost(),n.context,n.locals)},_hydrateView:function(e,t,n,r,i){for(var o=e.viewOffset,s=o+e.mainMergeMapping.nestedViewCountByViewIndex[o];s>=o;){var a=e.views[o],u=a.proto;if(a!==e&&a.proto.type===p.EMBEDDED)o+=e.mainMergeMapping.nestedViewCountByViewIndex[o]+1;else{if(a!==e){t=null,i=null;var l=e.mainMergeMapping.hostElementIndicesByViewIndex[o];n=e.elementInjectors[l],r=n.getComponent()}a.context=r,a.locals.parent=i;for(var f=u.elementBinders,h=0;h=n;n++){var r=e.views[n];if(r.hydrated()){c(r.locals)&&r.locals.clearValues(),r.context=null,r.changeDetector.dehydrate();for(var i=r.proto.elementBinders,o=0;o0?n:null}function r(e,t){return f(t)?e:"@media "+t+" {\n"+e+"\n}"}var i,o,s,a,c,u,l,f,h,d,p,g,m,v,_,y,b;return{setters:[function(e){s=e.Injectable},function(e){a=e.XHR},function(e){c=e.ListWrapper},function(e){u=e.UrlResolver},function(e){l=e.StyleUrlResolver},function(e){f=e.isBlank,h=e.isPresent,d=e.RegExpWrapper,p=e.StringWrapper,g=e.isPromise},function(e){m=e.PromiseWrapper}],execute:function(){i=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},o=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},v=$traceurRuntime.createClass(function(e,t,n){this._xhr=e,this._styleUrlResolver=t,this._urlResolver=n},{inlineImports:function(e,t){return this._inlineImports(e,t,[])},_inlineImports:function(e,r,i){var o=this,s=0,a=p.split(e,_);if(1===a.length)return e;for(var u=[];s' element and there are no matching directives with a corresponding property")}),a}function n(e,t,n){if(n.type===R.PropertyBindingType.PROPERTY){var r=d.tagName(e),i=-1!==r.indexOf("-");return i&&!t?!0:d.hasProperty(e,n.property)}return!0}function r(e,t){var n=a.split(t,P);if(1===n.length){var r=n[0],o=h.get(d.attrToPropMap,r);return r=i(o)?o:r,new R.ElementPropertyBinding(R.PropertyBindingType.PROPERTY,e,r)}if(n[0]==T)return new R.ElementPropertyBinding(R.PropertyBindingType.ATTRIBUTE,e,n[1]);if(n[0]==N)return new R.ElementPropertyBinding(R.PropertyBindingType.CLASS,e,O(n[1]));if(n[0]==V){var c=n.length>2?n[2]:null;return new R.ElementPropertyBinding(R.PropertyBindingType.STYLE,e,n[1],c)}throw new s("Invalid property name "+t)}var i,o,s,a,c,u,l,f,h,d,p,g,m,v,_,y,b,w,C,R,E,x,S,O,A,D,I,j,P,T,N,V;return{setters:[function(e){i=e.isPresent,o=e.isBlank,s=e.BaseException,a=e.StringWrapper},function(e){c=e.ListWrapper,u=e.MapWrapper,l=e.Set,f=e.SetWrapper,h=e.StringMapWrapper},function(e){d=e.DOM},function(e){p=e.ASTWithSource,g=e.AstTransformer,m=e.AccessMember,v=e.LiteralArray,_=e.ImplicitReceiver},function(e){y=e.DomProtoView,b=e.DomProtoViewRef},function(e){w=e.DomElementBinder,C=e.Event},function(e){R=e},function(e){E=e.NG_BINDING_CLASS,x=e.EVENT_TARGET_SEPARATOR,S=e.queryBoundTextNodeIndices,O=e.camelCaseToDashCase}],execute:function(){A=function(){function e(e,t,n){this.rootElement=e,this.type=t,this.viewEncapsulation=n,this.variableBindings=new Map,this.elements=[],this.rootTextBindings=new Map,this.ngContentCount=0,this.hostAttributes=new Map}return $traceurRuntime.createClass(e,{bindElement:function(e){var t=void 0!==arguments[1]?arguments[1]:null,n=new D(this.elements.length,e,t);return this.elements.push(n),d.addClass(e,E),n},bindVariable:function(e,t){this.variableBindings.set(t,e)},bindRootText:function(e,t){this.rootTextBindings.set(e,t)},bindNgContent:function(){this.ngContentCount++},setHostAttribute:function(e,t){this.hostAttributes.set(e,t)},build:function(){var e=[],n=[],r=[],o=[],s=this.ngContentCount;S(d.content(this.rootElement),this.rootTextBindings,function(e,t,n){r.push(n),o.push(t)}),c.forEach(this.elements,function(o){var a=new l,u=c.map(o.directives,function(e){return o.eventBuilder.merge(e.eventBuilder),c.forEach(e.templatePropertyNames,function(e){return a.add(e)}),new R.DirectiveBinder({directiveIndex:e.directiveIndex,propertyBindings:e.propertyBindings,eventBindings:e.eventBindings,hostPropertyBindings:t(o.element,i(o.componentId),e.hostPropertyBindings,a)})}),f=i(o.nestedProtoView)?o.nestedProtoView.build():null;i(f)&&(s+=f.transitiveNgContentCount);var h=i(o.parent)?o.parent.index:-1,d=[];S(o.element,o.textBindings,function(e,t,n){r.push(n),d.push(t)}),n.push(new R.ElementBinder({index:o.index,parentIndex:h,distanceToParent:o.distanceToParent,directives:u,nestedProtoView:f,propertyBindings:t(o.element,i(o.componentId),o.propertyBindings,a),variableBindings:o.variableBindings,eventBindings:o.eventBindings,readAttributes:o.readAttributes})),e.push(new w({textNodeIndices:d,hasNestedProtoView:i(f)||i(o.componentId),hasNativeShadowRoot:!1,eventLocals:new v(o.eventBuilder.buildEventLocals()),localEvents:o.eventBuilder.buildLocalEvents(),globalEvents:o.eventBuilder.buildGlobalEvents()}))});var a=d.childNodes(d.content(this.rootElement)).length;return new R.ProtoViewDto({render:new b(y.create(this.type,this.rootElement,this.viewEncapsulation,[a],o,e,this.hostAttributes)),type:this.type,elementBinders:n,variableBindings:this.variableBindings,textBindings:r,transitiveNgContentCount:s})}},{})}(),e("ProtoViewBuilder",A),D=function(){function e(e,t,n){this.index=e,this.element=t,this.parent=null,this.distanceToParent=0,this.directives=[],this.nestedProtoView=null,this.propertyBindings=new Map,this.variableBindings=new Map,this.eventBindings=[],this.eventBuilder=new j,this.textBindings=new Map,this.readAttributes=new Map,this.componentId=null}return $traceurRuntime.createClass(e,{setParent:function(e,t){return this.parent=e,i(e)&&(this.distanceToParent=t),this},readAttribute:function(e){o(this.readAttributes.get(e))&&this.readAttributes.set(e,d.getAttribute(this.element,e))},bindDirective:function(e){var t=new I(e);return this.directives.push(t),t},bindNestedProtoView:function(e){if(i(this.nestedProtoView))throw new s("Only one nested view per element is allowed");return this.nestedProtoView=new A(e,R.ViewType.EMBEDDED,R.ViewEncapsulation.NONE),this.nestedProtoView},bindProperty:function(e,t){this.propertyBindings.set(e,t)},bindVariable:function(e,t){i(this.nestedProtoView)?this.nestedProtoView.bindVariable(e,t):this.variableBindings.set(t,e)},bindEvent:function(e,t){var n=void 0!==arguments[2]?arguments[2]:null;this.eventBindings.push(this.eventBuilder.add(e,t,n))},bindText:function(e,t){this.textBindings.set(e,t)},setComponentId:function(e){this.componentId=e}},{})}(),e("ElementBinderBuilder",D),I=function(){function e(e){this.directiveIndex=e,this.propertyBindings=new Map,this.templatePropertyNames=[],this.hostPropertyBindings=new Map,this.eventBindings=[],this.eventBuilder=new j}return $traceurRuntime.createClass(e,{bindProperty:function(e,t,n){this.propertyBindings.set(e,t),i(n)&&this.templatePropertyNames.push(n)},bindHostProperty:function(e,t){this.hostPropertyBindings.set(e,t)},bindEvent:function(e,t){var n=void 0!==arguments[2]?arguments[2]:null;this.eventBindings.push(this.eventBuilder.add(e,t,n))}},{})}(),e("DirectiveBuilder",I),j=function(e){function t(){$traceurRuntime.superConstructor(t).call(this),this.locals=[],this.localEvents=[],this.globalEvents=[],this._implicitReceiver=new _}return $traceurRuntime.createClass(t,{add:function(e,t,n){var r=t.ast,s=i(n)?n+x+e:e,a=new R.EventBinding(s,new p(r,t.source,t.location)),c=new C(e,n,s);return o(n)?this.localEvents.push(c):this.globalEvents.push(c),a},visitAccessMember:function(e){for(var t=!1,n=e;!t&&n instanceof m;){var r=n;"$event"==r.name&&(t=!0),n=r.receiver}if(t){this.locals.push(e);var i=this.locals.length-1;return new m(this._implicitReceiver,""+i,function(e){return e[i]},null)}return e},buildEventLocals:function(){return this.locals},buildLocalEvents:function(){return this.localEvents},buildGlobalEvents:function(){return this.globalEvents},merge:function(e){this._merge(this.localEvents,e.localEvents),this._merge(this.globalEvents,e.globalEvents),c.concat(this.locals,e.locals)},_merge:function(e,t){for(var n=[],r=0;r-1?(a=i.substring(e,0,l).trim(),u=this._splitBindConfig(i.substring(e,l+1)),c=s.removeAt(u,0)):(a=e,c=e,u=[]),c=f(c);var d=r.bindElement().propertyBindings.get(c);if(n(d)){var p=r.attrs().get(h(c));t(p)&&(d=this._parser.wrapLiteralPrimitive(p,r.elementDescription)); + +}t(d)&&o.bindProperty(a,d,c)},_bindDirectiveEvent:function(e,t,n,r){var o=this._parser.parseAction(t,n.elementDescription);if(i.contains(e,d)){var s=e.split(d);r.bindEvent(s[1],o,s[0])}else r.bindEvent(e,o)},_bindHostProperty:function(e,t,n,r){var i=this._parser.parseSimpleBinding(t,"hostProperties of "+n.elementDescription);r.bindHostProperty(e,i)},_addHostAttribute:function(e,t,n){i.equals(e,"class")?s.forEach(t.split(" "),function(e){a.addClass(n.element,e)}):a.hasAttribute(n.element,e)||a.setAttribute(n.element,e,t)},_splitBindConfig:function(e){return s.map(e.split("|"),function(e){return e.trim()})}},{})}(),e("DirectiveParser",p)}}}),System.register("angular2/src/render/dom/compiler/style_encapsulator",["angular2/src/render/api","angular2/src/render/dom/util","angular2/src/dom/dom_adapter","angular2/src/facade/lang","angular2/src/render/dom/compiler/shadow_css"],function(e){"use strict";function t(e){return"_nghost-"+e}function n(e){return"_ngcontent-"+e}var r,i,o,s,a,c,u,l,f;return{setters:[function(e){r=e.ViewEncapsulation,i=e.ViewType},function(e){o=e.NG_CONTENT_ELEMENT_NAME,s=e.isElementWithTag},function(e){a=e.DOM},function(e){c=e.isBlank,u=e.isPresent},function(e){l=e.ShadowCss}],execute:function(){f=function(){function e(e,t,n){this._appId=e,this._view=t,this._componentUIDsCache=n}return $traceurRuntime.createClass(e,{processElement:function(e,t,n){s(t.element,o)?t.inheritedProtoView.bindNgContent():this._view.encapsulation===r.EMULATED&&this._processEmulatedScopedElement(t,e)},processStyle:function(e){var t=this._view.encapsulation;return t===r.EMULATED?this._shimCssForComponent(e,this._view.componentId):e},_processEmulatedScopedElement:function(e,r){var o=e.element,s=this._view.componentId,l=e.inheritedProtoView.type;if(l!==i.HOST&&u(s)){var f=n(this._getComponentId(s));if(a.setAttribute(o,f,""),c(r)&&l==i.COMPONENT){var h=t(this._getComponentId(s));e.inheritedProtoView.setHostAttribute(h,"")}}},_shimCssForComponent:function(e,r){var i=this._getComponentId(r),o=new l;return o.shimCssText(e,n(i),t(i))},_getComponentId:function(e){var t=this._componentUIDsCache.get(e);return c(t)&&(t=this._appId+"-"+this._componentUIDsCache.size,this._componentUIDsCache.set(e,t)),t}},{})}(),e("StyleEncapsulator",f)}}}),System.register("angular2/src/render/dom/dom_renderer",["angular2/di","angular2/src/facade/lang","angular2/src/dom/dom_adapter","angular2/src/render/dom/events/event_manager","angular2/src/render/dom/view/proto_view","angular2/src/render/dom/view/view","angular2/src/render/dom/view/fragment","angular2/src/render/dom/view/shared_styles_host","angular2/src/render/dom/util","angular2/src/render/api","angular2/src/render/dom/dom_tokens"],function(e){"use strict";function t(e,t){if(t.length>0&&c(f.parentElement(e))){for(var n=0;n0){var i=r[r.length-1];t(i,_(n))}},attachFragmentAfterElement:function(e,n){if(!u(e.renderBoundElementIndex)){var r=m(e.renderView),i=r.boundElements[e.renderBoundElementIndex];t(i,_(n))}},detachFragment:function(e){for(var t=_(e),n=0;n0&&i[0]===o&&(i[0]=t),r.fragments[0][0]=t}for(var s=new p(e,r.boundTextNodes,i),a=e.elementBinders,u=0;u-1?p=f.replace(p,"=JSONP_CALLBACK&","="+c+"&"):p.lastIndexOf("=JSONP_CALLBACK")===p.length-"=JSONP_CALLBACK".length&&(p=f.substring(p,0,p.length-"=JSONP_CALLBACK".length)+("="+c));var g=this._script=t.build(p);g.addEventListener("load",function(e){if(a.readyState!==r.CANCELLED){if(a.readyState=r.DONE,t.cleanup(g),!a._finished)return void l.callThrow(a.response,d("JSONP injected script did not invoke callback."));var n=new s({body:a._responseData});h(a.baseResponseOptions)&&(n=a.baseResponseOptions.merge(n)),l.callNext(a.response,new o(n))}}),g.addEventListener("error",function(e){a.readyState!==r.CANCELLED&&(a.readyState=r.DONE,t.cleanup(g),l.callThrow(a.response,e))}),t.send(g)}return $traceurRuntime.createClass(e,{finished:function(e){this._finished=!0,this._dom.removeConnection(this._id),this.readyState!==r.CANCELLED&&(this._responseData=e)},dispose:function(){this.readyState=r.CANCELLED;var e=this._script;this._script=null,h(e)&&this._dom.cleanup(e),l.callReturn(this.response)}},{})}(),e("JSONPConnection",p),g=$traceurRuntime.createClass(function(e,t){this._browserJSONP=e,this._baseResponseOptions=t},{createConnection:function(e){return new p(e,this._browserJSONP,this._baseResponseOptions)}},{}),e("JSONPBackend",g),e("JSONPBackend",g=t([a(),n("design:paramtypes",[c,s])],g))}}}),System.register("angular2/src/forms/model",["angular2/src/facade/lang","angular2/src/facade/async","angular2/src/facade/collection","angular2/src/forms/validators"],function(e){"use strict";function t(e){return e instanceof p}function n(e,t){return o(t)?null:(t instanceof l||(t=r.split(t,new RegExp("/"))),t instanceof l&&u.isEmpty(t)?null:u.reduce(t,function(e,t){if(e instanceof m)return i(e.controls[t])?e.controls[t]:null;if(e instanceof v){var n=t;return i(e.at(n))?e.at(n):null}return null},e))}var r,i,o,s,a,c,u,l,f,h,d,p,g,m,v;return e("isControl",t),{setters:[function(e){r=e.StringWrapper,i=e.isPresent,o=e.isBlank},function(e){s=e.EventEmitter,a=e.ObservableWrapper},function(e){c=e.StringMapWrapper,u=e.ListWrapper,l=e.List},function(e){f=e.Validators}],execute:function(){h="VALID",e("VALID",h),d="INVALID",e("INVALID",d),p=function(){function e(e){this.validator=e,this._pristine=!0,this._touched=!1}return $traceurRuntime.createClass(e,{get value(){return this._value},get status(){return this._status},get valid(){return this._status===h},get errors(){return this._errors},get pristine(){return this._pristine},get dirty(){return!this.pristine},get touched(){return this._touched},get untouched(){return!this._touched},get valueChanges(){return this._valueChanges},markAsTouched:function(){this._touched=!0},markAsDirty:function(){var e=(void 0!==arguments[0]?arguments[0]:{}).onlySelf;e=i(e)?e:!1,this._pristine=!1,i(this._parent)&&!e&&this._parent.markAsDirty({onlySelf:e})},setParent:function(e){this._parent=e},updateValidity:function(){var e=(void 0!==arguments[0]?arguments[0]:{}).onlySelf;e=i(e)?e:!1,this._errors=this.validator(this),this._status=i(this._errors)?d:h,i(this._parent)&&!e&&this._parent.updateValidity({onlySelf:e})},updateValueAndValidity:function(){var e=void 0!==arguments[0]?arguments[0]:{},t=e.onlySelf,n=e.emitEvent;t=i(t)?t:!1,n=i(n)?n:!0,this._updateValue(),n&&a.callNext(this._valueChanges,this._value),this._errors=this.validator(this),this._status=i(this._errors)?d:h,i(this._parent)&&!t&&this._parent.updateValueAndValidity({onlySelf:t,emitEvent:n})},find:function(e){return n(this,e)},getError:function(e){var t=void 0!==arguments[1]?arguments[1]:null,n=i(t)&&!u.isEmpty(t)?this.find(t):this;return i(n)&&i(n._errors)?c.get(n._errors,e):null},hasError:function(e){var t=void 0!==arguments[1]?arguments[1]:null;return i(this.getError(e,t))},_updateValue:function(){}},{})}(),e("AbstractControl",p),g=function(e){function t(){var e=void 0!==arguments[0]?arguments[0]:null,n=void 0!==arguments[1]?arguments[1]:f.nullValidator;$traceurRuntime.superConstructor(t).call(this,n),this._value=e,this.updateValidity({onlySelf:!0}),this._valueChanges=new s}return $traceurRuntime.createClass(t,{updateValue:function(e){var t=void 0!==arguments[1]?arguments[1]:{},n=t.onlySelf,r=t.emitEvent,o=t.emitModelToViewChange;o=i(o)?o:!0,this._value=e,i(this._onChange)&&o&&this._onChange(this._value),this.updateValueAndValidity({onlySelf:n,emitEvent:r})},registerOnChange:function(e){this._onChange=e}},{},e)}(p),e("Control",g),m=function(e){function t(e){var n=void 0!==arguments[1]?arguments[1]:null,r=void 0!==arguments[2]?arguments[2]:f.group;$traceurRuntime.superConstructor(t).call(this,r),this.controls=e,this._optionals=i(n)?n:{},this._valueChanges=new s,this._setParentForControls(),this._value=this._reduceValue(),this.updateValidity({onlySelf:!0})}return $traceurRuntime.createClass(t,{addControl:function(e,t){this.controls[e]=t,t.setParent(this)},removeControl:function(e){c["delete"](this.controls,e)},include:function(e){c.set(this._optionals,e,!0),this.updateValueAndValidity()},exclude:function(e){c.set(this._optionals,e,!1),this.updateValueAndValidity()},contains:function(e){var t=c.contains(this.controls,e);return t&&this._included(e)},_setParentForControls:function(){var e=this;c.forEach(this.controls,function(t,n){t.setParent(e)})},_updateValue:function(){this._value=this._reduceValue()},_reduceValue:function(){return this._reduceChildren({},function(e,t,n){return e[n]=t.value,e})},_reduceChildren:function(e,t){var n=this,r=e;return c.forEach(this.controls,function(e,i){n._included(i)&&(r=t(r,e,i))}),r},_included:function(e){var t=c.contains(this._optionals,e);return!t||c.get(this._optionals,e)}},{},e)}(p),e("ControlGroup",m),v=function(e){function t(e){var n=void 0!==arguments[1]?arguments[1]:f.array;$traceurRuntime.superConstructor(t).call(this,n),this.controls=e,this._valueChanges=new s,this._setParentForControls(),this._updateValue(),this.updateValidity({onlySelf:!0})}return $traceurRuntime.createClass(t,{at:function(e){return this.controls[e]},push:function(e){this.controls.push(e),e.setParent(this),this.updateValueAndValidity()},insert:function(e,t){u.insert(this.controls,e,t),t.setParent(this),this.updateValueAndValidity()},removeAt:function(e){u.removeAt(this.controls,e),this.updateValueAndValidity()},get length(){return this.controls.length},_updateValue:function(){this._value=u.map(this.controls,function(e){return e.value})},_setParentForControls:function(){var e=this;u.forEach(this.controls,function(t){t.setParent(e)})}},{},e)}(p),e("ControlArray",v)}}}),System.register("angular2/src/forms/directives/ng_control_name",["angular2/src/facade/lang","angular2/src/facade/async","angular2/core","angular2/annotations","angular2/di","angular2/src/forms/directives/control_container","angular2/src/forms/directives/ng_control","angular2/src/forms/directives/validators","angular2/src/forms/directives/shared"],function(e){"use strict";var t,n,r,i,o,s,a,c,u,l,f,h,d,p,g,m,v,_,y,b,w;return{setters:[function(e){i=e.CONST_EXPR},function(e){o=e.EventEmitter,s=e.ObservableWrapper},function(e){a=e.QueryList},function(e){c=e.Query,u=e.Directive,l=e.LifecycleEvent},function(e){f=e.forwardRef,h=e.Ancestor,d=e.Binding},function(e){p=e.ControlContainer},function(e){g=e.NgControl},function(e){m=e.NgValidator},function(e){v=e.controlPath,_=e.composeNgValidator,y=e.isPropertyUpdated}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},r=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}},b=i(new d(g,{toAlias:f(function(){return w})})),w=function(e){function t(e,n){$traceurRuntime.superConstructor(t).call(this),this.update=new o,this._added=!1,this._parent=e,this.ngValidators=n}return $traceurRuntime.createClass(t,{onChange:function(e){this._added||(this.formDirective.addControl(this),this._added=!0),y(e,this.viewModel)&&(this.viewModel=this.model,this.formDirective.updateModel(this,this.model))},onDestroy:function(){this.formDirective.removeControl(this)},viewToModelUpdate:function(e){this.viewModel=e,s.callNext(this.update,e)},get path(){return v(this.name,this._parent)},get formDirective(){return this._parent.formDirective},get control(){return this.formDirective.getControl(this)},get validator(){return _(this.ngValidators)}},{},e)}(g),e("NgControlName",w),e("NgControlName",w=t([u({selector:"[ng-control]",hostInjector:[b],properties:["name: ngControl","model: ngModel"],events:["update: ngModel"],lifecycle:[l.onDestroy,l.onChange],exportAs:"form"}),r(0,h()),r(1,c(m)),n("design:paramtypes",[p,a])],w))}}}),System.register("angular2/src/forms/directives/default_value_accessor",["angular2/render","angular2/annotations","angular2/core","angular2/di","angular2/src/forms/directives/ng_control","angular2/src/facade/lang","angular2/src/forms/directives/shared"],function(e){"use strict";var t,n,r,i,o,s,a,c,u,l,f,h;return{setters:[function(e){i=e.Renderer},function(e){o=e.Directive},function(e){s=e.ElementRef},function(e){a=e.Self},function(e){c=e.NgControl},function(e){u=e.isBlank,l=e.isPresent},function(e){f=e.setProperty}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},r=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}},h=$traceurRuntime.createClass(function(e,t,n){this.renderer=t,this.elementRef=n,this.onChange=function(e){},this.onTouched=function(){},this.cd=e,e.valueAccessor=this},{writeValue:function(e){var t=u(e)?"":e;f(this.renderer,this.elementRef,"value",t)},get ngClassUntouched(){return l(this.cd.control)?this.cd.control.untouched:!1},get ngClassTouched(){return l(this.cd.control)?this.cd.control.touched:!1},get ngClassPristine(){return l(this.cd.control)?this.cd.control.pristine:!1},get ngClassDirty(){return l(this.cd.control)?this.cd.control.dirty:!1},get ngClassValid(){return l(this.cd.control)?this.cd.control.valid:!1},get ngClassInvalid(){return l(this.cd.control)?!this.cd.control.valid:!1},registerOnChange:function(e){this.onChange=e},registerOnTouched:function(e){this.onTouched=e}},{}),e("DefaultValueAccessor",h),e("DefaultValueAccessor",h=t([o({selector:"input:not([type=checkbox])[ng-control],textarea[ng-control],input:not([type=checkbox])[ng-form-control],textarea[ng-form-control],input:not([type=checkbox])[ng-model],textarea[ng-model]",host:{"(change)":"onChange($event.target.value)","(input)":"onChange($event.target.value)","(blur)":"onTouched()","[class.ng-untouched]":"ngClassUntouched","[class.ng-touched]":"ngClassTouched","[class.ng-pristine]":"ngClassPristine","[class.ng-dirty]":"ngClassDirty","[class.ng-valid]":"ngClassValid","[class.ng-invalid]":"ngClassInvalid"}}),r(0,a()),n("design:paramtypes",[c,i,s])],h))}}}),System.register("angular2/src/di/binding",["angular2/src/facade/lang","angular2/src/facade/collection","angular2/src/reflection/reflection","angular2/src/di/key","angular2/src/di/metadata","angular2/src/di/exceptions","angular2/src/di/forward_ref"],function(e){"use strict";function t(e){return new I(e)}function n(e,t){if(u(t))return r(e);var n=m.map(t,function(e){return[e]});return m.map(t,function(t){return i(e,t,n)})}function r(e){var t=v.parameters(e);if(u(t))return[];if(m.any(t,function(e){return u(e)}))throw new E(e,t);return m.map(t,function(n){return i(e,n,t)})}function i(e,t,n){var r=[],i=null,s=!1;if(!g(t))return o(t,s,C,r);for(var a=C,u=0;u0?this._renderer.detachFragment(i.renderFragment):(this._renderer.dehydrateView(i.render),this._renderer.detachFragment(i.renderFragment),this._destroyPooledView(i))},_viewDehydrateRecurse:function(e){e.hydrated()&&this._utils.dehydrateView(e);for(var t=e.viewContainers,n=e.viewOffset,r=e.viewOffset+e.mainMergeMapping.nestedViewCountByViewIndex[e.viewOffset],o=e.elementOffset,s=n;r>=s;s++)for(var a=e.views[s],c=0;c=0;l--)this._destroyViewInContainer(a,o,l)}}},{}),e("AppViewManager",p),e("AppViewManager",p=t([r(),n("design:paramtypes",[h,d,f,u])],p))}}}),System.register("angular2/src/render/dom/compiler/view_loader",["angular2/di","angular2/src/facade/lang","angular2/src/facade/collection","angular2/src/facade/async","angular2/src/dom/dom_adapter","angular2/src/render/xhr","angular2/src/render/dom/compiler/style_inliner","angular2/src/render/dom/compiler/style_url_resolver"],function(e){"use strict";var t,n,r,i,o,s,a,c,u,l,f,h,d,p,g,m,v,_;return{setters:[function(e){r=e.Injectable},function(e){i=e.isBlank,o=e.isPresent,s=e.BaseException,a=e.isPromise,c=e.StringWrapper},function(e){u=e.Map,l=e.MapWrapper,f=e.ListWrapper},function(e){h=e.PromiseWrapper},function(e){d=e.DOM},function(e){p=e.XHR},function(e){g=e.StyleInliner},function(e){m=e.StyleUrlResolver}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},v=function(){function e(e,t){this.template=e,this.styles=t}return $traceurRuntime.createClass(e,{},{})}(),e("TemplateAndStyles",v),_=$traceurRuntime.createClass(function(e,t,n){this._xhr=e,this._styleInliner=t,this._styleUrlResolver=n,this._cache=new u},{load:function(e){var t=this,n=[this._loadHtml(e.template,e.templateAbsUrl)];return o(e.styles)&&e.styles.forEach(function(r){var i=t._resolveAndInlineCssText(r,e.templateAbsUrl);n.push(i)}),o(e.styleAbsUrls)&&e.styleAbsUrls.forEach(function(r){var i=t._loadText(r).then(function(n){return t._resolveAndInlineCssText(n,e.templateAbsUrl)});n.push(i)}),h.all(n).then(function(e){var t=e[0],n=f.slice(e,1);return new v(t.template,t.styles.concat(n))})},_loadText:function(e){var t=this._cache.get(e);return i(t)&&(t=h.catchError(this._xhr.get(e),function(t){return h.reject(new s('Failed to fetch url "'+e+'"'),null)}),this._cache.set(e,t)),t},_loadHtml:function(e,t){var n,r=this;if(o(e))n=h.resolve(e);else{if(!o(t))throw new s("View should have either the templateUrl or template property set");n=this._loadText(t)}return n.then(function(e){var n=d.createTemplate(e);if(o(t)&&t.indexOf("/")>=0){var i=t.substring(0,t.lastIndexOf("/"));r._substituteBaseUrl(d.content(n),i)}for(var s=d.querySelectorAll(d.content(n),"STYLE"),c=[],u=0;u=0&&d.setAttribute(e,r,c.replaceAll(n,/\$baseUrl/g,t))})}for(var r=d.childNodes(e),i=0;i0&&(this.binding0=t[0].binding,this.keyId0=t[0].getKeyId(),this.visibility0=t[0].visibility),n>1&&(this.binding1=t[1].binding,this.keyId1=t[1].getKeyId(),this.visibility1=t[1].visibility),n>2&&(this.binding2=t[2].binding,this.keyId2=t[2].getKeyId(),this.visibility2=t[2].visibility),n>3&&(this.binding3=t[3].binding,this.keyId3=t[3].getKeyId(),this.visibility3=t[3].visibility),n>4&&(this.binding4=t[4].binding,this.keyId4=t[4].getKeyId(),this.visibility4=t[4].visibility),n>5&&(this.binding5=t[5].binding,this.keyId5=t[5].getKeyId(),this.visibility5=t[5].visibility),n>6&&(this.binding6=t[6].binding,this.keyId6=t[6].getKeyId(),this.visibility6=t[6].visibility),n>7&&(this.binding7=t[7].binding,this.keyId7=t[7].getKeyId(),this.visibility7=t[7].visibility),n>8&&(this.binding8=t[8].binding,this.keyId8=t[8].getKeyId(),this.visibility8=t[8].visibility),n>9&&(this.binding9=t[9].binding,this.keyId9=t[9].getKeyId(),this.visibility9=t[9].visibility)}return $traceurRuntime.createClass(e,{getBindingAtIndex:function(e){if(0==e)return this.binding0;if(1==e)return this.binding1;if(2==e)return this.binding2;if(3==e)return this.binding3;if(4==e)return this.binding4;if(5==e)return this.binding5;if(6==e)return this.binding6;if(7==e)return this.binding7;if(8==e)return this.binding8;if(9==e)return this.binding9;throw new _(e)},createInjectorStrategy:function(e){return new M(e,this)}},{})}(),e("ProtoInjectorInlineStrategy",N),V=function(){function e(e,t){var n=t.length;this.bindings=c.createFixedSize(n),this.keyIds=c.createFixedSize(n),this.visibilities=c.createFixedSize(n);for(var r=0;n>r;r++)this.bindings[r]=t[r].binding,this.keyIds[r]=t[r].getKeyId(),this.visibilities[r]=t[r].visibility}return $traceurRuntime.createClass(e,{getBindingAtIndex:function(e){if(0>e||e>=this.bindings.length)throw new _(e);return this.bindings[e]},createInjectorStrategy:function(e){return new B(this,e)}},{})}(),e("ProtoInjectorDynamicStrategy",V),k=function(){function e(e){this.numberOfBindings=e.length,this._strategy=e.length>D?new V(this,e):new N(this,e)}return $traceurRuntime.createClass(e,{getBindingAtIndex:function(e){return this._strategy.getBindingAtIndex(e)}},{})}(),e("ProtoInjector",k),M=function(){function e(e,t){this.injector=e,this.protoStrategy=t,this.obj0=I,this.obj1=I,this.obj2=I,this.obj3=I,this.obj4=I,this.obj5=I,this.obj6=I,this.obj7=I,this.obj8=I,this.obj9=I}return $traceurRuntime.createClass(e,{resetConstructionCounter:function(){this.injector._constructionCounter=0},instantiateBinding:function(e,t){return this.injector._new(e,t)},attach:function(e,t){var n=this.injector;n._parent=e,n._isBoundary=t},getObjByKeyId:function(e,t){var n=this.protoStrategy,r=this.injector;return n.keyId0===e&&(n.visibility0&t)>0?(this.obj0===I&&(this.obj0=r._new(n.binding0,n.visibility0)),this.obj0):n.keyId1===e&&(n.visibility1&t)>0?(this.obj1===I&&(this.obj1=r._new(n.binding1,n.visibility1)),this.obj1):n.keyId2===e&&(n.visibility2&t)>0?(this.obj2===I&&(this.obj2=r._new(n.binding2,n.visibility2)),this.obj2):n.keyId3===e&&(n.visibility3&t)>0?(this.obj3===I&&(this.obj3=r._new(n.binding3,n.visibility3)),this.obj3):n.keyId4===e&&(n.visibility4&t)>0?(this.obj4===I&&(this.obj4=r._new(n.binding4,n.visibility4)),this.obj4):n.keyId5===e&&(n.visibility5&t)>0?(this.obj5===I&&(this.obj5=r._new(n.binding5,n.visibility5)),this.obj5):n.keyId6===e&&(n.visibility6&t)>0?(this.obj6===I&&(this.obj6=r._new(n.binding6,n.visibility6)),this.obj6):n.keyId7===e&&(n.visibility7&t)>0?(this.obj7===I&&(this.obj7=r._new(n.binding7,n.visibility7)),this.obj7):n.keyId8===e&&(n.visibility8&t)>0?(this.obj8===I&&(this.obj8=r._new(n.binding8,n.visibility8)),this.obj8):n.keyId9===e&&(n.visibility9&t)>0?(this.obj9===I&&(this.obj9=r._new(n.binding9,n.visibility9)),this.obj9):I},getObjAtIndex:function(e){if(0==e)return this.obj0;if(1==e)return this.obj1;if(2==e)return this.obj2;if(3==e)return this.obj3;if(4==e)return this.obj4;if(5==e)return this.obj5;if(6==e)return this.obj6;if(7==e)return this.obj7;if(8==e)return this.obj8;if(9==e)return this.obj9;throw new _(e)},getMaxNumberOfObjects:function(){return D}},{})}(),e("InjectorInlineStrategy",M),B=function(){function e(e,t){this.protoStrategy=e,this.injector=t,this.objs=c.createFixedSize(e.bindings.length),c.fill(this.objs,I)}return $traceurRuntime.createClass(e,{resetConstructionCounter:function(){this.injector._constructionCounter=0},instantiateBinding:function(e,t){return this.injector._new(e,t)},attach:function(e,t){var n=this.injector;n._parent=e,n._isBoundary=t},getObjByKeyId:function(e,t){for(var n=this.protoStrategy,r=0;r0)return this.objs[r]===I&&(this.objs[r]=this.injector._new(n.bindings[r],n.visibilities[r])),this.objs[r];return I},getObjAtIndex:function(e){if(0>e||e>=this.objs.length)throw new _(e);return this.objs[e]},getMaxNumberOfObjects:function(){return this.objs.length}},{})}(),e("InjectorDynamicStrategy",B),L=function(){function e(e,t){this.binding=e,this.visibility=t}return $traceurRuntime.createClass(e,{getKeyId:function(){return this.binding.key.id}},{})}(),e("BindingWithVisibility",L),$=function(){function e(e){var t=void 0!==arguments[1]?arguments[1]:null,n=void 0!==arguments[2]?arguments[2]:null,r=void 0!==arguments[3]?arguments[3]:null;this._proto=e,this._parent=t,this._depProvider=n,this._debugContext=r,this._isBoundary=!1,this._constructionCounter=0,this._strategy=e._strategy.createInjectorStrategy(this)}return $traceurRuntime.createClass(e,{debugContext:function(){return this._debugContext()},get:function(e){return this._getByKey(C.get(e),E,!1,T)},getOptional:function(e){return this._getByKey(C.get(e),E,!0,T)},getAt:function(e){return this._strategy.getObjAtIndex(e)},get parent(){return this._parent},get internalStrategy(){return this._strategy},resolveAndCreateChild:function(t){var n=void 0!==arguments[1]?arguments[1]:null,r=e.resolve(t);return this.createChildFromResolved(r,n)},createChildFromResolved:function(t){var n=void 0!==arguments[1]?arguments[1]:null,r=t.map(function(e){return new L(e,j)}),i=new k(r),o=new e(i,null,n);return o._parent=this,o},_new:function(e,t){if(this._constructionCounter++>this._strategy.getMaxNumberOfObjects())throw new g(this,e.key);var n,r,i,o,s,a,c,u,l,f,h,p,v,_,y,b,w,C,R,E,x=e.factory,S=e.dependencies,O=S.length;try{n=O>0?this._getByDependency(e,S[0],t):null,r=O>1?this._getByDependency(e,S[1],t):null,i=O>2?this._getByDependency(e,S[2],t):null,o=O>3?this._getByDependency(e,S[3],t):null,s=O>4?this._getByDependency(e,S[4],t):null,a=O>5?this._getByDependency(e,S[5],t):null,c=O>6?this._getByDependency(e,S[6],t):null,u=O>7?this._getByDependency(e,S[7],t):null,l=O>8?this._getByDependency(e,S[8],t):null,f=O>9?this._getByDependency(e,S[9],t):null,h=O>10?this._getByDependency(e,S[10],t):null,p=O>11?this._getByDependency(e,S[11],t):null,v=O>12?this._getByDependency(e,S[12],t):null,_=O>13?this._getByDependency(e,S[13],t):null,y=O>14?this._getByDependency(e,S[14],t):null,b=O>15?this._getByDependency(e,S[15],t):null,w=O>16?this._getByDependency(e,S[16],t):null,C=O>17?this._getByDependency(e,S[17],t):null,R=O>18?this._getByDependency(e,S[18],t):null,E=O>19?this._getByDependency(e,S[19],t):null}catch(A){throw A instanceof d&&A.addKey(this,e.key),A}var D;try{switch(O){case 0:D=x();break;case 1:D=x(n);break;case 2:D=x(n,r);break;case 3:D=x(n,r,i);break;case 4:D=x(n,r,i,o);break;case 5:D=x(n,r,i,o,s);break;case 6:D=x(n,r,i,o,s,a);break;case 7:D=x(n,r,i,o,s,a,c);break;case 8:D=x(n,r,i,o,s,a,c,u);break;case 9:D=x(n,r,i,o,s,a,c,u,l);break;case 10:D=x(n,r,i,o,s,a,c,u,l,f);break;case 11:D=x(n,r,i,o,s,a,c,u,l,f,h);break;case 12:D=x(n,r,i,o,s,a,c,u,l,f,h,p);break;case 13:D=x(n,r,i,o,s,a,c,u,l,f,h,p,v);break;case 14:D=x(n,r,i,o,s,a,c,u,l,f,h,p,v,_);break;case 15:D=x(n,r,i,o,s,a,c,u,l,f,h,p,v,_,y);break;case 16:D=x(n,r,i,o,s,a,c,u,l,f,h,p,v,_,y,b);break;case 17:D=x(n,r,i,o,s,a,c,u,l,f,h,p,v,_,y,b,w);break;case 18:D=x(n,r,i,o,s,a,c,u,l,f,h,p,v,_,y,b,w,C);break;case 19:D=x(n,r,i,o,s,a,c,u,l,f,h,p,v,_,y,b,w,C,R);break;case 20:D=x(n,r,i,o,s,a,c,u,l,f,h,p,v,_,y,b,w,C,R,E)}}catch(A){throw new m(this,A,A.stack,e.key)}return D},_getByDependency:function(e,t,n){var r=b(this._depProvider)?this._depProvider.getDependency(this,e,t):I;return r!==I?r:this._getByKey(t.key,t.visibility,t.optional,n)},_getByKey:function(e,t,n,r){return e===F?this:t instanceof x?this._getByKeySelf(e,n,r):t instanceof S?this._getByKeyAncestor(e,n,r,t.includeSelf):this._getByKeyUnbounded(e,n,r,t.includeSelf)},_throwOrNull:function(e,t){if(t)return null;throw new p(this,e)},_getByKeySelf:function(e,t,n){var r=this._strategy.getObjByKeyId(e.id,n);return r!==I?r:this._throwOrNull(e,t)},_getByKeyAncestor:function(e,t,n,r){var i=this;if(!r){if(i._isBoundary)return this._getPrivateDependency(e,t,i);i=i._parent}for(;null!=i;){var o=i._strategy.getObjByKeyId(e.id,n);if(o!==I)return o;if(b(i._parent)&&i._isBoundary)return this._getPrivateDependency(e,t,i);i=i._parent}return this._throwOrNull(e,t)},_getPrivateDependency:function(e,t,n){var r=n._parent._strategy.getObjByKeyId(e.id,P);return r!==I?r:this._throwOrNull(e,t)},_getByKeyUnbounded:function(e,t,n,r){var i=this;for(r||(n=i._isBoundary?T:j,i=i._parent);null!=i;){var o=i._strategy.getObjByKeyId(e.id,n);if(o!==I)return o;n=i._isBoundary?T:j,i=i._parent}return this._throwOrNull(e,t)},get displayName(){return"Injector(bindings: ["+i(this,function(e){return' "'+e.key.displayName+'" '}).join(", ")+"])"},toString:function(){return this.displayName}},{resolve:function(e){var i=t(e),s=r(i,new o);return n(s)},resolveAndCreate:function(t){var n=void 0!==arguments[1]?arguments[1]:null,r=e.resolve(t);return e.fromResolvedBindings(r,n)},fromResolvedBindings:function(t){var n=void 0!==arguments[1]?arguments[1]:null,r=t.map(function(e){return new L(e,j)}),i=new k(r),o=new e(i,null,n);return o}})}(),e("Injector",$),F=C.get($)}}}),System.register("angular2/src/change_detection/change_detection_jit_generator",["angular2/src/facade/lang","angular2/src/facade/collection","angular2/src/change_detection/abstract_change_detector","angular2/src/change_detection/change_detection_util","angular2/src/change_detection/proto_record","angular2/src/change_detection/codegen_name_util"],function(e){"use strict";var t,n,r,i,o,s,a,c,u,l,f,h,d,p,g,m,v,_,y,b;return{setters:[function(e){t=e.BaseException},function(e){n=e.ListWrapper},function(e){r=e.AbstractChangeDetector},function(e){i=e.ChangeDetectionUtil},function(e){o=e.RecordType},function(e){s=e.CodegenNameUtil,a=e.sanitizeName}],execute:function(){c="AbstractChangeDetector",u="ChangeDetectionUtil",l="this.dispatcher",f="this.pipes",h="this.protos",d="this.directiveRecords",p="isChanged",g="changes",m="this.locals",v="this.mode",_="this.currentProto",y="this.alreadyChecked",b=function(){function e(e,t,n,r,i){this.id=e,this.changeDetectionStrategy=t,this.records=n,this.directiveRecords=r,this.generateCheckNoChanges=i,this._names=new s(this.records,this.directiveRecords,"this._",u),this._typeName=a("ChangeDetector_"+this.id)}return $traceurRuntime.createClass(e,{generate:function(){var e=this,t="\n var "+this._typeName+" = function "+this._typeName+"(dispatcher, protos, directiveRecords) {\n "+c+".call(this, "+JSON.stringify(this.id)+", dispatcher);\n "+h+" = protos;\n "+d+" = directiveRecords;\n "+m+" = null;\n "+_+" = null;\n "+f+" = null;\n "+y+" = false;\n this.dehydrateDirectives(false);\n }\n\n "+this._typeName+".prototype = Object.create("+c+".prototype);\n\n "+this._typeName+".prototype.detectChangesInRecords = function(throwOnChange) {\n if (!this.hydrated()) {\n "+u+".throwDehydrated();\n }\n try {\n this.__detectChangesInRecords(throwOnChange);\n } catch (e) {\n this.throwError("+_+", e, e.stack);\n }\n }\n\n "+this._typeName+".prototype.__detectChangesInRecords = function(throwOnChange) {\n "+_+" = null;\n\n "+this._names.genInitLocals()+"\n var "+p+" = false;\n var "+g+" = null;\n\n context = "+this._names.getContextName()+";\n\n "+this.records.map(function(t){ +return e._genRecord(t)}).join("\n")+"\n\n "+y+" = true;\n }\n\n "+this._genCheckNoChanges()+"\n\n "+this._typeName+".prototype.callOnAllChangesDone = function() {\n "+this._genCallOnAllChangesDoneBody()+"\n }\n\n "+this._typeName+".prototype.hydrate = function(context, locals, directives, pipes) {\n "+v+' = "'+i.changeDetectionMode(this.changeDetectionStrategy)+'";\n '+this._names.getContextName()+" = context;\n "+m+" = locals;\n this.hydrateDirectives(directives);\n "+f+" = pipes;\n "+y+" = false;\n }\n\n "+this._maybeGenHydrateDirectives()+"\n\n "+this._typeName+".prototype.dehydrate = function() {\n this.dehydrateDirectives(true);\n "+m+" = null;\n "+f+" = null;\n }\n\n "+this._maybeGenDehydrateDirectives()+"\n\n "+this._typeName+".prototype.hydrated = function() {\n return "+this._names.getContextName()+" !== null;\n }\n\n return function(dispatcher) {\n return new "+this._typeName+"(dispatcher, protos, directiveRecords);\n }\n ";return new Function("AbstractChangeDetector","ChangeDetectionUtil","protos","directiveRecords",t)(r,i,this.records,this.directiveRecords)},_maybeGenDehydrateDirectives:function(){var e=this._names.genPipeOnDestroy();e&&(e="if (destroyPipes) { "+e+" }");var t=this._names.genDehydrateFields();return e||t?this._typeName+".prototype.dehydrateDirectives = function(destroyPipes) {\n "+e+"\n "+t+"\n }":""},_maybeGenHydrateDirectives:function(){var e=this._genHydrateDirectives(),t=this._genHydrateDetectors();return e||t?this._typeName+".prototype.hydrateDirectives = function(directives) {\n "+e+"\n "+t+"\n }":""},_genHydrateDirectives:function(){for(var e=this._names.getAllDirectiveNames(),t=n.createFixedSize(e.length),r=0,i=e.length;i>r;++r)t[r]=e[r]+" = directives.getDirectiveFor("+d+"["+r+"].directiveIndex);";return t.join("\n")},_genHydrateDetectors:function(){for(var e=this._names.getAllDetectorNames(),t=n.createFixedSize(e.length),r=0,i=e.length;i>r;++r)t[r]=e[r]+" =\n directives.getDetectorFor("+d+"["+r+"].directiveIndex);";return t.join("\n")},_genCallOnAllChangesDoneBody:function(){for(var e=[],t=this.directiveRecords,n=t.length-1;n>=0;--n){var r=t[n];r.callOnAllChangesDone&&e.push(this._names.getDirectiveName(r.directiveIndex)+".onAllChangesDone();")}var i=e.join("\n");return"\n this.dispatcher.notifyOnAllChangesDone();\n "+i+"\n "},_genRecord:function(e){var t;return t=e.isLifeCycleRecord()?this._genDirectiveLifecycle(e):e.isPipeRecord()?this._genPipeCheck(e):this._genReferenceCheck(e),""+t+this._maybeGenLastInDirective(e)},_genDirectiveLifecycle:function(e){if("onCheck"===e.name)return this._genOnCheck(e);if("onInit"===e.name)return this._genOnInit(e);if("onChange"===e.name)return this._genOnChange(e);throw new t("Unknown lifecycle event '"+e.name+"'")},_genPipeCheck:function(e){var t=this,n=this._names.getLocalName(e.contextIndex),r=e.args.map(function(e){return t._names.getLocalName(e)}).join(", "),i=this._names.getFieldName(e.selfIndex),o=this._names.getLocalName(e.selfIndex),s=this._names.getChangeName(e.selfIndex),a=this._names.getPipeName(e.selfIndex),c="this.ref",l=e.selfIndex-1,d=e.name;return"\n "+_+" = "+h+"["+l+"];\n if ("+a+" === "+u+".uninitialized) {\n "+a+" = "+f+".get('"+d+"', "+n+", "+c+");\n } else if (!"+a+".supports("+n+")) {\n "+a+".onDestroy();\n "+a+" = "+f+".get('"+d+"', "+n+", "+c+");\n }\n\n "+o+" = "+a+".transform("+n+", ["+r+"]);\n if ("+i+" !== "+o+") {\n "+o+" = "+u+".unwrapValue("+o+");\n "+s+" = true;\n "+this._genUpdateDirectiveOrElement(e)+"\n "+this._genAddToChanges(e)+"\n "+i+" = "+o+";\n }\n "},_genReferenceCheck:function(e){var t=this,n=this._names.getFieldName(e.selfIndex),r=this._names.getLocalName(e.selfIndex),i=e.selfIndex-1,o="\n "+_+" = "+h+"["+i+"];\n "+this._genUpdateCurrentValue(e)+"\n if ("+r+" !== "+n+") {\n "+this._names.getChangeName(e.selfIndex)+" = true;\n "+this._genUpdateDirectiveOrElement(e)+"\n "+this._genAddToChanges(e)+"\n "+n+" = "+r+";\n }\n ";if(e.isPureFunction()){var s=e.args.map(function(e){return t._names.getChangeName(e)}).join(" || ");return"if ("+s+") { "+o+" } else { "+r+" = "+n+"; }"}return o},_genUpdateCurrentValue:function(e){var n,r=this,i=-1==e.contextIndex?this._names.getDirectiveName(e.directiveIndex):this._names.getLocalName(e.contextIndex),s=this._names.getLocalName(e.selfIndex),a=e.args.map(function(e){return r._names.getLocalName(e)}).join(", ");switch(e.mode){case o.SELF:n=i;break;case o.CONST:n=JSON.stringify(e.funcOrValue);break;case o.PROPERTY:n=i+"."+e.name;break;case o.SAFE_PROPERTY:n=u+".isValueBlank("+i+") ? null : "+i+"."+e.name;break;case o.LOCAL:n=m+".get('"+e.name+"')";break;case o.INVOKE_METHOD:n=i+"."+e.name+"("+a+")";break;case o.SAFE_INVOKE_METHOD:n=u+".isValueBlank("+i+") ? null : "+i+"."+e.name+"("+a+")";break;case o.INVOKE_CLOSURE:n=i+"("+a+")";break;case o.PRIMITIVE_OP:n=u+"."+e.name+"("+a+")";break;case o.INTERPOLATE:n=this._genInterpolation(e);break;case o.KEYED_ACCESS:n=i+"["+this._names.getLocalName(e.args[0])+"]";break;default:throw new t("Unknown operation "+e.mode)}return s+" = "+n},_genInterpolation:function(e){for(var t="",n=0;n-1?(t=a.substring(e,0,r).trim(),n=a.substring(e,r+1).trim()):t=n=e,new U(n,M.getter(t))})}function n(e){var t=e.binding;if(!(t instanceof W))return[];var n=[],r=t;return l.forEach(r.hostActions,function(e,t){n.push(new K(e,M.getter(t)))}),n}var r,i,o,s,a,c,u,l,f,h,d,p,g,m,v,_,y,b,w,C,R,E,x,S,O,A,D,I,j,P,T,N,V,k,M,B,L,$,F,H,W,q,U,K,z,Q,G,Y,J,X,Z;return{setters:[function(e){r=e.isPresent,i=e.isBlank,o=e.BaseException,s=e.stringify,a=e.StringWrapper},function(e){c=e.ObservableWrapper},function(e){u=e.ListWrapper,l=e.MapWrapper},function(e){f=e.Injector,h=e.ProtoInjector,d=e.PUBLIC_AND_PRIVATE,p=e.PUBLIC,g=e.PRIVATE,m=e.undefinedValue,v=e.Key,_=e.Dependency,y=e.Binding,b=e.ResolvedBinding,w=e.NoBindingError},function(e){C=e.InjectorInlineStrategy,R=e.BindingWithVisibility},function(e){E=e.Attribute,x=e.Query},function(e){S=e},function(e){O=e.ViewContainerRef},function(e){A=e.ElementRef},function(e){D=e.TemplateRef},function(e){I=e.Directive,j=e.Component,P=e.LifecycleEvent},function(e){T=e.hasLifecycleHook},function(e){N=e.ChangeDetectorRef,V=e.Pipes},function(e){k=e.QueryList},function(e){M=e.reflector},function(e){B=e.DirectiveMetadata}],execute:function(){$=function(){function e(){this.viewManagerId=v.get(S.AppViewManager).id,this.templateRefId=v.get(D).id,this.viewContainerId=v.get(O).id,this.changeDetectorRefId=v.get(N).id,this.elementRefId=v.get(A).id,this.pipesKey=v.get(V)}return $traceurRuntime.createClass(e,{},{instance:function(){return i(L)&&(L=new e),L}})}(),e("StaticKeys",$),F=function(){function e(e){this._head=null,this._tail=null,this._next=null,r(e)&&e.addChild(this)}return $traceurRuntime.createClass(e,{addChild:function(e){r(this._tail)?(this._tail._next=e,this._tail=e):this._tail=this._head=e,e._next=null,e._parent=this},addChildAfter:function(e,t){if(i(t)){var n=this._head;this._head=e,e._next=n,i(this._tail)&&(this._tail=e)}else{if(i(t._next))return void this.addChild(e);e._next=t._next,t._next=e}e._parent=this},remove:function(){if(!i(this.parent)){var e=this._next,t=this._findPrev();i(t)?this.parent._head=this._next:t._next=this._next,i(e)&&(this._parent._tail=t),this._parent=null,this._next=null}},_findPrev:function(){var e=this.parent._head;if(e==this)return null;for(;e._next!==this;)e=e._next;return e},get parent(){return this._parent},get children(){for(var e=[],t=this._head;null!=t;)e.push(t),t=t._next;return e}},{})}(),e("TreeNode",F),H=function(e){function t(e,n,r,i,o,s){$traceurRuntime.superConstructor(t).call(this,e,n,r,i),this.attributeName=o,this.queryDecorator=s,this._verify()}return $traceurRuntime.createClass(t,{_verify:function(){var e=0;if(r(this.queryDecorator)&&e++,r(this.attributeName)&&e++,e>1)throw new o("A directive injectable can contain only one of the following @Attribute or @Query.")}},{createFrom:function(e){return new t(e.key,e.optional,e.visibility,e.properties,t._attributeName(e.properties),t._query(e.properties))},_attributeName:function(e){var t=u.find(e,function(e){return e instanceof E});return r(t)?t.attributeName:null},_query:function(e){return u.find(e,function(e){return e instanceof x})}},e)}(_),e("DirectiveDependency",H),W=function(e){function t(e,n,r,i,o,s){$traceurRuntime.superConstructor(t).call(this,e,n,r),this.resolvedHostInjectables=i,this.resolvedViewInjectables=o,this.metadata=s}return $traceurRuntime.createClass(t,{get callOnDestroy(){return this.metadata.callOnDestroy},get callOnChange(){return this.metadata.callOnChange},get callOnAllChangesDone(){return this.metadata.callOnAllChangesDone},get displayName(){return this.key.displayName},get eventEmitters(){return r(this.metadata)&&r(this.metadata.events)?this.metadata.events:[]},get hostActions(){return r(this.metadata)&&r(this.metadata.hostActions)?this.metadata.hostActions:new Map},get changeDetection(){return this.metadata.changeDetection}},{createFromBinding:function(e,n){i(n)&&(n=new I);var o=e.resolve(),a=u.map(o.dependencies,H.createFrom),c=r(n.hostInjector)?f.resolve(n.hostInjector):[],h=n instanceof j&&r(n.viewInjector)?f.resolve(n.viewInjector):[],d=B.create({id:s(o.key.token),type:n instanceof j?B.COMPONENT_TYPE:B.DIRECTIVE_TYPE,selector:n.selector,compileChildren:n.compileChildren,events:n.events,host:r(n.host)?l.createFromStringMap(n.host):null,properties:n.properties,readAttributes:t._readAttributes(a),callOnDestroy:T(P.onDestroy,o.key.token,n),callOnChange:T(P.onChange,o.key.token,n),callOnCheck:T(P.onCheck,o.key.token,n),callOnInit:T(P.onInit,o.key.token,n),callOnAllChangesDone:T(P.onAllChangesDone,o.key.token,n),changeDetection:n instanceof j?n.changeDetection:null,exportAs:n.exportAs});return new t(o.key,o.factory,a,c,h,d)},_readAttributes:function(e){var t=[];return u.forEach(e,function(e){r(e.attributeName)&&t.push(e.attributeName)}),t},createFromType:function(e,n){var r=new y(e,{toClass:e});return t.createFromBinding(r,n)}},e)}(b),e("DirectiveBinding",W),q=function(){function e(e,t,n,r){this.viewManager=e,this.view=t,this.elementRef=n,this.templateRef=r}return $traceurRuntime.createClass(e,{},{})}(),e("PreBuiltObjects",q),U=function(){function e(e,t){this.eventName=e,this.getter=t}return $traceurRuntime.createClass(e,{subscribe:function(e,t,n){var r=this,i=this.getter(n);return c.subscribe(i,function(n){return e.triggerEventHandlers(r.eventName,n,t)})}},{})}(),e("EventEmitterAccessor",U),K=function(){function e(e,t){this.methodName=e,this.getter=t}return $traceurRuntime.createClass(e,{subscribe:function(e,t,n){var r=this,i=this.getter(n);return c.subscribe(i,function(n){return e.invokeElementMethod(t,r.methodName,n)})}},{})}(),e("HostActionAccessor",K),z=function(){function e(e,r,i,o,s,a){this.parent=e,this.index=r,this.distanceToParent=o,this._firstBindingIsComponent=s,this.directiveVariableBindings=a;var c=i.length;this.protoInjector=new h(i),this.eventEmitterAccessors=u.createFixedSize(c),this.hostActionAccessors=u.createFixedSize(c);for(var l=0;c>l;++l)this.eventEmitterAccessors[l]=t(i[l]),this.hostActionAccessors[l]=n(i[l])}return $traceurRuntime.createClass(e,{instantiate:function(e){return new G(this,e)},directParent:function(){return this.distanceToParent<2?this.parent:null},get hasBindings(){return this.eventEmitterAccessors.length>0},getBindingAtIndex:function(e){return this.protoInjector.getBindingAtIndex(e)}},{create:function(t,n,r,i,o,s){var a=[];return e._createDirectiveBindingWithVisibility(r,a,i),i&&e._createViewInjectorBindingWithVisibility(r,a),e._createHostInjectorBindingWithVisibility(r,a,i),new e(t,n,a,o,i,s)},_createDirectiveBindingWithVisibility:function(t,n,r){u.forEach(t,function(i){n.push(e._createBindingWithVisibility(r,i,t,i))})},_createHostInjectorBindingWithVisibility:function(t,n,r){u.forEach(t,function(i){u.forEach(i.resolvedHostInjectables,function(o){n.push(e._createBindingWithVisibility(r,i,t,o))})})},_createBindingWithVisibility:function(e,t,n,r){var i=e&&n[0]===t;return new R(r,i?d:p)},_createViewInjectorBindingWithVisibility:function(e,t){var n=e[0];u.forEach(n.resolvedViewInjectables,function(e){return t.push(new R(e,g))})}})}(),e("ProtoElementInjector",z),Q=function(){function e(e,t,n){this.element=e,this.componentElement=t,this.injector=n}return $traceurRuntime.createClass(e,{},{})}(),G=function(e){function t(e,n){var r;$traceurRuntime.superConstructor(t).call(this,n),this._proto=e,this._preBuiltObjects=null,this._injector=new f(this._proto.protoInjector,null,this,(r=this,function(){return r._debugContext()}));var i=this._injector.internalStrategy;this._strategy=i instanceof C?new Y(i,this):new J(i,this),this.hydrated=!1,this._buildQueries(),this._addParentQueries()}return $traceurRuntime.createClass(t,{dehydrate:function(){this.hydrated=!1,this._host=null,this._preBuiltObjects=null,this._strategy.callOnDestroy(),this._strategy.dehydrate()},onAllChangesDone:function(){r(this._query0)&&this._query0.originator===this&&this._query0.list.fireCallbacks(),r(this._query1)&&this._query1.originator===this&&this._query1.list.fireCallbacks(),r(this._query2)&&this._query2.originator===this&&this._query2.list.fireCallbacks()},hydrate:function(e,t,n){this._host=t,this._preBuiltObjects=n,this._reattachInjectors(e),this._strategy.hydrate(),r(t)&&this._addViewQueries(t),this._addDirectivesToQueries(),this._addVarBindingsToQueries(),this.hydrated=!0},_debugContext:function(){var e=this._preBuiltObjects,t=e.elementRef.boundElementIndex-e.view.elementOffset,n=this._preBuiltObjects.view.getDebugContext(t,null);return r(n)?new Q(n.element,n.componentElement,n.injector):null},_reattachInjectors:function(e){r(this._parent)?r(e)?(this._reattachInjector(this._injector,e,!1),this._reattachInjector(e,this._parent._injector,!1)):this._reattachInjector(this._injector,this._parent._injector,!1):r(this._host)?r(e)?(this._reattachInjector(this._injector,e,!1),this._reattachInjector(e,this._host._injector,!0)):this._reattachInjector(this._injector,this._host._injector,!0):r(e)&&this._reattachInjector(this._injector,e,!0)},_reattachInjector:function(e,t,n){e.internalStrategy.attach(t,n)},getPipes:function(){var e=$.instance().pipesKey;return this._injector.getOptional(e)},hasVariableBinding:function(e){var t=this._proto.directiveVariableBindings;return r(t)&&t.has(e)},getVariableBinding:function(e){var t=this._proto.directiveVariableBindings.get(e);return r(t)?this.getDirectiveAtIndex(t):this.getElementRef()},get:function(e){return this._injector.get(e)},hasDirective:function(e){return r(this._injector.getOptional(e))},getEventEmitterAccessors:function(){return this._proto.eventEmitterAccessors},getHostActionAccessors:function(){return this._proto.hostActionAccessors},getDirectiveVariableBindings:function(){return this._proto.directiveVariableBindings},getComponent:function(){return this._strategy.getComponent()},getInjector:function(){return this._injector},getElementRef:function(){return this._preBuiltObjects.elementRef},getViewContainerRef:function(){return new O(this._preBuiltObjects.viewManager,this.getElementRef())},directParent:function(){return this._proto.distanceToParent<2?this.parent:null},isComponentKey:function(e){return this._strategy.isComponentKey(e)},getDependency:function(e,t,n){var o=n.key;if(!(n instanceof H))return m;if(!(t instanceof W))return m;var s=n,a=t,c=$.instance();if(o.id===c.viewManagerId)return this._preBuiltObjects.viewManager;if(r(s.attributeName))return this._buildAttribute(s);if(r(s.queryDecorator))return this._findQuery(s.queryDecorator).list;if(s.key.id===$.instance().changeDetectorRefId){if(a.metadata.type===B.COMPONENT_TYPE){var u=this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex);return u.changeDetector.ref}return this._preBuiltObjects.view.changeDetector.ref}if(s.key.id===$.instance().elementRefId)return this.getElementRef();if(s.key.id===$.instance().viewContainerId)return this.getViewContainerRef();if(s.key.id===$.instance().templateRefId){if(i(this._preBuiltObjects.templateRef)){if(s.optional)return null;throw new w(null,s.key)}return this._preBuiltObjects.templateRef}return m},_buildAttribute:function(e){var t=this._proto.attributes;return r(t)&&t.has(e.attributeName)?t.get(e.attributeName):null},_buildQueriesForDeps:function(e){for(var t=0;t",[]),u.HOST)},mergeProtoViewsRecursively:function(e){return o.resolve(v.mergeProtoViewsRecursively(e))},_compileView:function(e,t,n){e.encapsulation===f.EMULATED&&0===t.styles.length&&(e=this._normalizeViewEncapsulationIfThereAreNoStyles(e));var r=new h(this._stepFactory.createSteps(e)),i=r.processStyles(t.styles),s=r.processElements(a.createTemplate(t.template),n,e);return e.encapsulation===f.NATIVE?w(a.content(s[0].element),i.map(function(e){return a.createStyleElement(e)})):this._sharedStylesHost.addStyles(i),o.resolve(s[0].inheritedProtoView.build())},_normalizeViewEncapsulationIfThereAreNoStyles:function(e){return e.encapsulation===f.EMULATED?new c({componentId:e.componentId,templateAbsUrl:e.templateAbsUrl,template:e.template,styleAbsUrls:e.styleAbsUrls,styles:e.styles,directives:e.directives,encapsulation:f.NONE}):e}},{},e)}(l),e("DomCompiler",C),R=function(e){function t(e,n,r,i){$traceurRuntime.superConstructor(t).call(this,new g(e,i),n,r)}return $traceurRuntime.createClass(t,{},{},e)}(C),e("DefaultDomCompiler",R),e("DefaultDomCompiler",R=t([i(),r(3,y(_)),n("design:paramtypes",[m,d,b,Object])],R))}}}),System.register("angular2/http",["angular2/di","angular2/src/http/http","angular2/src/http/backends/xhr_backend","angular2/src/http/backends/jsonp_backend","angular2/src/http/backends/browser_xhr","angular2/src/http/backends/browser_jsonp","angular2/src/http/base_request_options","angular2/src/http/interfaces","angular2/src/http/base_response_options","angular2/src/http/backends/mock_backend","angular2/src/http/static_request","angular2/src/http/static_response","angular2/src/http/headers","angular2/src/http/enums","angular2/src/http/url_search_params"],function(e){"use strict";var t,n,r,i,o,s,a,c,u,l,f,h,d,p;return{setters:[function(e){t=e.bind},function(t){n=t.Http,r=t.Jsonp,e("Http",t.Http),e("Jsonp",t.Jsonp)},function(t){i=t.XHRBackend,e("XHRBackend",t.XHRBackend),e("XHRConnection",t.XHRConnection)},function(t){o=t.JSONPBackend,e("JSONPBackend",t.JSONPBackend),e("JSONPConnection",t.JSONPConnection)},function(t){s=t.BrowserXhr,e("BrowserXhr",t.BrowserXhr)},function(e){a=e.BrowserJsonp},function(t){c=t.BaseRequestOptions,u=t.RequestOptions,e("BaseRequestOptions",t.BaseRequestOptions),e("RequestOptions",t.RequestOptions)},function(t){l=t.ConnectionBackend,e("Connection",t.Connection),e("ConnectionBackend",t.ConnectionBackend)},function(t){f=t.BaseResponseOptions,h=t.ResponseOptions,e("BaseResponseOptions",t.BaseResponseOptions),e("ResponseOptions",t.ResponseOptions)},function(t){e("MockConnection",t.MockConnection),e("MockBackend",t.MockBackend)},function(t){e("Request",t.Request)},function(t){e("Response",t.Response)},function(t){e("Headers",t.Headers)},function(t){e("ResponseTypes",t.ResponseTypes),e("ReadyStates",t.ReadyStates),e("RequestMethods",t.RequestMethods),e("RequestCredentialsOpts",t.RequestCredentialsOpts),e("RequestCacheOpts",t.RequestCacheOpts),e("RequestModesOpts",t.RequestModesOpts)},function(t){e("URLSearchParams",t.URLSearchParams)}],execute:function(){d=[t(l).toClass(i),s,t(u).toClass(c),t(h).toClass(f),n],e("httpInjectables",d),p=[t(l).toClass(o),a,t(u).toClass(c),t(h).toClass(f),r],e("jsonpInjectables",p)}}}),System.register("angular2/di",["angular2/src/di/metadata","angular2/src/di/decorators","angular2/src/di/forward_ref","angular2/src/di/injector","angular2/src/di/binding","angular2/src/di/key","angular2/src/di/exceptions","angular2/src/di/opaque_token"],function(e){"use strict";var t={undefined:!0};return{setters:[function(t){e("InjectMetadata",t.InjectMetadata),e("OptionalMetadata",t.OptionalMetadata),e("InjectableMetadata",t.InjectableMetadata),e("VisibilityMetadata",t.VisibilityMetadata),e("SelfMetadata",t.SelfMetadata),e("AncestorMetadata",t.AncestorMetadata),e("UnboundedMetadata",t.UnboundedMetadata),e("DependencyMetadata",t.DependencyMetadata),e("DEFAULT_VISIBILITY",t.DEFAULT_VISIBILITY)},function(n){Object.keys(n).forEach(function(r){t[r]||e(r,n[r])})},function(t){e("forwardRef",t.forwardRef),e("resolveForwardRef",t.resolveForwardRef)},function(t){e("Injector",t.Injector),e("ProtoInjector",t.ProtoInjector),e("BindingWithVisibility",t.BindingWithVisibility),e("PUBLIC_AND_PRIVATE",t.PUBLIC_AND_PRIVATE),e("PUBLIC",t.PUBLIC),e("PRIVATE",t.PRIVATE),e("undefinedValue",t.undefinedValue)},function(t){e("Binding",t.Binding),e("BindingBuilder",t.BindingBuilder),e("ResolvedBinding",t.ResolvedBinding),e("Dependency",t.Dependency),e("bind",t.bind)},function(t){e("Key",t.Key),e("KeyRegistry",t.KeyRegistry),e("TypeLiteral",t.TypeLiteral)},function(t){e("NoBindingError",t.NoBindingError),e("AbstractBindingError",t.AbstractBindingError),e("CyclicDependencyError",t.CyclicDependencyError),e("InstantiationError",t.InstantiationError),e("InvalidBindingError",t.InvalidBindingError),e("NoAnnotationError",t.NoAnnotationError),e("OutOfBoundsError",t.OutOfBoundsError)},function(t){e("OpaqueToken",t.OpaqueToken)}],execute:function(){}}}),System.register("angular2/src/change_detection/jit_proto_change_detector",["angular2/src/facade/collection","angular2/src/change_detection/change_detection_jit_generator","angular2/src/change_detection/coalesce","angular2/src/change_detection/proto_change_detector"],function(e){"use strict";var t,n,r,i,o;return{setters:[function(e){t=e.ListWrapper},function(e){n=e.ChangeDetectorJITGenerator},function(e){r=e.coalesce},function(e){i=e.ProtoRecordBuilder}],execute:function(){o=function(){function e(e){this.definition=e,this._factory=this._createFactory(e)}return $traceurRuntime.createClass(e,{instantiate:function(e){return this._factory(e)},_createFactory:function(e){var o=new i;t.forEach(e.bindingRecords,function(t){o.add(t,e.variableNames)});var s=r(o.records);return new n(e.id,e.strategy,s,this.definition.directiveRecords,this.definition.generateCheckNoChanges).generate()}},{isSupported:function(){return!0}})}(),e("JitProtoChangeDetector",o)}}}),System.register("angular2/src/render/render",["angular2/src/render/dom/compiler/view_loader","angular2/src/render/dom/view/shared_styles_host","angular2/src/render/dom/compiler/compiler","angular2/src/render/dom/dom_renderer","angular2/src/render/dom/dom_tokens","angular2/src/render/api"],function(e){"use strict";var t={},t={},t={},t={},t={},t={};return{setters:[function(n){Object.keys(n).forEach(function(r){t[r]||e(r,n[r])})},function(n){Object.keys(n).forEach(function(r){t[r]||e(r,n[r])})},function(n){Object.keys(n).forEach(function(r){t[r]||e(r,n[r])})},function(n){Object.keys(n).forEach(function(r){t[r]||e(r,n[r])})},function(n){Object.keys(n).forEach(function(r){t[r]||e(r,n[r])})},function(n){Object.keys(n).forEach(function(r){t[r]||e(r,n[r])})}],execute:function(){}}}),System.register("angular2/src/change_detection/change_detection",["angular2/src/change_detection/jit_proto_change_detector","angular2/src/change_detection/pregen_proto_change_detector","angular2/src/change_detection/proto_change_detector","angular2/src/change_detection/pipes/pipes","angular2/src/change_detection/pipes/iterable_changes","angular2/src/change_detection/pipes/keyvalue_changes","angular2/src/change_detection/pipes/observable_pipe","angular2/src/change_detection/pipes/promise_pipe","angular2/src/change_detection/pipes/uppercase_pipe","angular2/src/change_detection/pipes/lowercase_pipe","angular2/src/change_detection/pipes/json_pipe","angular2/src/change_detection/pipes/limit_to_pipe","angular2/src/change_detection/pipes/date_pipe","angular2/src/change_detection/pipes/number_pipe","angular2/src/change_detection/pipes/null_pipe","angular2/src/change_detection/interfaces","angular2/di","angular2/src/facade/collection","angular2/src/facade/lang","angular2/src/change_detection/parser/ast","angular2/src/change_detection/parser/lexer","angular2/src/change_detection/parser/parser","angular2/src/change_detection/parser/locals","angular2/src/change_detection/exceptions","angular2/src/change_detection/constants","angular2/src/change_detection/binding_record","angular2/src/change_detection/directive_record","angular2/src/change_detection/dynamic_change_detector","angular2/src/change_detection/change_detector_ref","angular2/src/change_detection/pipes/pipe"],function(e){"use strict";var t,n,r,i,o,s,a,c,u,l,f,h,d,p,g,m,v,_,y,b,w,C,R,E,x,S,O,A,D,I,j,P,T,N,V,k,M,B,L,$,F,H,W,q,U,K;return{setters:[function(e){i=e.JitProtoChangeDetector},function(e){o=e.PregenProtoChangeDetector},function(t){s=t.DynamicProtoChangeDetector,e("DynamicProtoChangeDetector",t.DynamicProtoChangeDetector)},function(t){a=t.Pipes,e("Pipes",t.Pipes)},function(e){c=e.IterableChangesFactory},function(e){u=e.KeyValueChangesFactory},function(e){l=e.ObservablePipeFactory},function(e){f=e.PromisePipeFactory},function(e){h=e.UpperCasePipe},function(e){d=e.LowerCasePipe},function(e){p=e.JsonPipe},function(e){g=e.LimitToPipeFactory},function(e){m=e.DatePipe},function(e){v=e.DecimalPipe,_=e.PercentPipe,y=e.CurrencyPipe},function(t){b=t.NullPipeFactory,e("NullPipe",t.NullPipe),e("NullPipeFactory",t.NullPipeFactory)},function(t){w=t.ChangeDetection,e("ChangeDetection",t.ChangeDetection),e("ChangeDetectorDefinition",t.ChangeDetectorDefinition)},function(e){C=e.Inject,R=e.Injectable,E=e.OpaqueToken,x=e.Optional},function(e){S=e.StringMapWrapper},function(e){O=e.CONST,A=e.CONST_EXPR,D=e.isPresent},function(t){e("ASTWithSource",t.ASTWithSource),e("AST",t.AST),e("AstTransformer",t.AstTransformer),e("AccessMember",t.AccessMember),e("LiteralArray",t.LiteralArray),e("ImplicitReceiver",t.ImplicitReceiver)},function(t){e("Lexer",t.Lexer)},function(t){e("Parser",t.Parser)},function(t){e("Locals",t.Locals)},function(t){e("DehydratedException",t.DehydratedException),e("ExpressionChangedAfterItHasBeenCheckedException",t.ExpressionChangedAfterItHasBeenCheckedException),e("ChangeDetectionError",t.ChangeDetectionError)},function(t){e("CHECK_ONCE",t.CHECK_ONCE),e("CHECK_ALWAYS",t.CHECK_ALWAYS),e("DETACHED",t.DETACHED),e("CHECKED",t.CHECKED),e("ON_PUSH",t.ON_PUSH),e("DEFAULT",t.DEFAULT)},function(t){e("BindingRecord",t.BindingRecord)},function(t){e("DirectiveIndex",t.DirectiveIndex),e("DirectiveRecord",t.DirectiveRecord)},function(t){e("DynamicChangeDetector",t.DynamicChangeDetector)},function(t){e("ChangeDetectorRef",t.ChangeDetectorRef)},function(t){e("WrappedValue",t.WrappedValue),e("BasePipe",t.BasePipe)}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},r=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}},I=A([A(new u),A(new b)]),e("keyValDiff",I),j=A([A(new c),A(new b)]),e("iterableDiff",j),P=A([A(new l),A(new f),A(new b)]),e("async",P),T=A([A(new h),A(new b)]),e("uppercase",T),N=A([A(new d),A(new b)]),e("lowercase",N),V=A([A(new p),A(new b)]),e("json",V),k=A([A(new g),A(new b)]),e("limitTo",k),M=A([A(new v),A(new b)]),e("decimal",M),B=A([A(new _),A(new b)]),e("percent",B),L=A([A(new y),A(new b)]),e("currency",L),$=A([A(new m),A(new b)]),e("date",$),F=A(new a({iterableDiff:j,keyValDiff:I,async:P,uppercase:T,lowercase:N,json:V,limitTo:k,number:M,percent:B,currency:L,date:$})),e("defaultPipes",F),H={},e("preGeneratedProtoDetectors",H),W=A(new E("ProtoChangeDetectors")),e("PROTO_CHANGE_DETECTOR_KEY",W),q=function(e){function t(e){$traceurRuntime.superConstructor(t).call(this),this._dynamicChangeDetection=new U,this._protoChangeDetectorFactories=D(e)?e:H}return $traceurRuntime.createClass(t,{createProtoChangeDetector:function(e){var t=e.id;return S.contains(this._protoChangeDetectorFactories,t)?S.get(this._protoChangeDetectorFactories,t)(e):this._dynamicChangeDetection.createProtoChangeDetector(e)}},{isSupported:function(){return o.isSupported()}},e)}(w),e("PreGeneratedChangeDetection",q),e("PreGeneratedChangeDetection",q=t([R(),r(0,C(W)),r(0,x()),n("design:paramtypes",[Object])],q)),U=function(e){function t(){$traceurRuntime.superConstructor(t).apply(this,arguments)}return $traceurRuntime.createClass(t,{createProtoChangeDetector:function(e){return new s(e)}},{},e)}(w),e("DynamicChangeDetection",U),e("DynamicChangeDetection",U=t([R(),n("design:paramtypes",[])],U)),K=function(e){function t(){$traceurRuntime.superConstructor(t).apply(this,arguments)}return $traceurRuntime.createClass(t,{createProtoChangeDetector:function(e){return new i(e)}},{isSupported:function(){return i.isSupported()}},e)}(w),e("JitChangeDetection",K),e("JitChangeDetection",K=t([R(),O(),n("design:paramtypes",[])],K))}}}),System.register("angular2/change_detection",["angular2/src/change_detection/change_detection"],function(e){"use strict";return{setters:[function(t){e("CHECK_ONCE",t.CHECK_ONCE),e("CHECK_ALWAYS",t.CHECK_ALWAYS),e("DETACHED",t.DETACHED),e("CHECKED",t.CHECKED),e("ON_PUSH",t.ON_PUSH),e("DEFAULT",t.DEFAULT),e("ExpressionChangedAfterItHasBeenCheckedException",t.ExpressionChangedAfterItHasBeenCheckedException),e("ChangeDetectionError",t.ChangeDetectionError),e("ChangeDetectorRef",t.ChangeDetectorRef),e("WrappedValue",t.WrappedValue),e("Pipes",t.Pipes),e("BasePipe",t.BasePipe),e("NullPipe",t.NullPipe),e("NullPipeFactory",t.NullPipeFactory)}],execute:function(){}}}),System.register("angular2/src/core/annotations_impl/annotations",["angular2/src/facade/lang","angular2/src/di/metadata","angular2/change_detection"],function(e){"use strict";var t,n,r,i,o,s,a,c;return{setters:[function(e){r=e.CONST},function(e){i=e.InjectableMetadata},function(e){o=e.DEFAULT}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=function(e){function t(){var e,n=void 0!==arguments[0]?arguments[0]:{},r=n.selector,i=n.properties,o=n.events,s=n.host,a=n.lifecycle,c=n.hostInjector,u=n.exportAs,l=void 0===(e=n.compileChildren)?!0:e;$traceurRuntime.superConstructor(t).call(this),this.selector=r,this.properties=i,this.events=o,this.host=s,this.exportAs=u,this.lifecycle=a,this.compileChildren=l,this.hostInjector=c}return $traceurRuntime.createClass(t,{},{},e)}(i),e("Directive",s),e("Directive",s=t([r(),n("design:paramtypes",[Object])],s)),a=function(e){function t(){var e,n,r=void 0!==arguments[0]?arguments[0]:{},i=r.selector,s=r.properties,a=r.events,c=r.host,u=r.exportAs,l=r.lifecycle,f=r.hostInjector,h=r.viewInjector,d=void 0===(e=r.changeDetection)?o:e,p=void 0===(n=r.compileChildren)?!0:n;$traceurRuntime.superConstructor(t).call(this,{selector:i,properties:s,events:a,host:c,exportAs:u,hostInjector:f,lifecycle:l,compileChildren:p}),this.changeDetection=d,this.viewInjector=h}return $traceurRuntime.createClass(t,{},{},e)}(s),e("Component",a),e("Component",a=t([r(),n("design:paramtypes",[Object])],a)),e("LifecycleEvent",c),function(e){e[e.onDestroy=0]="onDestroy",e[e.onChange=1]="onChange",e[e.onCheck=2]="onCheck",e[e.onInit=3]="onInit",e[e.onAllChangesDone=4]="onAllChangesDone"}(c||e("LifecycleEvent",c={}))}}}),System.register("angular2/src/core/compiler/directive_resolver",["angular2/di","angular2/src/facade/lang","angular2/src/core/annotations_impl/annotations","angular2/src/reflection/reflection"],function(e){"use strict";var t,n,r,i,o,s,a,c,u,l;return{setters:[function(e){r=e.resolveForwardRef,i=e.Injectable},function(e){o=e.isPresent,s=e.BaseException,a=e.stringify},function(e){c=e.Directive},function(e){u=e.reflector}],execute:function(){t=this&&this.__decorate||function(e,t,n,r){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,n,r);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,r){return void(r&&r(t,n))},void 0);case 4:return e.reduceRight(function(e,r){return r&&r(t,n,e)||e},r)}},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},l=$traceurRuntime.createClass(function(){},{resolve:function(e){var t=u.annotations(r(e));if(o(t))for(var n=0;n is used within the recursive path of "+h(s));if(e.type===O.ViewType.COMPONENT)throw new l("Unconditional component cycle in "+h(s));a(n.get(s))}else{var c=r._compile(o,n);p(c)?i.push(c.then(a)):a(c)}})}),g.all(i).then(function(t){return g.all(e.map(function(e){return r._mergeProtoView(e)}))}).then(function(t){return e[0]})},_mergeProtoView:function(e){return e.type!==O.ViewType.HOST&&e.type!==O.ViewType.EMBEDDED?null:this._render.mergeProtoViewsRecursively(this._collectMergeRenderProtoViews(e)).then(function(t){e.mergeMapping=new b(t)})},_collectMergeRenderProtoViews:function(e){for(var t=[e.render],n=0;n -1; + +// TODO(vicb): remove '!isFirefox' when the bug gets fixed: +// https://bugzilla.mozilla.org/show_bug.cgi?id=1162013 +if (hasNativePromise && !isFirefox) { + // When available use a native Promise to schedule microtasks. + // When not available, es6-promise fallback will be used + var resolvedPromise = Promise.resolve(); + es6Promise._setScheduler(function(fn) { + resolvedPromise.then(fn); + }); +} + + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"es6-promise":15}],4:[function(require,module,exports){ +(function (global){ +'use strict'; + +var fnPatch = require('./functions'); +var promisePatch = require('./promise'); +var mutationObserverPatch = require('./mutation-observer'); +var definePropertyPatch = require('./define-property'); +var registerElementPatch = require('./register-element'); +var webSocketPatch = require('./websocket'); +var eventTargetPatch = require('./event-target'); +var propertyDescriptorPatch = require('./property-descriptor'); +var geolocationPatch = require('./geolocation'); + +function apply() { + fnPatch.patchSetClearFunction(global, [ + 'timeout', + 'interval', + 'immediate' + ]); + + fnPatch.patchSetFunction(global, [ + 'requestAnimationFrame', + 'mozRequestAnimationFrame', + 'webkitRequestAnimationFrame' + ]); + + fnPatch.patchFunction(global, [ + 'alert', + 'prompt' + ]); + + eventTargetPatch.apply(); + + propertyDescriptorPatch.apply(); + + promisePatch.apply(); + + mutationObserverPatch.patchClass('MutationObserver'); + mutationObserverPatch.patchClass('WebKitMutationObserver'); + + definePropertyPatch.apply(); + + registerElementPatch.apply(); + + geolocationPatch.apply(); +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./define-property":5,"./event-target":6,"./functions":7,"./geolocation":8,"./mutation-observer":9,"./promise":10,"./property-descriptor":11,"./register-element":12,"./websocket":13}],5:[function(require,module,exports){ +'use strict'; + +// might need similar for object.freeze +// i regret nothing + +var _defineProperty = Object.defineProperty; +var _getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; +var _create = Object.create; + +function apply() { + Object.defineProperty = function (obj, prop, desc) { + if (isUnconfigurable(obj, prop)) { + throw new TypeError('Cannot assign to read only property \'' + prop + '\' of ' + obj); + } + if (prop !== 'prototype') { + desc = rewriteDescriptor(obj, prop, desc); + } + return _defineProperty(obj, prop, desc); + }; + + Object.defineProperties = function (obj, props) { + Object.keys(props).forEach(function (prop) { + Object.defineProperty(obj, prop, props[prop]); + }); + return obj; + }; + + Object.create = function (obj, proto) { + if (typeof proto === 'object') { + Object.keys(proto).forEach(function (prop) { + proto[prop] = rewriteDescriptor(obj, prop, proto[prop]); + }); + } + return _create(obj, proto); + }; + + Object.getOwnPropertyDescriptor = function (obj, prop) { + var desc = _getOwnPropertyDescriptor(obj, prop); + if (isUnconfigurable(obj, prop)) { + desc.configurable = false; + } + return desc; + }; +}; + +function _redefineProperty(obj, prop, desc) { + desc = rewriteDescriptor(obj, prop, desc); + return _defineProperty(obj, prop, desc); +}; + +function isUnconfigurable (obj, prop) { + return obj && obj.__unconfigurables && obj.__unconfigurables[prop]; +} + +function rewriteDescriptor (obj, prop, desc) { + desc.configurable = true; + if (!desc.configurable) { + if (!obj.__unconfigurables) { + _defineProperty(obj, '__unconfigurables', { writable: true, value: {} }); + } + obj.__unconfigurables[prop] = true; + } + return desc; +} + +module.exports = { + apply: apply, + _redefineProperty: _redefineProperty +}; + + + +},{}],6:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function apply() { + // patched properties depend on addEventListener, so this needs to come first + if (global.EventTarget) { + utils.patchEventTargetMethods(global.EventTarget.prototype); + + // Note: EventTarget is not available in all browsers, + // if it's not available, we instead patch the APIs in the IDL that inherit from EventTarget + } else { + var apis = [ 'ApplicationCache', + 'EventSource', + 'FileReader', + 'InputMethodContext', + 'MediaController', + 'MessagePort', + 'Node', + 'Performance', + 'SVGElementInstance', + 'SharedWorker', + 'TextTrack', + 'TextTrackCue', + 'TextTrackList', + 'WebKitNamedFlow', + 'Window', + 'Worker', + 'WorkerGlobalScope', + 'XMLHttpRequest', + 'XMLHttpRequestEventTarget', + 'XMLHttpRequestUpload' + ]; + + apis.forEach(function(thing) { + global[thing] && utils.patchEventTargetMethods(global[thing].prototype); + }); + } +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],7:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function patchSetClearFunction(obj, fnNames) { + fnNames.map(function (name) { + return name[0].toUpperCase() + name.substr(1); + }).forEach(function (name) { + var setName = 'set' + name; + var delegate = obj[setName]; + + if (delegate) { + var clearName = 'clear' + name; + var ids = {}; + + var bindArgs = setName === 'setInterval' ? utils.bindArguments : utils.bindArgumentsOnce; + + global.zone[setName] = function (fn) { + var id, fnRef = fn; + arguments[0] = function () { + delete ids[id]; + return fnRef.apply(this, arguments); + }; + var args = bindArgs(arguments); + id = delegate.apply(obj, args); + ids[id] = true; + return id; + }; + + obj[setName] = function () { + return global.zone[setName].apply(this, arguments); + }; + + var clearDelegate = obj[clearName]; + + global.zone[clearName] = function (id) { + if (ids[id]) { + delete ids[id]; + global.zone.dequeueTask(); + } + return clearDelegate.apply(this, arguments); + }; + + obj[clearName] = function () { + return global.zone[clearName].apply(this, arguments); + }; + } + }); +}; + +function patchSetFunction(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + + if (delegate) { + global.zone[name] = function (fn) { + var fnRef = fn; + arguments[0] = function () { + return fnRef.apply(this, arguments); + }; + var args = utils.bindArgumentsOnce(arguments); + return delegate.apply(obj, args); + }; + + obj[name] = function () { + return zone[name].apply(this, arguments); + }; + } + }); +}; + +function patchFunction(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + global.zone[name] = function () { + return delegate.apply(obj, arguments); + }; + + obj[name] = function () { + return global.zone[name].apply(this, arguments); + }; + }); +}; + + +module.exports = { + patchSetClearFunction: patchSetClearFunction, + patchSetFunction: patchSetFunction, + patchFunction: patchFunction +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],8:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function apply() { + if (global.navigator && global.navigator.geolocation) { + utils.patchPrototype(global.navigator.geolocation, [ + 'getCurrentPosition', + 'watchPosition' + ]); + } +} + +module.exports = { + apply: apply +} + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],9:[function(require,module,exports){ +(function (global){ +'use strict'; + +// wrap some native API on `window` +function patchClass(className) { + var OriginalClass = global[className]; + if (!OriginalClass) return; + + global[className] = function (fn) { + this._o = new OriginalClass(global.zone.bind(fn, true)); + // Remember where the class was instantiate to execute the enqueueTask and dequeueTask hooks + this._creationZone = global.zone; + }; + + var instance = new OriginalClass(function () {}); + + global[className].prototype.disconnect = function () { + var result = this._o.disconnect.apply(this._o, arguments); + if (this._active) { + this._creationZone.dequeueTask(); + this._active = false; + } + return result; + }; + + global[className].prototype.observe = function () { + if (!this._active) { + this._creationZone.enqueueTask(); + this._active = true; + } + return this._o.observe.apply(this._o, arguments); + }; + + var prop; + for (prop in instance) { + (function (prop) { + if (typeof global[className].prototype !== undefined) { + return; + } + if (typeof instance[prop] === 'function') { + global[className].prototype[prop] = function () { + return this._o[prop].apply(this._o, arguments); + }; + } else { + Object.defineProperty(global[className].prototype, prop, { + set: function (fn) { + if (typeof fn === 'function') { + this._o[prop] = global.zone.bind(fn); + } else { + this._o[prop] = fn; + } + }, + get: function () { + return this._o[prop]; + } + }); + } + }(prop)); + } +}; + +module.exports = { + patchClass: patchClass +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],10:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +/* + * Patches a function that returns a Promise-like instance. + * + * This function must be used when either: + * - Native Promises are not available, + * - The function returns a Promise-like object. + * + * This is required because zones rely on a Promise monkey patch that could not be applied when + * Promise is not natively available or when the returned object is not an instance of Promise. + * + * Note that calling `bindPromiseFn` on a function that returns a native Promise will also work + * with minimal overhead. + * + * ``` + * var boundFunction = bindPromiseFn(FunctionReturningAPromise); + * + * boundFunction.then(successHandler, errorHandler); + * ``` + */ +var bindPromiseFn; + +if (global.Promise) { + bindPromiseFn = function (delegate) { + return function() { + var delegatePromise = delegate.apply(this, arguments); + + // if the delegate returned an instance of Promise, forward it. + if (delegatePromise instanceof Promise) { + return delegatePromise; + } + + // Otherwise wrap the Promise-like in a global Promise + return new Promise(function(resolve, reject) { + delegatePromise.then(resolve, reject); + }); + }; + }; +} else { + bindPromiseFn = function (delegate) { + return function () { + return _patchThenable(delegate.apply(this, arguments)); + }; + }; +} + + +function _patchPromiseFnsOnObject(objectPath, fnNames) { + var obj = global; + + var exists = objectPath.every(function (segment) { + obj = obj[segment]; + return obj; + }); + + if (!exists) { + return; + } + + fnNames.forEach(function (name) { + var fn = obj[name]; + if (fn) { + obj[name] = bindPromiseFn(fn); + } + }); +} + +function _patchThenable(thenable) { + var then = thenable.then; + thenable.then = function () { + var args = utils.bindArguments(arguments); + var nextThenable = then.apply(thenable, args); + return _patchThenable(nextThenable); + }; + + var ocatch = thenable.catch; + thenable.catch = function () { + var args = utils.bindArguments(arguments); + var nextThenable = ocatch.apply(thenable, args); + return _patchThenable(nextThenable); + }; + + return thenable; +} + + +function apply() { + // Patch .then() and .catch() on native Promises to execute callbacks in the zone where + // those functions are called. + if (global.Promise) { + utils.patchPrototype(Promise.prototype, [ + 'then', + 'catch' + ]); + + // Patch browser APIs that return a Promise + var patchFns = [ + // fetch + [[], ['fetch']], + [['Response', 'prototype'], ['arrayBuffer', 'blob', 'json', 'text']] + ]; + + patchFns.forEach(function(objPathAndFns) { + _patchPromiseFnsOnObject(objPathAndFns[0], objPathAndFns[1]); + }); + } +} + +module.exports = { + apply: apply, + bindPromiseFn: bindPromiseFn +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],11:[function(require,module,exports){ +(function (global){ +'use strict'; + +var webSocketPatch = require('./websocket'); +var utils = require('../utils'); + +var eventNames = 'copy cut paste abort blur focus canplay canplaythrough change click contextmenu dblclick drag dragend dragenter dragleave dragover dragstart drop durationchange emptied ended input invalid keydown keypress keyup load loadeddata loadedmetadata loadstart message mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup pause play playing progress ratechange reset scroll seeked seeking select show stalled submit suspend timeupdate volumechange waiting mozfullscreenchange mozfullscreenerror mozpointerlockchange mozpointerlockerror error webglcontextrestored webglcontextlost webglcontextcreationerror'.split(' '); + +function apply() { + if (canPatchViaPropertyDescriptor()) { + // for browsers that we can patch the descriptor: Chrome & Firefox + var onEventNames = eventNames.map(function (property) { + return 'on' + property; + }); + utils.patchProperties(HTMLElement.prototype, onEventNames); + utils.patchProperties(XMLHttpRequest.prototype); + if (typeof WebSocket !== 'undefined') { + utils.patchProperties(WebSocket.prototype); + } + } else { + // Safari + patchViaCapturingAllTheEvents(); + utils.patchClass('XMLHttpRequest'); + webSocketPatch.apply(); + } +} + +function canPatchViaPropertyDescriptor() { + if (!Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'onclick') && typeof Element !== 'undefined') { + // WebKit https://bugs.webkit.org/show_bug.cgi?id=134364 + // IDL interface attributes are not configurable + var desc = Object.getOwnPropertyDescriptor(Element.prototype, 'onclick'); + if (desc && !desc.configurable) return false; + } + + Object.defineProperty(HTMLElement.prototype, 'onclick', { + get: function () { + return true; + } + }); + var elt = document.createElement('div'); + var result = !!elt.onclick; + Object.defineProperty(HTMLElement.prototype, 'onclick', {}); + return result; +}; + +// Whenever any event fires, we check the event target and all parents +// for `onwhatever` properties and replace them with zone-bound functions +// - Chrome (for now) +function patchViaCapturingAllTheEvents() { + eventNames.forEach(function (property) { + var onproperty = 'on' + property; + document.addEventListener(property, function (event) { + var elt = event.target, bound; + while (elt) { + if (elt[onproperty] && !elt[onproperty]._unbound) { + bound = global.zone.bind(elt[onproperty]); + bound._unbound = elt[onproperty]; + elt[onproperty] = bound; + } + elt = elt.parentElement; + } + }, true); + }); +}; + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14,"./websocket":13}],12:[function(require,module,exports){ +(function (global){ +'use strict'; + +var _redefineProperty = require('./define-property')._redefineProperty; + +function apply() { + if (!('registerElement' in global.document)) { + return; + } + + var _registerElement = document.registerElement; + var callbacks = [ + 'createdCallback', + 'attachedCallback', + 'detachedCallback', + 'attributeChangedCallback' + ]; + + document.registerElement = function (name, opts) { + if (opts && opts.prototype) { + callbacks.forEach(function (callback) { + if (opts.prototype.hasOwnProperty(callback)) { + var descriptor = Object.getOwnPropertyDescriptor(opts.prototype, callback); + if (descriptor.value) { + descriptor.value = global.zone.bind(descriptor.value); + _redefineProperty(opts.prototype, callback, descriptor); + } else { + opts.prototype[callback] = global.zone.bind(opts.prototype[callback]); + } + } else if (opts.prototype[callback]) { + opts.prototype[callback] = global.zone.bind(opts.prototype[callback]); + } + }); + } + + return _registerElement.apply(document, [name, opts]); + }; +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./define-property":5}],13:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +// we have to patch the instance since the proto is non-configurable +function apply() { + var WS = global.WebSocket; + utils.patchEventTargetMethods(WS.prototype); + global.WebSocket = function(a, b) { + var socket = arguments.length > 1 ? new WS(a, b) : new WS(a); + var proxySocket; + + // Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance + var onmessageDesc = Object.getOwnPropertyDescriptor(socket, 'onmessage'); + if (onmessageDesc && onmessageDesc.configurable === false) { + proxySocket = Object.create(socket); + ['addEventListener', 'removeEventListener', 'send', 'close'].forEach(function(propName) { + proxySocket[propName] = function() { + return socket[propName].apply(socket, arguments); + }; + }); + } else { + // we can patch the real socket + proxySocket = socket; + } + + utils.patchProperties(proxySocket, ['onclose', 'onerror', 'onmessage', 'onopen']); + + return proxySocket; + }; +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],14:[function(require,module,exports){ +(function (global){ +'use strict'; + +function bindArguments(args) { + for (var i = args.length - 1; i >= 0; i--) { + if (typeof args[i] === 'function') { + args[i] = global.zone.bind(args[i]); + } + } + return args; +}; + +function bindArgumentsOnce(args) { + for (var i = args.length - 1; i >= 0; i--) { + if (typeof args[i] === 'function') { + args[i] = global.zone.bindOnce(args[i]); + } + } + return args; +}; + +function patchPrototype(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + if (delegate) { + obj[name] = function () { + return delegate.apply(this, bindArguments(arguments)); + }; + } + }); +}; + +function patchProperty(obj, prop) { + var desc = Object.getOwnPropertyDescriptor(obj, prop) || { + enumerable: true, + configurable: true + }; + + // A property descriptor cannot have getter/setter and be writable + // deleting the writable and value properties avoids this error: + // + // TypeError: property descriptors must not specify a value or be writable when a + // getter or setter has been specified + delete desc.writable; + delete desc.value; + + // substr(2) cuz 'onclick' -> 'click', etc + var eventName = prop.substr(2); + var _prop = '_' + prop; + + desc.set = function (fn) { + if (this[_prop]) { + this.removeEventListener(eventName, this[_prop]); + } + + if (typeof fn === 'function') { + this[_prop] = fn; + this.addEventListener(eventName, fn, false); + } else { + this[_prop] = null; + } + }; + + desc.get = function () { + return this[_prop]; + }; + + Object.defineProperty(obj, prop, desc); +}; + +function patchProperties(obj, properties) { + + (properties || (function () { + var props = []; + for (var prop in obj) { + props.push(prop); + } + return props; + }()). + filter(function (propertyName) { + return propertyName.substr(0,2) === 'on'; + })). + forEach(function (eventName) { + patchProperty(obj, eventName); + }); +}; + +function patchEventTargetMethods(obj) { + var addDelegate = obj.addEventListener; + obj.addEventListener = function (eventName, fn) { + fn._bound = fn._bound || {}; + arguments[1] = fn._bound[eventName] = zone.bind(fn); + return addDelegate.apply(this, arguments); + }; + + var removeDelegate = obj.removeEventListener; + obj.removeEventListener = function (eventName, fn) { + if(arguments[1]._bound && arguments[1]._bound[eventName]) { + var _bound = arguments[1]._bound; + arguments[1] = _bound[eventName]; + delete _bound[eventName]; + } + var result = removeDelegate.apply(this, arguments); + global.zone.dequeueTask(fn); + return result; + }; +}; + +// wrap some native API on `window` +function patchClass(className) { + var OriginalClass = global[className]; + if (!OriginalClass) return; + + global[className] = function () { + var a = bindArguments(arguments); + switch (a.length) { + case 0: this._o = new OriginalClass(); break; + case 1: this._o = new OriginalClass(a[0]); break; + case 2: this._o = new OriginalClass(a[0], a[1]); break; + case 3: this._o = new OriginalClass(a[0], a[1], a[2]); break; + case 4: this._o = new OriginalClass(a[0], a[1], a[2], a[3]); break; + default: throw new Error('what are you even doing?'); + } + }; + + var instance = new OriginalClass(); + + var prop; + for (prop in instance) { + (function (prop) { + if (typeof instance[prop] === 'function') { + global[className].prototype[prop] = function () { + return this._o[prop].apply(this._o, arguments); + }; + } else { + Object.defineProperty(global[className].prototype, prop, { + set: function (fn) { + if (typeof fn === 'function') { + this._o[prop] = global.zone.bind(fn); + } else { + this._o[prop] = fn; + } + }, + get: function () { + return this._o[prop]; + } + }); + } + }(prop)); + } + + for (prop in OriginalClass) { + if (prop !== 'prototype' && OriginalClass.hasOwnProperty(prop)) { + global[className][prop] = OriginalClass[prop]; + } + } +}; + +module.exports = { + bindArguments: bindArguments, + bindArgumentsOnce: bindArgumentsOnce, + patchPrototype: patchPrototype, + patchProperty: patchProperty, + patchProperties: patchProperties, + patchEventTargetMethods: patchEventTargetMethods, + patchClass: patchClass +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],15:[function(require,module,exports){ +(function (process,global){ +/*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE + * @version 2.3.0 + */ + +(function() { + "use strict"; + function lib$es6$promise$utils$$objectOrFunction(x) { + return typeof x === 'function' || (typeof x === 'object' && x !== null); + } + + function lib$es6$promise$utils$$isFunction(x) { + return typeof x === 'function'; + } + + function lib$es6$promise$utils$$isMaybeThenable(x) { + return typeof x === 'object' && x !== null; + } + + var lib$es6$promise$utils$$_isArray; + if (!Array.isArray) { + lib$es6$promise$utils$$_isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; + } else { + lib$es6$promise$utils$$_isArray = Array.isArray; + } + + var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray; + var lib$es6$promise$asap$$len = 0; + var lib$es6$promise$asap$$toString = {}.toString; + var lib$es6$promise$asap$$vertxNext; + var lib$es6$promise$asap$$customSchedulerFn; + + var lib$es6$promise$asap$$asap = function asap(callback, arg) { + lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback; + lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg; + lib$es6$promise$asap$$len += 2; + if (lib$es6$promise$asap$$len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + if (lib$es6$promise$asap$$customSchedulerFn) { + lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush); + } else { + lib$es6$promise$asap$$scheduleFlush(); + } + } + } + + function lib$es6$promise$asap$$setScheduler(scheduleFn) { + lib$es6$promise$asap$$customSchedulerFn = scheduleFn; + } + + function lib$es6$promise$asap$$setAsap(asapFn) { + lib$es6$promise$asap$$asap = asapFn; + } + + var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined; + var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {}; + var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver; + var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + + // test for web worker but not in IE10 + var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' && + typeof importScripts !== 'undefined' && + typeof MessageChannel !== 'undefined'; + + // node + function lib$es6$promise$asap$$useNextTick() { + var nextTick = process.nextTick; + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // setImmediate should be used instead instead + var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/); + if (Array.isArray(version) && version[1] === '0' && version[2] === '10') { + nextTick = setImmediate; + } + return function() { + nextTick(lib$es6$promise$asap$$flush); + }; + } + + // vertx + function lib$es6$promise$asap$$useVertxTimer() { + return function() { + lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush); + }; + } + + function lib$es6$promise$asap$$useMutationObserver() { + var iterations = 0; + var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return function() { + node.data = (iterations = ++iterations % 2); + }; + } + + // web worker + function lib$es6$promise$asap$$useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = lib$es6$promise$asap$$flush; + return function () { + channel.port2.postMessage(0); + }; + } + + function lib$es6$promise$asap$$useSetTimeout() { + return function() { + setTimeout(lib$es6$promise$asap$$flush, 1); + }; + } + + var lib$es6$promise$asap$$queue = new Array(1000); + function lib$es6$promise$asap$$flush() { + for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) { + var callback = lib$es6$promise$asap$$queue[i]; + var arg = lib$es6$promise$asap$$queue[i+1]; + + callback(arg); + + lib$es6$promise$asap$$queue[i] = undefined; + lib$es6$promise$asap$$queue[i+1] = undefined; + } + + lib$es6$promise$asap$$len = 0; + } + + function lib$es6$promise$asap$$attemptVertex() { + try { + var r = require; + var vertx = r('vertx'); + lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext; + return lib$es6$promise$asap$$useVertxTimer(); + } catch(e) { + return lib$es6$promise$asap$$useSetTimeout(); + } + } + + var lib$es6$promise$asap$$scheduleFlush; + // Decide what async method to use to triggering processing of queued callbacks: + if (lib$es6$promise$asap$$isNode) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick(); + } else if (lib$es6$promise$asap$$BrowserMutationObserver) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver(); + } else if (lib$es6$promise$asap$$isWorker) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel(); + } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertex(); + } else { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout(); + } + + function lib$es6$promise$$internal$$noop() {} + + var lib$es6$promise$$internal$$PENDING = void 0; + var lib$es6$promise$$internal$$FULFILLED = 1; + var lib$es6$promise$$internal$$REJECTED = 2; + + var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject(); + + function lib$es6$promise$$internal$$selfFullfillment() { + return new TypeError("You cannot resolve a promise with itself"); + } + + function lib$es6$promise$$internal$$cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); + } + + function lib$es6$promise$$internal$$getThen(promise) { + try { + return promise.then; + } catch(error) { + lib$es6$promise$$internal$$GET_THEN_ERROR.error = error; + return lib$es6$promise$$internal$$GET_THEN_ERROR; + } + } + + function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) { + try { + then.call(value, fulfillmentHandler, rejectionHandler); + } catch(e) { + return e; + } + } + + function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) { + lib$es6$promise$asap$$asap(function(promise) { + var sealed = false; + var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) { + if (sealed) { return; } + sealed = true; + if (thenable !== value) { + lib$es6$promise$$internal$$resolve(promise, value); + } else { + lib$es6$promise$$internal$$fulfill(promise, value); + } + }, function(reason) { + if (sealed) { return; } + sealed = true; + + lib$es6$promise$$internal$$reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + lib$es6$promise$$internal$$reject(promise, error); + } + }, promise); + } + + function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) { + if (thenable._state === lib$es6$promise$$internal$$FULFILLED) { + lib$es6$promise$$internal$$fulfill(promise, thenable._result); + } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, thenable._result); + } else { + lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) { + lib$es6$promise$$internal$$resolve(promise, value); + }, function(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + }); + } + } + + function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) { + if (maybeThenable.constructor === promise.constructor) { + lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable); + } else { + var then = lib$es6$promise$$internal$$getThen(maybeThenable); + + if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error); + } else if (then === undefined) { + lib$es6$promise$$internal$$fulfill(promise, maybeThenable); + } else if (lib$es6$promise$utils$$isFunction(then)) { + lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then); + } else { + lib$es6$promise$$internal$$fulfill(promise, maybeThenable); + } + } + } + + function lib$es6$promise$$internal$$resolve(promise, value) { + if (promise === value) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment()); + } else if (lib$es6$promise$utils$$objectOrFunction(value)) { + lib$es6$promise$$internal$$handleMaybeThenable(promise, value); + } else { + lib$es6$promise$$internal$$fulfill(promise, value); + } + } + + function lib$es6$promise$$internal$$publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + + lib$es6$promise$$internal$$publish(promise); + } + + function lib$es6$promise$$internal$$fulfill(promise, value) { + if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } + + promise._result = value; + promise._state = lib$es6$promise$$internal$$FULFILLED; + + if (promise._subscribers.length !== 0) { + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise); + } + } + + function lib$es6$promise$$internal$$reject(promise, reason) { + if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } + promise._state = lib$es6$promise$$internal$$REJECTED; + promise._result = reason; + + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise); + } + + function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) { + var subscribers = parent._subscribers; + var length = subscribers.length; + + parent._onerror = null; + + subscribers[length] = child; + subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment; + subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection; + + if (length === 0 && parent._state) { + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent); + } + } + + function lib$es6$promise$$internal$$publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + + if (subscribers.length === 0) { return; } + + var child, callback, detail = promise._result; + + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + + promise._subscribers.length = 0; + } + + function lib$es6$promise$$internal$$ErrorObject() { + this.error = null; + } + + var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject(); + + function lib$es6$promise$$internal$$tryCatch(callback, detail) { + try { + return callback(detail); + } catch(e) { + lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e; + return lib$es6$promise$$internal$$TRY_CATCH_ERROR; + } + } + + function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) { + var hasCallback = lib$es6$promise$utils$$isFunction(callback), + value, error, succeeded, failed; + + if (hasCallback) { + value = lib$es6$promise$$internal$$tryCatch(callback, detail); + + if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) { + failed = true; + error = value.error; + value = null; + } else { + succeeded = true; + } + + if (promise === value) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn()); + return; + } + + } else { + value = detail; + succeeded = true; + } + + if (promise._state !== lib$es6$promise$$internal$$PENDING) { + // noop + } else if (hasCallback && succeeded) { + lib$es6$promise$$internal$$resolve(promise, value); + } else if (failed) { + lib$es6$promise$$internal$$reject(promise, error); + } else if (settled === lib$es6$promise$$internal$$FULFILLED) { + lib$es6$promise$$internal$$fulfill(promise, value); + } else if (settled === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } + } + + function lib$es6$promise$$internal$$initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value){ + lib$es6$promise$$internal$$resolve(promise, value); + }, function rejectPromise(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + }); + } catch(e) { + lib$es6$promise$$internal$$reject(promise, e); + } + } + + function lib$es6$promise$enumerator$$Enumerator(Constructor, input) { + var enumerator = this; + + enumerator._instanceConstructor = Constructor; + enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (enumerator._validateInput(input)) { + enumerator._input = input; + enumerator.length = input.length; + enumerator._remaining = input.length; + + enumerator._init(); + + if (enumerator.length === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } else { + enumerator.length = enumerator.length || 0; + enumerator._enumerate(); + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } + } + } else { + lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError()); + } + } + + lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) { + return lib$es6$promise$utils$$isArray(input); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() { + return new Error('Array Methods must be provided an Array'); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._init = function() { + this._result = new Array(this.length); + }; + + var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator; + + lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() { + var enumerator = this; + + var length = enumerator.length; + var promise = enumerator.promise; + var input = enumerator._input; + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + enumerator._eachEntry(input[i], i); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) { + var enumerator = this; + var c = enumerator._instanceConstructor; + + if (lib$es6$promise$utils$$isMaybeThenable(entry)) { + if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) { + entry._onerror = null; + enumerator._settledAt(entry._state, i, entry._result); + } else { + enumerator._willSettleAt(c.resolve(entry), i); + } + } else { + enumerator._remaining--; + enumerator._result[i] = entry; + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) { + var enumerator = this; + var promise = enumerator.promise; + + if (promise._state === lib$es6$promise$$internal$$PENDING) { + enumerator._remaining--; + + if (state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } else { + enumerator._result[i] = value; + } + } + + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(promise, enumerator._result); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) { + var enumerator = this; + + lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) { + enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value); + }, function(reason) { + enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason); + }); + }; + function lib$es6$promise$promise$all$$all(entries) { + return new lib$es6$promise$enumerator$$default(this, entries).promise; + } + var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all; + function lib$es6$promise$promise$race$$race(entries) { + /*jshint validthis:true */ + var Constructor = this; + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (!lib$es6$promise$utils$$isArray(entries)) { + lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.')); + return promise; + } + + var length = entries.length; + + function onFulfillment(value) { + lib$es6$promise$$internal$$resolve(promise, value); + } + + function onRejection(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + } + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); + } + + return promise; + } + var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race; + function lib$es6$promise$promise$resolve$$resolve(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$resolve(promise, object); + return promise; + } + var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve; + function lib$es6$promise$promise$reject$$reject(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$reject(promise, reason); + return promise; + } + var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject; + + var lib$es6$promise$promise$$counter = 0; + + function lib$es6$promise$promise$$needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); + } + + function lib$es6$promise$promise$$needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); + } + + var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise; + /** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + var promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + var xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {function} resolver + Useful for tooling. + @constructor + */ + function lib$es6$promise$promise$$Promise(resolver) { + this._id = lib$es6$promise$promise$$counter++; + this._state = undefined; + this._result = undefined; + this._subscribers = []; + + if (lib$es6$promise$$internal$$noop !== resolver) { + if (!lib$es6$promise$utils$$isFunction(resolver)) { + lib$es6$promise$promise$$needsResolver(); + } + + if (!(this instanceof lib$es6$promise$promise$$Promise)) { + lib$es6$promise$promise$$needsNew(); + } + + lib$es6$promise$$internal$$initializePromise(this, resolver); + } + } + + lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default; + lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default; + lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default; + lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default; + lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler; + lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap; + lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap; + + lib$es6$promise$promise$$Promise.prototype = { + constructor: lib$es6$promise$promise$$Promise, + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + + Chaining + -------- + + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + + Assimilation + ------------ + + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + + If the assimliated promise rejects, then the downstream promise will also reject. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + + Simple Example + -------------- + + Synchronous Example + + ```javascript + var result; + + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + + Promise Example; + + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + + Advanced Example + -------------- + + Synchronous Example + + ```javascript + var author, books; + + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + + function foundBooks(books) { + + } + + function failure(reason) { + + } + + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + + Promise Example; + + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + then: function(onFulfillment, onRejection) { + var parent = this; + var state = parent._state; + + if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) { + return this; + } + + var child = new this.constructor(lib$es6$promise$$internal$$noop); + var result = parent._result; + + if (state) { + var callback = arguments[state - 1]; + lib$es6$promise$asap$$asap(function(){ + lib$es6$promise$$internal$$invokeCallback(state, child, callback, result); + }); + } else { + lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection); + } + + return child; + }, + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + 'catch': function(onRejection) { + return this.then(null, onRejection); + } + }; + function lib$es6$promise$polyfill$$polyfill() { + var local; + + if (typeof global !== 'undefined') { + local = global; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + + var P = local.Promise; + + if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) { + return; + } + + local.Promise = lib$es6$promise$promise$$default; + } + var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill; + + var lib$es6$promise$umd$$ES6Promise = { + 'Promise': lib$es6$promise$promise$$default, + 'polyfill': lib$es6$promise$polyfill$$default + }; + + /* global define:true module:true window: true */ + if (typeof define === 'function' && define['amd']) { + define(function() { return lib$es6$promise$umd$$ES6Promise; }); + } else if (typeof module !== 'undefined' && module['exports']) { + module['exports'] = lib$es6$promise$umd$$ES6Promise; + } else if (typeof this !== 'undefined') { + this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise; + } + + lib$es6$promise$polyfill$$default(); +}).call(this); + + +}).call(this,{},typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}]},{},[1]); + +(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 Reflect.defineMetadata("custom:annotation", options, target, key); + * } + * + */ + function defineMetadata(metadataKey, metadataValue, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey); + } + Reflect.defineMetadata = defineMetadata; + /** + * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.hasMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasMetadata("custom:annotation", C.prototype, "method"); + * + */ + function hasMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryHasMetadata(metadataKey, target, targetKey); + } + Reflect.hasMetadata = hasMetadata; + /** + * Gets a value indicating whether the target object has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasOwnMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "method"); + * + */ + function hasOwnMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryHasOwnMetadata(metadataKey, target, targetKey); + } + Reflect.hasOwnMetadata = hasOwnMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object or its prototype chain. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.getMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadata("custom:annotation", C.prototype, "method"); + * + */ + function getMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryGetMetadata(metadataKey, target, targetKey); + } + Reflect.getMetadata = getMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "method"); + * + */ + function getOwnMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryGetOwnMetadata(metadataKey, target, targetKey); + } + Reflect.getOwnMetadata = getOwnMetadata; + /** + * Gets the metadata keys defined on the target object or its prototype chain. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadataKeys(C); + * + * // property (on constructor) + * result = Reflect.getMetadataKeys(C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadataKeys(C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadataKeys(C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadataKeys(C.prototype, "method"); + * + */ + function getMetadataKeys(target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryMetadataKeys(target, targetKey); + } + Reflect.getMetadataKeys = getMetadataKeys; + /** + * Gets the unique metadata keys defined on the target object. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadataKeys(C); + * + * // property (on constructor) + * result = Reflect.getOwnMetadataKeys(C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadataKeys(C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadataKeys(C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadataKeys(C.prototype, "method"); + * + */ + function getOwnMetadataKeys(target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryOwnMetadataKeys(target, targetKey); + } + Reflect.getOwnMetadataKeys = getOwnMetadataKeys; + /** + * Deletes the metadata entry from the target object with the provided key. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata entry was found and deleted; otherwise, false. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.deleteMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "method"); + * + */ + function deleteMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#deletemetadata-metadatakey-p- + var metadataMap = GetOrCreateMetadataMap(target, targetKey, false); + if (IsUndefined(metadataMap)) { + return false; + } + if (!metadataMap.delete(metadataKey)) { + return false; + } + if (metadataMap.size > 0) { + return true; + } + var targetMetadata = __Metadata__.get(target); + targetMetadata.delete(targetKey); + if (targetMetadata.size > 0) { + return true; + } + __Metadata__.delete(target); + return true; + } + Reflect.deleteMetadata = deleteMetadata; + function DecorateConstructor(decorators, target) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target); + if (!IsUndefined(decorated)) { + if (!IsConstructor(decorated)) { + throw new TypeError(); + } + target = decorated; + } + } + return target; + } + function DecoratePropertyWithDescriptor(decorators, target, propertyKey, descriptor) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target, propertyKey, descriptor); + if (!IsUndefined(decorated)) { + if (!IsObject(decorated)) { + throw new TypeError(); + } + descriptor = decorated; + } + } + return descriptor; + } + function DecoratePropertyWithoutDescriptor(decorators, target, propertyKey) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + decorator(target, propertyKey); + } + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#getorcreatemetadatamap--o-p-create- + function GetOrCreateMetadataMap(target, targetKey, create) { + var targetMetadata = __Metadata__.get(target); + if (!targetMetadata) { + if (!create) { + return undefined; + } + targetMetadata = new _Map(); + __Metadata__.set(target, targetMetadata); + } + var keyMetadata = targetMetadata.get(targetKey); + if (!keyMetadata) { + if (!create) { + return undefined; + } + keyMetadata = new _Map(); + targetMetadata.set(targetKey, keyMetadata); + } + return keyMetadata; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasmetadata--metadatakey-o-p- + function OrdinaryHasMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) { + return true; + } + var parent = GetPrototypeOf(O); + if (parent !== null) { + return OrdinaryHasMetadata(MetadataKey, parent, P); + } + return false; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasownmetadata--metadatakey-o-p- + function OrdinaryHasOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, false); + if (metadataMap === undefined) { + return false; + } + return Boolean(metadataMap.has(MetadataKey)); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetmetadata--metadatakey-o-p- + function OrdinaryGetMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) { + return OrdinaryGetOwnMetadata(MetadataKey, O, P); + } + var parent = GetPrototypeOf(O); + if (parent !== null) { + return OrdinaryGetMetadata(MetadataKey, parent, P); + } + return undefined; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetownmetadata--metadatakey-o-p- + function OrdinaryGetOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, false); + if (metadataMap === undefined) { + return undefined; + } + return metadataMap.get(MetadataKey); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarydefineownmetadata--metadatakey-metadatavalue-o-p- + function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, true); + metadataMap.set(MetadataKey, MetadataValue); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarymetadatakeys--o-p- + function OrdinaryMetadataKeys(O, P) { + var ownKeys = OrdinaryOwnMetadataKeys(O, P); + var parent = GetPrototypeOf(O); + if (parent === null) { + return ownKeys; + } + var parentKeys = OrdinaryMetadataKeys(parent, P); + if (parentKeys.length <= 0) { + return ownKeys; + } + if (ownKeys.length <= 0) { + return parentKeys; + } + var set = new _Set(); + var keys = []; + for (var _i = 0; _i < ownKeys.length; _i++) { + var key = ownKeys[_i]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + for (var _a = 0; _a < parentKeys.length; _a++) { + var key = parentKeys[_a]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + return keys; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryownmetadatakeys--o-p- + function OrdinaryOwnMetadataKeys(target, targetKey) { + var metadataMap = GetOrCreateMetadataMap(target, targetKey, false); + var keys = []; + if (metadataMap) { + metadataMap.forEach(function (_, key) { return keys.push(key); }); + } + return keys; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-undefined-type + function IsUndefined(x) { + return x === undefined; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isarray + function IsArray(x) { + return Array.isArray(x); + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type + function IsObject(x) { + return typeof x === "object" ? x !== null : typeof x === "function"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor + function IsConstructor(x) { + return typeof x === "function"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-symbol-type + function IsSymbol(x) { + return typeof x === "symbol"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey + function ToPropertyKey(value) { + if (IsSymbol(value)) { + return value; + } + return String(value); + } + function GetPrototypeOf(O) { + var proto = Object.getPrototypeOf(O); + if (typeof O !== "function" || O === functionPrototype) { + return proto; + } + // TypeScript doesn't set __proto__ in ES5, as it's non-standard. + // Try to determine the superclass constructor. Compatible implementations + // must either set __proto__ on a subclass constructor to the superclass constructor, + // or ensure each class has a valid `constructor` property on its prototype that + // points back to the constructor. + // If this is not the same as Function.[[Prototype]], then this is definately inherited. + // This is the case when in ES6 or when using __proto__ in a compatible browser. + if (proto !== functionPrototype) { + return proto; + } + // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage. + var prototype = O.prototype; + var prototypeProto = Object.getPrototypeOf(prototype); + if (prototypeProto == null || prototypeProto === Object.prototype) { + return proto; + } + // if the constructor was not a function, then we cannot determine the heritage. + var constructor = prototypeProto.constructor; + if (typeof constructor !== "function") { + return proto; + } + // if we have some kind of self-reference, then we cannot determine the heritage. + if (constructor === O) { + return proto; + } + // we have a pretty good guess at the heritage. + return constructor; + } + // naive Map shim + function CreateMapPolyfill() { + var cacheSentinel = {}; + function Map() { + this._keys = []; + this._values = []; + this._cache = cacheSentinel; + } + Map.prototype = { + get size() { + return this._keys.length; + }, + has: function (key) { + if (key === this._cache) { + return true; + } + if (this._find(key) >= 0) { + this._cache = key; + return true; + } + return false; + }, + get: function (key) { + var index = this._find(key); + if (index >= 0) { + this._cache = key; + return this._values[index]; + } + return undefined; + }, + set: function (key, value) { + this.delete(key); + this._keys.push(key); + this._values.push(value); + this._cache = key; + return this; + }, + delete: function (key) { + var index = this._find(key); + if (index >= 0) { + this._keys.splice(index, 1); + this._values.splice(index, 1); + this._cache = cacheSentinel; + return true; + } + return false; + }, + clear: function () { + this._keys.length = 0; + this._values.length = 0; + this._cache = cacheSentinel; + }, + forEach: function (callback, thisArg) { + var size = this.size; + for (var i = 0; i < size; ++i) { + var key = this._keys[i]; + var value = this._values[i]; + this._cache = key; + callback.call(this, value, key, this); + } + }, + _find: function (key) { + var keys = this._keys; + var size = keys.length; + for (var i = 0; i < size; ++i) { + if (keys[i] === key) { + return i; + } + } + return -1; + } + }; + return Map; + } + // naive Set shim + function CreateSetPolyfill() { + var cacheSentinel = {}; + function Set() { + this._map = new _Map(); + } + Set.prototype = { + get size() { + return this._map.length; + }, + has: function (value) { + return this._map.has(value); + }, + add: function (value) { + this._map.set(value, value); + return this; + }, + delete: function (value) { + return this._map.delete(value); + }, + clear: function () { + this._map.clear(); + }, + forEach: function (callback, thisArg) { + this._map.forEach(callback, thisArg); + } + }; + return Set; + } + // naive WeakMap shim + function CreateWeakMapPolyfill() { + var UUID_SIZE = 16; + var isNode = typeof global !== "undefined" && + typeof module === "object" && + typeof module.exports === "object" && + typeof require === "function"; + var nodeCrypto = isNode && require("crypto"); + var hasOwn = Object.prototype.hasOwnProperty; + var keys = {}; + var rootKey = CreateUniqueKey(); + function WeakMap() { + this._key = CreateUniqueKey(); + } + WeakMap.prototype = { + has: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table) { + return this._key in table; + } + return false; + }, + get: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table) { + return table[this._key]; + } + return undefined; + }, + set: function (target, value) { + var table = GetOrCreateWeakMapTable(target, true); + table[this._key] = value; + return this; + }, + delete: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table && this._key in table) { + return delete table[this._key]; + } + return false; + }, + clear: function () { + // NOTE: not a real clear, just makes the previous data unreachable + this._key = CreateUniqueKey(); + } + }; + function FillRandomBytes(buffer, size) { + for (var i = 0; i < size; ++i) { + buffer[i] = Math.random() * 255 | 0; + } + } + function GenRandomBytes(size) { + if (nodeCrypto) { + var data = nodeCrypto.randomBytes(size); + return data; + } + else if (typeof Uint8Array === "function") { + var data = new Uint8Array(size); + if (typeof crypto !== "undefined") { + crypto.getRandomValues(data); + } + else if (typeof msCrypto !== "undefined") { + msCrypto.getRandomValues(data); + } + else { + FillRandomBytes(data, size); + } + return data; + } + else { + var data = new Array(size); + FillRandomBytes(data, size); + return data; + } + } + function CreateUUID() { + var data = GenRandomBytes(UUID_SIZE); + // mark as random - RFC 4122 § 4.4 + data[6] = data[6] & 0x4f | 0x40; + data[8] = data[8] & 0xbf | 0x80; + var result = ""; + for (var offset = 0; offset < UUID_SIZE; ++offset) { + var byte = data[offset]; + if (offset === 4 || offset === 6 || offset === 8) { + result += "-"; + } + if (byte < 16) { + result += "0"; + } + result += byte.toString(16).toLowerCase(); + } + return result; + } + function CreateUniqueKey() { + var key; + do { + key = "@@WeakMap@@" + CreateUUID(); + } while (hasOwn.call(keys, key)); + keys[key] = true; + return key; + } + function GetOrCreateWeakMapTable(target, create) { + if (!hasOwn.call(target, rootKey)) { + if (!create) { + return undefined; + } + Object.defineProperty(target, rootKey, { value: Object.create(null) }); + } + return target[rootKey]; + } + return WeakMap; + } + // hook global Reflect + (function (__global) { + if (typeof __global.Reflect !== "undefined") { + if (__global.Reflect !== Reflect) { + for (var p in Reflect) { + __global.Reflect[p] = Reflect[p]; + } + } + } + else { + __global.Reflect = Reflect; + } + })(typeof window !== "undefined" ? window : + typeof WorkerGlobalScope !== "undefined" ? self : + typeof global !== "undefined" ? global : + Function("return this;")()); +})(Reflect || (Reflect = {})); +//# sourceMappingURLDisabled=Reflect.js.map +/** + @license + + Apache License + Version 2.0, January 2011 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + */ + +(function(global) { + 'use strict'; + if (global.$traceurRuntime) { + return ; + } + var $Object = Object; + var $TypeError = TypeError; + var $create = $Object.create; + var $defineProperties = $Object.defineProperties; + var $defineProperty = $Object.defineProperty; + var $freeze = $Object.freeze; + var $getOwnPropertyDescriptor = $Object.getOwnPropertyDescriptor; + var $getOwnPropertyNames = $Object.getOwnPropertyNames; + var $keys = $Object.keys; + var $hasOwnProperty = $Object.prototype.hasOwnProperty; + var $toString = $Object.prototype.toString; + var $preventExtensions = Object.preventExtensions; + var $seal = Object.seal; + var $isExtensible = Object.isExtensible; + var $apply = Function.prototype.call.bind(Function.prototype.apply); + 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; + } + var counter = 0; + function newUniqueString() { + return '__$' + Math.floor(Math.random() * 1e9) + '$' + ++counter + '$__'; + } + var privateNames = $create(null); + function isPrivateName(s) { + return privateNames[s]; + } + function createPrivateName() { + var s = newUniqueString(); + privateNames[s] = true; + return s; + } + var CONTINUATION_TYPE = Object.create(null); + function createContinuation(operand, thisArg, argsArray) { + return [CONTINUATION_TYPE, operand, thisArg, argsArray]; + } + function isContinuation(object) { + return object && object[0] === CONTINUATION_TYPE; + } + var isTailRecursiveName = null; + function setupProperTailCalls() { + isTailRecursiveName = createPrivateName(); + 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(); + } + func[isTailRecursiveName] = true; + return func; + } + function isTailRecursive(func) { + return !!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; + } + var $traceurRuntime = { + initTailRecursiveFunction: initTailRecursiveFunction, + call: tailCall, + continuation: createContinuation, + construct: construct + }; + (function() { + function nonEnum(value) { + return { + configurable: true, + enumerable: false, + value: value, + writable: true + }; + } + var method = nonEnum; + var symbolInternalProperty = newUniqueString(); + var symbolDescriptionProperty = newUniqueString(); + var symbolDataProperty = newUniqueString(); + var symbolValues = $create(null); + function isShimSymbol(symbol) { + return typeof symbol === 'object' && symbol instanceof SymbolValue; + } + function typeOf(v) { + if (isShimSymbol(v)) + return 'symbol'; + return typeof v; + } + function Symbol(description) { + var value = new SymbolValue(description); + if (!(this instanceof Symbol)) + return value; + throw new TypeError('Symbol cannot be new\'ed'); + } + $defineProperty(Symbol.prototype, 'constructor', nonEnum(Symbol)); + $defineProperty(Symbol.prototype, 'toString', method(function() { + var symbolValue = this[symbolDataProperty]; + return symbolValue[symbolInternalProperty]; + })); + $defineProperty(Symbol.prototype, 'valueOf', method(function() { + var symbolValue = this[symbolDataProperty]; + if (!symbolValue) + throw TypeError('Conversion from symbol to string'); + if (!getOption('symbols')) + return symbolValue[symbolInternalProperty]; + return symbolValue; + })); + 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(Symbol)); + $defineProperty(SymbolValue.prototype, 'toString', { + value: Symbol.prototype.toString, + enumerable: false + }); + $defineProperty(SymbolValue.prototype, 'valueOf', { + value: Symbol.prototype.valueOf, + enumerable: false + }); + var hashProperty = createPrivateName(); + var hashPropertyDescriptor = {value: undefined}; + var hashObjectProperties = { + hash: {value: undefined}, + self: {value: undefined} + }; + var hashCounter = 0; + function getOwnHashObject(object) { + var hashObject = object[hashProperty]; + if (hashObject && hashObject.self === object) + return hashObject; + if ($isExtensible(object)) { + hashObjectProperties.hash.value = hashCounter++; + hashObjectProperties.self.value = object; + hashPropertyDescriptor.value = $create(null, hashObjectProperties); + $defineProperty(object, hashProperty, hashPropertyDescriptor); + return hashPropertyDescriptor.value; + } + return undefined; + } + function freeze(object) { + getOwnHashObject(object); + return $freeze.apply(this, arguments); + } + function preventExtensions(object) { + getOwnHashObject(object); + return $preventExtensions.apply(this, arguments); + } + function seal(object) { + getOwnHashObject(object); + return $seal.apply(this, arguments); + } + freeze(SymbolValue.prototype); + function isSymbolString(s) { + return symbolValues[s] || privateNames[s]; + } + function toProperty(name) { + if (isShimSymbol(name)) + return name[symbolInternalProperty]; + return name; + } + 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 getOwnPropertyDescriptor(object, name) { + return $getOwnPropertyDescriptor(object, toProperty(name)); + } + function hasOwnProperty(name) { + return $hasOwnProperty.call(this, toProperty(name)); + } + function getOption(name) { + return global.$traceurRuntime.options[name]; + } + function defineProperty(object, name, descriptor) { + if (isShimSymbol(name)) { + name = name[symbolInternalProperty]; + } + $defineProperty(object, name, descriptor); + return object; + } + function polyfillObject(Object) { + $defineProperty(Object, 'defineProperty', {value: defineProperty}); + $defineProperty(Object, 'getOwnPropertyNames', {value: getOwnPropertyNames}); + $defineProperty(Object, 'getOwnPropertyDescriptor', {value: getOwnPropertyDescriptor}); + $defineProperty(Object.prototype, 'hasOwnProperty', {value: hasOwnProperty}); + $defineProperty(Object, 'freeze', {value: freeze}); + $defineProperty(Object, 'preventExtensions', {value: preventExtensions}); + $defineProperty(Object, 'seal', {value: seal}); + $defineProperty(Object, 'keys', {value: keys}); + } + function exportStar(object) { + for (var i = 1; i < arguments.length; i++) { + var names = $getOwnPropertyNames(arguments[i]); + for (var j = 0; j < names.length; j++) { + var name = names[j]; + if (name === '__esModule' || isSymbolString(name)) + continue; + (function(mod, name) { + $defineProperty(object, name, { + get: function() { + return mod[name]; + }, + enumerable: true + }); + })(arguments[i], names[j]); + } + } + return object; + } + function isObject(x) { + return x != null && (typeof x === 'object' || typeof x === 'function'); + } + function toObject(x) { + if (x == null) + throw $TypeError(); + return $Object(x); + } + function checkObjectCoercible(argument) { + if (argument == null) { + throw new TypeError('Value cannot be converted to an Object'); + } + return argument; + } + function polyfillSymbol(global, Symbol) { + if (!global.Symbol) { + global.Symbol = Symbol; + Object.getOwnPropertySymbols = getOwnPropertySymbols; + } + if (!global.Symbol.iterator) { + global.Symbol.iterator = Symbol('Symbol.iterator'); + } + if (!global.Symbol.observer) { + global.Symbol.observer = Symbol('Symbol.observer'); + } + } + function setupGlobals(global) { + polyfillSymbol(global, Symbol); + global.Reflect = global.Reflect || {}; + global.Reflect.global = global.Reflect.global || global; + polyfillObject(global.Object); + } + setupGlobals(global); + global.$traceurRuntime = { + call: tailCall, + checkObjectCoercible: checkObjectCoercible, + construct: construct, + continuation: createContinuation, + createPrivateName: createPrivateName, + defineProperties: $defineProperties, + defineProperty: $defineProperty, + exportStar: exportStar, + getOwnHashObject: getOwnHashObject, + getOwnPropertyDescriptor: $getOwnPropertyDescriptor, + getOwnPropertyNames: $getOwnPropertyNames, + initTailRecursiveFunction: initTailRecursiveFunction, + isObject: isObject, + isPrivateName: isPrivateName, + isSymbolString: isSymbolString, + keys: $keys, + options: {}, + setupGlobals: setupGlobals, + toObject: toObject, + toProperty: toProperty, + 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 $__1 = $traceurRuntime, + canonicalizeUrl = $__1.canonicalizeUrl, + resolveUrl = $__1.resolveUrl, + isAbsolute = $__1.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 $__0 = 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]) + '^ ' + $__0.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 $__0 = arguments; + var depMap = {}; + deps.forEach((function(dep, index) { + return depMap[dep] = $__0[index]; + })); + var registryEntry = func.call(this, depMap); + registryEntry.execute.call(this); + return registryEntry.exports; + } + }; + } + }, + getAnonymousModule: function(func) { + return new Module(func.call(global), liveModuleSentinel); + }, + getForTesting: function(name) { + var $__0 = this; + if (!this.testingPrefix_) { + Object.keys(moduleInstances).some((function(key) { + var m = /(traceur@[^\/]*\/)/.exec(key); + if (m) { + $__0.testingPrefix_ = m[1]; + return true; + } + })); + } + return this.get(this.testingPrefix_ + name); + } + }; + 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; + global.System = { + register: ModuleStore.register.bind(ModuleStore), + registerModule: ModuleStore.registerModule.bind(ModuleStore), + get: ModuleStore.get, + set: ModuleStore.set, + normalize: ModuleStore.normalize + }; +})(typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this); +System.registerModule("traceur-runtime@0.0.88/src/runtime/async.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/src/runtime/async.js"; + if (typeof $traceurRuntime !== 'object') { + throw new Error('traceur runtime not found.'); + } + var $createPrivateName = $traceurRuntime.createPrivateName; + var $defineProperty = $traceurRuntime.defineProperty; + var $defineProperties = $traceurRuntime.defineProperties; + var $create = Object.create; + var thisName = $createPrivateName(); + var argsName = $createPrivateName(); + var observeName = $createPrivateName(); + function AsyncGeneratorFunction() {} + function AsyncGeneratorFunctionPrototype() {} + AsyncGeneratorFunction.prototype = AsyncGeneratorFunctionPrototype; + AsyncGeneratorFunctionPrototype.constructor = AsyncGeneratorFunction; + $defineProperty(AsyncGeneratorFunctionPrototype, 'constructor', {enumerable: false}); + var AsyncGeneratorContext = (function() { + function AsyncGeneratorContext(observer) { + var $__0 = this; + this.decoratedObserver = $traceurRuntime.createDecoratedGenerator(observer, (function() { + $__0.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[$traceurRuntime.toProperty(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 = 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 = [], + $__2 = 2; $__2 < arguments.length; $__2++) + args[$__2 - 2] = arguments[$__2]; + var object = $create(functionObject.prototype); + object[thisName] = this; + object[argsName] = args; + 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); + } + $traceurRuntime.initAsyncGeneratorFunction = initAsyncGeneratorFunction; + $traceurRuntime.createAsyncGeneratorInstance = createAsyncGeneratorInstance; + $traceurRuntime.observeForEach = observeForEach; + $traceurRuntime.schedule = schedule; + $traceurRuntime.createDecoratedGenerator = createDecoratedGenerator; + return {}; +}); +System.registerModule("traceur-runtime@0.0.88/src/runtime/classes.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/src/runtime/classes.js"; + var $Object = Object; + var $TypeError = TypeError; + var $create = $Object.create; + var $defineProperties = $traceurRuntime.defineProperties; + var $defineProperty = $traceurRuntime.defineProperty; + var $getOwnPropertyDescriptor = $traceurRuntime.getOwnPropertyDescriptor; + var $getOwnPropertyNames = $traceurRuntime.getOwnPropertyNames; + var $getPrototypeOf = Object.getPrototypeOf; + var $__0 = Object, + getOwnPropertyNames = $__0.getOwnPropertyNames, + getOwnPropertySymbols = $__0.getOwnPropertySymbols; + 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) { + if (!descriptor.get) + return descriptor.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); + 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 {}; +}); +System.registerModule("traceur-runtime@0.0.88/src/runtime/destructuring.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/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 {}; +}); +System.registerModule("traceur-runtime@0.0.88/src/runtime/generators.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/src/runtime/generators.js"; + if (typeof $traceurRuntime !== 'object') { + throw new Error('traceur runtime not found.'); + } + var createPrivateName = $traceurRuntime.createPrivateName; + var $defineProperties = $traceurRuntime.defineProperties; + var $defineProperty = $traceurRuntime.defineProperty; + var $create = Object.create; + var $TypeError = TypeError; + 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 = createPrivateName(); + var moveNextName = createPrivateName(); + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + GeneratorFunction.prototype = GeneratorFunctionPrototype; + $defineProperty(GeneratorFunctionPrototype, 'constructor', nonEnum(GeneratorFunction)); + GeneratorFunctionPrototype.prototype = { + constructor: GeneratorFunctionPrototype, + next: function(v) { + return nextOrThrow(this[ctxName], this[moveNextName], 'next', v); + }, + throw: function(v) { + return nextOrThrow(this[ctxName], this[moveNextName], 'throw', v); + }, + return: function(v) { + this[ctxName].oldReturnValue = this[ctxName].returnValue; + this[ctxName].returnValue = v; + return nextOrThrow(this[ctxName], 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); + object[ctxName] = ctx; + 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 {}; +}); +System.registerModule("traceur-runtime@0.0.88/src/runtime/relativeRequire.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/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 {}; +}); +System.registerModule("traceur-runtime@0.0.88/src/runtime/spread.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/src/runtime/spread.js"; + function spread() { + var rv = [], + j = 0, + iterResult; + for (var i = 0; i < arguments.length; i++) { + var valueToSpread = $traceurRuntime.checkObjectCoercible(arguments[i]); + if (typeof valueToSpread[$traceurRuntime.toProperty(Symbol.iterator)] !== 'function') { + throw new TypeError('Cannot spread non-iterable object.'); + } + var iter = valueToSpread[$traceurRuntime.toProperty(Symbol.iterator)](); + while (!(iterResult = iter.next()).done) { + rv[j++] = iterResult.value; + } + } + return rv; + } + $traceurRuntime.spread = spread; + return {}; +}); +System.registerModule("traceur-runtime@0.0.88/src/runtime/template.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/src/runtime/template.js"; + var $__0 = Object, + defineProperty = $__0.defineProperty, + freeze = $__0.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 {}; +}); +System.registerModule("traceur-runtime@0.0.88/src/runtime/type-assertions.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/src/runtime/type-assertions.js"; + var types = { + any: {name: 'any'}, + boolean: {name: 'boolean'}, + number: {name: 'number'}, + string: {name: 'string'}, + symbol: {name: 'symbol'}, + void: {name: 'void'} + }; + var GenericType = (function() { + function GenericType(type, argumentTypes) { + this.type = type; + this.argumentTypes = argumentTypes; + } + return ($traceurRuntime.createClass)(GenericType, {}, {}); + }()); + var typeRegister = Object.create(null); + function genericType(type) { + for (var argumentTypes = [], + $__1 = 1; $__1 < arguments.length; $__1++) + argumentTypes[$__1 - 1] = arguments[$__1]; + var typeMap = typeRegister; + var key = $traceurRuntime.getOwnHashObject(type).hash; + if (!typeMap[key]) { + typeMap[key] = Object.create(null); + } + typeMap = typeMap[key]; + for (var i = 0; i < argumentTypes.length - 1; i++) { + key = $traceurRuntime.getOwnHashObject(argumentTypes[i]).hash; + if (!typeMap[key]) { + typeMap[key] = Object.create(null); + } + typeMap = typeMap[key]; + } + var tail = argumentTypes[argumentTypes.length - 1]; + key = $traceurRuntime.getOwnHashObject(tail).hash; + if (!typeMap[key]) { + typeMap[key] = new GenericType(type, argumentTypes); + } + return typeMap[key]; + } + $traceurRuntime.GenericType = GenericType; + $traceurRuntime.genericType = genericType; + $traceurRuntime.type = types; + return {}; +}); +System.registerModule("traceur-runtime@0.0.88/src/runtime/runtime-modules.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/src/runtime/runtime-modules.js"; + System.get("traceur-runtime@0.0.88/src/runtime/relativeRequire.js"); + System.get("traceur-runtime@0.0.88/src/runtime/spread.js"); + System.get("traceur-runtime@0.0.88/src/runtime/destructuring.js"); + System.get("traceur-runtime@0.0.88/src/runtime/classes.js"); + System.get("traceur-runtime@0.0.88/src/runtime/async.js"); + System.get("traceur-runtime@0.0.88/src/runtime/generators.js"); + System.get("traceur-runtime@0.0.88/src/runtime/template.js"); + System.get("traceur-runtime@0.0.88/src/runtime/type-assertions.js"); + return {}; +}); +System.get("traceur-runtime@0.0.88/src/runtime/runtime-modules.js" + ''); +System.registerModule("traceur-runtime@0.0.88/src/runtime/polyfills/utils.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/src/runtime/polyfills/utils.js"; + var $ceil = Math.ceil; + var $floor = Math.floor; + var $isFinite = isFinite; + var $isNaN = isNaN; + var $pow = Math.pow; + var $min = Math.min; + var toObject = $traceurRuntime.toObject; + function toUint32(x) { + return x >>> 0; + } + function isObject(x) { + return x && (typeof x === 'object' || typeof x === 'function'); + } + function isCallable(x) { + return typeof x === 'function'; + } + function isNumber(x) { + return typeof x === 'number'; + } + function toInteger(x) { + x = +x; + if ($isNaN(x)) + return 0; + if (x === 0 || !$isFinite(x)) + return x; + return x > 0 ? $floor(x) : $ceil(x); + } + var MAX_SAFE_LENGTH = $pow(2, 53) - 1; + function toLength(x) { + var len = toInteger(x); + return len < 0 ? 0 : $min(len, MAX_SAFE_LENGTH); + } + function checkIterable(x) { + return !isObject(x) ? undefined : x[Symbol.iterator]; + } + function isConstructor(x) { + return isCallable(x); + } + function createIteratorResultObject(value, done) { + return { + value: value, + done: done + }; + } + function maybeDefine(object, name, descr) { + if (!(name in object)) { + Object.defineProperty(object, name, descr); + } + } + function maybeDefineMethod(object, name, value) { + maybeDefine(object, name, { + value: value, + configurable: true, + enumerable: false, + writable: true + }); + } + function maybeDefineConst(object, name, value) { + maybeDefine(object, name, { + value: value, + configurable: false, + enumerable: false, + writable: false + }); + } + function maybeAddFunctions(object, functions) { + for (var i = 0; i < functions.length; i += 2) { + var name = functions[i]; + var value = functions[i + 1]; + maybeDefineMethod(object, name, value); + } + } + function maybeAddConsts(object, consts) { + for (var i = 0; i < consts.length; i += 2) { + var name = consts[i]; + var value = consts[i + 1]; + maybeDefineConst(object, name, value); + } + } + function maybeAddIterator(object, func, Symbol) { + if (!Symbol || !Symbol.iterator || object[Symbol.iterator]) + return ; + if (object['@@iterator']) + func = object['@@iterator']; + Object.defineProperty(object, Symbol.iterator, { + value: func, + configurable: true, + enumerable: false, + writable: true + }); + } + var polyfills = []; + function registerPolyfill(func) { + polyfills.push(func); + } + function polyfillAll(global) { + polyfills.forEach((function(f) { + return f(global); + })); + } + return { + get toObject() { + return toObject; + }, + get toUint32() { + return toUint32; + }, + get isObject() { + return isObject; + }, + get isCallable() { + return isCallable; + }, + get isNumber() { + return isNumber; + }, + get toInteger() { + return toInteger; + }, + get toLength() { + return toLength; + }, + get checkIterable() { + return checkIterable; + }, + get isConstructor() { + return isConstructor; + }, + get createIteratorResultObject() { + return createIteratorResultObject; + }, + get maybeDefine() { + return maybeDefine; + }, + get maybeDefineMethod() { + return maybeDefineMethod; + }, + get maybeDefineConst() { + return maybeDefineConst; + }, + get maybeAddFunctions() { + return maybeAddFunctions; + }, + get maybeAddConsts() { + return maybeAddConsts; + }, + get maybeAddIterator() { + return maybeAddIterator; + }, + get registerPolyfill() { + return registerPolyfill; + }, + get polyfillAll() { + return polyfillAll; + } + }; +}); +System.registerModule("traceur-runtime@0.0.88/src/runtime/polyfills/Map.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/src/runtime/polyfills/Map.js"; + var $__0 = System.get("traceur-runtime@0.0.88/src/runtime/polyfills/utils.js"), + isObject = $__0.isObject, + maybeAddIterator = $__0.maybeAddIterator, + registerPolyfill = $__0.registerPolyfill; + var getOwnHashObject = $traceurRuntime.getOwnHashObject; + var $hasOwnProperty = Object.prototype.hasOwnProperty; + var deletedSentinel = {}; + function lookupIndex(map, key) { + if (isObject(key)) { + var hashObject = getOwnHashObject(key); + return hashObject && map.objectIndex_[hashObject.hash]; + } + if (typeof key === 'string') + return map.stringIndex_[key]; + return map.primitiveIndex_[key]; + } + function initMap(map) { + map.entries_ = []; + map.objectIndex_ = Object.create(null); + map.stringIndex_ = Object.create(null); + map.primitiveIndex_ = Object.create(null); + map.deletedCount_ = 0; + } + var Map = (function() { + function Map() { + var $__10, + $__11; + var iterable = arguments[0]; + if (!isObject(this)) + throw new TypeError('Map called on incompatible type'); + if ($hasOwnProperty.call(this, 'entries_')) { + throw new TypeError('Map can not be reentrantly initialised'); + } + initMap(this); + if (iterable !== null && iterable !== undefined) { + var $__5 = true; + var $__6 = false; + var $__7 = undefined; + try { + for (var $__3 = void 0, + $__2 = (iterable)[$traceurRuntime.toProperty(Symbol.iterator)](); !($__5 = ($__3 = $__2.next()).done); $__5 = true) { + var $__9 = $__3.value, + key = ($__10 = $__9[$traceurRuntime.toProperty(Symbol.iterator)](), ($__11 = $__10.next()).done ? void 0 : $__11.value), + value = ($__11 = $__10.next()).done ? void 0 : $__11.value; + { + this.set(key, value); + } + } + } catch ($__8) { + $__6 = true; + $__7 = $__8; + } finally { + try { + if (!$__5 && $__2.return != null) { + $__2.return(); + } + } finally { + if ($__6) { + throw $__7; + } + } + } + } + } + return ($traceurRuntime.createClass)(Map, { + get size() { + return this.entries_.length / 2 - this.deletedCount_; + }, + get: function(key) { + var index = lookupIndex(this, key); + if (index !== undefined) + return this.entries_[index + 1]; + }, + set: function(key, value) { + var objectMode = isObject(key); + var stringMode = typeof key === 'string'; + var index = lookupIndex(this, key); + if (index !== undefined) { + this.entries_[index + 1] = value; + } else { + index = this.entries_.length; + this.entries_[index] = key; + this.entries_[index + 1] = value; + if (objectMode) { + var hashObject = getOwnHashObject(key); + var hash = hashObject.hash; + this.objectIndex_[hash] = index; + } else if (stringMode) { + this.stringIndex_[key] = index; + } else { + this.primitiveIndex_[key] = index; + } + } + return this; + }, + has: function(key) { + return lookupIndex(this, key) !== undefined; + }, + delete: function(key) { + var objectMode = isObject(key); + var stringMode = typeof key === 'string'; + var index; + var hash; + if (objectMode) { + var hashObject = getOwnHashObject(key); + if (hashObject) { + index = this.objectIndex_[hash = hashObject.hash]; + delete this.objectIndex_[hash]; + } + } else if (stringMode) { + index = this.stringIndex_[key]; + delete this.stringIndex_[key]; + } else { + index = this.primitiveIndex_[key]; + delete this.primitiveIndex_[key]; + } + if (index !== undefined) { + this.entries_[index] = deletedSentinel; + this.entries_[index + 1] = undefined; + this.deletedCount_++; + return true; + } + return false; + }, + clear: function() { + initMap(this); + }, + forEach: function(callbackFn) { + var thisArg = arguments[1]; + for (var i = 0; i < this.entries_.length; i += 2) { + var key = this.entries_[i]; + var value = this.entries_[i + 1]; + if (key === deletedSentinel) + continue; + callbackFn.call(thisArg, value, key, this); + } + }, + entries: $traceurRuntime.initGeneratorFunction(function $__12() { + var i, + key, + value; + return $traceurRuntime.createGeneratorInstance(function($ctx) { + while (true) + switch ($ctx.state) { + case 0: + i = 0; + $ctx.state = 12; + break; + case 12: + $ctx.state = (i < this.entries_.length) ? 8 : -2; + break; + case 4: + i += 2; + $ctx.state = 12; + break; + case 8: + key = this.entries_[i]; + value = this.entries_[i + 1]; + $ctx.state = 9; + break; + case 9: + $ctx.state = (key === deletedSentinel) ? 4 : 6; + break; + case 6: + $ctx.state = 2; + return [key, value]; + case 2: + $ctx.maybeThrow(); + $ctx.state = 4; + break; + default: + return $ctx.end(); + } + }, $__12, this); + }), + keys: $traceurRuntime.initGeneratorFunction(function $__13() { + var i, + key, + value; + return $traceurRuntime.createGeneratorInstance(function($ctx) { + while (true) + switch ($ctx.state) { + case 0: + i = 0; + $ctx.state = 12; + break; + case 12: + $ctx.state = (i < this.entries_.length) ? 8 : -2; + break; + case 4: + i += 2; + $ctx.state = 12; + break; + case 8: + key = this.entries_[i]; + value = this.entries_[i + 1]; + $ctx.state = 9; + break; + case 9: + $ctx.state = (key === deletedSentinel) ? 4 : 6; + break; + case 6: + $ctx.state = 2; + return key; + case 2: + $ctx.maybeThrow(); + $ctx.state = 4; + break; + default: + return $ctx.end(); + } + }, $__13, this); + }), + values: $traceurRuntime.initGeneratorFunction(function $__14() { + var i, + key, + value; + return $traceurRuntime.createGeneratorInstance(function($ctx) { + while (true) + switch ($ctx.state) { + case 0: + i = 0; + $ctx.state = 12; + break; + case 12: + $ctx.state = (i < this.entries_.length) ? 8 : -2; + break; + case 4: + i += 2; + $ctx.state = 12; + break; + case 8: + key = this.entries_[i]; + value = this.entries_[i + 1]; + $ctx.state = 9; + break; + case 9: + $ctx.state = (key === deletedSentinel) ? 4 : 6; + break; + case 6: + $ctx.state = 2; + return value; + case 2: + $ctx.maybeThrow(); + $ctx.state = 4; + break; + default: + return $ctx.end(); + } + }, $__14, this); + }) + }, {}); + }()); + Object.defineProperty(Map.prototype, Symbol.iterator, { + configurable: true, + writable: true, + value: Map.prototype.entries + }); + function polyfillMap(global) { + var $__9 = global, + Object = $__9.Object, + Symbol = $__9.Symbol; + if (!global.Map) + global.Map = Map; + var mapPrototype = global.Map.prototype; + if (mapPrototype.entries === undefined) + global.Map = Map; + if (mapPrototype.entries) { + maybeAddIterator(mapPrototype, mapPrototype.entries, Symbol); + maybeAddIterator(Object.getPrototypeOf(new global.Map().entries()), function() { + return this; + }, Symbol); + } + } + registerPolyfill(polyfillMap); + return { + get Map() { + return Map; + }, + get polyfillMap() { + return polyfillMap; + } + }; +}); +System.get("traceur-runtime@0.0.88/src/runtime/polyfills/Map.js" + ''); +System.registerModule("traceur-runtime@0.0.88/src/runtime/polyfills/Set.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/src/runtime/polyfills/Set.js"; + var $__0 = System.get("traceur-runtime@0.0.88/src/runtime/polyfills/utils.js"), + isObject = $__0.isObject, + maybeAddIterator = $__0.maybeAddIterator, + registerPolyfill = $__0.registerPolyfill; + var Map = System.get("traceur-runtime@0.0.88/src/runtime/polyfills/Map.js").Map; + var getOwnHashObject = $traceurRuntime.getOwnHashObject; + var $hasOwnProperty = Object.prototype.hasOwnProperty; + function initSet(set) { + set.map_ = new Map(); + } + var Set = (function() { + function Set() { + var iterable = arguments[0]; + if (!isObject(this)) + throw new TypeError('Set called on incompatible type'); + if ($hasOwnProperty.call(this, 'map_')) { + throw new TypeError('Set can not be reentrantly initialised'); + } + initSet(this); + if (iterable !== null && iterable !== undefined) { + var $__7 = true; + var $__8 = false; + var $__9 = undefined; + try { + for (var $__5 = void 0, + $__4 = (iterable)[$traceurRuntime.toProperty(Symbol.iterator)](); !($__7 = ($__5 = $__4.next()).done); $__7 = true) { + var item = $__5.value; + { + this.add(item); + } + } + } catch ($__10) { + $__8 = true; + $__9 = $__10; + } finally { + try { + if (!$__7 && $__4.return != null) { + $__4.return(); + } + } finally { + if ($__8) { + throw $__9; + } + } + } + } + } + return ($traceurRuntime.createClass)(Set, { + get size() { + return this.map_.size; + }, + has: function(key) { + return this.map_.has(key); + }, + add: function(key) { + this.map_.set(key, key); + return this; + }, + delete: function(key) { + return this.map_.delete(key); + }, + clear: function() { + return this.map_.clear(); + }, + forEach: function(callbackFn) { + var thisArg = arguments[1]; + var $__2 = this; + return this.map_.forEach((function(value, key) { + callbackFn.call(thisArg, key, key, $__2); + })); + }, + values: $traceurRuntime.initGeneratorFunction(function $__12() { + var $__13, + $__14; + return $traceurRuntime.createGeneratorInstance(function($ctx) { + while (true) + switch ($ctx.state) { + case 0: + $__13 = $ctx.wrapYieldStar(this.map_.keys()[Symbol.iterator]()); + $ctx.sent = void 0; + $ctx.action = 'next'; + $ctx.state = 12; + break; + case 12: + $__14 = $__13[$ctx.action]($ctx.sentIgnoreThrow); + $ctx.state = 9; + break; + case 9: + $ctx.state = ($__14.done) ? 3 : 2; + break; + case 3: + $ctx.sent = $__14.value; + $ctx.state = -2; + break; + case 2: + $ctx.state = 12; + return $__14.value; + default: + return $ctx.end(); + } + }, $__12, this); + }), + entries: $traceurRuntime.initGeneratorFunction(function $__15() { + var $__16, + $__17; + return $traceurRuntime.createGeneratorInstance(function($ctx) { + while (true) + switch ($ctx.state) { + case 0: + $__16 = $ctx.wrapYieldStar(this.map_.entries()[Symbol.iterator]()); + $ctx.sent = void 0; + $ctx.action = 'next'; + $ctx.state = 12; + break; + case 12: + $__17 = $__16[$ctx.action]($ctx.sentIgnoreThrow); + $ctx.state = 9; + break; + case 9: + $ctx.state = ($__17.done) ? 3 : 2; + break; + case 3: + $ctx.sent = $__17.value; + $ctx.state = -2; + break; + case 2: + $ctx.state = 12; + return $__17.value; + default: + return $ctx.end(); + } + }, $__15, this); + }) + }, {}); + }()); + Object.defineProperty(Set.prototype, Symbol.iterator, { + configurable: true, + writable: true, + value: Set.prototype.values + }); + Object.defineProperty(Set.prototype, 'keys', { + configurable: true, + writable: true, + value: Set.prototype.values + }); + function polyfillSet(global) { + var $__11 = global, + Object = $__11.Object, + Symbol = $__11.Symbol; + if (!global.Set) + global.Set = Set; + var setPrototype = global.Set.prototype; + if (setPrototype.values) { + maybeAddIterator(setPrototype, setPrototype.values, Symbol); + maybeAddIterator(Object.getPrototypeOf(new global.Set().values()), function() { + return this; + }, Symbol); + } + } + registerPolyfill(polyfillSet); + return { + get Set() { + return Set; + }, + get polyfillSet() { + return polyfillSet; + } + }; +}); +System.get("traceur-runtime@0.0.88/src/runtime/polyfills/Set.js" + ''); +System.registerModule("traceur-runtime@0.0.88/node_modules/rsvp/lib/rsvp/asap.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/node_modules/rsvp/lib/rsvp/asap.js"; + var len = 0; + function asap(callback, arg) { + queue[len] = callback; + queue[len + 1] = arg; + len += 2; + if (len === 2) { + scheduleFlush(); + } + } + var $__default = asap; + var browserGlobal = (typeof window !== 'undefined') ? window : {}; + var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; + var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; + function useNextTick() { + return function() { + process.nextTick(flush); + }; + } + function useMutationObserver() { + var iterations = 0; + var observer = new BrowserMutationObserver(flush); + var node = document.createTextNode(''); + observer.observe(node, {characterData: true}); + return function() { + node.data = (iterations = ++iterations % 2); + }; + } + function useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = flush; + return function() { + channel.port2.postMessage(0); + }; + } + function useSetTimeout() { + return function() { + setTimeout(flush, 1); + }; + } + var queue = new Array(1000); + function flush() { + for (var i = 0; i < len; i += 2) { + var callback = queue[i]; + var arg = queue[i + 1]; + callback(arg); + queue[i] = undefined; + queue[i + 1] = undefined; + } + len = 0; + } + var scheduleFlush; + if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') { + scheduleFlush = useNextTick(); + } else if (BrowserMutationObserver) { + scheduleFlush = useMutationObserver(); + } else if (isWorker) { + scheduleFlush = useMessageChannel(); + } else { + scheduleFlush = useSetTimeout(); + } + return {get default() { + return $__default; + }}; +}); +System.registerModule("traceur-runtime@0.0.88/src/runtime/polyfills/Promise.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/src/runtime/polyfills/Promise.js"; + var async = System.get("traceur-runtime@0.0.88/node_modules/rsvp/lib/rsvp/asap.js").default; + var registerPolyfill = System.get("traceur-runtime@0.0.88/src/runtime/polyfills/utils.js").registerPolyfill; + var promiseRaw = {}; + function isPromise(x) { + return x && typeof x === 'object' && x.status_ !== undefined; + } + function idResolveHandler(x) { + return x; + } + function idRejectHandler(x) { + throw x; + } + function chain(promise) { + var onResolve = arguments[1] !== (void 0) ? arguments[1] : idResolveHandler; + var onReject = arguments[2] !== (void 0) ? arguments[2] : idRejectHandler; + var deferred = getDeferred(promise.constructor); + switch (promise.status_) { + case undefined: + throw TypeError; + case 0: + promise.onResolve_.push(onResolve, deferred); + promise.onReject_.push(onReject, deferred); + break; + case +1: + promiseEnqueue(promise.value_, [onResolve, deferred]); + break; + case -1: + promiseEnqueue(promise.value_, [onReject, deferred]); + break; + } + return deferred.promise; + } + function getDeferred(C) { + if (this === $Promise) { + var promise = promiseInit(new $Promise(promiseRaw)); + return { + promise: promise, + resolve: (function(x) { + promiseResolve(promise, x); + }), + reject: (function(r) { + promiseReject(promise, r); + }) + }; + } else { + var result = {}; + result.promise = new C((function(resolve, reject) { + result.resolve = resolve; + result.reject = reject; + })); + return result; + } + } + function promiseSet(promise, status, value, onResolve, onReject) { + promise.status_ = status; + promise.value_ = value; + promise.onResolve_ = onResolve; + promise.onReject_ = onReject; + return promise; + } + function promiseInit(promise) { + return promiseSet(promise, 0, undefined, [], []); + } + var Promise = (function() { + function Promise(resolver) { + if (resolver === promiseRaw) + return ; + if (typeof resolver !== 'function') + throw new TypeError; + var promise = promiseInit(this); + try { + resolver((function(x) { + promiseResolve(promise, x); + }), (function(r) { + promiseReject(promise, r); + })); + } catch (e) { + promiseReject(promise, e); + } + } + return ($traceurRuntime.createClass)(Promise, { + catch: function(onReject) { + return this.then(undefined, onReject); + }, + then: function(onResolve, onReject) { + if (typeof onResolve !== 'function') + onResolve = idResolveHandler; + if (typeof onReject !== 'function') + onReject = idRejectHandler; + var that = this; + var constructor = this.constructor; + return chain(this, function(x) { + x = promiseCoerce(constructor, x); + return x === that ? onReject(new TypeError) : isPromise(x) ? x.then(onResolve, onReject) : onResolve(x); + }, onReject); + } + }, { + resolve: function(x) { + if (this === $Promise) { + if (isPromise(x)) { + return x; + } + return promiseSet(new $Promise(promiseRaw), +1, x); + } else { + return new this(function(resolve, reject) { + resolve(x); + }); + } + }, + reject: function(r) { + if (this === $Promise) { + return promiseSet(new $Promise(promiseRaw), -1, r); + } else { + return new this((function(resolve, reject) { + reject(r); + })); + } + }, + all: function(values) { + var deferred = getDeferred(this); + var resolutions = []; + try { + var makeCountdownFunction = function(i) { + return (function(x) { + resolutions[i] = x; + if (--count === 0) + deferred.resolve(resolutions); + }); + }; + var count = 0; + var i = 0; + var $__6 = true; + var $__7 = false; + var $__8 = undefined; + try { + for (var $__4 = void 0, + $__3 = (values)[$traceurRuntime.toProperty(Symbol.iterator)](); !($__6 = ($__4 = $__3.next()).done); $__6 = true) { + var value = $__4.value; + { + var countdownFunction = makeCountdownFunction(i); + this.resolve(value).then(countdownFunction, (function(r) { + deferred.reject(r); + })); + ++i; + ++count; + } + } + } catch ($__9) { + $__7 = true; + $__8 = $__9; + } finally { + try { + if (!$__6 && $__3.return != null) { + $__3.return(); + } + } finally { + if ($__7) { + throw $__8; + } + } + } + if (count === 0) { + deferred.resolve(resolutions); + } + } catch (e) { + deferred.reject(e); + } + return deferred.promise; + }, + race: function(values) { + var deferred = getDeferred(this); + try { + for (var i = 0; i < values.length; i++) { + this.resolve(values[i]).then((function(x) { + deferred.resolve(x); + }), (function(r) { + deferred.reject(r); + })); + } + } catch (e) { + deferred.reject(e); + } + return deferred.promise; + } + }); + }()); + var $Promise = Promise; + var $PromiseReject = $Promise.reject; + function promiseResolve(promise, x) { + promiseDone(promise, +1, x, promise.onResolve_); + } + function promiseReject(promise, r) { + promiseDone(promise, -1, r, promise.onReject_); + } + function promiseDone(promise, status, value, reactions) { + if (promise.status_ !== 0) + return ; + promiseEnqueue(value, reactions); + promiseSet(promise, status, value); + } + function promiseEnqueue(value, tasks) { + async((function() { + for (var i = 0; i < tasks.length; i += 2) { + promiseHandle(value, tasks[i], tasks[i + 1]); + } + })); + } + function promiseHandle(value, handler, deferred) { + try { + var result = handler(value); + if (result === deferred.promise) + throw new TypeError; + else if (isPromise(result)) + chain(result, deferred.resolve, deferred.reject); + else + deferred.resolve(result); + } catch (e) { + try { + deferred.reject(e); + } catch (e) {} + } + } + var thenableSymbol = '@@thenable'; + function isObject(x) { + return x && (typeof x === 'object' || typeof x === 'function'); + } + function promiseCoerce(constructor, x) { + if (!isPromise(x) && isObject(x)) { + var then; + try { + then = x.then; + } catch (r) { + var promise = $PromiseReject.call(constructor, r); + x[thenableSymbol] = promise; + return promise; + } + if (typeof then === 'function') { + var p = x[thenableSymbol]; + if (p) { + return p; + } else { + var deferred = getDeferred(constructor); + x[thenableSymbol] = deferred.promise; + try { + then.call(x, deferred.resolve, deferred.reject); + } catch (r) { + deferred.reject(r); + } + return deferred.promise; + } + } + } + return x; + } + function polyfillPromise(global) { + if (!global.Promise) + global.Promise = Promise; + } + registerPolyfill(polyfillPromise); + return { + get Promise() { + return Promise; + }, + get polyfillPromise() { + return polyfillPromise; + } + }; +}); +System.get("traceur-runtime@0.0.88/src/runtime/polyfills/Promise.js" + ''); +System.registerModule("traceur-runtime@0.0.88/src/runtime/polyfills/StringIterator.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/src/runtime/polyfills/StringIterator.js"; + var $__0 = System.get("traceur-runtime@0.0.88/src/runtime/polyfills/utils.js"), + createIteratorResultObject = $__0.createIteratorResultObject, + isObject = $__0.isObject; + var toProperty = $traceurRuntime.toProperty; + var hasOwnProperty = Object.prototype.hasOwnProperty; + var iteratedString = Symbol('iteratedString'); + var stringIteratorNextIndex = Symbol('stringIteratorNextIndex'); + var StringIterator = (function() { + var $__2; + function StringIterator() {} + return ($traceurRuntime.createClass)(StringIterator, ($__2 = {}, Object.defineProperty($__2, "next", { + value: function() { + var o = this; + if (!isObject(o) || !hasOwnProperty.call(o, iteratedString)) { + throw new TypeError('this must be a StringIterator object'); + } + var s = o[toProperty(iteratedString)]; + if (s === undefined) { + return createIteratorResultObject(undefined, true); + } + var position = o[toProperty(stringIteratorNextIndex)]; + var len = s.length; + if (position >= len) { + o[toProperty(iteratedString)] = undefined; + return createIteratorResultObject(undefined, true); + } + var first = s.charCodeAt(position); + var resultString; + if (first < 0xD800 || first > 0xDBFF || position + 1 === len) { + resultString = String.fromCharCode(first); + } else { + var second = s.charCodeAt(position + 1); + if (second < 0xDC00 || second > 0xDFFF) { + resultString = String.fromCharCode(first); + } else { + resultString = String.fromCharCode(first) + String.fromCharCode(second); + } + } + o[toProperty(stringIteratorNextIndex)] = position + resultString.length; + return createIteratorResultObject(resultString, false); + }, + configurable: true, + enumerable: true, + writable: true + }), Object.defineProperty($__2, Symbol.iterator, { + value: function() { + return this; + }, + configurable: true, + enumerable: true, + writable: true + }), $__2), {}); + }()); + function createStringIterator(string) { + var s = String(string); + var iterator = Object.create(StringIterator.prototype); + iterator[toProperty(iteratedString)] = s; + iterator[toProperty(stringIteratorNextIndex)] = 0; + return iterator; + } + return {get createStringIterator() { + return createStringIterator; + }}; +}); +System.registerModule("traceur-runtime@0.0.88/src/runtime/polyfills/String.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/src/runtime/polyfills/String.js"; + var createStringIterator = System.get("traceur-runtime@0.0.88/src/runtime/polyfills/StringIterator.js").createStringIterator; + var $__1 = System.get("traceur-runtime@0.0.88/src/runtime/polyfills/utils.js"), + maybeAddFunctions = $__1.maybeAddFunctions, + maybeAddIterator = $__1.maybeAddIterator, + registerPolyfill = $__1.registerPolyfill; + var $toString = Object.prototype.toString; + var $indexOf = String.prototype.indexOf; + var $lastIndexOf = String.prototype.lastIndexOf; + function startsWith(search) { + var string = String(this); + if (this == null || $toString.call(search) == '[object RegExp]') { + throw TypeError(); + } + var stringLength = string.length; + var searchString = String(search); + var searchLength = searchString.length; + var position = arguments.length > 1 ? arguments[1] : undefined; + var pos = position ? Number(position) : 0; + if (isNaN(pos)) { + pos = 0; + } + var start = Math.min(Math.max(pos, 0), stringLength); + return $indexOf.call(string, searchString, pos) == start; + } + function endsWith(search) { + var string = String(this); + if (this == null || $toString.call(search) == '[object RegExp]') { + throw TypeError(); + } + var stringLength = string.length; + var searchString = String(search); + var searchLength = searchString.length; + var pos = stringLength; + if (arguments.length > 1) { + var position = arguments[1]; + if (position !== undefined) { + pos = position ? Number(position) : 0; + if (isNaN(pos)) { + pos = 0; + } + } + } + var end = Math.min(Math.max(pos, 0), stringLength); + var start = end - searchLength; + if (start < 0) { + return false; + } + return $lastIndexOf.call(string, searchString, start) == start; + } + function includes(search) { + if (this == null) { + throw TypeError(); + } + var string = String(this); + if (search && $toString.call(search) == '[object RegExp]') { + throw TypeError(); + } + var stringLength = string.length; + var searchString = String(search); + var searchLength = searchString.length; + var position = arguments.length > 1 ? arguments[1] : undefined; + var pos = position ? Number(position) : 0; + if (pos != pos) { + pos = 0; + } + var start = Math.min(Math.max(pos, 0), stringLength); + if (searchLength + start > stringLength) { + return false; + } + return $indexOf.call(string, searchString, pos) != -1; + } + function repeat(count) { + if (this == null) { + throw TypeError(); + } + var string = String(this); + var n = count ? Number(count) : 0; + if (isNaN(n)) { + n = 0; + } + if (n < 0 || n == Infinity) { + throw RangeError(); + } + if (n == 0) { + return ''; + } + var result = ''; + while (n--) { + result += string; + } + return result; + } + function codePointAt(position) { + if (this == null) { + throw TypeError(); + } + var string = String(this); + var size = string.length; + var index = position ? Number(position) : 0; + if (isNaN(index)) { + index = 0; + } + if (index < 0 || index >= size) { + return undefined; + } + var first = string.charCodeAt(index); + var second; + if (first >= 0xD800 && first <= 0xDBFF && size > index + 1) { + second = string.charCodeAt(index + 1); + if (second >= 0xDC00 && second <= 0xDFFF) { + return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; + } + } + return first; + } + function raw(callsite) { + var raw = callsite.raw; + var len = raw.length >>> 0; + if (len === 0) + return ''; + var s = ''; + var i = 0; + while (true) { + s += raw[i]; + if (i + 1 === len) + return s; + s += arguments[++i]; + } + } + function fromCodePoint(_) { + var codeUnits = []; + var floor = Math.floor; + var highSurrogate; + var lowSurrogate; + var index = -1; + var length = arguments.length; + if (!length) { + return ''; + } + while (++index < length) { + var codePoint = Number(arguments[index]); + if (!isFinite(codePoint) || codePoint < 0 || codePoint > 0x10FFFF || floor(codePoint) != codePoint) { + throw RangeError('Invalid code point: ' + codePoint); + } + if (codePoint <= 0xFFFF) { + codeUnits.push(codePoint); + } else { + codePoint -= 0x10000; + highSurrogate = (codePoint >> 10) + 0xD800; + lowSurrogate = (codePoint % 0x400) + 0xDC00; + codeUnits.push(highSurrogate, lowSurrogate); + } + } + return String.fromCharCode.apply(null, codeUnits); + } + function stringPrototypeIterator() { + var o = $traceurRuntime.checkObjectCoercible(this); + var s = String(o); + return createStringIterator(s); + } + function polyfillString(global) { + var String = global.String; + maybeAddFunctions(String.prototype, ['codePointAt', codePointAt, 'endsWith', endsWith, 'includes', includes, 'repeat', repeat, 'startsWith', startsWith]); + maybeAddFunctions(String, ['fromCodePoint', fromCodePoint, 'raw', raw]); + maybeAddIterator(String.prototype, stringPrototypeIterator, Symbol); + } + registerPolyfill(polyfillString); + return { + get startsWith() { + return startsWith; + }, + get endsWith() { + return endsWith; + }, + get includes() { + return includes; + }, + get repeat() { + return repeat; + }, + get codePointAt() { + return codePointAt; + }, + get raw() { + return raw; + }, + get fromCodePoint() { + return fromCodePoint; + }, + get stringPrototypeIterator() { + return stringPrototypeIterator; + }, + get polyfillString() { + return polyfillString; + } + }; +}); +System.get("traceur-runtime@0.0.88/src/runtime/polyfills/String.js" + ''); +System.registerModule("traceur-runtime@0.0.88/src/runtime/polyfills/ArrayIterator.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/src/runtime/polyfills/ArrayIterator.js"; + var $__0 = System.get("traceur-runtime@0.0.88/src/runtime/polyfills/utils.js"), + toObject = $__0.toObject, + toUint32 = $__0.toUint32, + createIteratorResultObject = $__0.createIteratorResultObject; + var ARRAY_ITERATOR_KIND_KEYS = 1; + var ARRAY_ITERATOR_KIND_VALUES = 2; + var ARRAY_ITERATOR_KIND_ENTRIES = 3; + var ArrayIterator = (function() { + var $__2; + function ArrayIterator() {} + return ($traceurRuntime.createClass)(ArrayIterator, ($__2 = {}, Object.defineProperty($__2, "next", { + value: function() { + var iterator = toObject(this); + var array = iterator.iteratorObject_; + if (!array) { + throw new TypeError('Object is not an ArrayIterator'); + } + var index = iterator.arrayIteratorNextIndex_; + var itemKind = iterator.arrayIterationKind_; + var length = toUint32(array.length); + if (index >= length) { + iterator.arrayIteratorNextIndex_ = Infinity; + return createIteratorResultObject(undefined, true); + } + iterator.arrayIteratorNextIndex_ = index + 1; + if (itemKind == ARRAY_ITERATOR_KIND_VALUES) + return createIteratorResultObject(array[index], false); + if (itemKind == ARRAY_ITERATOR_KIND_ENTRIES) + return createIteratorResultObject([index, array[index]], false); + return createIteratorResultObject(index, false); + }, + configurable: true, + enumerable: true, + writable: true + }), Object.defineProperty($__2, Symbol.iterator, { + value: function() { + return this; + }, + configurable: true, + enumerable: true, + writable: true + }), $__2), {}); + }()); + function createArrayIterator(array, kind) { + var object = toObject(array); + var iterator = new ArrayIterator; + iterator.iteratorObject_ = object; + iterator.arrayIteratorNextIndex_ = 0; + iterator.arrayIterationKind_ = kind; + return iterator; + } + function entries() { + return createArrayIterator(this, ARRAY_ITERATOR_KIND_ENTRIES); + } + function keys() { + return createArrayIterator(this, ARRAY_ITERATOR_KIND_KEYS); + } + function values() { + return createArrayIterator(this, ARRAY_ITERATOR_KIND_VALUES); + } + return { + get entries() { + return entries; + }, + get keys() { + return keys; + }, + get values() { + return values; + } + }; +}); +System.registerModule("traceur-runtime@0.0.88/src/runtime/polyfills/Array.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/src/runtime/polyfills/Array.js"; + var $__0 = System.get("traceur-runtime@0.0.88/src/runtime/polyfills/ArrayIterator.js"), + entries = $__0.entries, + keys = $__0.keys, + jsValues = $__0.values; + var $__1 = System.get("traceur-runtime@0.0.88/src/runtime/polyfills/utils.js"), + checkIterable = $__1.checkIterable, + isCallable = $__1.isCallable, + isConstructor = $__1.isConstructor, + maybeAddFunctions = $__1.maybeAddFunctions, + maybeAddIterator = $__1.maybeAddIterator, + registerPolyfill = $__1.registerPolyfill, + toInteger = $__1.toInteger, + toLength = $__1.toLength, + toObject = $__1.toObject; + function from(arrLike) { + var mapFn = arguments[1]; + var thisArg = arguments[2]; + var C = this; + var items = toObject(arrLike); + var mapping = mapFn !== undefined; + var k = 0; + var arr, + len; + if (mapping && !isCallable(mapFn)) { + throw TypeError(); + } + if (checkIterable(items)) { + arr = isConstructor(C) ? new C() : []; + var $__5 = true; + var $__6 = false; + var $__7 = undefined; + try { + for (var $__3 = void 0, + $__2 = (items)[$traceurRuntime.toProperty(Symbol.iterator)](); !($__5 = ($__3 = $__2.next()).done); $__5 = true) { + var item = $__3.value; + { + if (mapping) { + arr[k] = mapFn.call(thisArg, item, k); + } else { + arr[k] = item; + } + k++; + } + } + } catch ($__8) { + $__6 = true; + $__7 = $__8; + } finally { + try { + if (!$__5 && $__2.return != null) { + $__2.return(); + } + } finally { + if ($__6) { + throw $__7; + } + } + } + arr.length = k; + return arr; + } + len = toLength(items.length); + arr = isConstructor(C) ? new C(len) : new Array(len); + for (; k < len; k++) { + if (mapping) { + arr[k] = typeof thisArg === 'undefined' ? mapFn(items[k], k) : mapFn.call(thisArg, items[k], k); + } else { + arr[k] = items[k]; + } + } + arr.length = len; + return arr; + } + function of() { + for (var items = [], + $__9 = 0; $__9 < arguments.length; $__9++) + items[$__9] = arguments[$__9]; + var C = this; + var len = items.length; + var arr = isConstructor(C) ? new C(len) : new Array(len); + for (var k = 0; k < len; k++) { + arr[k] = items[k]; + } + arr.length = len; + return arr; + } + function fill(value) { + var start = arguments[1] !== (void 0) ? arguments[1] : 0; + var end = arguments[2]; + var object = toObject(this); + var len = toLength(object.length); + var fillStart = toInteger(start); + var fillEnd = end !== undefined ? toInteger(end) : len; + fillStart = fillStart < 0 ? Math.max(len + fillStart, 0) : Math.min(fillStart, len); + fillEnd = fillEnd < 0 ? Math.max(len + fillEnd, 0) : Math.min(fillEnd, len); + while (fillStart < fillEnd) { + object[fillStart] = value; + fillStart++; + } + return object; + } + function find(predicate) { + var thisArg = arguments[1]; + return findHelper(this, predicate, thisArg); + } + function findIndex(predicate) { + var thisArg = arguments[1]; + return findHelper(this, predicate, thisArg, true); + } + function findHelper(self, predicate) { + var thisArg = arguments[2]; + var returnIndex = arguments[3] !== (void 0) ? arguments[3] : false; + var object = toObject(self); + var len = toLength(object.length); + if (!isCallable(predicate)) { + throw TypeError(); + } + for (var i = 0; i < len; i++) { + var value = object[i]; + if (predicate.call(thisArg, value, i, object)) { + return returnIndex ? i : value; + } + } + return returnIndex ? -1 : undefined; + } + function polyfillArray(global) { + var $__10 = global, + Array = $__10.Array, + Object = $__10.Object, + Symbol = $__10.Symbol; + var values = jsValues; + if (Symbol && Symbol.iterator && Array.prototype[Symbol.iterator]) { + values = Array.prototype[Symbol.iterator]; + } + maybeAddFunctions(Array.prototype, ['entries', entries, 'keys', keys, 'values', values, 'fill', fill, 'find', find, 'findIndex', findIndex]); + maybeAddFunctions(Array, ['from', from, 'of', of]); + maybeAddIterator(Array.prototype, values, Symbol); + maybeAddIterator(Object.getPrototypeOf([].values()), function() { + return this; + }, Symbol); + } + registerPolyfill(polyfillArray); + return { + get from() { + return from; + }, + get of() { + return of; + }, + get fill() { + return fill; + }, + get find() { + return find; + }, + get findIndex() { + return findIndex; + }, + get polyfillArray() { + return polyfillArray; + } + }; +}); +System.get("traceur-runtime@0.0.88/src/runtime/polyfills/Array.js" + ''); +System.registerModule("traceur-runtime@0.0.88/src/runtime/polyfills/Object.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/src/runtime/polyfills/Object.js"; + var $__0 = System.get("traceur-runtime@0.0.88/src/runtime/polyfills/utils.js"), + maybeAddFunctions = $__0.maybeAddFunctions, + registerPolyfill = $__0.registerPolyfill; + var $__1 = $traceurRuntime, + defineProperty = $__1.defineProperty, + getOwnPropertyDescriptor = $__1.getOwnPropertyDescriptor, + getOwnPropertyNames = $__1.getOwnPropertyNames, + isPrivateName = $__1.isPrivateName, + keys = $__1.keys; + function is(left, right) { + if (left === right) + return left !== 0 || 1 / left === 1 / right; + return left !== left && right !== right; + } + function assign(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + var props = source == null ? [] : keys(source); + var p = void 0, + length = props.length; + for (p = 0; p < length; p++) { + var name = props[p]; + if (isPrivateName(name)) + continue; + target[name] = source[name]; + } + } + return target; + } + function mixin(target, source) { + var props = getOwnPropertyNames(source); + var p, + descriptor, + length = props.length; + for (p = 0; p < length; p++) { + var name = props[p]; + if (isPrivateName(name)) + continue; + descriptor = getOwnPropertyDescriptor(source, props[p]); + defineProperty(target, props[p], descriptor); + } + return target; + } + function polyfillObject(global) { + var Object = global.Object; + maybeAddFunctions(Object, ['assign', assign, 'is', is, 'mixin', mixin]); + } + registerPolyfill(polyfillObject); + return { + get is() { + return is; + }, + get assign() { + return assign; + }, + get mixin() { + return mixin; + }, + get polyfillObject() { + return polyfillObject; + } + }; +}); +System.get("traceur-runtime@0.0.88/src/runtime/polyfills/Object.js" + ''); +System.registerModule("traceur-runtime@0.0.88/src/runtime/polyfills/Number.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/src/runtime/polyfills/Number.js"; + var $__0 = System.get("traceur-runtime@0.0.88/src/runtime/polyfills/utils.js"), + isNumber = $__0.isNumber, + maybeAddConsts = $__0.maybeAddConsts, + maybeAddFunctions = $__0.maybeAddFunctions, + registerPolyfill = $__0.registerPolyfill, + toInteger = $__0.toInteger; + var $abs = Math.abs; + var $isFinite = isFinite; + var $isNaN = isNaN; + var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; + var MIN_SAFE_INTEGER = -Math.pow(2, 53) + 1; + var EPSILON = Math.pow(2, -52); + function NumberIsFinite(number) { + return isNumber(number) && $isFinite(number); + } + function isInteger(number) { + return NumberIsFinite(number) && toInteger(number) === number; + } + function NumberIsNaN(number) { + return isNumber(number) && $isNaN(number); + } + function isSafeInteger(number) { + if (NumberIsFinite(number)) { + var integral = toInteger(number); + if (integral === number) + return $abs(integral) <= MAX_SAFE_INTEGER; + } + return false; + } + function polyfillNumber(global) { + var Number = global.Number; + maybeAddConsts(Number, ['MAX_SAFE_INTEGER', MAX_SAFE_INTEGER, 'MIN_SAFE_INTEGER', MIN_SAFE_INTEGER, 'EPSILON', EPSILON]); + maybeAddFunctions(Number, ['isFinite', NumberIsFinite, 'isInteger', isInteger, 'isNaN', NumberIsNaN, 'isSafeInteger', isSafeInteger]); + } + registerPolyfill(polyfillNumber); + return { + get MAX_SAFE_INTEGER() { + return MAX_SAFE_INTEGER; + }, + get MIN_SAFE_INTEGER() { + return MIN_SAFE_INTEGER; + }, + get EPSILON() { + return EPSILON; + }, + get isFinite() { + return NumberIsFinite; + }, + get isInteger() { + return isInteger; + }, + get isNaN() { + return NumberIsNaN; + }, + get isSafeInteger() { + return isSafeInteger; + }, + get polyfillNumber() { + return polyfillNumber; + } + }; +}); +System.get("traceur-runtime@0.0.88/src/runtime/polyfills/Number.js" + ''); +System.registerModule("traceur-runtime@0.0.88/src/runtime/polyfills/fround.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/src/runtime/polyfills/fround.js"; + var $isFinite = isFinite; + var $isNaN = isNaN; + var $__0 = Math, + LN2 = $__0.LN2, + abs = $__0.abs, + floor = $__0.floor, + log = $__0.log, + min = $__0.min, + pow = $__0.pow; + function packIEEE754(v, ebits, fbits) { + var bias = (1 << (ebits - 1)) - 1, + s, + e, + f, + ln, + i, + bits, + str, + bytes; + function roundToEven(n) { + var w = floor(n), + f = n - w; + if (f < 0.5) + return w; + if (f > 0.5) + return w + 1; + return w % 2 ? w + 1 : w; + } + if (v !== v) { + e = (1 << ebits) - 1; + f = pow(2, fbits - 1); + s = 0; + } else if (v === Infinity || v === -Infinity) { + e = (1 << ebits) - 1; + f = 0; + s = (v < 0) ? 1 : 0; + } else if (v === 0) { + e = 0; + f = 0; + s = (1 / v === -Infinity) ? 1 : 0; + } else { + s = v < 0; + v = abs(v); + if (v >= pow(2, 1 - bias)) { + e = min(floor(log(v) / LN2), 1023); + f = roundToEven(v / pow(2, e) * pow(2, fbits)); + if (f / pow(2, fbits) >= 2) { + e = e + 1; + f = 1; + } + if (e > bias) { + e = (1 << ebits) - 1; + f = 0; + } else { + e = e + bias; + f = f - pow(2, fbits); + } + } else { + e = 0; + f = roundToEven(v / pow(2, 1 - bias - fbits)); + } + } + bits = []; + for (i = fbits; i; i -= 1) { + bits.push(f % 2 ? 1 : 0); + f = floor(f / 2); + } + for (i = ebits; i; i -= 1) { + bits.push(e % 2 ? 1 : 0); + e = floor(e / 2); + } + bits.push(s ? 1 : 0); + bits.reverse(); + str = bits.join(''); + bytes = []; + while (str.length) { + bytes.push(parseInt(str.substring(0, 8), 2)); + str = str.substring(8); + } + return bytes; + } + function unpackIEEE754(bytes, ebits, fbits) { + var bits = [], + i, + j, + b, + str, + bias, + s, + e, + f; + for (i = bytes.length; i; i -= 1) { + b = bytes[i - 1]; + for (j = 8; j; j -= 1) { + bits.push(b % 2 ? 1 : 0); + b = b >> 1; + } + } + bits.reverse(); + str = bits.join(''); + bias = (1 << (ebits - 1)) - 1; + s = parseInt(str.substring(0, 1), 2) ? -1 : 1; + e = parseInt(str.substring(1, 1 + ebits), 2); + f = parseInt(str.substring(1 + ebits), 2); + if (e === (1 << ebits) - 1) { + return f !== 0 ? NaN : s * Infinity; + } else if (e > 0) { + return s * pow(2, e - bias) * (1 + f / pow(2, fbits)); + } else if (f !== 0) { + return s * pow(2, -(bias - 1)) * (f / pow(2, fbits)); + } else { + return s < 0 ? -0 : 0; + } + } + function unpackF32(b) { + return unpackIEEE754(b, 8, 23); + } + function packF32(v) { + return packIEEE754(v, 8, 23); + } + function fround(x) { + if (x === 0 || !$isFinite(x) || $isNaN(x)) { + return x; + } + return unpackF32(packF32(Number(x))); + } + return {get fround() { + return fround; + }}; +}); +System.registerModule("traceur-runtime@0.0.88/src/runtime/polyfills/Math.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/src/runtime/polyfills/Math.js"; + var jsFround = System.get("traceur-runtime@0.0.88/src/runtime/polyfills/fround.js").fround; + var $__1 = System.get("traceur-runtime@0.0.88/src/runtime/polyfills/utils.js"), + maybeAddFunctions = $__1.maybeAddFunctions, + registerPolyfill = $__1.registerPolyfill, + toUint32 = $__1.toUint32; + var $isFinite = isFinite; + var $isNaN = isNaN; + var $__2 = Math, + abs = $__2.abs, + ceil = $__2.ceil, + exp = $__2.exp, + floor = $__2.floor, + log = $__2.log, + pow = $__2.pow, + sqrt = $__2.sqrt; + function clz32(x) { + x = toUint32(+x); + if (x == 0) + return 32; + var result = 0; + if ((x & 0xFFFF0000) === 0) { + x <<= 16; + result += 16; + } + ; + if ((x & 0xFF000000) === 0) { + x <<= 8; + result += 8; + } + ; + if ((x & 0xF0000000) === 0) { + x <<= 4; + result += 4; + } + ; + if ((x & 0xC0000000) === 0) { + x <<= 2; + result += 2; + } + ; + if ((x & 0x80000000) === 0) { + x <<= 1; + result += 1; + } + ; + return result; + } + function imul(x, y) { + x = toUint32(+x); + y = toUint32(+y); + var xh = (x >>> 16) & 0xffff; + var xl = x & 0xffff; + var yh = (y >>> 16) & 0xffff; + var yl = y & 0xffff; + return xl * yl + (((xh * yl + xl * yh) << 16) >>> 0) | 0; + } + function sign(x) { + x = +x; + if (x > 0) + return 1; + if (x < 0) + return -1; + return x; + } + function log10(x) { + return log(x) * 0.434294481903251828; + } + function log2(x) { + return log(x) * 1.442695040888963407; + } + function log1p(x) { + x = +x; + if (x < -1 || $isNaN(x)) { + return NaN; + } + if (x === 0 || x === Infinity) { + return x; + } + if (x === -1) { + return -Infinity; + } + var result = 0; + var n = 50; + if (x < 0 || x > 1) { + return log(1 + x); + } + for (var i = 1; i < n; i++) { + if ((i % 2) === 0) { + result -= pow(x, i) / i; + } else { + result += pow(x, i) / i; + } + } + return result; + } + function expm1(x) { + x = +x; + if (x === -Infinity) { + return -1; + } + if (!$isFinite(x) || x === 0) { + return x; + } + return exp(x) - 1; + } + function cosh(x) { + x = +x; + if (x === 0) { + return 1; + } + if ($isNaN(x)) { + return NaN; + } + if (!$isFinite(x)) { + return Infinity; + } + if (x < 0) { + x = -x; + } + if (x > 21) { + return exp(x) / 2; + } + return (exp(x) + exp(-x)) / 2; + } + function sinh(x) { + x = +x; + if (!$isFinite(x) || x === 0) { + return x; + } + return (exp(x) - exp(-x)) / 2; + } + function tanh(x) { + x = +x; + if (x === 0) + return x; + if (!$isFinite(x)) + return sign(x); + var exp1 = exp(x); + var exp2 = exp(-x); + return (exp1 - exp2) / (exp1 + exp2); + } + function acosh(x) { + x = +x; + if (x < 1) + return NaN; + if (!$isFinite(x)) + return x; + return log(x + sqrt(x + 1) * sqrt(x - 1)); + } + function asinh(x) { + x = +x; + if (x === 0 || !$isFinite(x)) + return x; + if (x > 0) + return log(x + sqrt(x * x + 1)); + return -log(-x + sqrt(x * x + 1)); + } + function atanh(x) { + x = +x; + if (x === -1) { + return -Infinity; + } + if (x === 1) { + return Infinity; + } + if (x === 0) { + return x; + } + if ($isNaN(x) || x < -1 || x > 1) { + return NaN; + } + return 0.5 * log((1 + x) / (1 - x)); + } + function hypot(x, y) { + var length = arguments.length; + var args = new Array(length); + var max = 0; + for (var i = 0; i < length; i++) { + var n = arguments[i]; + n = +n; + if (n === Infinity || n === -Infinity) + return Infinity; + n = abs(n); + if (n > max) + max = n; + args[i] = n; + } + if (max === 0) + max = 1; + var sum = 0; + var compensation = 0; + for (var i = 0; i < length; i++) { + var n = args[i] / max; + var summand = n * n - compensation; + var preliminary = sum + summand; + compensation = (preliminary - sum) - summand; + sum = preliminary; + } + return sqrt(sum) * max; + } + function trunc(x) { + x = +x; + if (x > 0) + return floor(x); + if (x < 0) + return ceil(x); + return x; + } + var fround, + f32; + if (typeof Float32Array === 'function') { + f32 = new Float32Array(1); + fround = function(x) { + f32[0] = Number(x); + return f32[0]; + }; + } else { + fround = jsFround; + } + function cbrt(x) { + x = +x; + if (x === 0) + return x; + var negate = x < 0; + if (negate) + x = -x; + var result = pow(x, 1 / 3); + return negate ? -result : result; + } + function polyfillMath(global) { + var Math = global.Math; + maybeAddFunctions(Math, ['acosh', acosh, 'asinh', asinh, 'atanh', atanh, 'cbrt', cbrt, 'clz32', clz32, 'cosh', cosh, 'expm1', expm1, 'fround', fround, 'hypot', hypot, 'imul', imul, 'log10', log10, 'log1p', log1p, 'log2', log2, 'sign', sign, 'sinh', sinh, 'tanh', tanh, 'trunc', trunc]); + } + registerPolyfill(polyfillMath); + return { + get clz32() { + return clz32; + }, + get imul() { + return imul; + }, + get sign() { + return sign; + }, + get log10() { + return log10; + }, + get log2() { + return log2; + }, + get log1p() { + return log1p; + }, + get expm1() { + return expm1; + }, + get cosh() { + return cosh; + }, + get sinh() { + return sinh; + }, + get tanh() { + return tanh; + }, + get acosh() { + return acosh; + }, + get asinh() { + return asinh; + }, + get atanh() { + return atanh; + }, + get hypot() { + return hypot; + }, + get trunc() { + return trunc; + }, + get fround() { + return fround; + }, + get cbrt() { + return cbrt; + }, + get polyfillMath() { + return polyfillMath; + } + }; +}); +System.get("traceur-runtime@0.0.88/src/runtime/polyfills/Math.js" + ''); +System.registerModule("traceur-runtime@0.0.88/src/runtime/polyfills/polyfills.js", [], function() { + "use strict"; + var __moduleName = "traceur-runtime@0.0.88/src/runtime/polyfills/polyfills.js"; + var polyfillAll = System.get("traceur-runtime@0.0.88/src/runtime/polyfills/utils.js").polyfillAll; + polyfillAll(Reflect.global); + var setupGlobals = $traceurRuntime.setupGlobals; + $traceurRuntime.setupGlobals = function(global) { + setupGlobals(global); + polyfillAll(global); + }; + return {}; +}); +System.get("traceur-runtime@0.0.88/src/runtime/polyfills/polyfills.js" + ''); + +(function(global) { + + var defined = {}; + + // indexOf polyfill for IE8 + var indexOf = Array.prototype.indexOf || function(item) { + for (var i = 0, l = this.length; i < l; i++) + if (this[i] === item) + return i; + return -1; + } + + function dedupe(deps) { + var newDeps = []; + for (var i = 0, l = deps.length; i < l; i++) + if (indexOf.call(newDeps, deps[i]) == -1) + newDeps.push(deps[i]) + return newDeps; + } + + function register(name, deps, declare, execute) { + if (typeof name != 'string') + throw "System.register provided no module name"; + + var entry; + + // dynamic + if (typeof declare == 'boolean') { + entry = { + declarative: false, + deps: deps, + execute: execute, + executingRequire: declare + }; + } + else { + // ES6 declarative + entry = { + declarative: true, + deps: deps, + declare: declare + }; + } + + entry.name = name; + + // we never overwrite an existing define + if (!(name in defined)) + defined[name] = entry; + + entry.deps = dedupe(entry.deps); + + // we have to normalize dependencies + // (assume dependencies are normalized for now) + // entry.normalizedDeps = entry.deps.map(normalize); + entry.normalizedDeps = entry.deps; + } + + function buildGroups(entry, groups) { + groups[entry.groupIndex] = groups[entry.groupIndex] || []; + + if (indexOf.call(groups[entry.groupIndex], entry) != -1) + return; + + groups[entry.groupIndex].push(entry); + + for (var i = 0, l = entry.normalizedDeps.length; i < l; i++) { + var depName = entry.normalizedDeps[i]; + var depEntry = defined[depName]; + + // not in the registry means already linked / ES6 + if (!depEntry || depEntry.evaluated) + continue; + + // now we know the entry is in our unlinked linkage group + var depGroupIndex = entry.groupIndex + (depEntry.declarative != entry.declarative); + + // the group index of an entry is always the maximum + if (depEntry.groupIndex === undefined || depEntry.groupIndex < depGroupIndex) { + + // if already in a group, remove from the old group + if (depEntry.groupIndex !== undefined) { + groups[depEntry.groupIndex].splice(indexOf.call(groups[depEntry.groupIndex], depEntry), 1); + + // if the old group is empty, then we have a mixed depndency cycle + if (groups[depEntry.groupIndex].length == 0) + throw new TypeError("Mixed dependency cycle detected"); + } + + depEntry.groupIndex = depGroupIndex; + } + + buildGroups(depEntry, groups); + } + } + + function link(name) { + var startEntry = defined[name]; + + startEntry.groupIndex = 0; + + var groups = []; + + buildGroups(startEntry, groups); + + var curGroupDeclarative = !!startEntry.declarative == groups.length % 2; + for (var i = groups.length - 1; i >= 0; i--) { + var group = groups[i]; + for (var j = 0; j < group.length; j++) { + var entry = group[j]; + + // link each group + if (curGroupDeclarative) + linkDeclarativeModule(entry); + else + linkDynamicModule(entry); + } + curGroupDeclarative = !curGroupDeclarative; + } + } + + // module binding records + var moduleRecords = {}; + function getOrCreateModuleRecord(name) { + return moduleRecords[name] || (moduleRecords[name] = { + name: name, + dependencies: [], + exports: {}, // start from an empty module and extend + importers: [] + }) + } + + function linkDeclarativeModule(entry) { + // only link if already not already started linking (stops at circular) + if (entry.module) + return; + + var module = entry.module = getOrCreateModuleRecord(entry.name); + var exports = entry.module.exports; + + var declaration = entry.declare.call(global, function(name, value) { + module.locked = true; + exports[name] = value; + + for (var i = 0, l = module.importers.length; i < l; i++) { + var importerModule = module.importers[i]; + if (!importerModule.locked) { + var importerIndex = indexOf.call(importerModule.dependencies, module); + importerModule.setters[importerIndex](exports); + } + } + + module.locked = false; + return value; + }); + + module.setters = declaration.setters; + module.execute = declaration.execute; + + if (!module.setters || !module.execute) + throw new TypeError("Invalid System.register form for " + entry.name); + + // now link all the module dependencies + for (var i = 0, l = entry.normalizedDeps.length; i < l; i++) { + var depName = entry.normalizedDeps[i]; + var depEntry = defined[depName]; + var depModule = moduleRecords[depName]; + + // work out how to set depExports based on scenarios... + var depExports; + + if (depModule) { + depExports = depModule.exports; + } + else if (depEntry && !depEntry.declarative) { + if (depEntry.module.exports && depEntry.module.exports.__esModule) + depExports = depEntry.module.exports; + else + depExports = { 'default': depEntry.module.exports, __useDefault: true }; + } + // in the module registry + else if (!depEntry) { + depExports = load(depName); + } + // we have an entry -> link + else { + linkDeclarativeModule(depEntry); + depModule = depEntry.module; + depExports = depModule.exports; + } + + // only declarative modules have dynamic bindings + if (depModule && depModule.importers) { + depModule.importers.push(module); + module.dependencies.push(depModule); + } + else + module.dependencies.push(null); + + // run the setter for this dependency + if (module.setters[i]) + module.setters[i](depExports); + } + } + + // An analog to loader.get covering execution of all three layers (real declarative, simulated declarative, simulated dynamic) + function getModule(name) { + var exports; + var entry = defined[name]; + + if (!entry) { + exports = load(name); + if (!exports) + throw new Error("Unable to load dependency " + name + "."); + } + + else { + if (entry.declarative) + ensureEvaluated(name, []); + + else if (!entry.evaluated) + linkDynamicModule(entry); + + exports = entry.module.exports; + } + + if ((!entry || entry.declarative) && exports && exports.__useDefault) + return exports['default']; + + return exports; + } + + function linkDynamicModule(entry) { + if (entry.module) + return; + + var exports = {}; + + var module = entry.module = { exports: exports, id: entry.name }; + + // AMD requires execute the tree first + if (!entry.executingRequire) { + for (var i = 0, l = entry.normalizedDeps.length; i < l; i++) { + var depName = entry.normalizedDeps[i]; + var depEntry = defined[depName]; + if (depEntry) + linkDynamicModule(depEntry); + } + } + + // now execute + entry.evaluated = true; + var output = entry.execute.call(global, function(name) { + for (var i = 0, l = entry.deps.length; i < l; i++) { + if (entry.deps[i] != name) + continue; + return getModule(entry.normalizedDeps[i]); + } + throw new TypeError('Module ' + name + ' not declared as a dependency.'); + }, exports, module); + + if (output) + module.exports = output; + } + + /* + * Given a module, and the list of modules for this current branch, + * ensure that each of the dependencies of this module is evaluated + * (unless one is a circular dependency already in the list of seen + * modules, in which case we execute it) + * + * Then we evaluate the module itself depth-first left to right + * execution to match ES6 modules + */ + function ensureEvaluated(moduleName, seen) { + var entry = defined[moduleName]; + + // if already seen, that means it's an already-evaluated non circular dependency + if (!entry || entry.evaluated || !entry.declarative) + return; + + // this only applies to declarative modules which late-execute + + seen.push(moduleName); + + for (var i = 0, l = entry.normalizedDeps.length; i < l; i++) { + var depName = entry.normalizedDeps[i]; + if (indexOf.call(seen, depName) == -1) { + if (!defined[depName]) + load(depName); + else + ensureEvaluated(depName, seen); + } + } + + if (entry.evaluated) + return; + + entry.evaluated = true; + entry.module.execute.call(global); + } + + // magical execution function + var modules = {}; + function load(name) { + if (modules[name]) + return modules[name]; + + var entry = defined[name]; + + // first we check if this module has already been defined in the registry + if (!entry) + throw "Module " + name + " not present."; + + // recursively ensure that the module and all its + // dependencies are linked (with dependency group handling) + link(name); + + // now handle dependency execution in correct order + ensureEvaluated(name, []); + + // remove from the registry + defined[name] = undefined; + + var module = entry.module.exports; + + if (!module || !entry.declarative && module.__esModule !== true) + module = { 'default': module, __useDefault: true }; + + // return the defined module object + return modules[name] = module; + }; + + return function(mains, declare) { + + var System; + var System = { + register: register, + get: load, + set: function(name, module) { + modules[name] = module; + }, + newModule: function(module) { + return module; + }, + global: global + }; + System.set('@empty', {}); + + declare(System); + + for (var i = 0; i < mains.length; i++) + load(mains[i]); + } + +})(typeof window != 'undefined' ? window : global) +/* (['mainModule'], function(System) { + System.register(...); +}); */ + +(['angular2/angular2_sfx'], function(System) { + +/** + @license +Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +Microsoft Open Technologies would like to thank its contributors, a list +of whom are at http://rx.codeplex.com/wikipage?title=Contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); you +may not use this file except in compliance with the License. You may +obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied. See the License for the specific language governing permissions +and limitations under the License. + + */ +System.register("rx", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + ; + (function(undefined) { + var objectTypes = { + 'boolean': false, + 'function': true, + 'object': true, + 'number': false, + 'string': false, + 'undefined': false + }; + var root = (objectTypes[typeof window] && window) || this, + freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports, + freeModule = objectTypes[typeof module] && module && !module.nodeType && module, + moduleExports = freeModule && freeModule.exports === freeExports && freeExports, + freeGlobal = objectTypes[typeof global] && global; + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { + root = freeGlobal; + } + var Rx = { + internals: {}, + config: {Promise: root.Promise}, + helpers: {} + }; + var noop = Rx.helpers.noop = function() {}, + notDefined = Rx.helpers.notDefined = function(x) { + return typeof x === 'undefined'; + }, + isScheduler = Rx.helpers.isScheduler = function(x) { + return x instanceof Rx.Scheduler; + }, + identity = Rx.helpers.identity = function(x) { + return x; + }, + pluck = Rx.helpers.pluck = function(property) { + return function(x) { + return x[property]; + }; + }, + just = Rx.helpers.just = function(value) { + return function() { + return value; + }; + }, + defaultNow = Rx.helpers.defaultNow = Date.now, + defaultComparer = Rx.helpers.defaultComparer = function(x, y) { + return isEqual(x, y); + }, + defaultSubComparer = Rx.helpers.defaultSubComparer = function(x, y) { + return x > y ? 1 : (x < y ? -1 : 0); + }, + defaultKeySerializer = Rx.helpers.defaultKeySerializer = function(x) { + return x.toString(); + }, + defaultError = Rx.helpers.defaultError = function(err) { + throw err; + }, + isPromise = Rx.helpers.isPromise = function(p) { + return !!p && typeof p.then === 'function'; + }, + asArray = Rx.helpers.asArray = function() { + return Array.prototype.slice.call(arguments); + }, + not = Rx.helpers.not = function(a) { + return !a; + }, + isFunction = Rx.helpers.isFunction = (function() { + var isFn = function(value) { + return typeof value == 'function' || false; + }; + if (isFn(/x/)) { + isFn = function(value) { + return typeof value == 'function' && toString.call(value) == '[object Function]'; + }; + } + return isFn; + }()); + function cloneArray(arr) { + for (var a = [], + i = 0, + len = arr.length; i < len; i++) { + a.push(arr[i]); + } + return a; + } + Rx.config.longStackSupport = false; + var hasStacks = false; + try { + throw new Error(); + } catch (e) { + hasStacks = !!e.stack; + } + var rStartingLine = captureLine(), + rFileName; + var STACK_JUMP_SEPARATOR = "From previous event:"; + function makeStackTraceLong(error, observable) { + if (hasStacks && observable.stack && typeof error === "object" && error !== null && error.stack && error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1) { + var stacks = []; + for (var o = observable; !!o; o = o.source) { + if (o.stack) { + stacks.unshift(o.stack); + } + } + stacks.unshift(error.stack); + var concatedStacks = stacks.join("\n" + STACK_JUMP_SEPARATOR + "\n"); + error.stack = filterStackString(concatedStacks); + } + } + function filterStackString(stackString) { + var lines = stackString.split("\n"), + desiredLines = []; + for (var i = 0, + len = lines.length; i < len; i++) { + var line = lines[i]; + if (!isInternalFrame(line) && !isNodeFrame(line) && line) { + desiredLines.push(line); + } + } + return desiredLines.join("\n"); + } + function isInternalFrame(stackLine) { + var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine); + if (!fileNameAndLineNumber) { + return false; + } + var fileName = fileNameAndLineNumber[0], + lineNumber = fileNameAndLineNumber[1]; + return fileName === rFileName && lineNumber >= rStartingLine && lineNumber <= rEndingLine; + } + function isNodeFrame(stackLine) { + return stackLine.indexOf("(module.js:") !== -1 || stackLine.indexOf("(node.js:") !== -1; + } + function captureLine() { + if (!hasStacks) { + return ; + } + try { + throw new Error(); + } catch (e) { + var lines = e.stack.split("\n"); + var firstLine = lines[0].indexOf("@") > 0 ? lines[1] : lines[2]; + var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine); + if (!fileNameAndLineNumber) { + return ; + } + rFileName = fileNameAndLineNumber[0]; + return fileNameAndLineNumber[1]; + } + } + function getFileNameAndLineNumber(stackLine) { + var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine); + if (attempt1) { + return [attempt1[1], Number(attempt1[2])]; + } + var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine); + if (attempt2) { + return [attempt2[1], Number(attempt2[2])]; + } + var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine); + if (attempt3) { + return [attempt3[1], Number(attempt3[2])]; + } + } + var EmptyError = Rx.EmptyError = function() { + this.message = 'Sequence contains no elements.'; + Error.call(this); + }; + EmptyError.prototype = Error.prototype; + var ObjectDisposedError = Rx.ObjectDisposedError = function() { + this.message = 'Object has been disposed'; + Error.call(this); + }; + ObjectDisposedError.prototype = Error.prototype; + var ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError = function() { + this.message = 'Argument out of range'; + Error.call(this); + }; + ArgumentOutOfRangeError.prototype = Error.prototype; + var NotSupportedError = Rx.NotSupportedError = function(message) { + this.message = message || 'This operation is not supported'; + Error.call(this); + }; + NotSupportedError.prototype = Error.prototype; + var NotImplementedError = Rx.NotImplementedError = function(message) { + this.message = message || 'This operation is not implemented'; + Error.call(this); + }; + NotImplementedError.prototype = Error.prototype; + var notImplemented = Rx.helpers.notImplemented = function() { + throw new NotImplementedError(); + }; + var notSupported = Rx.helpers.notSupported = function() { + throw new NotSupportedError(); + }; + var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) || '_es6shim_iterator_'; + if (root.Set && typeof new root.Set()['@@iterator'] === 'function') { + $iterator$ = '@@iterator'; + } + var doneEnumerator = Rx.doneEnumerator = { + done: true, + value: undefined + }; + var isIterable = Rx.helpers.isIterable = function(o) { + return o[$iterator$] !== undefined; + }; + var isArrayLike = Rx.helpers.isArrayLike = function(o) { + return o && o.length !== undefined; + }; + Rx.helpers.iterator = $iterator$; + var bindCallback = Rx.internals.bindCallback = function(func, thisArg, argCount) { + if (typeof thisArg === 'undefined') { + return func; + } + switch (argCount) { + case 0: + return function() { + return func.call(thisArg); + }; + case 1: + return function(arg) { + return func.call(thisArg, arg); + }; + case 2: + return function(value, index) { + return func.call(thisArg, value, index); + }; + case 3: + return function(value, index, collection) { + return func.call(thisArg, value, index, collection); + }; + } + return function() { + return func.apply(thisArg, arguments); + }; + }; + var dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor'], + dontEnumsLength = dontEnums.length; + var argsClass = '[object Arguments]', + arrayClass = '[object Array]', + boolClass = '[object Boolean]', + dateClass = '[object Date]', + errorClass = '[object Error]', + funcClass = '[object Function]', + numberClass = '[object Number]', + objectClass = '[object Object]', + regexpClass = '[object RegExp]', + stringClass = '[object String]'; + var toString = Object.prototype.toString, + hasOwnProperty = Object.prototype.hasOwnProperty, + supportsArgsClass = toString.call(arguments) == argsClass, + supportNodeClass, + errorProto = Error.prototype, + objectProto = Object.prototype, + stringProto = String.prototype, + propertyIsEnumerable = objectProto.propertyIsEnumerable; + try { + supportNodeClass = !(toString.call(document) == objectClass && !({'toString': 0} + '')); + } catch (e) { + supportNodeClass = true; + } + var nonEnumProps = {}; + nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { + 'constructor': true, + 'toLocaleString': true, + 'toString': true, + 'valueOf': true + }; + nonEnumProps[boolClass] = nonEnumProps[stringClass] = { + 'constructor': true, + 'toString': true, + 'valueOf': true + }; + nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { + 'constructor': true, + 'toString': true + }; + nonEnumProps[objectClass] = {'constructor': true}; + var support = {}; + (function() { + var ctor = function() { + this.x = 1; + }, + props = []; + ctor.prototype = { + 'valueOf': 1, + 'y': 1 + }; + for (var key in new ctor) { + props.push(key); + } + for (key in arguments) {} + support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name'); + support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype'); + support.nonEnumArgs = key != 0; + support.nonEnumShadows = !/valueOf/.test(props); + }(1)); + var isObject = Rx.internals.isObject = function(value) { + var type = typeof value; + return value && (type == 'function' || type == 'object') || false; + }; + function keysIn(object) { + var result = []; + if (!isObject(object)) { + return result; + } + if (support.nonEnumArgs && object.length && isArguments(object)) { + object = slice.call(object); + } + var skipProto = support.enumPrototypes && typeof object == 'function', + skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error); + for (var key in object) { + if (!(skipProto && key == 'prototype') && !(skipErrorProps && (key == 'message' || key == 'name'))) { + result.push(key); + } + } + if (support.nonEnumShadows && object !== objectProto) { + var ctor = object.constructor, + index = -1, + length = dontEnumsLength; + if (object === (ctor && ctor.prototype)) { + var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object), + nonEnum = nonEnumProps[className]; + } + while (++index < length) { + key = dontEnums[index]; + if (!(nonEnum && nonEnum[key]) && hasOwnProperty.call(object, key)) { + result.push(key); + } + } + } + return result; + } + function internalFor(object, callback, keysFunc) { + var index = -1, + props = keysFunc(object), + length = props.length; + while (++index < length) { + var key = props[index]; + if (callback(object[key], key, object) === false) { + break; + } + } + return object; + } + function internalForIn(object, callback) { + return internalFor(object, callback, keysIn); + } + function isNode(value) { + return typeof value.toString != 'function' && typeof(value + '') == 'string'; + } + var isArguments = function(value) { + return (value && typeof value == 'object') ? toString.call(value) == argsClass : false; + }; + if (!supportsArgsClass) { + isArguments = function(value) { + return (value && typeof value == 'object') ? hasOwnProperty.call(value, 'callee') : false; + }; + } + var isEqual = Rx.internals.isEqual = function(x, y) { + return deepEquals(x, y, [], []); + }; + function deepEquals(a, b, stackA, stackB) { + if (a === b) { + return a !== 0 || (1 / a == 1 / b); + } + var type = typeof a, + otherType = typeof b; + if (a === a && (a == null || b == null || (type != 'function' && type != 'object' && otherType != 'function' && otherType != 'object'))) { + return false; + } + var className = toString.call(a), + otherClass = toString.call(b); + if (className == argsClass) { + className = objectClass; + } + if (otherClass == argsClass) { + otherClass = objectClass; + } + if (className != otherClass) { + return false; + } + switch (className) { + case boolClass: + case dateClass: + return +a == +b; + case numberClass: + return (a != +a) ? b != +b : (a == 0 ? (1 / a == 1 / b) : a == +b); + case regexpClass: + case stringClass: + return a == String(b); + } + var isArr = className == arrayClass; + if (!isArr) { + if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) { + return false; + } + var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor, + ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor; + if (ctorA != ctorB && !(hasOwnProperty.call(a, 'constructor') && hasOwnProperty.call(b, 'constructor')) && !(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) && ('constructor' in a && 'constructor' in b)) { + return false; + } + } + var initedStack = !stackA; + stackA || (stackA = []); + stackB || (stackB = []); + var length = stackA.length; + while (length--) { + if (stackA[length] == a) { + return stackB[length] == b; + } + } + var size = 0; + var result = true; + stackA.push(a); + stackB.push(b); + if (isArr) { + length = a.length; + size = b.length; + result = size == length; + if (result) { + while (size--) { + var index = length, + value = b[size]; + if (!(result = deepEquals(a[size], value, stackA, stackB))) { + break; + } + } + } + } else { + internalForIn(b, function(value, key, b) { + if (hasOwnProperty.call(b, key)) { + size++; + return (result = hasOwnProperty.call(a, key) && deepEquals(a[key], value, stackA, stackB)); + } + }); + if (result) { + internalForIn(a, function(value, key, a) { + if (hasOwnProperty.call(a, key)) { + return (result = --size > -1); + } + }); + } + } + stackA.pop(); + stackB.pop(); + return result; + } + var hasProp = {}.hasOwnProperty, + slice = Array.prototype.slice; + var inherits = this.inherits = Rx.internals.inherits = function(child, parent) { + function __() { + this.constructor = child; + } + __.prototype = parent.prototype; + child.prototype = new __(); + }; + var addProperties = Rx.internals.addProperties = function(obj) { + for (var sources = [], + i = 1, + len = arguments.length; i < len; i++) { + sources.push(arguments[i]); + } + for (var idx = 0, + ln = sources.length; idx < ln; idx++) { + var source = sources[idx]; + for (var prop in source) { + obj[prop] = source[prop]; + } + } + }; + var addRef = Rx.internals.addRef = function(xs, r) { + return new AnonymousObservable(function(observer) { + return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer)); + }); + }; + function arrayInitialize(count, factory) { + var a = new Array(count); + for (var i = 0; i < count; i++) { + a[i] = factory(); + } + return a; + } + var errorObj = {e: {}}; + var tryCatchTarget; + function tryCatcher() { + try { + return tryCatchTarget.apply(this, arguments); + } catch (e) { + errorObj.e = e; + return errorObj; + } + } + function tryCatch(fn) { + if (!isFunction(fn)) { + throw new TypeError('fn must be a function'); + } + tryCatchTarget = fn; + return tryCatcher; + } + function thrower(e) { + throw e; + } + function IndexedItem(id, value) { + this.id = id; + this.value = value; + } + IndexedItem.prototype.compareTo = function(other) { + var c = this.value.compareTo(other.value); + c === 0 && (c = this.id - other.id); + return c; + }; + var PriorityQueue = Rx.internals.PriorityQueue = function(capacity) { + this.items = new Array(capacity); + this.length = 0; + }; + var priorityProto = PriorityQueue.prototype; + priorityProto.isHigherPriority = function(left, right) { + return this.items[left].compareTo(this.items[right]) < 0; + }; + priorityProto.percolate = function(index) { + if (index >= this.length || index < 0) { + return ; + } + var parent = index - 1 >> 1; + if (parent < 0 || parent === index) { + return ; + } + if (this.isHigherPriority(index, parent)) { + var temp = this.items[index]; + this.items[index] = this.items[parent]; + this.items[parent] = temp; + this.percolate(parent); + } + }; + priorityProto.heapify = function(index) { + +index || (index = 0); + if (index >= this.length || index < 0) { + return ; + } + var left = 2 * index + 1, + right = 2 * index + 2, + first = index; + if (left < this.length && this.isHigherPriority(left, first)) { + first = left; + } + if (right < this.length && this.isHigherPriority(right, first)) { + first = right; + } + if (first !== index) { + var temp = this.items[index]; + this.items[index] = this.items[first]; + this.items[first] = temp; + this.heapify(first); + } + }; + priorityProto.peek = function() { + return this.items[0].value; + }; + priorityProto.removeAt = function(index) { + this.items[index] = this.items[--this.length]; + this.items[this.length] = undefined; + this.heapify(); + }; + priorityProto.dequeue = function() { + var result = this.peek(); + this.removeAt(0); + return result; + }; + priorityProto.enqueue = function(item) { + var index = this.length++; + this.items[index] = new IndexedItem(PriorityQueue.count++, item); + this.percolate(index); + }; + priorityProto.remove = function(item) { + for (var i = 0; i < this.length; i++) { + if (this.items[i].value === item) { + this.removeAt(i); + return true; + } + } + return false; + }; + PriorityQueue.count = 0; + var CompositeDisposable = Rx.CompositeDisposable = function() { + var args = [], + i, + len; + if (Array.isArray(arguments[0])) { + args = arguments[0]; + len = args.length; + } else { + len = arguments.length; + args = new Array(len); + for (i = 0; i < len; i++) { + args[i] = arguments[i]; + } + } + for (i = 0; i < len; i++) { + if (!isDisposable(args[i])) { + throw new TypeError('Not a disposable'); + } + } + this.disposables = args; + this.isDisposed = false; + this.length = args.length; + }; + var CompositeDisposablePrototype = CompositeDisposable.prototype; + CompositeDisposablePrototype.add = function(item) { + if (this.isDisposed) { + item.dispose(); + } else { + this.disposables.push(item); + this.length++; + } + }; + CompositeDisposablePrototype.remove = function(item) { + var shouldDispose = false; + if (!this.isDisposed) { + var idx = this.disposables.indexOf(item); + if (idx !== -1) { + shouldDispose = true; + this.disposables.splice(idx, 1); + this.length--; + item.dispose(); + } + } + return shouldDispose; + }; + CompositeDisposablePrototype.dispose = function() { + if (!this.isDisposed) { + this.isDisposed = true; + var len = this.disposables.length, + currentDisposables = new Array(len); + for (var i = 0; i < len; i++) { + currentDisposables[i] = this.disposables[i]; + } + this.disposables = []; + this.length = 0; + for (i = 0; i < len; i++) { + currentDisposables[i].dispose(); + } + } + }; + var Disposable = Rx.Disposable = function(action) { + this.isDisposed = false; + this.action = action || noop; + }; + Disposable.prototype.dispose = function() { + if (!this.isDisposed) { + this.action(); + this.isDisposed = true; + } + }; + var disposableCreate = Disposable.create = function(action) { + return new Disposable(action); + }; + var disposableEmpty = Disposable.empty = {dispose: noop}; + var isDisposable = Disposable.isDisposable = function(d) { + return d && isFunction(d.dispose); + }; + var checkDisposed = Disposable.checkDisposed = function(disposable) { + if (disposable.isDisposed) { + throw new ObjectDisposedError(); + } + }; + var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = (function() { + function BooleanDisposable() { + this.isDisposed = false; + this.current = null; + } + var booleanDisposablePrototype = BooleanDisposable.prototype; + booleanDisposablePrototype.getDisposable = function() { + return this.current; + }; + booleanDisposablePrototype.setDisposable = function(value) { + var shouldDispose = this.isDisposed; + if (!shouldDispose) { + var old = this.current; + this.current = value; + } + old && old.dispose(); + shouldDispose && value && value.dispose(); + }; + booleanDisposablePrototype.dispose = function() { + if (!this.isDisposed) { + this.isDisposed = true; + var old = this.current; + this.current = null; + } + old && old.dispose(); + }; + return BooleanDisposable; + }()); + var SerialDisposable = Rx.SerialDisposable = SingleAssignmentDisposable; + var RefCountDisposable = Rx.RefCountDisposable = (function() { + function InnerDisposable(disposable) { + this.disposable = disposable; + this.disposable.count++; + this.isInnerDisposed = false; + } + InnerDisposable.prototype.dispose = function() { + if (!this.disposable.isDisposed && !this.isInnerDisposed) { + this.isInnerDisposed = true; + this.disposable.count--; + if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) { + this.disposable.isDisposed = true; + this.disposable.underlyingDisposable.dispose(); + } + } + }; + function RefCountDisposable(disposable) { + this.underlyingDisposable = disposable; + this.isDisposed = false; + this.isPrimaryDisposed = false; + this.count = 0; + } + RefCountDisposable.prototype.dispose = function() { + if (!this.isDisposed && !this.isPrimaryDisposed) { + this.isPrimaryDisposed = true; + if (this.count === 0) { + this.isDisposed = true; + this.underlyingDisposable.dispose(); + } + } + }; + RefCountDisposable.prototype.getDisposable = function() { + return this.isDisposed ? disposableEmpty : new InnerDisposable(this); + }; + return RefCountDisposable; + })(); + function ScheduledDisposable(scheduler, disposable) { + this.scheduler = scheduler; + this.disposable = disposable; + this.isDisposed = false; + } + function scheduleItem(s, self) { + if (!self.isDisposed) { + self.isDisposed = true; + self.disposable.dispose(); + } + } + ScheduledDisposable.prototype.dispose = function() { + this.scheduler.scheduleWithState(this, scheduleItem); + }; + var ScheduledItem = Rx.internals.ScheduledItem = function(scheduler, state, action, dueTime, comparer) { + this.scheduler = scheduler; + this.state = state; + this.action = action; + this.dueTime = dueTime; + this.comparer = comparer || defaultSubComparer; + this.disposable = new SingleAssignmentDisposable(); + }; + ScheduledItem.prototype.invoke = function() { + this.disposable.setDisposable(this.invokeCore()); + }; + ScheduledItem.prototype.compareTo = function(other) { + return this.comparer(this.dueTime, other.dueTime); + }; + ScheduledItem.prototype.isCancelled = function() { + return this.disposable.isDisposed; + }; + ScheduledItem.prototype.invokeCore = function() { + return this.action(this.scheduler, this.state); + }; + var Scheduler = Rx.Scheduler = (function() { + function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) { + this.now = now; + this._schedule = schedule; + this._scheduleRelative = scheduleRelative; + this._scheduleAbsolute = scheduleAbsolute; + } + function invokeAction(scheduler, action) { + action(); + return disposableEmpty; + } + var schedulerProto = Scheduler.prototype; + schedulerProto.schedule = function(action) { + return this._schedule(action, invokeAction); + }; + schedulerProto.scheduleWithState = function(state, action) { + return this._schedule(state, action); + }; + schedulerProto.scheduleWithRelative = function(dueTime, action) { + return this._scheduleRelative(action, dueTime, invokeAction); + }; + schedulerProto.scheduleWithRelativeAndState = function(state, dueTime, action) { + return this._scheduleRelative(state, dueTime, action); + }; + schedulerProto.scheduleWithAbsolute = function(dueTime, action) { + return this._scheduleAbsolute(action, dueTime, invokeAction); + }; + schedulerProto.scheduleWithAbsoluteAndState = function(state, dueTime, action) { + return this._scheduleAbsolute(state, dueTime, action); + }; + Scheduler.now = defaultNow; + Scheduler.normalize = function(timeSpan) { + timeSpan < 0 && (timeSpan = 0); + return timeSpan; + }; + return Scheduler; + }()); + var normalizeTime = Scheduler.normalize; + (function(schedulerProto) { + function invokeRecImmediate(scheduler, pair) { + var state = pair[0], + action = pair[1], + group = new CompositeDisposable(); + function recursiveAction(state1) { + action(state1, function(state2) { + var isAdded = false, + isDone = false, + d = scheduler.scheduleWithState(state2, function(scheduler1, state3) { + if (isAdded) { + group.remove(d); + } else { + isDone = true; + } + recursiveAction(state3); + return disposableEmpty; + }); + if (!isDone) { + group.add(d); + isAdded = true; + } + }); + } + recursiveAction(state); + return group; + } + function invokeRecDate(scheduler, pair, method) { + var state = pair[0], + action = pair[1], + group = new CompositeDisposable(); + function recursiveAction(state1) { + action(state1, function(state2, dueTime1) { + var isAdded = false, + isDone = false, + d = scheduler[method](state2, dueTime1, function(scheduler1, state3) { + if (isAdded) { + group.remove(d); + } else { + isDone = true; + } + recursiveAction(state3); + return disposableEmpty; + }); + if (!isDone) { + group.add(d); + isAdded = true; + } + }); + } + ; + recursiveAction(state); + return group; + } + function scheduleInnerRecursive(action, self) { + action(function(dt) { + self(action, dt); + }); + } + schedulerProto.scheduleRecursive = function(action) { + return this.scheduleRecursiveWithState(action, function(_action, self) { + _action(function() { + self(_action); + }); + }); + }; + schedulerProto.scheduleRecursiveWithState = function(state, action) { + return this.scheduleWithState([state, action], invokeRecImmediate); + }; + schedulerProto.scheduleRecursiveWithRelative = function(dueTime, action) { + return this.scheduleRecursiveWithRelativeAndState(action, dueTime, scheduleInnerRecursive); + }; + schedulerProto.scheduleRecursiveWithRelativeAndState = function(state, dueTime, action) { + return this._scheduleRelative([state, action], dueTime, function(s, p) { + return invokeRecDate(s, p, 'scheduleWithRelativeAndState'); + }); + }; + schedulerProto.scheduleRecursiveWithAbsolute = function(dueTime, action) { + return this.scheduleRecursiveWithAbsoluteAndState(action, dueTime, scheduleInnerRecursive); + }; + schedulerProto.scheduleRecursiveWithAbsoluteAndState = function(state, dueTime, action) { + return this._scheduleAbsolute([state, action], dueTime, function(s, p) { + return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState'); + }); + }; + }(Scheduler.prototype)); + (function(schedulerProto) { + Scheduler.prototype.schedulePeriodic = function(period, action) { + return this.schedulePeriodicWithState(null, period, action); + }; + Scheduler.prototype.schedulePeriodicWithState = function(state, period, action) { + if (typeof root.setInterval === 'undefined') { + throw new NotSupportedError(); + } + period = normalizeTime(period); + var s = state, + id = root.setInterval(function() { + s = action(s); + }, period); + return disposableCreate(function() { + root.clearInterval(id); + }); + }; + }(Scheduler.prototype)); + (function(schedulerProto) { + schedulerProto.catchError = schedulerProto['catch'] = function(handler) { + return new CatchScheduler(this, handler); + }; + }(Scheduler.prototype)); + var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function() { + function tick(command, recurse) { + recurse(0, this._period); + try { + this._state = this._action(this._state); + } catch (e) { + this._cancel.dispose(); + throw e; + } + } + function SchedulePeriodicRecursive(scheduler, state, period, action) { + this._scheduler = scheduler; + this._state = state; + this._period = period; + this._action = action; + } + SchedulePeriodicRecursive.prototype.start = function() { + var d = new SingleAssignmentDisposable(); + this._cancel = d; + d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this))); + return d; + }; + return SchedulePeriodicRecursive; + }()); + var immediateScheduler = Scheduler.immediate = (function() { + function scheduleNow(state, action) { + return action(this, state); + } + return new Scheduler(defaultNow, scheduleNow, notSupported, notSupported); + }()); + var currentThreadScheduler = Scheduler.currentThread = (function() { + var queue; + function runTrampoline() { + while (queue.length > 0) { + var item = queue.dequeue(); + !item.isCancelled() && item.invoke(); + } + } + function scheduleNow(state, action) { + var si = new ScheduledItem(this, state, action, this.now()); + if (!queue) { + queue = new PriorityQueue(4); + queue.enqueue(si); + var result = tryCatch(runTrampoline)(); + queue = null; + if (result === errorObj) { + return thrower(result.e); + } + } else { + queue.enqueue(si); + } + return si.disposable; + } + var currentScheduler = new Scheduler(defaultNow, scheduleNow, notSupported, notSupported); + currentScheduler.scheduleRequired = function() { + return !queue; + }; + return currentScheduler; + }()); + var scheduleMethod, + clearMethod; + var localTimer = (function() { + var localSetTimeout, + localClearTimeout = noop; + if (!!root.WScript) { + localSetTimeout = function(fn, time) { + root.WScript.Sleep(time); + fn(); + }; + } else if (!!root.setTimeout) { + localSetTimeout = root.setTimeout; + localClearTimeout = root.clearTimeout; + } else { + throw new NotSupportedError(); + } + return { + setTimeout: localSetTimeout, + clearTimeout: localClearTimeout + }; + }()); + var localSetTimeout = localTimer.setTimeout, + localClearTimeout = localTimer.clearTimeout; + (function() { + var nextHandle = 1, + tasksByHandle = {}, + currentlyRunning = false; + clearMethod = function(handle) { + delete tasksByHandle[handle]; + }; + function runTask(handle) { + if (currentlyRunning) { + localSetTimeout(function() { + runTask(handle); + }, 0); + } else { + var task = tasksByHandle[handle]; + if (task) { + currentlyRunning = true; + var result = tryCatch(task)(); + clearMethod(handle); + currentlyRunning = false; + if (result === errorObj) { + return thrower(result.e); + } + } + } + } + var reNative = RegExp('^' + String(toString).replace(/[.*+?^${}()|[\]\\]/g, '\\$&').replace(/toString| for [^\]]+/g, '.*?') + '$'); + var setImmediate = typeof(setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' && !reNative.test(setImmediate) && setImmediate; + function postMessageSupported() { + if (!root.postMessage || root.importScripts) { + return false; + } + var isAsync = false, + oldHandler = root.onmessage; + root.onmessage = function() { + isAsync = true; + }; + root.postMessage('', '*'); + root.onmessage = oldHandler; + return isAsync; + } + if (isFunction(setImmediate)) { + scheduleMethod = function(action) { + var id = nextHandle++; + tasksByHandle[id] = action; + setImmediate(function() { + runTask(id); + }); + return id; + }; + } else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') { + scheduleMethod = function(action) { + var id = nextHandle++; + tasksByHandle[id] = action; + process.nextTick(function() { + runTask(id); + }); + return id; + }; + } else if (postMessageSupported()) { + var MSG_PREFIX = 'ms.rx.schedule' + Math.random(); + function onGlobalPostMessage(event) { + if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) { + runTask(event.data.substring(MSG_PREFIX.length)); + } + } + if (root.addEventListener) { + root.addEventListener('message', onGlobalPostMessage, false); + } else { + root.attachEvent('onmessage', onGlobalPostMessage, false); + } + scheduleMethod = function(action) { + var id = nextHandle++; + tasksByHandle[id] = action; + root.postMessage(MSG_PREFIX + currentId, '*'); + return id; + }; + } else if (!!root.MessageChannel) { + var channel = new root.MessageChannel(); + channel.port1.onmessage = function(e) { + runTask(e.data); + }; + scheduleMethod = function(action) { + var id = nextHandle++; + tasksByHandle[id] = action; + channel.port2.postMessage(id); + return id; + }; + } else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) { + scheduleMethod = function(action) { + var scriptElement = root.document.createElement('script'); + var id = nextHandle++; + tasksByHandle[id] = action; + scriptElement.onreadystatechange = function() { + runTask(id); + scriptElement.onreadystatechange = null; + scriptElement.parentNode.removeChild(scriptElement); + scriptElement = null; + }; + root.document.documentElement.appendChild(scriptElement); + return id; + }; + } else { + scheduleMethod = function(action) { + var id = nextHandle++; + tasksByHandle[id] = action; + localSetTimeout(function() { + runTask(id); + }, 0); + return id; + }; + } + }()); + var timeoutScheduler = Scheduler.timeout = Scheduler.default = (function() { + function scheduleNow(state, action) { + var scheduler = this, + disposable = new SingleAssignmentDisposable(); + var id = scheduleMethod(function() { + if (!disposable.isDisposed) { + disposable.setDisposable(action(scheduler, state)); + } + }); + return new CompositeDisposable(disposable, disposableCreate(function() { + clearMethod(id); + })); + } + function scheduleRelative(state, dueTime, action) { + var scheduler = this, + dt = Scheduler.normalize(dueTime); + if (dt === 0) { + return scheduler.scheduleWithState(state, action); + } + var disposable = new SingleAssignmentDisposable(); + var id = localSetTimeout(function() { + if (!disposable.isDisposed) { + disposable.setDisposable(action(scheduler, state)); + } + }, dt); + return new CompositeDisposable(disposable, disposableCreate(function() { + localClearTimeout(id); + })); + } + function scheduleAbsolute(state, dueTime, action) { + return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action); + } + return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute); + })(); + var CatchScheduler = (function(__super__) { + function scheduleNow(state, action) { + return this._scheduler.scheduleWithState(state, this._wrap(action)); + } + function scheduleRelative(state, dueTime, action) { + return this._scheduler.scheduleWithRelativeAndState(state, dueTime, this._wrap(action)); + } + function scheduleAbsolute(state, dueTime, action) { + return this._scheduler.scheduleWithAbsoluteAndState(state, dueTime, this._wrap(action)); + } + inherits(CatchScheduler, __super__); + function CatchScheduler(scheduler, handler) { + this._scheduler = scheduler; + this._handler = handler; + this._recursiveOriginal = null; + this._recursiveWrapper = null; + __super__.call(this, this._scheduler.now.bind(this._scheduler), scheduleNow, scheduleRelative, scheduleAbsolute); + } + CatchScheduler.prototype._clone = function(scheduler) { + return new CatchScheduler(scheduler, this._handler); + }; + CatchScheduler.prototype._wrap = function(action) { + var parent = this; + return function(self, state) { + try { + return action(parent._getRecursiveWrapper(self), state); + } catch (e) { + if (!parent._handler(e)) { + throw e; + } + return disposableEmpty; + } + }; + }; + CatchScheduler.prototype._getRecursiveWrapper = function(scheduler) { + if (this._recursiveOriginal !== scheduler) { + this._recursiveOriginal = scheduler; + var wrapper = this._clone(scheduler); + wrapper._recursiveOriginal = scheduler; + wrapper._recursiveWrapper = wrapper; + this._recursiveWrapper = wrapper; + } + return this._recursiveWrapper; + }; + CatchScheduler.prototype.schedulePeriodicWithState = function(state, period, action) { + var self = this, + failed = false, + d = new SingleAssignmentDisposable(); + d.setDisposable(this._scheduler.schedulePeriodicWithState(state, period, function(state1) { + if (failed) { + return null; + } + try { + return action(state1); + } catch (e) { + failed = true; + if (!self._handler(e)) { + throw e; + } + d.dispose(); + return null; + } + })); + return d; + }; + return CatchScheduler; + }(Scheduler)); + var Notification = Rx.Notification = (function() { + function Notification(kind, value, exception, accept, acceptObservable, toString) { + this.kind = kind; + this.value = value; + this.exception = exception; + this._accept = accept; + this._acceptObservable = acceptObservable; + this.toString = toString; + } + Notification.prototype.accept = function(observerOrOnNext, onError, onCompleted) { + return observerOrOnNext && typeof observerOrOnNext === 'object' ? this._acceptObservable(observerOrOnNext) : this._accept(observerOrOnNext, onError, onCompleted); + }; + Notification.prototype.toObservable = function(scheduler) { + var self = this; + isScheduler(scheduler) || (scheduler = immediateScheduler); + return new AnonymousObservable(function(observer) { + return scheduler.scheduleWithState(self, function(_, notification) { + notification._acceptObservable(observer); + notification.kind === 'N' && observer.onCompleted(); + }); + }); + }; + return Notification; + })(); + var notificationCreateOnNext = Notification.createOnNext = (function() { + function _accept(onNext) { + return onNext(this.value); + } + function _acceptObservable(observer) { + return observer.onNext(this.value); + } + function toString() { + return 'OnNext(' + this.value + ')'; + } + return function(value) { + return new Notification('N', value, null, _accept, _acceptObservable, toString); + }; + }()); + var notificationCreateOnError = Notification.createOnError = (function() { + function _accept(onNext, onError) { + return onError(this.exception); + } + function _acceptObservable(observer) { + return observer.onError(this.exception); + } + function toString() { + return 'OnError(' + this.exception + ')'; + } + return function(e) { + return new Notification('E', null, e, _accept, _acceptObservable, toString); + }; + }()); + var notificationCreateOnCompleted = Notification.createOnCompleted = (function() { + function _accept(onNext, onError, onCompleted) { + return onCompleted(); + } + function _acceptObservable(observer) { + return observer.onCompleted(); + } + function toString() { + return 'OnCompleted()'; + } + return function() { + return new Notification('C', null, null, _accept, _acceptObservable, toString); + }; + }()); + var Enumerator = Rx.internals.Enumerator = function(next) { + this._next = next; + }; + Enumerator.prototype.next = function() { + return this._next(); + }; + Enumerator.prototype[$iterator$] = function() { + return this; + }; + var Enumerable = Rx.internals.Enumerable = function(iterator) { + this._iterator = iterator; + }; + Enumerable.prototype[$iterator$] = function() { + return this._iterator(); + }; + Enumerable.prototype.concat = function() { + var sources = this; + return new AnonymousObservable(function(o) { + var e = sources[$iterator$](); + var isDisposed, + subscription = new SerialDisposable(); + var cancelable = immediateScheduler.scheduleRecursive(function(self) { + if (isDisposed) { + return ; + } + try { + var currentItem = e.next(); + } catch (ex) { + return o.onError(ex); + } + if (currentItem.done) { + return o.onCompleted(); + } + var currentValue = currentItem.value; + isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); + var d = new SingleAssignmentDisposable(); + subscription.setDisposable(d); + d.setDisposable(currentValue.subscribe(function(x) { + o.onNext(x); + }, function(err) { + o.onError(err); + }, self)); + }); + return new CompositeDisposable(subscription, cancelable, disposableCreate(function() { + isDisposed = true; + })); + }); + }; + Enumerable.prototype.catchError = function() { + var sources = this; + return new AnonymousObservable(function(o) { + var e = sources[$iterator$](); + var isDisposed, + subscription = new SerialDisposable(); + var cancelable = immediateScheduler.scheduleRecursiveWithState(null, function(lastException, self) { + if (isDisposed) { + return ; + } + try { + var currentItem = e.next(); + } catch (ex) { + return observer.onError(ex); + } + if (currentItem.done) { + if (lastException !== null) { + o.onError(lastException); + } else { + o.onCompleted(); + } + return ; + } + var currentValue = currentItem.value; + isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); + var d = new SingleAssignmentDisposable(); + subscription.setDisposable(d); + d.setDisposable(currentValue.subscribe(function(x) { + o.onNext(x); + }, self, function() { + o.onCompleted(); + })); + }); + return new CompositeDisposable(subscription, cancelable, disposableCreate(function() { + isDisposed = true; + })); + }); + }; + Enumerable.prototype.catchErrorWhen = function(notificationHandler) { + var sources = this; + return new AnonymousObservable(function(o) { + var exceptions = new Subject(), + notifier = new Subject(), + handled = notificationHandler(exceptions), + notificationDisposable = handled.subscribe(notifier); + var e = sources[$iterator$](); + var isDisposed, + lastException, + subscription = new SerialDisposable(); + var cancelable = immediateScheduler.scheduleRecursive(function(self) { + if (isDisposed) { + return ; + } + try { + var currentItem = e.next(); + } catch (ex) { + return o.onError(ex); + } + if (currentItem.done) { + if (lastException) { + o.onError(lastException); + } else { + o.onCompleted(); + } + return ; + } + var currentValue = currentItem.value; + isPromise(currentValue) && (currentValue = observableFromPromise(currentValue)); + var outer = new SingleAssignmentDisposable(); + var inner = new SingleAssignmentDisposable(); + subscription.setDisposable(new CompositeDisposable(inner, outer)); + outer.setDisposable(currentValue.subscribe(function(x) { + o.onNext(x); + }, function(exn) { + inner.setDisposable(notifier.subscribe(self, function(ex) { + o.onError(ex); + }, function() { + o.onCompleted(); + })); + exceptions.onNext(exn); + }, function() { + o.onCompleted(); + })); + }); + return new CompositeDisposable(notificationDisposable, subscription, cancelable, disposableCreate(function() { + isDisposed = true; + })); + }); + }; + var enumerableRepeat = Enumerable.repeat = function(value, repeatCount) { + if (repeatCount == null) { + repeatCount = -1; + } + return new Enumerable(function() { + var left = repeatCount; + return new Enumerator(function() { + if (left === 0) { + return doneEnumerator; + } + if (left > 0) { + left--; + } + return { + done: false, + value: value + }; + }); + }); + }; + var enumerableOf = Enumerable.of = function(source, selector, thisArg) { + if (selector) { + var selectorFn = bindCallback(selector, thisArg, 3); + } + return new Enumerable(function() { + var index = -1; + return new Enumerator(function() { + return ++index < source.length ? { + done: false, + value: !selector ? source[index] : selectorFn(source[index], index, source) + } : doneEnumerator; + }); + }); + }; + var Observer = Rx.Observer = function() {}; + Observer.prototype.toNotifier = function() { + var observer = this; + return function(n) { + return n.accept(observer); + }; + }; + Observer.prototype.asObserver = function() { + return new AnonymousObserver(this.onNext.bind(this), this.onError.bind(this), this.onCompleted.bind(this)); + }; + Observer.prototype.checked = function() { + return new CheckedObserver(this); + }; + var observerCreate = Observer.create = function(onNext, onError, onCompleted) { + onNext || (onNext = noop); + onError || (onError = defaultError); + onCompleted || (onCompleted = noop); + return new AnonymousObserver(onNext, onError, onCompleted); + }; + Observer.fromNotifier = function(handler, thisArg) { + return new AnonymousObserver(function(x) { + return handler.call(thisArg, notificationCreateOnNext(x)); + }, function(e) { + return handler.call(thisArg, notificationCreateOnError(e)); + }, function() { + return handler.call(thisArg, notificationCreateOnCompleted()); + }); + }; + Observer.prototype.notifyOn = function(scheduler) { + return new ObserveOnObserver(scheduler, this); + }; + Observer.prototype.makeSafe = function(disposable) { + return new AnonymousSafeObserver(this._onNext, this._onError, this._onCompleted, disposable); + }; + var AbstractObserver = Rx.internals.AbstractObserver = (function(__super__) { + inherits(AbstractObserver, __super__); + function AbstractObserver() { + this.isStopped = false; + __super__.call(this); + } + AbstractObserver.prototype.next = notImplemented; + AbstractObserver.prototype.error = notImplemented; + AbstractObserver.prototype.completed = notImplemented; + AbstractObserver.prototype.onNext = function(value) { + if (!this.isStopped) { + this.next(value); + } + }; + AbstractObserver.prototype.onError = function(error) { + if (!this.isStopped) { + this.isStopped = true; + this.error(error); + } + }; + AbstractObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + this.isStopped = true; + this.completed(); + } + }; + AbstractObserver.prototype.dispose = function() { + this.isStopped = true; + }; + AbstractObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.error(e); + return true; + } + return false; + }; + return AbstractObserver; + }(Observer)); + var AnonymousObserver = Rx.AnonymousObserver = (function(__super__) { + inherits(AnonymousObserver, __super__); + function AnonymousObserver(onNext, onError, onCompleted) { + __super__.call(this); + this._onNext = onNext; + this._onError = onError; + this._onCompleted = onCompleted; + } + AnonymousObserver.prototype.next = function(value) { + this._onNext(value); + }; + AnonymousObserver.prototype.error = function(error) { + this._onError(error); + }; + AnonymousObserver.prototype.completed = function() { + this._onCompleted(); + }; + return AnonymousObserver; + }(AbstractObserver)); + var CheckedObserver = (function(__super__) { + inherits(CheckedObserver, __super__); + function CheckedObserver(observer) { + __super__.call(this); + this._observer = observer; + this._state = 0; + } + var CheckedObserverPrototype = CheckedObserver.prototype; + CheckedObserverPrototype.onNext = function(value) { + this.checkAccess(); + var res = tryCatch(this._observer.onNext).call(this._observer, value); + this._state = 0; + res === errorObj && thrower(res.e); + }; + CheckedObserverPrototype.onError = function(err) { + this.checkAccess(); + var res = tryCatch(this._observer.onError).call(this._observer, err); + this._state = 2; + res === errorObj && thrower(res.e); + }; + CheckedObserverPrototype.onCompleted = function() { + this.checkAccess(); + var res = tryCatch(this._observer.onCompleted).call(this._observer); + this._state = 2; + res === errorObj && thrower(res.e); + }; + CheckedObserverPrototype.checkAccess = function() { + if (this._state === 1) { + throw new Error('Re-entrancy detected'); + } + if (this._state === 2) { + throw new Error('Observer completed'); + } + if (this._state === 0) { + this._state = 1; + } + }; + return CheckedObserver; + }(Observer)); + var ScheduledObserver = Rx.internals.ScheduledObserver = (function(__super__) { + inherits(ScheduledObserver, __super__); + function ScheduledObserver(scheduler, observer) { + __super__.call(this); + this.scheduler = scheduler; + this.observer = observer; + this.isAcquired = false; + this.hasFaulted = false; + this.queue = []; + this.disposable = new SerialDisposable(); + } + ScheduledObserver.prototype.next = function(value) { + var self = this; + this.queue.push(function() { + self.observer.onNext(value); + }); + }; + ScheduledObserver.prototype.error = function(e) { + var self = this; + this.queue.push(function() { + self.observer.onError(e); + }); + }; + ScheduledObserver.prototype.completed = function() { + var self = this; + this.queue.push(function() { + self.observer.onCompleted(); + }); + }; + ScheduledObserver.prototype.ensureActive = function() { + var isOwner = false, + parent = this; + if (!this.hasFaulted && this.queue.length > 0) { + isOwner = !this.isAcquired; + this.isAcquired = true; + } + if (isOwner) { + this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(self) { + var work; + if (parent.queue.length > 0) { + work = parent.queue.shift(); + } else { + parent.isAcquired = false; + return ; + } + try { + work(); + } catch (ex) { + parent.queue = []; + parent.hasFaulted = true; + throw ex; + } + self(); + })); + } + }; + ScheduledObserver.prototype.dispose = function() { + __super__.prototype.dispose.call(this); + this.disposable.dispose(); + }; + return ScheduledObserver; + }(AbstractObserver)); + var ObserveOnObserver = (function(__super__) { + inherits(ObserveOnObserver, __super__); + function ObserveOnObserver(scheduler, observer, cancel) { + __super__.call(this, scheduler, observer); + this._cancel = cancel; + } + ObserveOnObserver.prototype.next = function(value) { + __super__.prototype.next.call(this, value); + this.ensureActive(); + }; + ObserveOnObserver.prototype.error = function(e) { + __super__.prototype.error.call(this, e); + this.ensureActive(); + }; + ObserveOnObserver.prototype.completed = function() { + __super__.prototype.completed.call(this); + this.ensureActive(); + }; + ObserveOnObserver.prototype.dispose = function() { + __super__.prototype.dispose.call(this); + this._cancel && this._cancel.dispose(); + this._cancel = null; + }; + return ObserveOnObserver; + })(ScheduledObserver); + var observableProto; + var Observable = Rx.Observable = (function() { + function Observable(subscribe) { + if (Rx.config.longStackSupport && hasStacks) { + try { + throw new Error(); + } catch (e) { + this.stack = e.stack.substring(e.stack.indexOf("\n") + 1); + } + var self = this; + this._subscribe = function(observer) { + var oldOnError = observer.onError.bind(observer); + observer.onError = function(err) { + makeStackTraceLong(err, self); + oldOnError(err); + }; + return subscribe.call(self, observer); + }; + } else { + this._subscribe = subscribe; + } + } + observableProto = Observable.prototype; + observableProto.subscribe = observableProto.forEach = function(observerOrOnNext, onError, onCompleted) { + return this._subscribe(typeof observerOrOnNext === 'object' ? observerOrOnNext : observerCreate(observerOrOnNext, onError, onCompleted)); + }; + observableProto.subscribeOnNext = function(onNext, thisArg) { + return this._subscribe(observerCreate(typeof thisArg !== 'undefined' ? function(x) { + onNext.call(thisArg, x); + } : onNext)); + }; + observableProto.subscribeOnError = function(onError, thisArg) { + return this._subscribe(observerCreate(null, typeof thisArg !== 'undefined' ? function(e) { + onError.call(thisArg, e); + } : onError)); + }; + observableProto.subscribeOnCompleted = function(onCompleted, thisArg) { + return this._subscribe(observerCreate(null, null, typeof thisArg !== 'undefined' ? function() { + onCompleted.call(thisArg); + } : onCompleted)); + }; + return Observable; + })(); + var ObservableBase = Rx.ObservableBase = (function(__super__) { + inherits(ObservableBase, __super__); + function fixSubscriber(subscriber) { + return subscriber && isFunction(subscriber.dispose) ? subscriber : isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty; + } + function setDisposable(s, state) { + var ado = state[0], + self = state[1]; + var sub = tryCatch(self.subscribeCore).call(self, ado); + if (sub === errorObj) { + if (!ado.fail(errorObj.e)) { + return thrower(errorObj.e); + } + } + ado.setDisposable(fixSubscriber(sub)); + } + function subscribe(observer) { + var ado = new AutoDetachObserver(observer), + state = [ado, this]; + if (currentThreadScheduler.scheduleRequired()) { + currentThreadScheduler.scheduleWithState(state, setDisposable); + } else { + setDisposable(null, state); + } + return ado; + } + function ObservableBase() { + __super__.call(this, subscribe); + } + ObservableBase.prototype.subscribeCore = notImplemented; + return ObservableBase; + }(Observable)); + observableProto.observeOn = function(scheduler) { + var source = this; + return new AnonymousObservable(function(observer) { + return source.subscribe(new ObserveOnObserver(scheduler, observer)); + }, source); + }; + observableProto.subscribeOn = function(scheduler) { + var source = this; + return new AnonymousObservable(function(observer) { + var m = new SingleAssignmentDisposable(), + d = new SerialDisposable(); + d.setDisposable(m); + m.setDisposable(scheduler.schedule(function() { + d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(observer))); + })); + return d; + }, source); + }; + var observableFromPromise = Observable.fromPromise = function(promise) { + return observableDefer(function() { + var subject = new Rx.AsyncSubject(); + promise.then(function(value) { + subject.onNext(value); + subject.onCompleted(); + }, subject.onError.bind(subject)); + return subject; + }); + }; + observableProto.toPromise = function(promiseCtor) { + promiseCtor || (promiseCtor = Rx.config.Promise); + if (!promiseCtor) { + throw new NotSupportedError('Promise type not provided nor in Rx.config.Promise'); + } + var source = this; + return new promiseCtor(function(resolve, reject) { + var value, + hasValue = false; + source.subscribe(function(v) { + value = v; + hasValue = true; + }, reject, function() { + hasValue && resolve(value); + }); + }); + }; + var ToArrayObservable = (function(__super__) { + inherits(ToArrayObservable, __super__); + function ToArrayObservable(source) { + this.source = source; + __super__.call(this); + } + ToArrayObservable.prototype.subscribeCore = function(observer) { + return this.source.subscribe(new ToArrayObserver(observer)); + }; + return ToArrayObservable; + }(ObservableBase)); + function ToArrayObserver(observer) { + this.observer = observer; + this.a = []; + this.isStopped = false; + } + ToArrayObserver.prototype.onNext = function(x) { + if (!this.isStopped) { + this.a.push(x); + } + }; + ToArrayObserver.prototype.onError = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onError(e); + } + }; + ToArrayObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onNext(this.a); + this.observer.onCompleted(); + } + }; + ToArrayObserver.prototype.dispose = function() { + this.isStopped = true; + }; + ToArrayObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onError(e); + return true; + } + return false; + }; + observableProto.toArray = function() { + return new ToArrayObservable(this); + }; + Observable.create = Observable.createWithDisposable = function(subscribe, parent) { + return new AnonymousObservable(subscribe, parent); + }; + var observableDefer = Observable.defer = function(observableFactory) { + return new AnonymousObservable(function(observer) { + var result; + try { + result = observableFactory(); + } catch (e) { + return observableThrow(e).subscribe(observer); + } + isPromise(result) && (result = observableFromPromise(result)); + return result.subscribe(observer); + }); + }; + var observableEmpty = Observable.empty = function(scheduler) { + isScheduler(scheduler) || (scheduler = immediateScheduler); + return new AnonymousObservable(function(observer) { + return scheduler.scheduleWithState(null, function() { + observer.onCompleted(); + }); + }); + }; + var FromObservable = (function(__super__) { + inherits(FromObservable, __super__); + function FromObservable(iterable, mapper, scheduler) { + this.iterable = iterable; + this.mapper = mapper; + this.scheduler = scheduler; + __super__.call(this); + } + FromObservable.prototype.subscribeCore = function(observer) { + var sink = new FromSink(observer, this); + return sink.run(); + }; + return FromObservable; + }(ObservableBase)); + var FromSink = (function() { + function FromSink(observer, parent) { + this.observer = observer; + this.parent = parent; + } + FromSink.prototype.run = function() { + var list = Object(this.parent.iterable), + it = getIterable(list), + observer = this.observer, + mapper = this.parent.mapper; + function loopRecursive(i, recurse) { + try { + var next = it.next(); + } catch (e) { + return observer.onError(e); + } + if (next.done) { + return observer.onCompleted(); + } + var result = next.value; + if (mapper) { + try { + result = mapper(result, i); + } catch (e) { + return observer.onError(e); + } + } + observer.onNext(result); + recurse(i + 1); + } + return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive); + }; + return FromSink; + }()); + var maxSafeInteger = Math.pow(2, 53) - 1; + function StringIterable(str) { + this._s = s; + } + StringIterable.prototype[$iterator$] = function() { + return new StringIterator(this._s); + }; + function StringIterator(str) { + this._s = s; + this._l = s.length; + this._i = 0; + } + StringIterator.prototype[$iterator$] = function() { + return this; + }; + StringIterator.prototype.next = function() { + return this._i < this._l ? { + done: false, + value: this._s.charAt(this._i++) + } : doneEnumerator; + }; + function ArrayIterable(a) { + this._a = a; + } + ArrayIterable.prototype[$iterator$] = function() { + return new ArrayIterator(this._a); + }; + function ArrayIterator(a) { + this._a = a; + this._l = toLength(a); + this._i = 0; + } + ArrayIterator.prototype[$iterator$] = function() { + return this; + }; + ArrayIterator.prototype.next = function() { + return this._i < this._l ? { + done: false, + value: this._a[this._i++] + } : doneEnumerator; + }; + function numberIsFinite(value) { + return typeof value === 'number' && root.isFinite(value); + } + function isNan(n) { + return n !== n; + } + function getIterable(o) { + var i = o[$iterator$], + it; + if (!i && typeof o === 'string') { + it = new StringIterable(o); + return it[$iterator$](); + } + if (!i && o.length !== undefined) { + it = new ArrayIterable(o); + return it[$iterator$](); + } + if (!i) { + throw new TypeError('Object is not iterable'); + } + return o[$iterator$](); + } + function sign(value) { + var number = +value; + if (number === 0) { + return number; + } + if (isNaN(number)) { + return number; + } + return number < 0 ? -1 : 1; + } + function toLength(o) { + var len = +o.length; + if (isNaN(len)) { + return 0; + } + if (len === 0 || !numberIsFinite(len)) { + return len; + } + len = sign(len) * Math.floor(Math.abs(len)); + if (len <= 0) { + return 0; + } + if (len > maxSafeInteger) { + return maxSafeInteger; + } + return len; + } + var observableFrom = Observable.from = function(iterable, mapFn, thisArg, scheduler) { + if (iterable == null) { + throw new Error('iterable cannot be null.'); + } + if (mapFn && !isFunction(mapFn)) { + throw new Error('mapFn when provided must be a function'); + } + if (mapFn) { + var mapper = bindCallback(mapFn, thisArg, 2); + } + isScheduler(scheduler) || (scheduler = currentThreadScheduler); + return new FromObservable(iterable, mapper, scheduler); + }; + var FromArrayObservable = (function(__super__) { + inherits(FromArrayObservable, __super__); + function FromArrayObservable(args, scheduler) { + this.args = args; + this.scheduler = scheduler; + __super__.call(this); + } + FromArrayObservable.prototype.subscribeCore = function(observer) { + var sink = new FromArraySink(observer, this); + return sink.run(); + }; + return FromArrayObservable; + }(ObservableBase)); + function FromArraySink(observer, parent) { + this.observer = observer; + this.parent = parent; + } + FromArraySink.prototype.run = function() { + var observer = this.observer, + args = this.parent.args, + len = args.length; + function loopRecursive(i, recurse) { + if (i < len) { + observer.onNext(args[i]); + recurse(i + 1); + } else { + observer.onCompleted(); + } + } + return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive); + }; + var observableFromArray = Observable.fromArray = function(array, scheduler) { + isScheduler(scheduler) || (scheduler = currentThreadScheduler); + return new FromArrayObservable(array, scheduler); + }; + Observable.generate = function(initialState, condition, iterate, resultSelector, scheduler) { + isScheduler(scheduler) || (scheduler = currentThreadScheduler); + return new AnonymousObservable(function(o) { + var first = true; + return scheduler.scheduleRecursiveWithState(initialState, function(state, self) { + var hasResult, + result; + try { + if (first) { + first = false; + } else { + state = iterate(state); + } + hasResult = condition(state); + hasResult && (result = resultSelector(state)); + } catch (e) { + return o.onError(e); + } + if (hasResult) { + o.onNext(result); + self(state); + } else { + o.onCompleted(); + } + }); + }); + }; + var observableNever = Observable.never = function() { + return new AnonymousObservable(function() { + return disposableEmpty; + }); + }; + function observableOf(scheduler, array) { + isScheduler(scheduler) || (scheduler = currentThreadScheduler); + return new FromArrayObservable(array, scheduler); + } + Observable.of = function() { + var len = arguments.length, + args = new Array(len); + for (var i = 0; i < len; i++) { + args[i] = arguments[i]; + } + return new FromArrayObservable(args, currentThreadScheduler); + }; + Observable.ofWithScheduler = function(scheduler) { + var len = arguments.length, + args = new Array(len - 1); + for (var i = 1; i < len; i++) { + args[i - 1] = arguments[i]; + } + return new FromArrayObservable(args, scheduler); + }; + Observable.pairs = function(obj, scheduler) { + scheduler || (scheduler = Rx.Scheduler.currentThread); + return new AnonymousObservable(function(observer) { + var keys = Object.keys(obj), + len = keys.length; + return scheduler.scheduleRecursiveWithState(0, function(idx, self) { + if (idx < len) { + var key = keys[idx]; + observer.onNext([key, obj[key]]); + self(idx + 1); + } else { + observer.onCompleted(); + } + }); + }); + }; + var RangeObservable = (function(__super__) { + inherits(RangeObservable, __super__); + function RangeObservable(start, count, scheduler) { + this.start = start; + this.count = count; + this.scheduler = scheduler; + __super__.call(this); + } + RangeObservable.prototype.subscribeCore = function(observer) { + var sink = new RangeSink(observer, this); + return sink.run(); + }; + return RangeObservable; + }(ObservableBase)); + var RangeSink = (function() { + function RangeSink(observer, parent) { + this.observer = observer; + this.parent = parent; + } + RangeSink.prototype.run = function() { + var start = this.parent.start, + count = this.parent.count, + observer = this.observer; + function loopRecursive(i, recurse) { + if (i < count) { + observer.onNext(start + i); + recurse(i + 1); + } else { + observer.onCompleted(); + } + } + return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive); + }; + return RangeSink; + }()); + Observable.range = function(start, count, scheduler) { + isScheduler(scheduler) || (scheduler = currentThreadScheduler); + return new RangeObservable(start, count, scheduler); + }; + Observable.repeat = function(value, repeatCount, scheduler) { + isScheduler(scheduler) || (scheduler = currentThreadScheduler); + return observableReturn(value, scheduler).repeat(repeatCount == null ? -1 : repeatCount); + }; + var observableReturn = Observable['return'] = Observable.just = Observable.returnValue = function(value, scheduler) { + isScheduler(scheduler) || (scheduler = immediateScheduler); + return new AnonymousObservable(function(o) { + return scheduler.scheduleWithState(value, function(_, v) { + o.onNext(v); + o.onCompleted(); + }); + }); + }; + var observableThrow = Observable['throw'] = Observable.throwError = function(error, scheduler) { + isScheduler(scheduler) || (scheduler = immediateScheduler); + return new AnonymousObservable(function(observer) { + return scheduler.schedule(function() { + observer.onError(error); + }); + }); + }; + Observable.throwException = function() { + return Observable.throwError.apply(null, arguments); + }; + Observable.using = function(resourceFactory, observableFactory) { + return new AnonymousObservable(function(observer) { + var disposable = disposableEmpty, + resource, + source; + try { + resource = resourceFactory(); + resource && (disposable = resource); + source = observableFactory(resource); + } catch (exception) { + return new CompositeDisposable(observableThrow(exception).subscribe(observer), disposable); + } + return new CompositeDisposable(source.subscribe(observer), disposable); + }); + }; + observableProto.amb = function(rightSource) { + var leftSource = this; + return new AnonymousObservable(function(observer) { + var choice, + leftChoice = 'L', + rightChoice = 'R', + leftSubscription = new SingleAssignmentDisposable(), + rightSubscription = new SingleAssignmentDisposable(); + isPromise(rightSource) && (rightSource = observableFromPromise(rightSource)); + function choiceL() { + if (!choice) { + choice = leftChoice; + rightSubscription.dispose(); + } + } + function choiceR() { + if (!choice) { + choice = rightChoice; + leftSubscription.dispose(); + } + } + leftSubscription.setDisposable(leftSource.subscribe(function(left) { + choiceL(); + if (choice === leftChoice) { + observer.onNext(left); + } + }, function(err) { + choiceL(); + if (choice === leftChoice) { + observer.onError(err); + } + }, function() { + choiceL(); + if (choice === leftChoice) { + observer.onCompleted(); + } + })); + rightSubscription.setDisposable(rightSource.subscribe(function(right) { + choiceR(); + if (choice === rightChoice) { + observer.onNext(right); + } + }, function(err) { + choiceR(); + if (choice === rightChoice) { + observer.onError(err); + } + }, function() { + choiceR(); + if (choice === rightChoice) { + observer.onCompleted(); + } + })); + return new CompositeDisposable(leftSubscription, rightSubscription); + }); + }; + Observable.amb = function() { + var acc = observableNever(), + items = []; + if (Array.isArray(arguments[0])) { + items = arguments[0]; + } else { + for (var i = 0, + len = arguments.length; i < len; i++) { + items.push(arguments[i]); + } + } + function func(previous, current) { + return previous.amb(current); + } + for (var i = 0, + len = items.length; i < len; i++) { + acc = func(acc, items[i]); + } + return acc; + }; + function observableCatchHandler(source, handler) { + return new AnonymousObservable(function(o) { + var d1 = new SingleAssignmentDisposable(), + subscription = new SerialDisposable(); + subscription.setDisposable(d1); + d1.setDisposable(source.subscribe(function(x) { + o.onNext(x); + }, function(e) { + try { + var result = handler(e); + } catch (ex) { + return o.onError(ex); + } + isPromise(result) && (result = observableFromPromise(result)); + var d = new SingleAssignmentDisposable(); + subscription.setDisposable(d); + d.setDisposable(result.subscribe(o)); + }, function(x) { + o.onCompleted(x); + })); + return subscription; + }, source); + } + observableProto['catch'] = observableProto.catchError = observableProto.catchException = function(handlerOrSecond) { + return typeof handlerOrSecond === 'function' ? observableCatchHandler(this, handlerOrSecond) : observableCatch([this, handlerOrSecond]); + }; + var observableCatch = Observable.catchError = Observable['catch'] = Observable.catchException = function() { + var items = []; + if (Array.isArray(arguments[0])) { + items = arguments[0]; + } else { + for (var i = 0, + len = arguments.length; i < len; i++) { + items.push(arguments[i]); + } + } + return enumerableOf(items).catchError(); + }; + observableProto.combineLatest = function() { + var len = arguments.length, + args = new Array(len); + for (var i = 0; i < len; i++) { + args[i] = arguments[i]; + } + if (Array.isArray(args[0])) { + args[0].unshift(this); + } else { + args.unshift(this); + } + return combineLatest.apply(this, args); + }; + var combineLatest = Observable.combineLatest = function() { + var len = arguments.length, + args = new Array(len); + for (var i = 0; i < len; i++) { + args[i] = arguments[i]; + } + var resultSelector = args.pop(); + Array.isArray(args[0]) && (args = args[0]); + return new AnonymousObservable(function(o) { + var n = args.length, + falseFactory = function() { + return false; + }, + hasValue = arrayInitialize(n, falseFactory), + hasValueAll = false, + isDone = arrayInitialize(n, falseFactory), + values = new Array(n); + function next(i) { + hasValue[i] = true; + if (hasValueAll || (hasValueAll = hasValue.every(identity))) { + try { + var res = resultSelector.apply(null, values); + } catch (e) { + return o.onError(e); + } + o.onNext(res); + } else if (isDone.filter(function(x, j) { + return j !== i; + }).every(identity)) { + o.onCompleted(); + } + } + function done(i) { + isDone[i] = true; + isDone.every(identity) && o.onCompleted(); + } + var subscriptions = new Array(n); + for (var idx = 0; idx < n; idx++) { + (function(i) { + var source = args[i], + sad = new SingleAssignmentDisposable(); + isPromise(source) && (source = observableFromPromise(source)); + sad.setDisposable(source.subscribe(function(x) { + values[i] = x; + next(i); + }, function(e) { + o.onError(e); + }, function() { + done(i); + })); + subscriptions[i] = sad; + }(idx)); + } + return new CompositeDisposable(subscriptions); + }, this); + }; + observableProto.concat = function() { + for (var args = [], + i = 0, + len = arguments.length; i < len; i++) { + args.push(arguments[i]); + } + args.unshift(this); + return observableConcat.apply(null, args); + }; + var observableConcat = Observable.concat = function() { + var args; + if (Array.isArray(arguments[0])) { + args = arguments[0]; + } else { + args = new Array(arguments.length); + for (var i = 0, + len = arguments.length; i < len; i++) { + args[i] = arguments[i]; + } + } + return enumerableOf(args).concat(); + }; + observableProto.concatAll = observableProto.concatObservable = function() { + return this.merge(1); + }; + var MergeObservable = (function(__super__) { + inherits(MergeObservable, __super__); + function MergeObservable(source, maxConcurrent) { + this.source = source; + this.maxConcurrent = maxConcurrent; + __super__.call(this); + } + MergeObservable.prototype.subscribeCore = function(observer) { + var g = new CompositeDisposable(); + g.add(this.source.subscribe(new MergeObserver(observer, this.maxConcurrent, g))); + return g; + }; + return MergeObservable; + }(ObservableBase)); + var MergeObserver = (function() { + function MergeObserver(o, max, g) { + this.o = o; + this.max = max; + this.g = g; + this.done = false; + this.q = []; + this.activeCount = 0; + this.isStopped = false; + } + MergeObserver.prototype.handleSubscribe = function(xs) { + var sad = new SingleAssignmentDisposable(); + this.g.add(sad); + isPromise(xs) && (xs = observableFromPromise(xs)); + sad.setDisposable(xs.subscribe(new InnerObserver(this, sad))); + }; + MergeObserver.prototype.onNext = function(innerSource) { + if (this.isStopped) { + return ; + } + if (this.activeCount < this.max) { + this.activeCount++; + this.handleSubscribe(innerSource); + } else { + this.q.push(innerSource); + } + }; + MergeObserver.prototype.onError = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.o.onError(e); + } + }; + MergeObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + this.isStopped = true; + this.done = true; + this.activeCount === 0 && this.o.onCompleted(); + } + }; + MergeObserver.prototype.dispose = function() { + this.isStopped = true; + }; + MergeObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.o.onError(e); + return true; + } + return false; + }; + function InnerObserver(parent, sad) { + this.parent = parent; + this.sad = sad; + this.isStopped = false; + } + InnerObserver.prototype.onNext = function(x) { + if (!this.isStopped) { + this.parent.o.onNext(x); + } + }; + InnerObserver.prototype.onError = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.parent.o.onError(e); + } + }; + InnerObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + this.isStopped = true; + var parent = this.parent; + parent.g.remove(this.sad); + if (parent.q.length > 0) { + parent.handleSubscribe(parent.q.shift()); + } else { + parent.activeCount--; + parent.done && parent.activeCount === 0 && parent.o.onCompleted(); + } + } + }; + InnerObserver.prototype.dispose = function() { + this.isStopped = true; + }; + InnerObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.parent.o.onError(e); + return true; + } + return false; + }; + return MergeObserver; + }()); + observableProto.merge = function(maxConcurrentOrOther) { + return typeof maxConcurrentOrOther !== 'number' ? observableMerge(this, maxConcurrentOrOther) : new MergeObservable(this, maxConcurrentOrOther); + }; + var observableMerge = Observable.merge = function() { + var scheduler, + sources = [], + i, + len = arguments.length; + if (!arguments[0]) { + scheduler = immediateScheduler; + for (i = 1; i < len; i++) { + sources.push(arguments[i]); + } + } else if (isScheduler(arguments[0])) { + scheduler = arguments[0]; + for (i = 1; i < len; i++) { + sources.push(arguments[i]); + } + } else { + scheduler = immediateScheduler; + for (i = 0; i < len; i++) { + sources.push(arguments[i]); + } + } + if (Array.isArray(sources[0])) { + sources = sources[0]; + } + return observableOf(scheduler, sources).mergeAll(); + }; + var CompositeError = Rx.CompositeError = function(errors) { + this.name = "NotImplementedError"; + this.innerErrors = errors; + this.message = 'This contains multiple errors. Check the innerErrors'; + Error.call(this); + }; + CompositeError.prototype = Error.prototype; + Observable.mergeDelayError = function() { + var args; + if (Array.isArray(arguments[0])) { + args = arguments[0]; + } else { + var len = arguments.length; + args = new Array(len); + for (var i = 0; i < len; i++) { + args[i] = arguments[i]; + } + } + var source = observableOf(null, args); + return new AnonymousObservable(function(o) { + var group = new CompositeDisposable(), + m = new SingleAssignmentDisposable(), + isStopped = false, + errors = []; + function setCompletion() { + if (errors.length === 0) { + o.onCompleted(); + } else if (errors.length === 1) { + o.onError(errors[0]); + } else { + o.onError(new CompositeError(errors)); + } + } + group.add(m); + m.setDisposable(source.subscribe(function(innerSource) { + var innerSubscription = new SingleAssignmentDisposable(); + group.add(innerSubscription); + isPromise(innerSource) && (innerSource = observableFromPromise(innerSource)); + innerSubscription.setDisposable(innerSource.subscribe(function(x) { + o.onNext(x); + }, function(e) { + errors.push(e); + group.remove(innerSubscription); + isStopped && group.length === 1 && setCompletion(); + }, function() { + group.remove(innerSubscription); + isStopped && group.length === 1 && setCompletion(); + })); + }, function(e) { + errors.push(e); + isStopped = true; + group.length === 1 && setCompletion(); + }, function() { + isStopped = true; + group.length === 1 && setCompletion(); + })); + return group; + }); + }; + var MergeAllObservable = (function(__super__) { + inherits(MergeAllObservable, __super__); + function MergeAllObservable(source) { + this.source = source; + __super__.call(this); + } + MergeAllObservable.prototype.subscribeCore = function(observer) { + var g = new CompositeDisposable(), + m = new SingleAssignmentDisposable(); + g.add(m); + m.setDisposable(this.source.subscribe(new MergeAllObserver(observer, g))); + return g; + }; + return MergeAllObservable; + }(ObservableBase)); + var MergeAllObserver = (function() { + function MergeAllObserver(o, g) { + this.o = o; + this.g = g; + this.isStopped = false; + this.done = false; + } + MergeAllObserver.prototype.onNext = function(innerSource) { + if (this.isStopped) { + return ; + } + var sad = new SingleAssignmentDisposable(); + this.g.add(sad); + isPromise(innerSource) && (innerSource = observableFromPromise(innerSource)); + sad.setDisposable(innerSource.subscribe(new InnerObserver(this, this.g, sad))); + }; + MergeAllObserver.prototype.onError = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.o.onError(e); + } + }; + MergeAllObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + this.isStopped = true; + this.done = true; + this.g.length === 1 && this.o.onCompleted(); + } + }; + MergeAllObserver.prototype.dispose = function() { + this.isStopped = true; + }; + MergeAllObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.o.onError(e); + return true; + } + return false; + }; + function InnerObserver(parent, g, sad) { + this.parent = parent; + this.g = g; + this.sad = sad; + this.isStopped = false; + } + InnerObserver.prototype.onNext = function(x) { + if (!this.isStopped) { + this.parent.o.onNext(x); + } + }; + InnerObserver.prototype.onError = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.parent.o.onError(e); + } + }; + InnerObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + var parent = this.parent; + this.isStopped = true; + parent.g.remove(this.sad); + parent.done && parent.g.length === 1 && parent.o.onCompleted(); + } + }; + InnerObserver.prototype.dispose = function() { + this.isStopped = true; + }; + InnerObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.parent.o.onError(e); + return true; + } + return false; + }; + return MergeAllObserver; + }()); + observableProto.mergeAll = observableProto.mergeObservable = function() { + return new MergeAllObservable(this); + }; + observableProto.onErrorResumeNext = function(second) { + if (!second) { + throw new Error('Second observable is required'); + } + return onErrorResumeNext([this, second]); + }; + var onErrorResumeNext = Observable.onErrorResumeNext = function() { + var sources = []; + if (Array.isArray(arguments[0])) { + sources = arguments[0]; + } else { + for (var i = 0, + len = arguments.length; i < len; i++) { + sources.push(arguments[i]); + } + } + return new AnonymousObservable(function(observer) { + var pos = 0, + subscription = new SerialDisposable(), + cancelable = immediateScheduler.scheduleRecursive(function(self) { + var current, + d; + if (pos < sources.length) { + current = sources[pos++]; + isPromise(current) && (current = observableFromPromise(current)); + d = new SingleAssignmentDisposable(); + subscription.setDisposable(d); + d.setDisposable(current.subscribe(observer.onNext.bind(observer), self, self)); + } else { + observer.onCompleted(); + } + }); + return new CompositeDisposable(subscription, cancelable); + }); + }; + observableProto.skipUntil = function(other) { + var source = this; + return new AnonymousObservable(function(o) { + var isOpen = false; + var disposables = new CompositeDisposable(source.subscribe(function(left) { + isOpen && o.onNext(left); + }, function(e) { + o.onError(e); + }, function() { + isOpen && o.onCompleted(); + })); + isPromise(other) && (other = observableFromPromise(other)); + var rightSubscription = new SingleAssignmentDisposable(); + disposables.add(rightSubscription); + rightSubscription.setDisposable(other.subscribe(function() { + isOpen = true; + rightSubscription.dispose(); + }, function(e) { + o.onError(e); + }, function() { + rightSubscription.dispose(); + })); + return disposables; + }, source); + }; + observableProto['switch'] = observableProto.switchLatest = function() { + var sources = this; + return new AnonymousObservable(function(observer) { + var hasLatest = false, + innerSubscription = new SerialDisposable(), + isStopped = false, + latest = 0, + subscription = sources.subscribe(function(innerSource) { + var d = new SingleAssignmentDisposable(), + id = ++latest; + hasLatest = true; + innerSubscription.setDisposable(d); + isPromise(innerSource) && (innerSource = observableFromPromise(innerSource)); + d.setDisposable(innerSource.subscribe(function(x) { + latest === id && observer.onNext(x); + }, function(e) { + latest === id && observer.onError(e); + }, function() { + if (latest === id) { + hasLatest = false; + isStopped && observer.onCompleted(); + } + })); + }, function(e) { + observer.onError(e); + }, function() { + isStopped = true; + !hasLatest && observer.onCompleted(); + }); + return new CompositeDisposable(subscription, innerSubscription); + }, sources); + }; + observableProto.takeUntil = function(other) { + var source = this; + return new AnonymousObservable(function(o) { + isPromise(other) && (other = observableFromPromise(other)); + return new CompositeDisposable(source.subscribe(o), other.subscribe(function() { + o.onCompleted(); + }, function(e) { + o.onError(e); + }, noop)); + }, source); + }; + observableProto.withLatestFrom = function() { + var len = arguments.length, + args = new Array(len); + for (var i = 0; i < len; i++) { + args[i] = arguments[i]; + } + var resultSelector = args.pop(), + source = this; + if (typeof source === 'undefined') { + throw new Error('Source observable not found for withLatestFrom().'); + } + if (typeof resultSelector !== 'function') { + throw new Error('withLatestFrom() expects a resultSelector function.'); + } + if (Array.isArray(args[0])) { + args = args[0]; + } + return new AnonymousObservable(function(observer) { + var falseFactory = function() { + return false; + }, + n = args.length, + hasValue = arrayInitialize(n, falseFactory), + hasValueAll = false, + values = new Array(n); + var subscriptions = new Array(n + 1); + for (var idx = 0; idx < n; idx++) { + (function(i) { + var other = args[i], + sad = new SingleAssignmentDisposable(); + isPromise(other) && (other = observableFromPromise(other)); + sad.setDisposable(other.subscribe(function(x) { + values[i] = x; + hasValue[i] = true; + hasValueAll = hasValue.every(identity); + }, observer.onError.bind(observer), function() {})); + subscriptions[i] = sad; + }(idx)); + } + var sad = new SingleAssignmentDisposable(); + sad.setDisposable(source.subscribe(function(x) { + var res; + var allValues = [x].concat(values); + if (!hasValueAll) + return ; + try { + res = resultSelector.apply(null, allValues); + } catch (ex) { + observer.onError(ex); + return ; + } + observer.onNext(res); + }, observer.onError.bind(observer), function() { + observer.onCompleted(); + })); + subscriptions[n] = sad; + return new CompositeDisposable(subscriptions); + }, this); + }; + function zipArray(second, resultSelector) { + var first = this; + return new AnonymousObservable(function(observer) { + var index = 0, + len = second.length; + return first.subscribe(function(left) { + if (index < len) { + var right = second[index++], + result; + try { + result = resultSelector(left, right); + } catch (e) { + return observer.onError(e); + } + observer.onNext(result); + } else { + observer.onCompleted(); + } + }, function(e) { + observer.onError(e); + }, function() { + observer.onCompleted(); + }); + }, first); + } + function falseFactory() { + return false; + } + function emptyArrayFactory() { + return []; + } + observableProto.zip = function() { + if (Array.isArray(arguments[0])) { + return zipArray.apply(this, arguments); + } + var len = arguments.length, + args = new Array(len); + for (var i = 0; i < len; i++) { + args[i] = arguments[i]; + } + var parent = this, + resultSelector = args.pop(); + args.unshift(parent); + return new AnonymousObservable(function(observer) { + var n = args.length, + queues = arrayInitialize(n, emptyArrayFactory), + isDone = arrayInitialize(n, falseFactory); + function next(i) { + var res, + queuedValues; + if (queues.every(function(x) { + return x.length > 0; + })) { + try { + queuedValues = queues.map(function(x) { + return x.shift(); + }); + res = resultSelector.apply(parent, queuedValues); + } catch (ex) { + observer.onError(ex); + return ; + } + observer.onNext(res); + } else if (isDone.filter(function(x, j) { + return j !== i; + }).every(identity)) { + observer.onCompleted(); + } + } + ; + function done(i) { + isDone[i] = true; + if (isDone.every(function(x) { + return x; + })) { + observer.onCompleted(); + } + } + var subscriptions = new Array(n); + for (var idx = 0; idx < n; idx++) { + (function(i) { + var source = args[i], + sad = new SingleAssignmentDisposable(); + isPromise(source) && (source = observableFromPromise(source)); + sad.setDisposable(source.subscribe(function(x) { + queues[i].push(x); + next(i); + }, function(e) { + observer.onError(e); + }, function() { + done(i); + })); + subscriptions[i] = sad; + })(idx); + } + return new CompositeDisposable(subscriptions); + }, parent); + }; + Observable.zip = function() { + var len = arguments.length, + args = new Array(len); + for (var i = 0; i < len; i++) { + args[i] = arguments[i]; + } + var first = args.shift(); + return first.zip.apply(first, args); + }; + Observable.zipArray = function() { + var sources; + if (Array.isArray(arguments[0])) { + sources = arguments[0]; + } else { + var len = arguments.length; + sources = new Array(len); + for (var i = 0; i < len; i++) { + sources[i] = arguments[i]; + } + } + return new AnonymousObservable(function(observer) { + var n = sources.length, + queues = arrayInitialize(n, function() { + return []; + }), + isDone = arrayInitialize(n, function() { + return false; + }); + function next(i) { + if (queues.every(function(x) { + return x.length > 0; + })) { + var res = queues.map(function(x) { + return x.shift(); + }); + observer.onNext(res); + } else if (isDone.filter(function(x, j) { + return j !== i; + }).every(identity)) { + observer.onCompleted(); + return ; + } + } + ; + function done(i) { + isDone[i] = true; + if (isDone.every(identity)) { + observer.onCompleted(); + return ; + } + } + var subscriptions = new Array(n); + for (var idx = 0; idx < n; idx++) { + (function(i) { + subscriptions[i] = new SingleAssignmentDisposable(); + subscriptions[i].setDisposable(sources[i].subscribe(function(x) { + queues[i].push(x); + next(i); + }, function(e) { + observer.onError(e); + }, function() { + done(i); + })); + })(idx); + } + return new CompositeDisposable(subscriptions); + }); + }; + observableProto.asObservable = function() { + var source = this; + return new AnonymousObservable(function(o) { + return source.subscribe(o); + }, this); + }; + observableProto.bufferWithCount = function(count, skip) { + if (typeof skip !== 'number') { + skip = count; + } + return this.windowWithCount(count, skip).selectMany(function(x) { + return x.toArray(); + }).where(function(x) { + return x.length > 0; + }); + }; + observableProto.dematerialize = function() { + var source = this; + return new AnonymousObservable(function(o) { + return source.subscribe(function(x) { + return x.accept(o); + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, this); + }; + observableProto.distinctUntilChanged = function(keySelector, comparer) { + var source = this; + comparer || (comparer = defaultComparer); + return new AnonymousObservable(function(o) { + var hasCurrentKey = false, + currentKey; + return source.subscribe(function(value) { + var key = value; + if (keySelector) { + try { + key = keySelector(value); + } catch (e) { + o.onError(e); + return ; + } + } + if (hasCurrentKey) { + try { + var comparerEquals = comparer(currentKey, key); + } catch (e) { + o.onError(e); + return ; + } + } + if (!hasCurrentKey || !comparerEquals) { + hasCurrentKey = true; + currentKey = key; + o.onNext(value); + } + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, this); + }; + observableProto['do'] = observableProto.tap = observableProto.doAction = function(observerOrOnNext, onError, onCompleted) { + var source = this; + return new AnonymousObservable(function(observer) { + var tapObserver = !observerOrOnNext || isFunction(observerOrOnNext) ? observerCreate(observerOrOnNext || noop, onError || noop, onCompleted || noop) : observerOrOnNext; + return source.subscribe(function(x) { + try { + tapObserver.onNext(x); + } catch (e) { + observer.onError(e); + } + observer.onNext(x); + }, function(err) { + try { + tapObserver.onError(err); + } catch (e) { + observer.onError(e); + } + observer.onError(err); + }, function() { + try { + tapObserver.onCompleted(); + } catch (e) { + observer.onError(e); + } + observer.onCompleted(); + }); + }, this); + }; + observableProto.doOnNext = observableProto.tapOnNext = function(onNext, thisArg) { + return this.tap(typeof thisArg !== 'undefined' ? function(x) { + onNext.call(thisArg, x); + } : onNext); + }; + observableProto.doOnError = observableProto.tapOnError = function(onError, thisArg) { + return this.tap(noop, typeof thisArg !== 'undefined' ? function(e) { + onError.call(thisArg, e); + } : onError); + }; + observableProto.doOnCompleted = observableProto.tapOnCompleted = function(onCompleted, thisArg) { + return this.tap(noop, null, typeof thisArg !== 'undefined' ? function() { + onCompleted.call(thisArg); + } : onCompleted); + }; + observableProto['finally'] = observableProto.ensure = function(action) { + var source = this; + return new AnonymousObservable(function(observer) { + var subscription; + try { + subscription = source.subscribe(observer); + } catch (e) { + action(); + throw e; + } + return disposableCreate(function() { + try { + subscription.dispose(); + } catch (e) { + throw e; + } finally { + action(); + } + }); + }, this); + }; + observableProto.finallyAction = function(action) { + return this.ensure(action); + }; + observableProto.ignoreElements = function() { + var source = this; + return new AnonymousObservable(function(o) { + return source.subscribe(noop, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, source); + }; + observableProto.materialize = function() { + var source = this; + return new AnonymousObservable(function(observer) { + return source.subscribe(function(value) { + observer.onNext(notificationCreateOnNext(value)); + }, function(e) { + observer.onNext(notificationCreateOnError(e)); + observer.onCompleted(); + }, function() { + observer.onNext(notificationCreateOnCompleted()); + observer.onCompleted(); + }); + }, source); + }; + observableProto.repeat = function(repeatCount) { + return enumerableRepeat(this, repeatCount).concat(); + }; + observableProto.retry = function(retryCount) { + return enumerableRepeat(this, retryCount).catchError(); + }; + observableProto.retryWhen = function(notifier) { + return enumerableRepeat(this).catchErrorWhen(notifier); + }; + observableProto.scan = function() { + var hasSeed = false, + seed, + accumulator, + source = this; + if (arguments.length === 2) { + hasSeed = true; + seed = arguments[0]; + accumulator = arguments[1]; + } else { + accumulator = arguments[0]; + } + return new AnonymousObservable(function(o) { + var hasAccumulation, + accumulation, + hasValue; + return source.subscribe(function(x) { + !hasValue && (hasValue = true); + try { + if (hasAccumulation) { + accumulation = accumulator(accumulation, x); + } else { + accumulation = hasSeed ? accumulator(seed, x) : x; + hasAccumulation = true; + } + } catch (e) { + o.onError(e); + return ; + } + o.onNext(accumulation); + }, function(e) { + o.onError(e); + }, function() { + !hasValue && hasSeed && o.onNext(seed); + o.onCompleted(); + }); + }, source); + }; + observableProto.skipLast = function(count) { + if (count < 0) { + throw new ArgumentOutOfRangeError(); + } + var source = this; + return new AnonymousObservable(function(o) { + var q = []; + return source.subscribe(function(x) { + q.push(x); + q.length > count && o.onNext(q.shift()); + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, source); + }; + observableProto.startWith = function() { + var values, + scheduler, + start = 0; + if (!!arguments.length && isScheduler(arguments[0])) { + scheduler = arguments[0]; + start = 1; + } else { + scheduler = immediateScheduler; + } + for (var args = [], + i = start, + len = arguments.length; i < len; i++) { + args.push(arguments[i]); + } + return enumerableOf([observableFromArray(args, scheduler), this]).concat(); + }; + observableProto.takeLast = function(count) { + if (count < 0) { + throw new ArgumentOutOfRangeError(); + } + var source = this; + return new AnonymousObservable(function(o) { + var q = []; + return source.subscribe(function(x) { + q.push(x); + q.length > count && q.shift(); + }, function(e) { + o.onError(e); + }, function() { + while (q.length > 0) { + o.onNext(q.shift()); + } + o.onCompleted(); + }); + }, source); + }; + observableProto.takeLastBuffer = function(count) { + var source = this; + return new AnonymousObservable(function(o) { + var q = []; + return source.subscribe(function(x) { + q.push(x); + q.length > count && q.shift(); + }, function(e) { + o.onError(e); + }, function() { + o.onNext(q); + o.onCompleted(); + }); + }, source); + }; + observableProto.windowWithCount = function(count, skip) { + var source = this; + +count || (count = 0); + Math.abs(count) === Infinity && (count = 0); + if (count <= 0) { + throw new ArgumentOutOfRangeError(); + } + skip == null && (skip = count); + +skip || (skip = 0); + Math.abs(skip) === Infinity && (skip = 0); + if (skip <= 0) { + throw new ArgumentOutOfRangeError(); + } + return new AnonymousObservable(function(observer) { + var m = new SingleAssignmentDisposable(), + refCountDisposable = new RefCountDisposable(m), + n = 0, + q = []; + function createWindow() { + var s = new Subject(); + q.push(s); + observer.onNext(addRef(s, refCountDisposable)); + } + createWindow(); + m.setDisposable(source.subscribe(function(x) { + for (var i = 0, + len = q.length; i < len; i++) { + q[i].onNext(x); + } + var c = n - count + 1; + c >= 0 && c % skip === 0 && q.shift().onCompleted(); + ++n % skip === 0 && createWindow(); + }, function(e) { + while (q.length > 0) { + q.shift().onError(e); + } + observer.onError(e); + }, function() { + while (q.length > 0) { + q.shift().onCompleted(); + } + observer.onCompleted(); + })); + return refCountDisposable; + }, source); + }; + function concatMap(source, selector, thisArg) { + var selectorFunc = bindCallback(selector, thisArg, 3); + return source.map(function(x, i) { + var result = selectorFunc(x, i, source); + isPromise(result) && (result = observableFromPromise(result)); + (isArrayLike(result) || isIterable(result)) && (result = observableFrom(result)); + return result; + }).concatAll(); + } + observableProto.selectConcat = observableProto.concatMap = function(selector, resultSelector, thisArg) { + if (isFunction(selector) && isFunction(resultSelector)) { + return this.concatMap(function(x, i) { + var selectorResult = selector(x, i); + isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult)); + (isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult)); + return selectorResult.map(function(y, i2) { + return resultSelector(x, y, i, i2); + }); + }); + } + return isFunction(selector) ? concatMap(this, selector, thisArg) : concatMap(this, function() { + return selector; + }); + }; + observableProto.concatMapObserver = observableProto.selectConcatObserver = function(onNext, onError, onCompleted, thisArg) { + var source = this, + onNextFunc = bindCallback(onNext, thisArg, 2), + onErrorFunc = bindCallback(onError, thisArg, 1), + onCompletedFunc = bindCallback(onCompleted, thisArg, 0); + return new AnonymousObservable(function(observer) { + var index = 0; + return source.subscribe(function(x) { + var result; + try { + result = onNextFunc(x, index++); + } catch (e) { + observer.onError(e); + return ; + } + isPromise(result) && (result = observableFromPromise(result)); + observer.onNext(result); + }, function(err) { + var result; + try { + result = onErrorFunc(err); + } catch (e) { + observer.onError(e); + return ; + } + isPromise(result) && (result = observableFromPromise(result)); + observer.onNext(result); + observer.onCompleted(); + }, function() { + var result; + try { + result = onCompletedFunc(); + } catch (e) { + observer.onError(e); + return ; + } + isPromise(result) && (result = observableFromPromise(result)); + observer.onNext(result); + observer.onCompleted(); + }); + }, this).concatAll(); + }; + observableProto.defaultIfEmpty = function(defaultValue) { + var source = this; + defaultValue === undefined && (defaultValue = null); + return new AnonymousObservable(function(observer) { + var found = false; + return source.subscribe(function(x) { + found = true; + observer.onNext(x); + }, function(e) { + observer.onError(e); + }, function() { + !found && observer.onNext(defaultValue); + observer.onCompleted(); + }); + }, source); + }; + function arrayIndexOfComparer(array, item, comparer) { + for (var i = 0, + len = array.length; i < len; i++) { + if (comparer(array[i], item)) { + return i; + } + } + return -1; + } + function HashSet(comparer) { + this.comparer = comparer; + this.set = []; + } + HashSet.prototype.push = function(value) { + var retValue = arrayIndexOfComparer(this.set, value, this.comparer) === -1; + retValue && this.set.push(value); + return retValue; + }; + observableProto.distinct = function(keySelector, comparer) { + var source = this; + comparer || (comparer = defaultComparer); + return new AnonymousObservable(function(o) { + var hashSet = new HashSet(comparer); + return source.subscribe(function(x) { + var key = x; + if (keySelector) { + try { + key = keySelector(x); + } catch (e) { + o.onError(e); + return ; + } + } + hashSet.push(key) && o.onNext(x); + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, this); + }; + var MapObservable = (function(__super__) { + inherits(MapObservable, __super__); + function MapObservable(source, selector, thisArg) { + this.source = source; + this.selector = bindCallback(selector, thisArg, 3); + __super__.call(this); + } + MapObservable.prototype.internalMap = function(selector, thisArg) { + var self = this; + return new MapObservable(this.source, function(x, i, o) { + return selector.call(this, self.selector(x, i, o), i, o); + }, thisArg); + }; + MapObservable.prototype.subscribeCore = function(observer) { + return this.source.subscribe(new MapObserver(observer, this.selector, this)); + }; + return MapObservable; + }(ObservableBase)); + function MapObserver(observer, selector, source) { + this.observer = observer; + this.selector = selector; + this.source = source; + this.i = 0; + this.isStopped = false; + } + MapObserver.prototype.onNext = function(x) { + if (this.isStopped) { + return ; + } + var result = tryCatch(this.selector).call(this, x, this.i++, this.source); + if (result === errorObj) { + return this.observer.onError(result.e); + } + this.observer.onNext(result); + }; + MapObserver.prototype.onError = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onError(e); + } + }; + MapObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onCompleted(); + } + }; + MapObserver.prototype.dispose = function() { + this.isStopped = true; + }; + MapObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onError(e); + return true; + } + return false; + }; + observableProto.map = observableProto.select = function(selector, thisArg) { + var selectorFn = typeof selector === 'function' ? selector : function() { + return selector; + }; + return this instanceof MapObservable ? this.internalMap(selectorFn, thisArg) : new MapObservable(this, selectorFn, thisArg); + }; + observableProto.pluck = function() { + var args = arguments, + len = arguments.length; + if (len === 0) { + throw new Error('List of properties cannot be empty.'); + } + return this.map(function(x) { + var currentProp = x; + for (var i = 0; i < len; i++) { + var p = currentProp[args[i]]; + if (typeof p !== 'undefined') { + currentProp = p; + } else { + return undefined; + } + } + return currentProp; + }); + }; + observableProto.flatMapObserver = observableProto.selectManyObserver = function(onNext, onError, onCompleted, thisArg) { + var source = this; + return new AnonymousObservable(function(observer) { + var index = 0; + return source.subscribe(function(x) { + var result; + try { + result = onNext.call(thisArg, x, index++); + } catch (e) { + observer.onError(e); + return ; + } + isPromise(result) && (result = observableFromPromise(result)); + observer.onNext(result); + }, function(err) { + var result; + try { + result = onError.call(thisArg, err); + } catch (e) { + observer.onError(e); + return ; + } + isPromise(result) && (result = observableFromPromise(result)); + observer.onNext(result); + observer.onCompleted(); + }, function() { + var result; + try { + result = onCompleted.call(thisArg); + } catch (e) { + observer.onError(e); + return ; + } + isPromise(result) && (result = observableFromPromise(result)); + observer.onNext(result); + observer.onCompleted(); + }); + }, source).mergeAll(); + }; + function flatMap(source, selector, thisArg) { + var selectorFunc = bindCallback(selector, thisArg, 3); + return source.map(function(x, i) { + var result = selectorFunc(x, i, source); + isPromise(result) && (result = observableFromPromise(result)); + (isArrayLike(result) || isIterable(result)) && (result = observableFrom(result)); + return result; + }).mergeAll(); + } + observableProto.selectMany = observableProto.flatMap = function(selector, resultSelector, thisArg) { + if (isFunction(selector) && isFunction(resultSelector)) { + return this.flatMap(function(x, i) { + var selectorResult = selector(x, i); + isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult)); + (isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult)); + return selectorResult.map(function(y, i2) { + return resultSelector(x, y, i, i2); + }); + }, thisArg); + } + return isFunction(selector) ? flatMap(this, selector, thisArg) : flatMap(this, function() { + return selector; + }); + }; + observableProto.selectSwitch = observableProto.flatMapLatest = observableProto.switchMap = function(selector, thisArg) { + return this.select(selector, thisArg).switchLatest(); + }; + observableProto.skip = function(count) { + if (count < 0) { + throw new ArgumentOutOfRangeError(); + } + var source = this; + return new AnonymousObservable(function(o) { + var remaining = count; + return source.subscribe(function(x) { + if (remaining <= 0) { + o.onNext(x); + } else { + remaining--; + } + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, source); + }; + observableProto.skipWhile = function(predicate, thisArg) { + var source = this, + callback = bindCallback(predicate, thisArg, 3); + return new AnonymousObservable(function(o) { + var i = 0, + running = false; + return source.subscribe(function(x) { + if (!running) { + try { + running = !callback(x, i++, source); + } catch (e) { + o.onError(e); + return ; + } + } + running && o.onNext(x); + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, source); + }; + observableProto.take = function(count, scheduler) { + if (count < 0) { + throw new ArgumentOutOfRangeError(); + } + if (count === 0) { + return observableEmpty(scheduler); + } + var source = this; + return new AnonymousObservable(function(o) { + var remaining = count; + return source.subscribe(function(x) { + if (remaining-- > 0) { + o.onNext(x); + remaining === 0 && o.onCompleted(); + } + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, source); + }; + observableProto.takeWhile = function(predicate, thisArg) { + var source = this, + callback = bindCallback(predicate, thisArg, 3); + return new AnonymousObservable(function(o) { + var i = 0, + running = true; + return source.subscribe(function(x) { + if (running) { + try { + running = callback(x, i++, source); + } catch (e) { + o.onError(e); + return ; + } + if (running) { + o.onNext(x); + } else { + o.onCompleted(); + } + } + }, function(e) { + o.onError(e); + }, function() { + o.onCompleted(); + }); + }, source); + }; + var FilterObservable = (function(__super__) { + inherits(FilterObservable, __super__); + function FilterObservable(source, predicate, thisArg) { + this.source = source; + this.predicate = bindCallback(predicate, thisArg, 3); + __super__.call(this); + } + FilterObservable.prototype.subscribeCore = function(observer) { + return this.source.subscribe(new FilterObserver(observer, this.predicate, this)); + }; + FilterObservable.prototype.internalFilter = function(predicate, thisArg) { + var self = this; + return new FilterObservable(this.source, function(x, i, o) { + return self.predicate(x, i, o) && predicate.call(this, x, i, o); + }, thisArg); + }; + return FilterObservable; + }(ObservableBase)); + function FilterObserver(observer, predicate, source) { + this.observer = observer; + this.predicate = predicate; + this.source = source; + this.i = 0; + this.isStopped = false; + } + FilterObserver.prototype.onNext = function(x) { + if (this.isStopped) { + return ; + } + var shouldYield = tryCatch(this.predicate).call(this, x, this.i++, this.source); + if (shouldYield === errorObj) { + return this.observer.onError(shouldYield.e); + } + shouldYield && this.observer.onNext(x); + }; + FilterObserver.prototype.onError = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onError(e); + } + }; + FilterObserver.prototype.onCompleted = function() { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onCompleted(); + } + }; + FilterObserver.prototype.dispose = function() { + this.isStopped = true; + }; + FilterObserver.prototype.fail = function(e) { + if (!this.isStopped) { + this.isStopped = true; + this.observer.onError(e); + return true; + } + return false; + }; + observableProto.filter = observableProto.where = function(predicate, thisArg) { + return this instanceof FilterObservable ? this.internalFilter(predicate, thisArg) : new FilterObservable(this, predicate, thisArg); + }; + observableProto.transduce = function(transducer) { + var source = this; + function transformForObserver(o) { + return { + '@@transducer/init': function() { + return o; + }, + '@@transducer/step': function(obs, input) { + return obs.onNext(input); + }, + '@@transducer/result': function(obs) { + return obs.onCompleted(); + } + }; + } + return new AnonymousObservable(function(o) { + var xform = transducer(transformForObserver(o)); + return source.subscribe(function(v) { + try { + xform['@@transducer/step'](o, v); + } catch (e) { + o.onError(e); + } + }, function(e) { + o.onError(e); + }, function() { + xform['@@transducer/result'](o); + }); + }, source); + }; + var AnonymousObservable = Rx.AnonymousObservable = (function(__super__) { + inherits(AnonymousObservable, __super__); + function fixSubscriber(subscriber) { + return subscriber && isFunction(subscriber.dispose) ? subscriber : isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty; + } + function setDisposable(s, state) { + var ado = state[0], + subscribe = state[1]; + var sub = tryCatch(subscribe)(ado); + if (sub === errorObj) { + if (!ado.fail(errorObj.e)) { + return thrower(errorObj.e); + } + } + ado.setDisposable(fixSubscriber(sub)); + } + function AnonymousObservable(subscribe, parent) { + this.source = parent; + function s(observer) { + var ado = new AutoDetachObserver(observer), + state = [ado, subscribe]; + if (currentThreadScheduler.scheduleRequired()) { + currentThreadScheduler.scheduleWithState(state, setDisposable); + } else { + setDisposable(null, state); + } + return ado; + } + __super__.call(this, s); + } + return AnonymousObservable; + }(Observable)); + var AutoDetachObserver = (function(__super__) { + inherits(AutoDetachObserver, __super__); + function AutoDetachObserver(observer) { + __super__.call(this); + this.observer = observer; + this.m = new SingleAssignmentDisposable(); + } + var AutoDetachObserverPrototype = AutoDetachObserver.prototype; + AutoDetachObserverPrototype.next = function(value) { + var result = tryCatch(this.observer.onNext).call(this.observer, value); + if (result === errorObj) { + this.dispose(); + thrower(result.e); + } + }; + AutoDetachObserverPrototype.error = function(err) { + var result = tryCatch(this.observer.onError).call(this.observer, err); + this.dispose(); + result === errorObj && thrower(result.e); + }; + AutoDetachObserverPrototype.completed = function() { + var result = tryCatch(this.observer.onCompleted).call(this.observer); + this.dispose(); + result === errorObj && thrower(result.e); + }; + AutoDetachObserverPrototype.setDisposable = function(value) { + this.m.setDisposable(value); + }; + AutoDetachObserverPrototype.getDisposable = function() { + return this.m.getDisposable(); + }; + AutoDetachObserverPrototype.dispose = function() { + __super__.prototype.dispose.call(this); + this.m.dispose(); + }; + return AutoDetachObserver; + }(AbstractObserver)); + var InnerSubscription = function(subject, observer) { + this.subject = subject; + this.observer = observer; + }; + InnerSubscription.prototype.dispose = function() { + if (!this.subject.isDisposed && this.observer !== null) { + var idx = this.subject.observers.indexOf(this.observer); + this.subject.observers.splice(idx, 1); + this.observer = null; + } + }; + var Subject = Rx.Subject = (function(__super__) { + function subscribe(observer) { + checkDisposed(this); + if (!this.isStopped) { + this.observers.push(observer); + return new InnerSubscription(this, observer); + } + if (this.hasError) { + observer.onError(this.error); + return disposableEmpty; + } + observer.onCompleted(); + return disposableEmpty; + } + inherits(Subject, __super__); + function Subject() { + __super__.call(this, subscribe); + this.isDisposed = false, this.isStopped = false, this.observers = []; + this.hasError = false; + } + addProperties(Subject.prototype, Observer.prototype, { + hasObservers: function() { + return this.observers.length > 0; + }, + onCompleted: function() { + checkDisposed(this); + if (!this.isStopped) { + this.isStopped = true; + for (var i = 0, + os = cloneArray(this.observers), + len = os.length; i < len; i++) { + os[i].onCompleted(); + } + this.observers.length = 0; + } + }, + onError: function(error) { + checkDisposed(this); + if (!this.isStopped) { + this.isStopped = true; + this.error = error; + this.hasError = true; + for (var i = 0, + os = cloneArray(this.observers), + len = os.length; i < len; i++) { + os[i].onError(error); + } + this.observers.length = 0; + } + }, + onNext: function(value) { + checkDisposed(this); + if (!this.isStopped) { + for (var i = 0, + os = cloneArray(this.observers), + len = os.length; i < len; i++) { + os[i].onNext(value); + } + } + }, + dispose: function() { + this.isDisposed = true; + this.observers = null; + } + }); + Subject.create = function(observer, observable) { + return new AnonymousSubject(observer, observable); + }; + return Subject; + }(Observable)); + var AsyncSubject = Rx.AsyncSubject = (function(__super__) { + function subscribe(observer) { + checkDisposed(this); + if (!this.isStopped) { + this.observers.push(observer); + return new InnerSubscription(this, observer); + } + if (this.hasError) { + observer.onError(this.error); + } else if (this.hasValue) { + observer.onNext(this.value); + observer.onCompleted(); + } else { + observer.onCompleted(); + } + return disposableEmpty; + } + inherits(AsyncSubject, __super__); + function AsyncSubject() { + __super__.call(this, subscribe); + this.isDisposed = false; + this.isStopped = false; + this.hasValue = false; + this.observers = []; + this.hasError = false; + } + addProperties(AsyncSubject.prototype, Observer, { + hasObservers: function() { + checkDisposed(this); + return this.observers.length > 0; + }, + onCompleted: function() { + var i, + len; + checkDisposed(this); + if (!this.isStopped) { + this.isStopped = true; + var os = cloneArray(this.observers), + len = os.length; + if (this.hasValue) { + for (i = 0; i < len; i++) { + var o = os[i]; + o.onNext(this.value); + o.onCompleted(); + } + } else { + for (i = 0; i < len; i++) { + os[i].onCompleted(); + } + } + this.observers.length = 0; + } + }, + onError: function(error) { + checkDisposed(this); + if (!this.isStopped) { + this.isStopped = true; + this.hasError = true; + this.error = error; + for (var i = 0, + os = cloneArray(this.observers), + len = os.length; i < len; i++) { + os[i].onError(error); + } + this.observers.length = 0; + } + }, + onNext: function(value) { + checkDisposed(this); + if (this.isStopped) { + return ; + } + this.value = value; + this.hasValue = true; + }, + dispose: function() { + this.isDisposed = true; + this.observers = null; + this.exception = null; + this.value = null; + } + }); + return AsyncSubject; + }(Observable)); + var AnonymousSubject = Rx.AnonymousSubject = (function(__super__) { + inherits(AnonymousSubject, __super__); + function subscribe(observer) { + return this.observable.subscribe(observer); + } + function AnonymousSubject(observer, observable) { + this.observer = observer; + this.observable = observable; + __super__.call(this, subscribe); + } + addProperties(AnonymousSubject.prototype, Observer.prototype, { + onCompleted: function() { + this.observer.onCompleted(); + }, + onError: function(error) { + this.observer.onError(error); + }, + onNext: function(value) { + this.observer.onNext(value); + } + }); + return AnonymousSubject; + }(Observable)); + if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { + root.Rx = Rx; + define(function() { + return Rx; + }); + } else if (freeExports && freeModule) { + if (moduleExports) { + (freeModule.exports = Rx).Rx = Rx; + } else { + freeExports.Rx = Rx; + } + } else { + root.Rx = Rx; + } + var rEndingLine = captureLine(); + }.call(this)); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/facade/lang", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/facade/lang"; + var _global, + Type, + isDart, + BaseException, + Math, + Date, + assertionsEnabled_, + StringWrapper, + StringJoiner, + NumberParseError, + NumberWrapper, + RegExp, + RegExpWrapper, + RegExpMatcherWrapper, + FunctionWrapper, + Json, + DateWrapper; + function getTypeNameForDebugging(type) { + return type['name']; + } + function makeTypeError(message) { + return new TypeError(message); + } + function assertionsEnabled() { + return assertionsEnabled_; + } + function ENUM_INDEX(value) { + return value; + } + function CONST_EXPR(expr) { + return expr; + } + function CONST() { + return (function(target) { + return target; + }); + } + function ABSTRACT() { + return (function(t) { + return t; + }); + } + function IMPLEMENTS(_) { + return (function(t) { + return t; + }); + } + function isPresent(obj) { + return obj !== undefined && obj !== null; + } + function isBlank(obj) { + return obj === undefined || obj === null; + } + function isString(obj) { + return typeof obj === "string"; + } + function isFunction(obj) { + return typeof obj === "function"; + } + function isType(obj) { + return isFunction(obj); + } + function isStringMap(obj) { + return typeof obj === 'object' && obj !== null; + } + function isPromise(obj) { + return obj instanceof _global.Promise; + } + function isArray(obj) { + return Array.isArray(obj); + } + function isNumber(obj) { + return typeof obj === 'number'; + } + function isDate(obj) { + return obj instanceof Date && !isNaN(obj.valueOf()); + } + function stringify(token) { + if (typeof token === 'string') { + return token; + } + if (token === undefined || token === null) { + return '' + token; + } + if (token.name) { + return token.name; + } + var res = token.toString(); + var newLineIndex = res.indexOf("\n"); + return (newLineIndex === -1) ? res : res.substring(0, newLineIndex); + } + function serializeEnum(val) { + return val; + } + function deserializeEnum(val, values) { + return val; + } + function looseIdentical(a, b) { + return a === b || typeof a === "number" && typeof b === "number" && isNaN(a) && isNaN(b); + } + function getMapKey(value) { + return value; + } + function normalizeBlank(obj) { + return isBlank(obj) ? null : obj; + } + function normalizeBool(obj) { + return isBlank(obj) ? false : obj; + } + function isJsObject(o) { + return o !== null && (typeof o === "function" || typeof o === "object"); + } + function print(obj) { + if (obj instanceof BaseException) { + console.log(obj.stack); + } else { + console.log(obj); + } + } + $__export("getTypeNameForDebugging", getTypeNameForDebugging); + $__export("makeTypeError", makeTypeError); + $__export("assertionsEnabled", assertionsEnabled); + $__export("ENUM_INDEX", ENUM_INDEX); + $__export("CONST_EXPR", CONST_EXPR); + $__export("CONST", CONST); + $__export("ABSTRACT", ABSTRACT); + $__export("IMPLEMENTS", IMPLEMENTS); + $__export("isPresent", isPresent); + $__export("isBlank", isBlank); + $__export("isString", isString); + $__export("isFunction", isFunction); + $__export("isType", isType); + $__export("isStringMap", isStringMap); + $__export("isPromise", isPromise); + $__export("isArray", isArray); + $__export("isNumber", isNumber); + $__export("isDate", isDate); + $__export("stringify", stringify); + $__export("serializeEnum", serializeEnum); + $__export("deserializeEnum", deserializeEnum); + $__export("looseIdentical", looseIdentical); + $__export("getMapKey", getMapKey); + $__export("normalizeBlank", normalizeBlank); + $__export("normalizeBool", normalizeBool); + $__export("isJsObject", isJsObject); + $__export("print", print); + return { + setters: [], + execute: function() { + _global = (typeof window === 'undefined' ? global : window); + $__export("global", _global); + Type = Function; + $__export("Type", Type); + isDart = false; + $__export("isDart", isDart); + BaseException = (function($__super) { + function BaseException(message, _originalException, _originalStack, _context) { + $traceurRuntime.superConstructor(BaseException).call(this, message); + this.message = message; + this._originalException = _originalException; + this._originalStack = _originalStack; + this._context = _context; + this.stack = (new Error(message)).stack; + } + return ($traceurRuntime.createClass)(BaseException, { + get originalException() { + return this._originalException; + }, + get originalStack() { + return this._originalStack; + }, + get context() { + return this._context; + }, + toString: function() { + return this.message; + } + }, {}, $__super); + }(Error)); + $__export("BaseException", BaseException); + Math = _global.Math; + $__export("Math", Math); + Date = _global.Date; + $__export("Date", Date); + assertionsEnabled_ = typeof _global['assert'] !== 'undefined'; + _global.assert = function assert(condition) { + if (assertionsEnabled_) { + _global['assert'].call(condition); + } + }; + StringWrapper = (function() { + function StringWrapper() {} + return ($traceurRuntime.createClass)(StringWrapper, {}, { + fromCharCode: function(code) { + return String.fromCharCode(code); + }, + charCodeAt: function(s, index) { + return s.charCodeAt(index); + }, + split: function(s, regExp) { + return s.split(regExp); + }, + equals: function(s, s2) { + return s === s2; + }, + replace: function(s, from, replace) { + return s.replace(from, replace); + }, + replaceAll: function(s, from, replace) { + return s.replace(from, replace); + }, + toUpperCase: function(s) { + return s.toUpperCase(); + }, + toLowerCase: function(s) { + return s.toLowerCase(); + }, + startsWith: function(s, start) { + return s.startsWith(start); + }, + substring: function(s, start) { + var end = arguments[2] !== (void 0) ? arguments[2] : null; + return s.substring(start, end === null ? undefined : end); + }, + replaceAllMapped: function(s, from, cb) { + return s.replace(from, function() { + for (var matches = [], + $__1 = 0; $__1 < arguments.length; $__1++) + matches[$__1] = arguments[$__1]; + matches.splice(-2, 2); + return cb(matches); + }); + }, + contains: function(s, substr) { + return s.indexOf(substr) != -1; + }, + compare: function(a, b) { + if (a < b) { + return -1; + } else if (a > b) { + return 1; + } else { + return 0; + } + } + }); + }()); + $__export("StringWrapper", StringWrapper); + StringJoiner = (function() { + function StringJoiner() { + var parts = arguments[0] !== (void 0) ? arguments[0] : []; + this.parts = parts; + } + return ($traceurRuntime.createClass)(StringJoiner, { + add: function(part) { + this.parts.push(part); + }, + toString: function() { + return this.parts.join(""); + } + }, {}); + }()); + $__export("StringJoiner", StringJoiner); + NumberParseError = (function($__super) { + function NumberParseError(message) { + $traceurRuntime.superConstructor(NumberParseError).call(this); + this.message = message; + } + return ($traceurRuntime.createClass)(NumberParseError, {toString: function() { + return this.message; + }}, {}, $__super); + }(BaseException)); + $__export("NumberParseError", NumberParseError); + NumberWrapper = (function() { + function NumberWrapper() {} + return ($traceurRuntime.createClass)(NumberWrapper, {}, { + toFixed: function(n, fractionDigits) { + return n.toFixed(fractionDigits); + }, + equal: function(a, b) { + return a === b; + }, + parseIntAutoRadix: function(text) { + var result = parseInt(text); + if (isNaN(result)) { + throw new NumberParseError("Invalid integer literal when parsing " + text); + } + return result; + }, + parseInt: function(text, radix) { + if (radix == 10) { + if (/^(\-|\+)?[0-9]+$/.test(text)) { + return parseInt(text, radix); + } + } else if (radix == 16) { + if (/^(\-|\+)?[0-9ABCDEFabcdef]+$/.test(text)) { + return parseInt(text, radix); + } + } else { + var result = parseInt(text, radix); + if (!isNaN(result)) { + return result; + } + } + throw new NumberParseError("Invalid integer literal when parsing " + text + " in base " + radix); + }, + parseFloat: function(text) { + return parseFloat(text); + }, + get NaN() { + return NaN; + }, + isNaN: function(value) { + return isNaN(value); + }, + isInteger: function(value) { + return Number.isInteger(value); + } + }); + }()); + $__export("NumberWrapper", NumberWrapper); + RegExp = _global.RegExp; + $__export("RegExp", RegExp); + RegExpWrapper = (function() { + function RegExpWrapper() {} + return ($traceurRuntime.createClass)(RegExpWrapper, {}, { + create: function(regExpStr) { + var flags = arguments[1] !== (void 0) ? arguments[1] : ''; + flags = flags.replace(/g/g, ''); + return new _global.RegExp(regExpStr, flags + 'g'); + }, + firstMatch: function(regExp, input) { + regExp.lastIndex = 0; + return regExp.exec(input); + }, + test: function(regExp, input) { + return regExp.test(input); + }, + matcher: function(regExp, input) { + regExp.lastIndex = 0; + return { + re: regExp, + input: input + }; + } + }); + }()); + $__export("RegExpWrapper", RegExpWrapper); + RegExpMatcherWrapper = (function() { + function RegExpMatcherWrapper() {} + return ($traceurRuntime.createClass)(RegExpMatcherWrapper, {}, {next: function(matcher) { + return matcher.re.exec(matcher.input); + }}); + }()); + $__export("RegExpMatcherWrapper", RegExpMatcherWrapper); + FunctionWrapper = (function() { + function FunctionWrapper() {} + return ($traceurRuntime.createClass)(FunctionWrapper, {}, {apply: function(fn, posArgs) { + return fn.apply(null, posArgs); + }}); + }()); + $__export("FunctionWrapper", FunctionWrapper); + Json = (function() { + function Json() {} + return ($traceurRuntime.createClass)(Json, {}, { + parse: function(s) { + return _global.JSON.parse(s); + }, + stringify: function(data) { + return _global.JSON.stringify(data, null, 2); + } + }); + }()); + $__export("Json", Json); + DateWrapper = (function() { + function DateWrapper() {} + return ($traceurRuntime.createClass)(DateWrapper, {}, { + create: function(year) { + var month = arguments[1] !== (void 0) ? arguments[1] : 1; + var day = arguments[2] !== (void 0) ? arguments[2] : 1; + var hour = arguments[3] !== (void 0) ? arguments[3] : 0; + var minutes = arguments[4] !== (void 0) ? arguments[4] : 0; + var seconds = arguments[5] !== (void 0) ? arguments[5] : 0; + var milliseconds = arguments[6] !== (void 0) ? arguments[6] : 0; + return new Date(year, month - 1, day, hour, minutes, seconds, milliseconds); + }, + fromMillis: function(ms) { + return new Date(ms); + }, + toMillis: function(date) { + return date.getTime(); + }, + now: function() { + return new Date(); + }, + toJson: function(date) { + return date.toJSON(); + } + }); + }()); + $__export("DateWrapper", DateWrapper); + } + }; +}); + +System.register("angular2/src/util/decorators", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/util/decorators"; + var global, + isFunction, + stringify, + Reflect; + function extractAnnotation(annotation) { + if (isFunction(annotation) && annotation.hasOwnProperty('annotation')) { + annotation = annotation.annotation; + } + return annotation; + } + function applyParams(fnOrArray, key) { + if (fnOrArray === Object || fnOrArray === String || fnOrArray === Function || fnOrArray === Number || fnOrArray === Array) { + throw new Error(("Can not use native " + stringify(fnOrArray) + " as constructor")); + } + if (isFunction(fnOrArray)) { + return fnOrArray; + } else if (fnOrArray instanceof Array) { + var annotations = fnOrArray; + var fn = fnOrArray[fnOrArray.length - 1]; + if (!isFunction(fn)) { + throw new Error(("Last position of Class method array must be Function in key " + key + " was '" + stringify(fn) + "'")); + } + var annoLength = annotations.length - 1; + if (annoLength != fn.length) { + throw new Error(("Number of annotations (" + annoLength + ") does not match number of arguments (" + fn.length + ") in the function: " + stringify(fn))); + } + var paramsAnnotations = []; + for (var i = 0, + ii = annotations.length - 1; i < ii; i++) { + var paramAnnotations = []; + paramsAnnotations.push(paramAnnotations); + var annotation = annotations[i]; + if (annotation instanceof Array) { + for (var j = 0; j < annotation.length; j++) { + paramAnnotations.push(extractAnnotation(annotation[j])); + } + } else if (isFunction(annotation)) { + paramAnnotations.push(extractAnnotation(annotation)); + } else { + paramAnnotations.push(annotation); + } + } + Reflect.defineMetadata('parameters', paramsAnnotations, fn); + return fn; + } else { + throw new Error(("Only Function or Array is supported in Class definition for key '" + key + "' is '" + stringify(fnOrArray) + "'")); + } + } + function Class(clsDef) { + var constructor = applyParams(clsDef.hasOwnProperty('constructor') ? clsDef.constructor : undefined, 'constructor'); + var proto = constructor.prototype; + if (clsDef.hasOwnProperty('extends')) { + if (isFunction(clsDef.extends)) { + constructor.prototype = proto = Object.create(clsDef.extends.prototype); + } else { + throw new Error(("Class definition 'extends' property must be a constructor function was: " + stringify(clsDef.extends))); + } + } + for (var key in clsDef) { + if (key != 'extends' && key != 'prototype' && clsDef.hasOwnProperty(key)) { + proto[key] = applyParams(clsDef[key], key); + } + } + if (this && this.annotations instanceof Array) { + Reflect.defineMetadata('annotations', this.annotations, constructor); + } + return constructor; + } + function makeDecorator(annotationCls) { + var chainFn = arguments[1] !== (void 0) ? arguments[1] : null; + function DecoratorFactory(objOrType) { + var annotationInstance = new annotationCls(objOrType); + if (this instanceof annotationCls) { + return annotationInstance; + } else { + var chainAnnotation = isFunction(this) && this.annotations instanceof Array ? this.annotations : []; + chainAnnotation.push(annotationInstance); + var TypeDecorator = function TypeDecorator(cls) { + var annotations = Reflect.getMetadata('annotations', cls); + annotations = annotations || []; + annotations.push(annotationInstance); + Reflect.defineMetadata('annotations', annotations, cls); + return cls; + }; + TypeDecorator.annotations = chainAnnotation; + TypeDecorator.Class = Class; + if (chainFn) + chainFn(TypeDecorator); + return TypeDecorator; + } + } + DecoratorFactory.prototype = Object.create(annotationCls.prototype); + return DecoratorFactory; + } + function makeParamDecorator(annotationCls) { + function ParamDecoratorFactory() { + for (var args = [], + $__0 = 0; $__0 < arguments.length; $__0++) + args[$__0] = arguments[$__0]; + var annotationInstance = Object.create(annotationCls.prototype); + annotationCls.apply(annotationInstance, args); + if (this instanceof annotationCls) { + return annotationInstance; + } else { + ParamDecorator.annotation = annotationInstance; + return ParamDecorator; + } + function ParamDecorator(cls, unusedKey, index) { + var parameters = Reflect.getMetadata('parameters', cls); + parameters = parameters || []; + while (parameters.length <= index) { + parameters.push(null); + } + parameters[index] = parameters[index] || []; + var annotationsForParam = parameters[index]; + annotationsForParam.push(annotationInstance); + Reflect.defineMetadata('parameters', parameters, cls); + return cls; + } + } + ParamDecoratorFactory.prototype = Object.create(annotationCls.prototype); + return ParamDecoratorFactory; + } + $__export("Class", Class); + $__export("makeDecorator", makeDecorator); + $__export("makeParamDecorator", makeParamDecorator); + return { + setters: [function($__m) { + global = $__m.global; + isFunction = $__m.isFunction; + stringify = $__m.stringify; + }], + execute: function() { + Reflect = global.Reflect; + if (!(Reflect && Reflect.getMetadata)) { + throw 'reflect-metadata shim is required when using class decorators'; + } + } + }; +}); + +System.register("angular2/src/di/forward_ref", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/forward_ref"; + var stringify, + isFunction; + function forwardRef(forwardRefFn) { + forwardRefFn.__forward_ref__ = forwardRef; + forwardRefFn.toString = function() { + return stringify(this()); + }; + return forwardRefFn; + } + function resolveForwardRef(type) { + if (isFunction(type) && type.hasOwnProperty('__forward_ref__') && type.__forward_ref__ === forwardRef) { + return type(); + } else { + return type; + } + } + $__export("forwardRef", forwardRef); + $__export("resolveForwardRef", resolveForwardRef); + return { + setters: [function($__m) { + stringify = $__m.stringify; + isFunction = $__m.isFunction; + }], + execute: function() { + } + }; +}); + +System.register("angular2/src/facade/collection", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/facade/collection"; + var isJsObject, + global, + isPresent, + isArray, + List, + Map, + Set, + StringMap, + createMapFromPairs, + createMapFromMap, + _clearValues, + MapWrapper, + StringMapWrapper, + ListWrapper, + createSetFromList, + SetWrapper; + function isListLikeIterable(obj) { + if (!isJsObject(obj)) + return false; + return isArray(obj) || (!(obj instanceof Map) && Symbol.iterator in obj); + } + function iterateListLike(obj, fn) { + if (isArray(obj)) { + for (var i = 0; i < obj.length; i++) { + fn(obj[i]); + } + } else { + var iterator = obj[Symbol.iterator](); + var item; + while (!((item = iterator.next()).done)) { + fn(item.value); + } + } + } + $__export("isListLikeIterable", isListLikeIterable); + $__export("iterateListLike", iterateListLike); + return { + setters: [function($__m) { + isJsObject = $__m.isJsObject; + global = $__m.global; + isPresent = $__m.isPresent; + isArray = $__m.isArray; + }], + execute: function() { + List = global.Array; + $__export("List", List); + Map = global.Map; + $__export("Map", Map); + Set = global.Set; + $__export("Set", Set); + StringMap = global.Object; + $__export("StringMap", StringMap); + createMapFromPairs = (function() { + try { + if (new Map([1, 2]).size === 2) { + return function createMapFromPairs(pairs) { + return new Map(pairs); + }; + } + } catch (e) {} + return function createMapAndPopulateFromPairs(pairs) { + var map = new Map(); + for (var i = 0; i < pairs.length; i++) { + var pair = pairs[i]; + map.set(pair[0], pair[1]); + } + return map; + }; + })(); + createMapFromMap = (function() { + try { + if (new Map(new Map())) { + return function createMapFromMap(m) { + return new Map(m); + }; + } + } catch (e) {} + return function createMapAndPopulateFromMap(m) { + var map = new Map(); + m.forEach((function(v, k) { + map.set(k, v); + })); + return map; + }; + })(); + _clearValues = (function() { + if ((new Map()).keys().next) { + return function _clearValues(m) { + var keyIterator = m.keys(); + var k; + while (!((k = keyIterator.next()).done)) { + m.set(k.value, null); + } + }; + } else { + return function _clearValuesWithForeEach(m) { + m.forEach((function(v, k) { + m.set(k, null); + })); + }; + } + })(); + MapWrapper = (function() { + function MapWrapper() {} + return ($traceurRuntime.createClass)(MapWrapper, {}, { + clone: function(m) { + return createMapFromMap(m); + }, + createFromStringMap: function(stringMap) { + var result = new Map(); + for (var prop in stringMap) { + result.set(prop, stringMap[prop]); + } + return result; + }, + toStringMap: function(m) { + var r = {}; + m.forEach((function(v, k) { + return r[k] = v; + })); + return r; + }, + createFromPairs: function(pairs) { + return createMapFromPairs(pairs); + }, + forEach: function(m, fn) { + m.forEach(fn); + }, + get: function(map, key) { + return map.get(key); + }, + size: function(m) { + return m.size; + }, + delete: function(m, k) { + m.delete(k); + }, + clearValues: function(m) { + _clearValues(m); + }, + iterable: function(m) { + return m; + }, + keys: function(m) { + return Array.from(m.keys()); + }, + values: function(m) { + return Array.from(m.values()); + } + }); + }()); + $__export("MapWrapper", MapWrapper); + StringMapWrapper = (function() { + function StringMapWrapper() {} + return ($traceurRuntime.createClass)(StringMapWrapper, {}, { + create: function() { + return {}; + }, + contains: function(map, key) { + return map.hasOwnProperty(key); + }, + get: function(map, key) { + return map.hasOwnProperty(key) ? map[key] : undefined; + }, + set: function(map, key, value) { + map[key] = value; + }, + keys: function(map) { + return Object.keys(map); + }, + isEmpty: function(map) { + for (var prop in map) { + return false; + } + return true; + }, + delete: function(map, key) { + delete map[key]; + }, + forEach: function(map, callback) { + for (var prop in map) { + if (map.hasOwnProperty(prop)) { + callback(map[prop], prop); + } + } + }, + merge: function(m1, m2) { + var m = {}; + for (var attr in m1) { + if (m1.hasOwnProperty(attr)) { + m[attr] = m1[attr]; + } + } + for (var attr in m2) { + if (m2.hasOwnProperty(attr)) { + m[attr] = m2[attr]; + } + } + return m; + }, + equals: function(m1, m2) { + var k1 = Object.keys(m1); + var k2 = Object.keys(m2); + if (k1.length != k2.length) { + return false; + } + var key; + for (var i = 0; i < k1.length; i++) { + key = k1[i]; + if (m1[key] !== m2[key]) { + return false; + } + } + return true; + } + }); + }()); + $__export("StringMapWrapper", StringMapWrapper); + ListWrapper = (function() { + function ListWrapper() {} + return ($traceurRuntime.createClass)(ListWrapper, {}, { + createFixedSize: function(size) { + return new List(size); + }, + createGrowableSize: function(size) { + return new List(size); + }, + get: function(m, k) { + return m[k]; + }, + set: function(m, k, v) { + m[k] = v; + }, + clone: function(array) { + return array.slice(0); + }, + map: function(array, fn) { + return array.map(fn); + }, + forEach: function(array, fn) { + for (var i = 0; i < array.length; i++) { + fn(array[i]); + } + }, + first: function(array) { + if (!array) + return null; + return array[0]; + }, + last: function(array) { + if (!array || array.length == 0) + return null; + return array[array.length - 1]; + }, + find: function(list, pred) { + for (var i = 0; i < list.length; ++i) { + if (pred(list[i])) + return list[i]; + } + return null; + }, + indexOf: function(array, value) { + var startIndex = arguments[2] !== (void 0) ? arguments[2] : 0; + return array.indexOf(value, startIndex); + }, + reduce: function(list, fn, init) { + return list.reduce(fn, init); + }, + filter: function(array, pred) { + return array.filter(pred); + }, + any: function(list, pred) { + for (var i = 0; i < list.length; ++i) { + if (pred(list[i])) + return true; + } + return false; + }, + contains: function(list, el) { + return list.indexOf(el) !== -1; + }, + reversed: function(array) { + var a = ListWrapper.clone(array); + return a.reverse(); + }, + concat: function(a, b) { + return a.concat(b); + }, + insert: function(list, index, value) { + list.splice(index, 0, value); + }, + removeAt: function(list, index) { + var res = list[index]; + list.splice(index, 1); + return res; + }, + removeAll: function(list, items) { + for (var i = 0; i < items.length; ++i) { + var index = list.indexOf(items[i]); + list.splice(index, 1); + } + }, + removeLast: function(list) { + return list.pop(); + }, + remove: function(list, el) { + var index = list.indexOf(el); + if (index > -1) { + list.splice(index, 1); + return true; + } + return false; + }, + clear: function(list) { + list.splice(0, list.length); + }, + join: function(list, s) { + return list.join(s); + }, + isEmpty: function(list) { + return list.length == 0; + }, + fill: function(list, value) { + var start = arguments[2] !== (void 0) ? arguments[2] : 0; + var end = arguments[3] !== (void 0) ? arguments[3] : null; + list.fill(value, start, end === null ? undefined : end); + }, + equals: function(a, b) { + if (a.length != b.length) + return false; + for (var i = 0; i < a.length; ++i) { + if (a[i] !== b[i]) + return false; + } + return true; + }, + slice: function(l) { + var from = arguments[1] !== (void 0) ? arguments[1] : 0; + var to = arguments[2] !== (void 0) ? arguments[2] : null; + return l.slice(from, to === null ? undefined : to); + }, + splice: function(l, from, length) { + return l.splice(from, length); + }, + sort: function(l, compareFn) { + if (isPresent(compareFn)) { + l.sort(compareFn); + } else { + l.sort(); + } + }, + toString: function(l) { + return l.toString(); + }, + toJSON: function(l) { + return JSON.stringify(l); + } + }); + }()); + $__export("ListWrapper", ListWrapper); + createSetFromList = (function() { + var test = new Set([1, 2, 3]); + if (test.size === 3) { + return function createSetFromList(lst) { + return new Set(lst); + }; + } else { + return function createSetAndPopulateFromList(lst) { + var res = new Set(lst); + if (res.size !== lst.length) { + for (var i = 0; i < lst.length; i++) { + res.add(lst[i]); + } + } + return res; + }; + } + })(); + SetWrapper = (function() { + function SetWrapper() {} + return ($traceurRuntime.createClass)(SetWrapper, {}, { + createFromList: function(lst) { + return createSetFromList(lst); + }, + has: function(s, key) { + return s.has(key); + }, + delete: function(m, k) { + m.delete(k); + } + }); + }()); + $__export("SetWrapper", SetWrapper); + } + }; +}); + +System.register("angular2/src/reflection/reflector", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/reflection/reflector"; + var isPresent, + Map, + StringMapWrapper, + ReflectionInfo, + Reflector; + function _mergeMaps(target, config) { + StringMapWrapper.forEach(config, (function(v, k) { + return target.set(k, v); + })); + } + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + Map = $__m.Map; + StringMapWrapper = $__m.StringMapWrapper; + }], + execute: function() { + ReflectionInfo = (function() { + function ReflectionInfo(annotations, parameters, factory, interfaces) { + this._annotations = annotations; + this._parameters = parameters; + this._factory = factory; + this._interfaces = interfaces; + } + return ($traceurRuntime.createClass)(ReflectionInfo, {}, {}); + }()); + $__export("ReflectionInfo", ReflectionInfo); + Reflector = (function() { + function Reflector(reflectionCapabilities) { + this._injectableInfo = new Map(); + this._getters = new Map(); + this._setters = new Map(); + this._methods = new Map(); + this.reflectionCapabilities = reflectionCapabilities; + } + return ($traceurRuntime.createClass)(Reflector, { + isReflectionEnabled: function() { + return this.reflectionCapabilities.isReflectionEnabled(); + }, + registerFunction: function(func, funcInfo) { + this._injectableInfo.set(func, funcInfo); + }, + registerType: function(type, typeInfo) { + this._injectableInfo.set(type, typeInfo); + }, + registerGetters: function(getters) { + _mergeMaps(this._getters, getters); + }, + registerSetters: function(setters) { + _mergeMaps(this._setters, setters); + }, + registerMethods: function(methods) { + _mergeMaps(this._methods, methods); + }, + factory: function(type) { + if (this._containsReflectionInfo(type)) { + var res = this._injectableInfo.get(type)._factory; + return isPresent(res) ? res : null; + } else { + return this.reflectionCapabilities.factory(type); + } + }, + parameters: function(typeOrFunc) { + if (this._injectableInfo.has(typeOrFunc)) { + var res = this._injectableInfo.get(typeOrFunc)._parameters; + return isPresent(res) ? res : []; + } else { + return this.reflectionCapabilities.parameters(typeOrFunc); + } + }, + annotations: function(typeOrFunc) { + if (this._injectableInfo.has(typeOrFunc)) { + var res = this._injectableInfo.get(typeOrFunc)._annotations; + return isPresent(res) ? res : []; + } else { + return this.reflectionCapabilities.annotations(typeOrFunc); + } + }, + interfaces: function(type) { + if (this._injectableInfo.has(type)) { + var res = this._injectableInfo.get(type)._interfaces; + return isPresent(res) ? res : []; + } else { + return this.reflectionCapabilities.interfaces(type); + } + }, + getter: function(name) { + if (this._getters.has(name)) { + return this._getters.get(name); + } else { + return this.reflectionCapabilities.getter(name); + } + }, + setter: function(name) { + if (this._setters.has(name)) { + return this._setters.get(name); + } else { + return this.reflectionCapabilities.setter(name); + } + }, + method: function(name) { + if (this._methods.has(name)) { + return this._methods.get(name); + } else { + return this.reflectionCapabilities.method(name); + } + }, + _containsReflectionInfo: function(typeOrFunc) { + return this._injectableInfo.has(typeOrFunc); + } + }, {}); + }()); + $__export("Reflector", Reflector); + } + }; +}); + +System.register("angular2/src/reflection/reflection_capabilities", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/reflection/reflection_capabilities"; + var isPresent, + isFunction, + global, + stringify, + BaseException, + ListWrapper, + ReflectionCapabilities; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + isFunction = $__m.isFunction; + global = $__m.global; + stringify = $__m.stringify; + BaseException = $__m.BaseException; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }], + execute: function() { + ReflectionCapabilities = (function() { + function ReflectionCapabilities(reflect) { + this._reflect = isPresent(reflect) ? reflect : global.Reflect; + } + return ($traceurRuntime.createClass)(ReflectionCapabilities, { + isReflectionEnabled: function() { + return true; + }, + factory: function(t) { + switch (t.length) { + case 0: + return (function() { + return new t(); + }); + case 1: + return (function(a1) { + return new t(a1); + }); + case 2: + return (function(a1, a2) { + return new t(a1, a2); + }); + case 3: + return (function(a1, a2, a3) { + return new t(a1, a2, a3); + }); + case 4: + return (function(a1, a2, a3, a4) { + return new t(a1, a2, a3, a4); + }); + case 5: + return (function(a1, a2, a3, a4, a5) { + return new t(a1, a2, a3, a4, a5); + }); + case 6: + return (function(a1, a2, a3, a4, a5, a6) { + return new t(a1, a2, a3, a4, a5, a6); + }); + case 7: + return (function(a1, a2, a3, a4, a5, a6, a7) { + return new t(a1, a2, a3, a4, a5, a6, a7); + }); + case 8: + return (function(a1, a2, a3, a4, a5, a6, a7, a8) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8); + }); + case 9: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9); + }); + case 10: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + }); + case 11: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + }); + case 12: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + }); + case 13: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + }); + case 14: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + }); + case 15: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + }); + case 16: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + }); + case 17: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17); + }); + case 18: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18); + }); + case 19: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19); + }); + case 20: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) { + return new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + }); + } + ; + throw new Error(("Cannot create a factory for '" + stringify(t) + "' because its constructor has more than 20 arguments")); + }, + _zipTypesAndAnnotaions: function(paramTypes, paramAnnotations) { + var result; + if (typeof paramTypes === 'undefined') { + result = ListWrapper.createFixedSize(paramAnnotations.length); + } else { + result = ListWrapper.createFixedSize(paramTypes.length); + } + for (var i = 0; i < result.length; i++) { + if (typeof paramTypes === 'undefined') { + result[i] = []; + } else if (paramTypes[i] != Object) { + result[i] = [paramTypes[i]]; + } else { + result[i] = []; + } + if (isPresent(paramAnnotations) && isPresent(paramAnnotations[i])) { + result[i] = result[i].concat(paramAnnotations[i]); + } + } + return result; + }, + parameters: function(typeOfFunc) { + if (isPresent(typeOfFunc.parameters)) { + return typeOfFunc.parameters; + } + if (isPresent(this._reflect) && isPresent(this._reflect.getMetadata)) { + var paramAnnotations = this._reflect.getMetadata('parameters', typeOfFunc); + var paramTypes = this._reflect.getMetadata('design:paramtypes', typeOfFunc); + if (isPresent(paramTypes) || isPresent(paramAnnotations)) { + return this._zipTypesAndAnnotaions(paramTypes, paramAnnotations); + } + } + return ListWrapper.createFixedSize(typeOfFunc.length); + }, + annotations: function(typeOfFunc) { + if (isPresent(typeOfFunc.annotations)) { + var annotations = typeOfFunc.annotations; + if (isFunction(annotations) && annotations.annotations) { + annotations = annotations.annotations; + } + return annotations; + } + if (isPresent(this._reflect) && isPresent(this._reflect.getMetadata)) { + var annotations = this._reflect.getMetadata('annotations', typeOfFunc); + if (isPresent(annotations)) + return annotations; + } + return []; + }, + interfaces: function(type) { + throw new BaseException("JavaScript does not support interfaces"); + }, + getter: function(name) { + return new Function('o', 'return o.' + name + ';'); + }, + setter: function(name) { + return new Function('o', 'v', 'return o.' + name + ' = v;'); + }, + method: function(name) { + var functionBody = ("if (!o." + name + ") throw new Error('\"" + name + "\" is undefined');\n return o." + name + ".apply(o, args);"); + return new Function('o', 'args', functionBody); + } + }, {}); + }()); + $__export("ReflectionCapabilities", ReflectionCapabilities); + } + }; +}); + +System.register("angular2/src/di/type_literal", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/type_literal"; + var TypeLiteral; + return { + setters: [], + execute: function() { + TypeLiteral = (function() { + function TypeLiteral() {} + return ($traceurRuntime.createClass)(TypeLiteral, {get type() { + throw new Error("Type literals are only supported in Dart"); + }}, {}); + }()); + $__export("TypeLiteral", TypeLiteral); + } + }; +}); + +System.register("angular2/src/di/exceptions", ["angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/exceptions"; + var ListWrapper, + stringify, + BaseException, + isBlank, + AbstractBindingError, + NoBindingError, + CyclicDependencyError, + InstantiationError, + InvalidBindingError, + NoAnnotationError, + OutOfBoundsError; + function findFirstClosedCycle(keys) { + var res = []; + for (var i = 0; i < keys.length; ++i) { + if (ListWrapper.contains(res, keys[i])) { + res.push(keys[i]); + return res; + } else { + res.push(keys[i]); + } + } + return res; + } + function constructResolvingPath(keys) { + if (keys.length > 1) { + var reversed = findFirstClosedCycle(ListWrapper.reversed(keys)); + var tokenStrs = ListWrapper.map(reversed, (function(k) { + return stringify(k.token); + })); + return " (" + tokenStrs.join(' -> ') + ")"; + } else { + return ""; + } + } + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + stringify = $__m.stringify; + BaseException = $__m.BaseException; + isBlank = $__m.isBlank; + }], + execute: function() { + AbstractBindingError = (function($__super) { + function AbstractBindingError(injector, key, constructResolvingMessage, originalException, originalStack) { + $traceurRuntime.superConstructor(AbstractBindingError).call(this, "DI Exception", originalException, originalStack, null); + this.keys = [key]; + this.injectors = [injector]; + this.constructResolvingMessage = constructResolvingMessage; + this.message = this.constructResolvingMessage(this.keys); + } + return ($traceurRuntime.createClass)(AbstractBindingError, { + addKey: function(injector, key) { + this.injectors.push(injector); + this.keys.push(key); + this.message = this.constructResolvingMessage(this.keys); + }, + get context() { + return this.injectors[this.injectors.length - 1].debugContext(); + }, + toString: function() { + return this.message; + } + }, {}, $__super); + }(BaseException)); + $__export("AbstractBindingError", AbstractBindingError); + NoBindingError = (function($__super) { + function NoBindingError(injector, key) { + $traceurRuntime.superConstructor(NoBindingError).call(this, injector, key, function(keys) { + var first = stringify(ListWrapper.first(keys).token); + return ("No provider for " + first + "!" + constructResolvingPath(keys)); + }); + } + return ($traceurRuntime.createClass)(NoBindingError, {}, {}, $__super); + }(AbstractBindingError)); + $__export("NoBindingError", NoBindingError); + CyclicDependencyError = (function($__super) { + function CyclicDependencyError(injector, key) { + $traceurRuntime.superConstructor(CyclicDependencyError).call(this, injector, key, function(keys) { + return ("Cannot instantiate cyclic dependency!" + constructResolvingPath(keys)); + }); + } + return ($traceurRuntime.createClass)(CyclicDependencyError, {}, {}, $__super); + }(AbstractBindingError)); + $__export("CyclicDependencyError", CyclicDependencyError); + InstantiationError = (function($__super) { + function InstantiationError(injector, originalException, originalStack, key) { + $traceurRuntime.superConstructor(InstantiationError).call(this, injector, key, function(keys) { + var first = stringify(ListWrapper.first(keys).token); + return ("Error during instantiation of " + first + "!" + constructResolvingPath(keys) + "."); + }, originalException, originalStack); + this.causeKey = key; + } + return ($traceurRuntime.createClass)(InstantiationError, {}, {}, $__super); + }(AbstractBindingError)); + $__export("InstantiationError", InstantiationError); + InvalidBindingError = (function($__super) { + function InvalidBindingError(binding) { + $traceurRuntime.superConstructor(InvalidBindingError).call(this); + this.message = "Invalid binding - only instances of Binding and Type are allowed, got: " + binding.toString(); + } + return ($traceurRuntime.createClass)(InvalidBindingError, {toString: function() { + return this.message; + }}, {}, $__super); + }(BaseException)); + $__export("InvalidBindingError", InvalidBindingError); + NoAnnotationError = (function($__super) { + function NoAnnotationError(typeOrFunc, params) { + $traceurRuntime.superConstructor(NoAnnotationError).call(this); + var signature = []; + for (var i = 0, + ii = params.length; i < ii; i++) { + var parameter = params[i]; + if (isBlank(parameter) || parameter.length == 0) { + signature.push('?'); + } else { + signature.push(ListWrapper.map(parameter, stringify).join(' ')); + } + } + this.message = "Cannot resolve all parameters for " + stringify(typeOrFunc) + "(" + signature.join(', ') + "). " + 'Make sure they all have valid type or annotations.'; + } + return ($traceurRuntime.createClass)(NoAnnotationError, {toString: function() { + return this.message; + }}, {}, $__super); + }(BaseException)); + $__export("NoAnnotationError", NoAnnotationError); + OutOfBoundsError = (function($__super) { + function OutOfBoundsError(index) { + $traceurRuntime.superConstructor(OutOfBoundsError).call(this); + this.message = ("Index " + index + " is out-of-bounds."); + } + return ($traceurRuntime.createClass)(OutOfBoundsError, {toString: function() { + return this.message; + }}, {}, $__super); + }(BaseException)); + $__export("OutOfBoundsError", OutOfBoundsError); + } + }; +}); + +System.register("angular2/src/di/opaque_token", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/opaque_token"; + var __decorate, + __metadata, + CONST, + OpaqueToken; + return { + setters: [function($__m) { + CONST = $__m.CONST; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + OpaqueToken = (($traceurRuntime.createClass)(function(desc) { + this._desc = 'Token(' + desc + ')'; + }, {toString: function() { + return this._desc; + }}, {})); + $__export("OpaqueToken", OpaqueToken); + $__export("OpaqueToken", OpaqueToken = __decorate([CONST(), __metadata('design:paramtypes', [String])], OpaqueToken)); + } + }; +}); + +System.register("angular2/src/dom/dom_adapter", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/dom/dom_adapter"; + var BaseException, + isBlank, + DOM, + DomAdapter; + function setRootDomAdapter(adapter) { + if (isBlank(DOM)) { + $__export("DOM", DOM = adapter); + } + } + function _abstract() { + return new BaseException('This method is abstract'); + } + $__export("setRootDomAdapter", setRootDomAdapter); + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + isBlank = $__m.isBlank; + }], + execute: function() { + $__export("DOM", DOM); + DomAdapter = (function() { + function DomAdapter() {} + return ($traceurRuntime.createClass)(DomAdapter, { + hasProperty: function(element, name) { + throw _abstract(); + }, + setProperty: function(el, name, value) { + throw _abstract(); + }, + getProperty: function(el, name) { + throw _abstract(); + }, + invoke: function(el, methodName, args) { + throw _abstract(); + }, + logError: function(error) { + throw _abstract(); + }, + log: function(error) { + throw _abstract(); + }, + logGroup: function(error) { + throw _abstract(); + }, + logGroupEnd: function() { + throw _abstract(); + }, + get attrToPropMap() { + throw _abstract(); + }, + parse: function(templateHtml) { + throw _abstract(); + }, + query: function(selector) { + throw _abstract(); + }, + querySelector: function(el, selector) { + throw _abstract(); + }, + querySelectorAll: function(el, selector) { + throw _abstract(); + }, + on: function(el, evt, listener) { + throw _abstract(); + }, + onAndCancel: function(el, evt, listener) { + throw _abstract(); + }, + dispatchEvent: function(el, evt) { + throw _abstract(); + }, + createMouseEvent: function(eventType) { + throw _abstract(); + }, + createEvent: function(eventType) { + throw _abstract(); + }, + preventDefault: function(evt) { + throw _abstract(); + }, + getInnerHTML: function(el) { + throw _abstract(); + }, + getOuterHTML: function(el) { + throw _abstract(); + }, + nodeName: function(node) { + throw _abstract(); + }, + nodeValue: function(node) { + throw _abstract(); + }, + type: function(node) { + throw _abstract(); + }, + content: function(node) { + throw _abstract(); + }, + firstChild: function(el) { + throw _abstract(); + }, + nextSibling: function(el) { + throw _abstract(); + }, + parentElement: function(el) { + throw _abstract(); + }, + childNodes: function(el) { + throw _abstract(); + }, + childNodesAsList: function(el) { + throw _abstract(); + }, + clearNodes: function(el) { + throw _abstract(); + }, + appendChild: function(el, node) { + throw _abstract(); + }, + removeChild: function(el, node) { + throw _abstract(); + }, + replaceChild: function(el, newNode, oldNode) { + throw _abstract(); + }, + remove: function(el) { + throw _abstract(); + }, + insertBefore: function(el, node) { + throw _abstract(); + }, + insertAllBefore: function(el, nodes) { + throw _abstract(); + }, + insertAfter: function(el, node) { + throw _abstract(); + }, + setInnerHTML: function(el, value) { + throw _abstract(); + }, + getText: function(el) { + throw _abstract(); + }, + setText: function(el, value) { + throw _abstract(); + }, + getValue: function(el) { + throw _abstract(); + }, + setValue: function(el, value) { + throw _abstract(); + }, + getChecked: function(el) { + throw _abstract(); + }, + setChecked: function(el, value) { + throw _abstract(); + }, + createTemplate: function(html) { + throw _abstract(); + }, + createElement: function(tagName) { + var doc = arguments[1] !== (void 0) ? arguments[1] : null; + throw _abstract(); + }, + createTextNode: function(text) { + var doc = arguments[1] !== (void 0) ? arguments[1] : null; + throw _abstract(); + }, + createScriptTag: function(attrName, attrValue) { + var doc = arguments[2] !== (void 0) ? arguments[2] : null; + throw _abstract(); + }, + createStyleElement: function(css) { + var doc = arguments[1] !== (void 0) ? arguments[1] : null; + throw _abstract(); + }, + createShadowRoot: function(el) { + throw _abstract(); + }, + getShadowRoot: function(el) { + throw _abstract(); + }, + getHost: function(el) { + throw _abstract(); + }, + getDistributedNodes: function(el) { + throw _abstract(); + }, + clone: function(node) { + throw _abstract(); + }, + getElementsByClassName: function(element, name) { + throw _abstract(); + }, + getElementsByTagName: function(element, name) { + throw _abstract(); + }, + classList: function(element) { + throw _abstract(); + }, + addClass: function(element, classname) { + throw _abstract(); + }, + removeClass: function(element, classname) { + throw _abstract(); + }, + hasClass: function(element, classname) { + throw _abstract(); + }, + setStyle: function(element, stylename, stylevalue) { + throw _abstract(); + }, + removeStyle: function(element, stylename) { + throw _abstract(); + }, + getStyle: function(element, stylename) { + throw _abstract(); + }, + tagName: function(element) { + throw _abstract(); + }, + attributeMap: function(element) { + throw _abstract(); + }, + hasAttribute: function(element, attribute) { + throw _abstract(); + }, + getAttribute: function(element, attribute) { + throw _abstract(); + }, + setAttribute: function(element, name, value) { + throw _abstract(); + }, + removeAttribute: function(element, attribute) { + throw _abstract(); + }, + templateAwareRoot: function(el) { + throw _abstract(); + }, + createHtmlDocument: function() { + throw _abstract(); + }, + defaultDoc: function() { + throw _abstract(); + }, + getBoundingClientRect: function(el) { + throw _abstract(); + }, + getTitle: function() { + throw _abstract(); + }, + setTitle: function(newTitle) { + throw _abstract(); + }, + elementMatches: function(n, selector) { + throw _abstract(); + }, + isTemplateElement: function(el) { + throw _abstract(); + }, + isTextNode: function(node) { + throw _abstract(); + }, + isCommentNode: function(node) { + throw _abstract(); + }, + isElementNode: function(node) { + throw _abstract(); + }, + hasShadowRoot: function(node) { + throw _abstract(); + }, + isShadowRoot: function(node) { + throw _abstract(); + }, + importIntoDoc: function(node) { + throw _abstract(); + }, + isPageRule: function(rule) { + throw _abstract(); + }, + isStyleRule: function(rule) { + throw _abstract(); + }, + isMediaRule: function(rule) { + throw _abstract(); + }, + isKeyframesRule: function(rule) { + throw _abstract(); + }, + getHref: function(element) { + throw _abstract(); + }, + getEventKey: function(event) { + throw _abstract(); + }, + resolveAndSetHref: function(element, baseUrl, href) { + throw _abstract(); + }, + cssToRules: function(css) { + throw _abstract(); + }, + supportsDOMEvents: function() { + throw _abstract(); + }, + supportsNativeShadowDOM: function() { + throw _abstract(); + }, + getGlobalEventTarget: function(target) { + throw _abstract(); + }, + getHistory: function() { + throw _abstract(); + }, + getLocation: function() { + throw _abstract(); + }, + getBaseHref: function() { + throw _abstract(); + }, + getUserAgent: function() { + throw _abstract(); + }, + setData: function(element, name, value) { + throw _abstract(); + }, + getData: function(element, name) { + throw _abstract(); + }, + setGlobalVar: function(name, value) { + throw _abstract(); + } + }, {}); + }()); + $__export("DomAdapter", DomAdapter); + } + }; +}); + +System.register("angular2/src/dom/generic_browser_adapter", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/dom/dom_adapter"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/dom/generic_browser_adapter"; + var ListWrapper, + isPresent, + isFunction, + DomAdapter, + GenericBrowserDomAdapter; + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + isFunction = $__m.isFunction; + }, function($__m) { + DomAdapter = $__m.DomAdapter; + }], + execute: function() { + GenericBrowserDomAdapter = (function($__super) { + function GenericBrowserDomAdapter() { + $traceurRuntime.superConstructor(GenericBrowserDomAdapter).apply(this, arguments); + } + return ($traceurRuntime.createClass)(GenericBrowserDomAdapter, { + getDistributedNodes: function(el) { + return el.getDistributedNodes(); + }, + resolveAndSetHref: function(el, baseUrl, href) { + el.href = href == null ? baseUrl : baseUrl + '/../' + href; + }, + cssToRules: function(css) { + var style = this.createStyleElement(css); + this.appendChild(this.defaultDoc().head, style); + var rules = []; + if (isPresent(style.sheet)) { + try { + var rawRules = style.sheet.cssRules; + rules = ListWrapper.createFixedSize(rawRules.length); + for (var i = 0; i < rawRules.length; i++) { + rules[i] = rawRules[i]; + } + } catch (e) {} + } else {} + this.remove(style); + return rules; + }, + supportsDOMEvents: function() { + return true; + }, + supportsNativeShadowDOM: function() { + return isFunction(this.defaultDoc().body.createShadowRoot); + } + }, {}, $__super); + }(DomAdapter)); + $__export("GenericBrowserDomAdapter", GenericBrowserDomAdapter); + } + }; +}); + +System.register("angular2/src/change_detection/constants", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/constants"; + var CHECK_ONCE, + CHECKED, + CHECK_ALWAYS, + DETACHED, + ON_PUSH, + DEFAULT; + return { + setters: [], + execute: function() { + CHECK_ONCE = "CHECK_ONCE"; + $__export("CHECK_ONCE", CHECK_ONCE); + CHECKED = "CHECKED"; + $__export("CHECKED", CHECKED); + CHECK_ALWAYS = "ALWAYS_CHECK"; + $__export("CHECK_ALWAYS", CHECK_ALWAYS); + DETACHED = "DETACHED"; + $__export("DETACHED", DETACHED); + ON_PUSH = "ON_PUSH"; + $__export("ON_PUSH", ON_PUSH); + DEFAULT = "DEFAULT"; + $__export("DEFAULT", DEFAULT); + } + }; +}); + +System.register("angular2/src/change_detection/exceptions", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/exceptions"; + var BaseException, + ExpressionChangedAfterItHasBeenCheckedException, + ChangeDetectionError, + DehydratedException; + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + }], + execute: function() { + ExpressionChangedAfterItHasBeenCheckedException = (function($__super) { + function ExpressionChangedAfterItHasBeenCheckedException(proto, change, context) { + $traceurRuntime.superConstructor(ExpressionChangedAfterItHasBeenCheckedException).call(this, ("Expression '" + proto.expressionAsString + "' has changed after it was checked. ") + ("Previous value: '" + change.previousValue + "'. Current value: '" + change.currentValue + "'")); + } + return ($traceurRuntime.createClass)(ExpressionChangedAfterItHasBeenCheckedException, {}, {}, $__super); + }(BaseException)); + $__export("ExpressionChangedAfterItHasBeenCheckedException", ExpressionChangedAfterItHasBeenCheckedException); + ChangeDetectionError = (function($__super) { + function ChangeDetectionError(proto, originalException, originalStack, context) { + $traceurRuntime.superConstructor(ChangeDetectionError).call(this, (originalException + " in [" + proto.expressionAsString + "]"), originalException, originalStack, context); + this.location = proto.expressionAsString; + } + return ($traceurRuntime.createClass)(ChangeDetectionError, {}, {}, $__super); + }(BaseException)); + $__export("ChangeDetectionError", ChangeDetectionError); + DehydratedException = (function($__super) { + function DehydratedException() { + $traceurRuntime.superConstructor(DehydratedException).call(this, 'Attempt to detect changes on a dehydrated detector.'); + } + return ($traceurRuntime.createClass)(DehydratedException, {}, {}, $__super); + }(BaseException)); + $__export("DehydratedException", DehydratedException); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/pipe", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/pipe"; + var __decorate, + __metadata, + BaseException, + CONST, + WrappedValue, + _wrappedValues, + _wrappedIndex, + BasePipe; + function _abstract() { + throw new BaseException('This method is abstract'); + } + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + CONST = $__m.CONST; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + WrappedValue = (function() { + function WrappedValue(wrapped) { + this.wrapped = wrapped; + } + return ($traceurRuntime.createClass)(WrappedValue, {}, {wrap: function(value) { + var w = _wrappedValues[_wrappedIndex++ % 5]; + w.wrapped = value; + return w; + }}); + }()); + $__export("WrappedValue", WrappedValue); + _wrappedValues = [new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null)]; + _wrappedIndex = 0; + BasePipe = (($traceurRuntime.createClass)(function() {}, { + supports: function(obj) { + return true; + }, + onDestroy: function() {}, + transform: function(value, args) { + return _abstract(); + } + }, {})); + $__export("BasePipe", BasePipe); + $__export("BasePipe", BasePipe = __decorate([CONST(), __metadata('design:paramtypes', [])], BasePipe)); + } + }; +}); + +System.register("angular2/src/change_detection/proto_record", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/proto_record"; + var RecordType, + ProtoRecord; + return { + setters: [], + execute: function() { + $__export("RecordType", RecordType); + (function(RecordType) { + RecordType[RecordType["SELF"] = 0] = "SELF"; + RecordType[RecordType["CONST"] = 1] = "CONST"; + RecordType[RecordType["PRIMITIVE_OP"] = 2] = "PRIMITIVE_OP"; + RecordType[RecordType["PROPERTY"] = 3] = "PROPERTY"; + RecordType[RecordType["LOCAL"] = 4] = "LOCAL"; + RecordType[RecordType["INVOKE_METHOD"] = 5] = "INVOKE_METHOD"; + RecordType[RecordType["INVOKE_CLOSURE"] = 6] = "INVOKE_CLOSURE"; + RecordType[RecordType["KEYED_ACCESS"] = 7] = "KEYED_ACCESS"; + RecordType[RecordType["PIPE"] = 8] = "PIPE"; + RecordType[RecordType["INTERPOLATE"] = 9] = "INTERPOLATE"; + RecordType[RecordType["SAFE_PROPERTY"] = 10] = "SAFE_PROPERTY"; + RecordType[RecordType["SAFE_INVOKE_METHOD"] = 11] = "SAFE_INVOKE_METHOD"; + RecordType[RecordType["DIRECTIVE_LIFECYCLE"] = 12] = "DIRECTIVE_LIFECYCLE"; + })(RecordType || ($__export("RecordType", RecordType = {}))); + ProtoRecord = (function() { + function ProtoRecord(mode, name, funcOrValue, args, fixedArgs, contextIndex, directiveIndex, selfIndex, bindingRecord, expressionAsString, lastInBinding, lastInDirective) { + this.mode = mode; + this.name = name; + this.funcOrValue = funcOrValue; + this.args = args; + this.fixedArgs = fixedArgs; + this.contextIndex = contextIndex; + this.directiveIndex = directiveIndex; + this.selfIndex = selfIndex; + this.bindingRecord = bindingRecord; + this.expressionAsString = expressionAsString; + this.lastInBinding = lastInBinding; + this.lastInDirective = lastInDirective; + } + return ($traceurRuntime.createClass)(ProtoRecord, { + isPureFunction: function() { + return this.mode === RecordType.INTERPOLATE || this.mode === RecordType.PRIMITIVE_OP; + }, + isPipeRecord: function() { + return this.mode === RecordType.PIPE; + }, + isLifeCycleRecord: function() { + return this.mode === RecordType.DIRECTIVE_LIFECYCLE; + } + }, {}); + }()); + $__export("ProtoRecord", ProtoRecord); + } + }; +}); + +System.register("angular2/src/change_detection/codegen_name_util", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/codegen_name_util"; + var RegExpWrapper, + StringWrapper, + ListWrapper, + _CONTEXT_IDX, + _whiteSpaceRegExp, + CodegenNameUtil; + function sanitizeName(s) { + return StringWrapper.replaceAll(s, _whiteSpaceRegExp, ''); + } + $__export("sanitizeName", sanitizeName); + return { + setters: [function($__m) { + RegExpWrapper = $__m.RegExpWrapper; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }], + execute: function() { + _CONTEXT_IDX = 0; + _whiteSpaceRegExp = RegExpWrapper.create("\\W", "g"); + CodegenNameUtil = (function() { + function CodegenNameUtil(records, directiveRecords, fieldPrefix, utilName) { + this.records = records; + this.directiveRecords = directiveRecords; + this.fieldPrefix = fieldPrefix; + this.utilName = utilName; + this._sanitizedNames = ListWrapper.createFixedSize(this.records.length + 1); + this._sanitizedNames[_CONTEXT_IDX] = 'context'; + for (var i = 0, + iLen = this.records.length; i < iLen; ++i) { + this._sanitizedNames[i + 1] = sanitizeName(("" + this.records[i].name + i)); + } + } + return ($traceurRuntime.createClass)(CodegenNameUtil, { + getContextName: function() { + return this.getFieldName(_CONTEXT_IDX); + }, + getLocalName: function(idx) { + return this._sanitizedNames[idx]; + }, + getChangeName: function(idx) { + return ("c_" + this._sanitizedNames[idx]); + }, + genInitLocals: function() { + var declarations = []; + var assignments = []; + for (var i = 0, + iLen = this.getFieldCount(); i < iLen; ++i) { + var changeName = this.getChangeName(i); + declarations.push((this.getLocalName(i) + "," + changeName)); + assignments.push(changeName); + } + return ("var " + ListWrapper.join(declarations, ',') + ";") + (ListWrapper.join(assignments, '=') + " = false;"); + }, + getFieldCount: function() { + return this._sanitizedNames.length; + }, + getFieldName: function(idx) { + return ("" + this.fieldPrefix + this._sanitizedNames[idx]); + }, + getAllFieldNames: function() { + var fieldList = []; + for (var k = 0, + kLen = this.getFieldCount(); k < kLen; ++k) { + fieldList.push(this.getFieldName(k)); + } + for (var i = 0, + iLen = this.records.length; i < iLen; ++i) { + var rec = this.records[i]; + if (rec.isPipeRecord()) { + fieldList.push(this.getPipeName(rec.selfIndex)); + } + } + for (var j = 0, + jLen = this.directiveRecords.length; j < jLen; ++j) { + var dRec = this.directiveRecords[j]; + fieldList.push(this.getDirectiveName(dRec.directiveIndex)); + if (dRec.isOnPushChangeDetection()) { + fieldList.push(this.getDetectorName(dRec.directiveIndex)); + } + } + return fieldList; + }, + genDeclareFields: function() { + var fields = this.getAllFieldNames(); + ListWrapper.removeAt(fields, _CONTEXT_IDX); + return ListWrapper.isEmpty(fields) ? '' : ("var " + ListWrapper.join(fields, ', ') + ";"); + }, + genDehydrateFields: function() { + var fields = this.getAllFieldNames(); + ListWrapper.removeAt(fields, _CONTEXT_IDX); + if (!ListWrapper.isEmpty(fields)) { + fields.push((this.utilName + ".uninitialized;")); + } + return (this.getContextName() + " = null; " + ListWrapper.join(fields, ' = ')); + }, + genPipeOnDestroy: function() { + var $__0 = this; + return ListWrapper.join(ListWrapper.map(ListWrapper.filter(this.records, (function(r) { + return r.isPipeRecord(); + })), (function(r) { + return ($__0.getPipeName(r.selfIndex) + ".onDestroy();"); + })), '\n'); + }, + getPipeName: function(idx) { + return ("" + this.fieldPrefix + this._sanitizedNames[idx] + "_pipe"); + }, + getAllDirectiveNames: function() { + var $__0 = this; + return ListWrapper.map(this.directiveRecords, (function(d) { + return $__0.getDirectiveName(d.directiveIndex); + })); + }, + getDirectiveName: function(d) { + return (this.fieldPrefix + "directive_" + d.name); + }, + getAllDetectorNames: function() { + var $__0 = this; + return ListWrapper.map(ListWrapper.filter(this.directiveRecords, (function(r) { + return r.isOnPushChangeDetection(); + })), (function(d) { + return $__0.getDetectorName(d.directiveIndex); + })); + }, + getDetectorName: function(d) { + return (this.fieldPrefix + "detector_" + d.name); + } + }, {}); + }()); + $__export("CodegenNameUtil", CodegenNameUtil); + } + }; +}); + +System.register("angular2/src/change_detection/coalesce", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/proto_record"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/coalesce"; + var isPresent, + isBlank, + looseIdentical, + ListWrapper, + Map, + RecordType, + ProtoRecord; + function coalesce(records) { + var res = []; + var indexMap = new Map(); + for (var i = 0; i < records.length; ++i) { + var r = records[i]; + var record = _replaceIndices(r, res.length + 1, indexMap); + var matchingRecord = _findMatching(record, res); + if (isPresent(matchingRecord) && record.lastInBinding) { + res.push(_selfRecord(record, matchingRecord.selfIndex, res.length + 1)); + indexMap.set(r.selfIndex, matchingRecord.selfIndex); + } else if (isPresent(matchingRecord) && !record.lastInBinding) { + indexMap.set(r.selfIndex, matchingRecord.selfIndex); + } else { + res.push(record); + indexMap.set(r.selfIndex, record.selfIndex); + } + } + return res; + } + function _selfRecord(r, contextIndex, selfIndex) { + return new ProtoRecord(RecordType.SELF, "self", null, [], r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.expressionAsString, r.lastInBinding, r.lastInDirective); + } + function _findMatching(r, rs) { + return ListWrapper.find(rs, (function(rr) { + return rr.mode !== RecordType.DIRECTIVE_LIFECYCLE && _sameDirIndex(rr, r) && rr.mode === r.mode && looseIdentical(rr.funcOrValue, r.funcOrValue) && rr.contextIndex === r.contextIndex && looseIdentical(rr.name, r.name) && ListWrapper.equals(rr.args, r.args); + })); + } + function _sameDirIndex(a, b) { + var di1 = isBlank(a.directiveIndex) ? null : a.directiveIndex.directiveIndex; + var ei1 = isBlank(a.directiveIndex) ? null : a.directiveIndex.elementIndex; + var di2 = isBlank(b.directiveIndex) ? null : b.directiveIndex.directiveIndex; + var ei2 = isBlank(b.directiveIndex) ? null : b.directiveIndex.elementIndex; + return di1 === di2 && ei1 === ei2; + } + function _replaceIndices(r, selfIndex, indexMap) { + var args = ListWrapper.map(r.args, (function(a) { + return _map(indexMap, a); + })); + var contextIndex = _map(indexMap, r.contextIndex); + return new ProtoRecord(r.mode, r.name, r.funcOrValue, args, r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.expressionAsString, r.lastInBinding, r.lastInDirective); + } + function _map(indexMap, value) { + var r = indexMap.get(value); + return isPresent(r) ? r : value; + } + $__export("coalesce", coalesce); + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + looseIdentical = $__m.looseIdentical; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + Map = $__m.Map; + }, function($__m) { + RecordType = $__m.RecordType; + ProtoRecord = $__m.ProtoRecord; + }], + execute: function() { + } + }; +}); + +System.register("angular2/src/change_detection/parser/ast", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/parser/ast"; + var isBlank, + isPresent, + FunctionWrapper, + BaseException, + ListWrapper, + StringMapWrapper, + AST, + EmptyExpr, + ImplicitReceiver, + Chain, + Conditional, + If, + AccessMember, + SafeAccessMember, + KeyedAccess, + BindingPipe, + LiteralPrimitive, + LiteralArray, + LiteralMap, + Interpolation, + Binary, + PrefixNot, + Assignment, + MethodCall, + SafeMethodCall, + FunctionCall, + ASTWithSource, + TemplateBinding, + AstTransformer, + _evalListCache; + function evalList(context, locals, exps) { + var length = exps.length; + if (length > 10) { + throw new BaseException("Cannot have more than 10 argument"); + } + var result = _evalListCache[length]; + for (var i = 0; i < length; i++) { + result[i] = exps[i].eval(context, locals); + } + return result; + } + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + FunctionWrapper = $__m.FunctionWrapper; + BaseException = $__m.BaseException; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }], + execute: function() { + AST = (function() { + function AST() {} + return ($traceurRuntime.createClass)(AST, { + eval: function(context, locals) { + throw new BaseException("Not supported"); + }, + get isAssignable() { + return false; + }, + assign: function(context, locals, value) { + throw new BaseException("Not supported"); + }, + visit: function(visitor) { + return null; + }, + toString: function() { + return "AST"; + } + }, {}); + }()); + $__export("AST", AST); + EmptyExpr = (function($__super) { + function EmptyExpr() { + $traceurRuntime.superConstructor(EmptyExpr).apply(this, arguments); + } + return ($traceurRuntime.createClass)(EmptyExpr, { + eval: function(context, locals) { + return null; + }, + visit: function(visitor) {} + }, {}, $__super); + }(AST)); + $__export("EmptyExpr", EmptyExpr); + ImplicitReceiver = (function($__super) { + function ImplicitReceiver() { + $traceurRuntime.superConstructor(ImplicitReceiver).apply(this, arguments); + } + return ($traceurRuntime.createClass)(ImplicitReceiver, { + eval: function(context, locals) { + return context; + }, + visit: function(visitor) { + return visitor.visitImplicitReceiver(this); + } + }, {}, $__super); + }(AST)); + $__export("ImplicitReceiver", ImplicitReceiver); + Chain = (function($__super) { + function Chain(expressions) { + $traceurRuntime.superConstructor(Chain).call(this); + this.expressions = expressions; + } + return ($traceurRuntime.createClass)(Chain, { + eval: function(context, locals) { + var result; + for (var i = 0; i < this.expressions.length; i++) { + var last = this.expressions[i].eval(context, locals); + if (isPresent(last)) + result = last; + } + return result; + }, + visit: function(visitor) { + return visitor.visitChain(this); + } + }, {}, $__super); + }(AST)); + $__export("Chain", Chain); + Conditional = (function($__super) { + function Conditional(condition, trueExp, falseExp) { + $traceurRuntime.superConstructor(Conditional).call(this); + this.condition = condition; + this.trueExp = trueExp; + this.falseExp = falseExp; + } + return ($traceurRuntime.createClass)(Conditional, { + eval: function(context, locals) { + if (this.condition.eval(context, locals)) { + return this.trueExp.eval(context, locals); + } else { + return this.falseExp.eval(context, locals); + } + }, + visit: function(visitor) { + return visitor.visitConditional(this); + } + }, {}, $__super); + }(AST)); + $__export("Conditional", Conditional); + If = (function($__super) { + function If(condition, trueExp, falseExp) { + $traceurRuntime.superConstructor(If).call(this); + this.condition = condition; + this.trueExp = trueExp; + this.falseExp = falseExp; + } + return ($traceurRuntime.createClass)(If, { + eval: function(context, locals) { + if (this.condition.eval(context, locals)) { + this.trueExp.eval(context, locals); + } else if (isPresent(this.falseExp)) { + this.falseExp.eval(context, locals); + } + }, + visit: function(visitor) { + return visitor.visitIf(this); + } + }, {}, $__super); + }(AST)); + $__export("If", If); + AccessMember = (function($__super) { + function AccessMember(receiver, name, getter, setter) { + $traceurRuntime.superConstructor(AccessMember).call(this); + this.receiver = receiver; + this.name = name; + this.getter = getter; + this.setter = setter; + } + return ($traceurRuntime.createClass)(AccessMember, { + eval: function(context, locals) { + if (this.receiver instanceof ImplicitReceiver && isPresent(locals) && locals.contains(this.name)) { + return locals.get(this.name); + } else { + var evaluatedReceiver = this.receiver.eval(context, locals); + return this.getter(evaluatedReceiver); + } + }, + get isAssignable() { + return true; + }, + assign: function(context, locals, value) { + var evaluatedContext = this.receiver.eval(context, locals); + if (this.receiver instanceof ImplicitReceiver && isPresent(locals) && locals.contains(this.name)) { + throw new BaseException(("Cannot reassign a variable binding " + this.name)); + } else { + return this.setter(evaluatedContext, value); + } + }, + visit: function(visitor) { + return visitor.visitAccessMember(this); + } + }, {}, $__super); + }(AST)); + $__export("AccessMember", AccessMember); + SafeAccessMember = (function($__super) { + function SafeAccessMember(receiver, name, getter, setter) { + $traceurRuntime.superConstructor(SafeAccessMember).call(this); + this.receiver = receiver; + this.name = name; + this.getter = getter; + this.setter = setter; + } + return ($traceurRuntime.createClass)(SafeAccessMember, { + eval: function(context, locals) { + var evaluatedReceiver = this.receiver.eval(context, locals); + return isBlank(evaluatedReceiver) ? null : this.getter(evaluatedReceiver); + }, + visit: function(visitor) { + return visitor.visitSafeAccessMember(this); + } + }, {}, $__super); + }(AST)); + $__export("SafeAccessMember", SafeAccessMember); + KeyedAccess = (function($__super) { + function KeyedAccess(obj, key) { + $traceurRuntime.superConstructor(KeyedAccess).call(this); + this.obj = obj; + this.key = key; + } + return ($traceurRuntime.createClass)(KeyedAccess, { + eval: function(context, locals) { + var obj = this.obj.eval(context, locals); + var key = this.key.eval(context, locals); + return obj[key]; + }, + get isAssignable() { + return true; + }, + assign: function(context, locals, value) { + var obj = this.obj.eval(context, locals); + var key = this.key.eval(context, locals); + obj[key] = value; + return value; + }, + visit: function(visitor) { + return visitor.visitKeyedAccess(this); + } + }, {}, $__super); + }(AST)); + $__export("KeyedAccess", KeyedAccess); + BindingPipe = (function($__super) { + function BindingPipe(exp, name, args) { + $traceurRuntime.superConstructor(BindingPipe).call(this); + this.exp = exp; + this.name = name; + this.args = args; + } + return ($traceurRuntime.createClass)(BindingPipe, {visit: function(visitor) { + return visitor.visitPipe(this); + }}, {}, $__super); + }(AST)); + $__export("BindingPipe", BindingPipe); + LiteralPrimitive = (function($__super) { + function LiteralPrimitive(value) { + $traceurRuntime.superConstructor(LiteralPrimitive).call(this); + this.value = value; + } + return ($traceurRuntime.createClass)(LiteralPrimitive, { + eval: function(context, locals) { + return this.value; + }, + visit: function(visitor) { + return visitor.visitLiteralPrimitive(this); + } + }, {}, $__super); + }(AST)); + $__export("LiteralPrimitive", LiteralPrimitive); + LiteralArray = (function($__super) { + function LiteralArray(expressions) { + $traceurRuntime.superConstructor(LiteralArray).call(this); + this.expressions = expressions; + } + return ($traceurRuntime.createClass)(LiteralArray, { + eval: function(context, locals) { + return ListWrapper.map(this.expressions, (function(e) { + return e.eval(context, locals); + })); + }, + visit: function(visitor) { + return visitor.visitLiteralArray(this); + } + }, {}, $__super); + }(AST)); + $__export("LiteralArray", LiteralArray); + LiteralMap = (function($__super) { + function LiteralMap(keys, values) { + $traceurRuntime.superConstructor(LiteralMap).call(this); + this.keys = keys; + this.values = values; + } + return ($traceurRuntime.createClass)(LiteralMap, { + eval: function(context, locals) { + var res = StringMapWrapper.create(); + for (var i = 0; i < this.keys.length; ++i) { + StringMapWrapper.set(res, this.keys[i], this.values[i].eval(context, locals)); + } + return res; + }, + visit: function(visitor) { + return visitor.visitLiteralMap(this); + } + }, {}, $__super); + }(AST)); + $__export("LiteralMap", LiteralMap); + Interpolation = (function($__super) { + function Interpolation(strings, expressions) { + $traceurRuntime.superConstructor(Interpolation).call(this); + this.strings = strings; + this.expressions = expressions; + } + return ($traceurRuntime.createClass)(Interpolation, { + eval: function(context, locals) { + throw new BaseException("evaluating an Interpolation is not supported"); + }, + visit: function(visitor) { + visitor.visitInterpolation(this); + } + }, {}, $__super); + }(AST)); + $__export("Interpolation", Interpolation); + Binary = (function($__super) { + function Binary(operation, left, right) { + $traceurRuntime.superConstructor(Binary).call(this); + this.operation = operation; + this.left = left; + this.right = right; + } + return ($traceurRuntime.createClass)(Binary, { + eval: function(context, locals) { + var left = this.left.eval(context, locals); + switch (this.operation) { + case '&&': + return left && this.right.eval(context, locals); + case '||': + return left || this.right.eval(context, locals); + } + var right = this.right.eval(context, locals); + switch (this.operation) { + case '+': + return left + right; + case '-': + return left - right; + case '*': + return left * right; + case '/': + return left / right; + case '%': + return left % right; + case '==': + return left == right; + case '!=': + return left != right; + case '===': + return left === right; + case '!==': + return left !== right; + case '<': + return left < right; + case '>': + return left > right; + case '<=': + return left <= right; + case '>=': + return left >= right; + case '^': + return left ^ right; + case '&': + return left & right; + } + throw 'Internal error [$operation] not handled'; + }, + visit: function(visitor) { + return visitor.visitBinary(this); + } + }, {}, $__super); + }(AST)); + $__export("Binary", Binary); + PrefixNot = (function($__super) { + function PrefixNot(expression) { + $traceurRuntime.superConstructor(PrefixNot).call(this); + this.expression = expression; + } + return ($traceurRuntime.createClass)(PrefixNot, { + eval: function(context, locals) { + return !this.expression.eval(context, locals); + }, + visit: function(visitor) { + return visitor.visitPrefixNot(this); + } + }, {}, $__super); + }(AST)); + $__export("PrefixNot", PrefixNot); + Assignment = (function($__super) { + function Assignment(target, value) { + $traceurRuntime.superConstructor(Assignment).call(this); + this.target = target; + this.value = value; + } + return ($traceurRuntime.createClass)(Assignment, { + eval: function(context, locals) { + return this.target.assign(context, locals, this.value.eval(context, locals)); + }, + visit: function(visitor) { + return visitor.visitAssignment(this); + } + }, {}, $__super); + }(AST)); + $__export("Assignment", Assignment); + MethodCall = (function($__super) { + function MethodCall(receiver, name, fn, args) { + $traceurRuntime.superConstructor(MethodCall).call(this); + this.receiver = receiver; + this.name = name; + this.fn = fn; + this.args = args; + } + return ($traceurRuntime.createClass)(MethodCall, { + eval: function(context, locals) { + var evaluatedArgs = evalList(context, locals, this.args); + if (this.receiver instanceof ImplicitReceiver && isPresent(locals) && locals.contains(this.name)) { + var fn = locals.get(this.name); + return FunctionWrapper.apply(fn, evaluatedArgs); + } else { + var evaluatedReceiver = this.receiver.eval(context, locals); + return this.fn(evaluatedReceiver, evaluatedArgs); + } + }, + visit: function(visitor) { + return visitor.visitMethodCall(this); + } + }, {}, $__super); + }(AST)); + $__export("MethodCall", MethodCall); + SafeMethodCall = (function($__super) { + function SafeMethodCall(receiver, name, fn, args) { + $traceurRuntime.superConstructor(SafeMethodCall).call(this); + this.receiver = receiver; + this.name = name; + this.fn = fn; + this.args = args; + } + return ($traceurRuntime.createClass)(SafeMethodCall, { + eval: function(context, locals) { + var evaluatedReceiver = this.receiver.eval(context, locals); + if (isBlank(evaluatedReceiver)) + return null; + var evaluatedArgs = evalList(context, locals, this.args); + return this.fn(evaluatedReceiver, evaluatedArgs); + }, + visit: function(visitor) { + return visitor.visitSafeMethodCall(this); + } + }, {}, $__super); + }(AST)); + $__export("SafeMethodCall", SafeMethodCall); + FunctionCall = (function($__super) { + function FunctionCall(target, args) { + $traceurRuntime.superConstructor(FunctionCall).call(this); + this.target = target; + this.args = args; + } + return ($traceurRuntime.createClass)(FunctionCall, { + eval: function(context, locals) { + var obj = this.target.eval(context, locals); + if (!(obj instanceof Function)) { + throw new BaseException((obj + " is not a function")); + } + return FunctionWrapper.apply(obj, evalList(context, locals, this.args)); + }, + visit: function(visitor) { + return visitor.visitFunctionCall(this); + } + }, {}, $__super); + }(AST)); + $__export("FunctionCall", FunctionCall); + ASTWithSource = (function($__super) { + function ASTWithSource(ast, source, location) { + $traceurRuntime.superConstructor(ASTWithSource).call(this); + this.ast = ast; + this.source = source; + this.location = location; + } + return ($traceurRuntime.createClass)(ASTWithSource, { + eval: function(context, locals) { + return this.ast.eval(context, locals); + }, + get isAssignable() { + return this.ast.isAssignable; + }, + assign: function(context, locals, value) { + return this.ast.assign(context, locals, value); + }, + visit: function(visitor) { + return this.ast.visit(visitor); + }, + toString: function() { + return (this.source + " in " + this.location); + } + }, {}, $__super); + }(AST)); + $__export("ASTWithSource", ASTWithSource); + TemplateBinding = (function() { + function TemplateBinding(key, keyIsVar, name, expression) { + this.key = key; + this.keyIsVar = keyIsVar; + this.name = name; + this.expression = expression; + } + return ($traceurRuntime.createClass)(TemplateBinding, {}, {}); + }()); + $__export("TemplateBinding", TemplateBinding); + AstTransformer = (function() { + function AstTransformer() {} + return ($traceurRuntime.createClass)(AstTransformer, { + visitImplicitReceiver: function(ast) { + return ast; + }, + visitInterpolation: function(ast) { + return new Interpolation(ast.strings, this.visitAll(ast.expressions)); + }, + visitLiteralPrimitive: function(ast) { + return new LiteralPrimitive(ast.value); + }, + visitAccessMember: function(ast) { + return new AccessMember(ast.receiver.visit(this), ast.name, ast.getter, ast.setter); + }, + visitSafeAccessMember: function(ast) { + return new SafeAccessMember(ast.receiver.visit(this), ast.name, ast.getter, ast.setter); + }, + visitMethodCall: function(ast) { + return new MethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args)); + }, + visitSafeMethodCall: function(ast) { + return new SafeMethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args)); + }, + visitFunctionCall: function(ast) { + return new FunctionCall(ast.target.visit(this), this.visitAll(ast.args)); + }, + visitLiteralArray: function(ast) { + return new LiteralArray(this.visitAll(ast.expressions)); + }, + visitLiteralMap: function(ast) { + return new LiteralMap(ast.keys, this.visitAll(ast.values)); + }, + visitBinary: function(ast) { + return new Binary(ast.operation, ast.left.visit(this), ast.right.visit(this)); + }, + visitPrefixNot: function(ast) { + return new PrefixNot(ast.expression.visit(this)); + }, + visitConditional: function(ast) { + return new Conditional(ast.condition.visit(this), ast.trueExp.visit(this), ast.falseExp.visit(this)); + }, + visitPipe: function(ast) { + return new BindingPipe(ast.exp.visit(this), ast.name, this.visitAll(ast.args)); + }, + visitKeyedAccess: function(ast) { + return new KeyedAccess(ast.obj.visit(this), ast.key.visit(this)); + }, + visitAll: function(asts) { + var res = ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }, + visitChain: function(ast) { + return new Chain(this.visitAll(ast.expressions)); + }, + visitAssignment: function(ast) { + return new Assignment(ast.target.visit(this), ast.value.visit(this)); + }, + visitIf: function(ast) { + var falseExp = isPresent(ast.falseExp) ? ast.falseExp.visit(this) : null; + return new If(ast.condition.visit(this), ast.trueExp.visit(this), falseExp); + } + }, {}); + }()); + $__export("AstTransformer", AstTransformer); + _evalListCache = [[], [0], [0, 0], [0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]; + } + }; +}); + +System.register("angular2/src/change_detection/dynamic_change_detector", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/abstract_change_detector", "angular2/src/change_detection/change_detection_util", "angular2/src/change_detection/proto_record"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/dynamic_change_detector"; + var isPresent, + isBlank, + BaseException, + FunctionWrapper, + ListWrapper, + AbstractChangeDetector, + ChangeDetectionUtil, + RecordType, + DynamicChangeDetector; + function isSame(a, b) { + if (a === b) + return true; + if (a instanceof String && b instanceof String && a == b) + return true; + if ((a !== a) && (b !== b)) + return true; + return false; + } + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + FunctionWrapper = $__m.FunctionWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + AbstractChangeDetector = $__m.AbstractChangeDetector; + }, function($__m) { + ChangeDetectionUtil = $__m.ChangeDetectionUtil; + }, function($__m) { + RecordType = $__m.RecordType; + }], + execute: function() { + DynamicChangeDetector = (function($__super) { + function DynamicChangeDetector(id, changeControlStrategy, dispatcher, protos, directiveRecords) { + $traceurRuntime.superConstructor(DynamicChangeDetector).call(this, id, dispatcher); + this.changeControlStrategy = changeControlStrategy; + this.protos = protos; + this.directiveRecords = directiveRecords; + this.locals = null; + this.directives = null; + this.alreadyChecked = false; + this.pipes = null; + this.values = ListWrapper.createFixedSize(protos.length + 1); + this.localPipes = ListWrapper.createFixedSize(protos.length + 1); + this.prevContexts = ListWrapper.createFixedSize(protos.length + 1); + this.changes = ListWrapper.createFixedSize(protos.length + 1); + this.values[0] = null; + ListWrapper.fill(this.values, ChangeDetectionUtil.uninitialized, 1); + ListWrapper.fill(this.localPipes, null); + ListWrapper.fill(this.prevContexts, ChangeDetectionUtil.uninitialized); + ListWrapper.fill(this.changes, false); + } + return ($traceurRuntime.createClass)(DynamicChangeDetector, { + hydrate: function(context, locals, directives, pipes) { + this.mode = ChangeDetectionUtil.changeDetectionMode(this.changeControlStrategy); + this.values[0] = context; + this.locals = locals; + this.directives = directives; + this.alreadyChecked = false; + this.pipes = pipes; + }, + dehydrate: function() { + this._destroyPipes(); + this.values[0] = null; + ListWrapper.fill(this.values, ChangeDetectionUtil.uninitialized, 1); + ListWrapper.fill(this.changes, false); + ListWrapper.fill(this.localPipes, null); + ListWrapper.fill(this.prevContexts, ChangeDetectionUtil.uninitialized); + this.locals = null; + this.pipes = null; + }, + _destroyPipes: function() { + for (var i = 0; i < this.localPipes.length; ++i) { + if (isPresent(this.localPipes[i])) { + this.localPipes[i].onDestroy(); + } + } + }, + hydrated: function() { + return this.values[0] !== null; + }, + checkNoChanges: function() { + this.runDetectChanges(true); + }, + detectChangesInRecords: function(throwOnChange) { + if (!this.hydrated()) { + ChangeDetectionUtil.throwDehydrated(); + } + var protos = this.protos; + var changes = null; + var isChanged = false; + for (var i = 0; i < protos.length; ++i) { + var proto = protos[i]; + var bindingRecord = proto.bindingRecord; + var directiveRecord = bindingRecord.directiveRecord; + if (proto.isLifeCycleRecord()) { + if (proto.name === "onCheck" && !throwOnChange) { + this._getDirectiveFor(directiveRecord.directiveIndex).onCheck(); + } else if (proto.name === "onInit" && !throwOnChange && !this.alreadyChecked) { + this._getDirectiveFor(directiveRecord.directiveIndex).onInit(); + } else if (proto.name === "onChange" && isPresent(changes) && !throwOnChange) { + this._getDirectiveFor(directiveRecord.directiveIndex).onChange(changes); + } + } else { + var change = this._check(proto, throwOnChange); + if (isPresent(change)) { + this._updateDirectiveOrElement(change, bindingRecord); + isChanged = true; + changes = this._addChange(bindingRecord, change, changes); + } + } + if (proto.lastInDirective) { + changes = null; + if (isChanged && bindingRecord.isOnPushChangeDetection()) { + this._getDetectorFor(directiveRecord.directiveIndex).markAsCheckOnce(); + } + isChanged = false; + } + } + this.alreadyChecked = true; + }, + callOnAllChangesDone: function() { + this.dispatcher.notifyOnAllChangesDone(); + var dirs = this.directiveRecords; + for (var i = dirs.length - 1; i >= 0; --i) { + var dir = dirs[i]; + if (dir.callOnAllChangesDone) { + this._getDirectiveFor(dir.directiveIndex).onAllChangesDone(); + } + } + }, + _updateDirectiveOrElement: function(change, bindingRecord) { + if (isBlank(bindingRecord.directiveRecord)) { + this.dispatcher.notifyOnBinding(bindingRecord, change.currentValue); + } else { + var directiveIndex = bindingRecord.directiveRecord.directiveIndex; + bindingRecord.setter(this._getDirectiveFor(directiveIndex), change.currentValue); + } + }, + _addChange: function(bindingRecord, change, changes) { + if (bindingRecord.callOnChange()) { + return ChangeDetectionUtil.addChange(changes, bindingRecord.propertyName, change); + } else { + return changes; + } + }, + _getDirectiveFor: function(directiveIndex) { + return this.directives.getDirectiveFor(directiveIndex); + }, + _getDetectorFor: function(directiveIndex) { + return this.directives.getDetectorFor(directiveIndex); + }, + _check: function(proto, throwOnChange) { + try { + if (proto.isPipeRecord()) { + return this._pipeCheck(proto, throwOnChange); + } else { + return this._referenceCheck(proto, throwOnChange); + } + } catch (e) { + this.throwError(proto, e, e.stack); + } + }, + _referenceCheck: function(proto, throwOnChange) { + if (this._pureFuncAndArgsDidNotChange(proto)) { + this._setChanged(proto, false); + return null; + } + var prevValue = this._readSelf(proto); + var currValue = this._calculateCurrValue(proto); + if (!isSame(prevValue, currValue)) { + if (proto.lastInBinding) { + var change = ChangeDetectionUtil.simpleChange(prevValue, currValue); + if (throwOnChange) + ChangeDetectionUtil.throwOnChange(proto, change); + this._writeSelf(proto, currValue); + this._setChanged(proto, true); + return change; + } else { + this._writeSelf(proto, currValue); + this._setChanged(proto, true); + return null; + } + } else { + this._setChanged(proto, false); + return null; + } + }, + _calculateCurrValue: function(proto) { + switch (proto.mode) { + case RecordType.SELF: + return this._readContext(proto); + case RecordType.CONST: + return proto.funcOrValue; + case RecordType.PROPERTY: + var context = this._readContext(proto); + return proto.funcOrValue(context); + case RecordType.SAFE_PROPERTY: + var context = this._readContext(proto); + return isBlank(context) ? null : proto.funcOrValue(context); + case RecordType.LOCAL: + return this.locals.get(proto.name); + case RecordType.INVOKE_METHOD: + var context = this._readContext(proto); + var args = this._readArgs(proto); + return proto.funcOrValue(context, args); + case RecordType.SAFE_INVOKE_METHOD: + var context = this._readContext(proto); + if (isBlank(context)) { + return null; + } + var args = this._readArgs(proto); + return proto.funcOrValue(context, args); + case RecordType.KEYED_ACCESS: + var arg = this._readArgs(proto)[0]; + return this._readContext(proto)[arg]; + case RecordType.INVOKE_CLOSURE: + return FunctionWrapper.apply(this._readContext(proto), this._readArgs(proto)); + case RecordType.INTERPOLATE: + case RecordType.PRIMITIVE_OP: + return FunctionWrapper.apply(proto.funcOrValue, this._readArgs(proto)); + default: + throw new BaseException(("Unknown operation " + proto.mode)); + } + }, + _pipeCheck: function(proto, throwOnChange) { + var context = this._readContext(proto); + var args = this._readArgs(proto); + var pipe = this._pipeFor(proto, context); + var prevValue = this._readSelf(proto); + var currValue = pipe.transform(context, args); + if (!isSame(prevValue, currValue)) { + currValue = ChangeDetectionUtil.unwrapValue(currValue); + if (proto.lastInBinding) { + var change = ChangeDetectionUtil.simpleChange(prevValue, currValue); + if (throwOnChange) + ChangeDetectionUtil.throwOnChange(proto, change); + this._writeSelf(proto, currValue); + this._setChanged(proto, true); + return change; + } else { + this._writeSelf(proto, currValue); + this._setChanged(proto, true); + return null; + } + } else { + this._setChanged(proto, false); + return null; + } + }, + _pipeFor: function(proto, context) { + var storedPipe = this._readPipe(proto); + if (isPresent(storedPipe) && storedPipe.supports(context)) { + return storedPipe; + } + if (isPresent(storedPipe)) { + storedPipe.onDestroy(); + } + var pipe = this.pipes.get(proto.name, context, this.ref); + this._writePipe(proto, pipe); + return pipe; + }, + _readContext: function(proto) { + if (proto.contextIndex == -1) { + return this._getDirectiveFor(proto.directiveIndex); + } else { + return this.values[proto.contextIndex]; + } + return this.values[proto.contextIndex]; + }, + _readSelf: function(proto) { + return this.values[proto.selfIndex]; + }, + _writeSelf: function(proto, value) { + this.values[proto.selfIndex] = value; + }, + _readPipe: function(proto) { + return this.localPipes[proto.selfIndex]; + }, + _writePipe: function(proto, value) { + this.localPipes[proto.selfIndex] = value; + }, + _setChanged: function(proto, value) { + this.changes[proto.selfIndex] = value; + }, + _pureFuncAndArgsDidNotChange: function(proto) { + return proto.isPureFunction() && !this._argsChanged(proto); + }, + _argsChanged: function(proto) { + var args = proto.args; + for (var i = 0; i < args.length; ++i) { + if (this.changes[args[i]]) { + return true; + } + } + return false; + }, + _readArgs: function(proto) { + var res = ListWrapper.createFixedSize(proto.args.length); + var args = proto.args; + for (var i = 0; i < args.length; ++i) { + res[i] = this.values[args[i]]; + } + return res; + } + }, {}, $__super); + }(AbstractChangeDetector)); + $__export("DynamicChangeDetector", DynamicChangeDetector); + } + }; +}); + +System.register("angular2/src/change_detection/directive_record", ["angular2/src/change_detection/constants", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/directive_record"; + var ON_PUSH, + StringWrapper, + normalizeBool, + DirectiveIndex, + DirectiveRecord; + return { + setters: [function($__m) { + ON_PUSH = $__m.ON_PUSH; + }, function($__m) { + StringWrapper = $__m.StringWrapper; + normalizeBool = $__m.normalizeBool; + }], + execute: function() { + DirectiveIndex = (function() { + function DirectiveIndex(elementIndex, directiveIndex) { + this.elementIndex = elementIndex; + this.directiveIndex = directiveIndex; + } + return ($traceurRuntime.createClass)(DirectiveIndex, {get name() { + return (this.elementIndex + "_" + this.directiveIndex); + }}, {}); + }()); + $__export("DirectiveIndex", DirectiveIndex); + DirectiveRecord = (function() { + function DirectiveRecord() { + var $__1 = arguments[0] !== (void 0) ? arguments[0] : {}, + directiveIndex = $__1.directiveIndex, + callOnAllChangesDone = $__1.callOnAllChangesDone, + callOnChange = $__1.callOnChange, + callOnCheck = $__1.callOnCheck, + callOnInit = $__1.callOnInit, + changeDetection = $__1.changeDetection; + this.directiveIndex = directiveIndex; + this.callOnAllChangesDone = normalizeBool(callOnAllChangesDone); + this.callOnChange = normalizeBool(callOnChange); + this.callOnCheck = normalizeBool(callOnCheck); + this.callOnInit = normalizeBool(callOnInit); + this.changeDetection = changeDetection; + } + return ($traceurRuntime.createClass)(DirectiveRecord, {isOnPushChangeDetection: function() { + return StringWrapper.equals(this.changeDetection, ON_PUSH); + }}, {}); + }()); + $__export("DirectiveRecord", DirectiveRecord); + } + }; +}); + +System.register("angular2/src/change_detection/pregen_proto_change_detector", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pregen_proto_change_detector"; + var BaseException, + PregenProtoChangeDetector; + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + }], + execute: function() { + $__export("PregenProtoChangeDetectorFactory", Function); + PregenProtoChangeDetector = (function() { + function PregenProtoChangeDetector() {} + return ($traceurRuntime.createClass)(PregenProtoChangeDetector, {instantiate: function(dispatcher) { + throw new BaseException('Pregen change detection not supported in Js'); + }}, {isSupported: function() { + return false; + }}); + }()); + $__export("PregenProtoChangeDetector", PregenProtoChangeDetector); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/pipes", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/pipes"; + var __decorate, + __metadata, + ListWrapper, + StringMapWrapper, + isBlank, + isPresent, + BaseException, + CONST, + Injectable, + UnboundedMetadata, + OptionalMetadata, + Binding, + Pipes; + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + CONST = $__m.CONST; + }, function($__m) { + Injectable = $__m.Injectable; + UnboundedMetadata = $__m.UnboundedMetadata; + OptionalMetadata = $__m.OptionalMetadata; + Binding = $__m.Binding; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Pipes = (($traceurRuntime.createClass)(function(config) { + this.config = config; + }, { + get: function(type, obj, cdRef, existingPipe) { + if (isPresent(existingPipe) && existingPipe.supports(obj)) + return existingPipe; + if (isPresent(existingPipe)) + existingPipe.onDestroy(); + var factories = this._getListOfFactories(type, obj); + var factory = this._getMatchingFactory(factories, type, obj); + return factory.create(cdRef); + }, + _getListOfFactories: function(type, obj) { + var listOfFactories = this.config[type]; + if (isBlank(listOfFactories)) { + throw new BaseException(("Cannot find '" + type + "' pipe supporting object '" + obj + "'")); + } + return listOfFactories; + }, + _getMatchingFactory: function(listOfFactories, type, obj) { + var matchingFactory = ListWrapper.find(listOfFactories, (function(pipeFactory) { + return pipeFactory.supports(obj); + })); + if (isBlank(matchingFactory)) { + throw new BaseException(("Cannot find '" + type + "' pipe supporting object '" + obj + "'")); + } + return matchingFactory; + } + }, { + extend: function(config) { + return new Binding(Pipes, { + toFactory: (function(pipes) { + if (isBlank(pipes)) { + throw new BaseException('Cannot extend Pipes without a parent injector'); + } + return Pipes.create(config, pipes); + }), + deps: [[Pipes, new UnboundedMetadata(), new OptionalMetadata()]] + }); + }, + create: function(config) { + var pipes = arguments[1] !== (void 0) ? arguments[1] : null; + if (isPresent(pipes)) { + StringMapWrapper.forEach(pipes.config, (function(v, k) { + if (StringMapWrapper.contains(config, k)) { + var configFactories = config[k]; + config[k] = configFactories.concat(v); + } else { + config[k] = ListWrapper.clone(v); + } + })); + } + return new Pipes(config); + } + })); + $__export("Pipes", Pipes); + $__export("Pipes", Pipes = __decorate([Injectable(), CONST(), __metadata('design:paramtypes', [Object])], Pipes)); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/iterable_changes", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/iterable_changes"; + var __decorate, + __metadata, + CONST, + isListLikeIterable, + iterateListLike, + MapWrapper, + isBlank, + isPresent, + stringify, + getMapKey, + looseIdentical, + isArray, + WrappedValue, + BasePipe, + IterableChangesFactory, + IterableChanges, + CollectionChangeRecord, + _DuplicateItemRecordList, + _DuplicateMap; + return { + setters: [function($__m) { + CONST = $__m.CONST; + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + stringify = $__m.stringify; + getMapKey = $__m.getMapKey; + looseIdentical = $__m.looseIdentical; + isArray = $__m.isArray; + }, function($__m) { + isListLikeIterable = $__m.isListLikeIterable; + iterateListLike = $__m.iterateListLike; + MapWrapper = $__m.MapWrapper; + }, function($__m) { + WrappedValue = $__m.WrappedValue; + BasePipe = $__m.BasePipe; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + IterableChangesFactory = (($traceurRuntime.createClass)(function() {}, { + supports: function(obj) { + return IterableChanges.supportsObj(obj); + }, + create: function(cdRef) { + return new IterableChanges(); + } + }, {})); + $__export("IterableChangesFactory", IterableChangesFactory); + $__export("IterableChangesFactory", IterableChangesFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], IterableChangesFactory)); + IterableChanges = (function($__super) { + function IterableChanges() { + $traceurRuntime.superConstructor(IterableChanges).call(this); + this._collection = null; + this._length = null; + this._linkedRecords = null; + this._unlinkedRecords = null; + this._previousItHead = null; + this._itHead = null; + this._itTail = null; + this._additionsHead = null; + this._additionsTail = null; + this._movesHead = null; + this._movesTail = null; + this._removalsHead = null; + this._removalsTail = null; + } + return ($traceurRuntime.createClass)(IterableChanges, { + supports: function(obj) { + return IterableChanges.supportsObj(obj); + }, + get collection() { + return this._collection; + }, + get length() { + return this._length; + }, + forEachItem: function(fn) { + var record; + for (record = this._itHead; record !== null; record = record._next) { + fn(record); + } + }, + forEachPreviousItem: function(fn) { + var record; + for (record = this._previousItHead; record !== null; record = record._nextPrevious) { + fn(record); + } + }, + forEachAddedItem: function(fn) { + var record; + for (record = this._additionsHead; record !== null; record = record._nextAdded) { + fn(record); + } + }, + forEachMovedItem: function(fn) { + var record; + for (record = this._movesHead; record !== null; record = record._nextMoved) { + fn(record); + } + }, + forEachRemovedItem: function(fn) { + var record; + for (record = this._removalsHead; record !== null; record = record._nextRemoved) { + fn(record); + } + }, + transform: function(collection) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + if (this.check(collection)) { + return WrappedValue.wrap(this); + } else { + return null; + } + }, + check: function(collection) { + var $__0 = this; + this._reset(); + var record = this._itHead; + var mayBeDirty = false; + var index; + var item; + if (isArray(collection)) { + var list = collection; + this._length = collection.length; + for (index = 0; index < this._length; index++) { + item = list[index]; + if (record === null || !looseIdentical(record.item, item)) { + record = this._mismatch(record, item, index); + mayBeDirty = true; + } else if (mayBeDirty) { + record = this._verifyReinsertion(record, item, index); + } + record = record._next; + } + } else { + index = 0; + iterateListLike(collection, (function(item) { + if (record === null || !looseIdentical(record.item, item)) { + record = $__0._mismatch(record, item, index); + mayBeDirty = true; + } else if (mayBeDirty) { + record = $__0._verifyReinsertion(record, item, index); + } + record = record._next; + index++; + })); + this._length = index; + } + this._truncate(record); + this._collection = collection; + return this.isDirty; + }, + get isDirty() { + return this._additionsHead !== null || this._movesHead !== null || this._removalsHead !== null; + }, + _reset: function() { + if (this.isDirty) { + var record; + var nextRecord; + for (record = this._previousItHead = this._itHead; record !== null; record = record._next) { + record._nextPrevious = record._next; + } + for (record = this._additionsHead; record !== null; record = record._nextAdded) { + record.previousIndex = record.currentIndex; + } + this._additionsHead = this._additionsTail = null; + for (record = this._movesHead; record !== null; record = nextRecord) { + record.previousIndex = record.currentIndex; + nextRecord = record._nextMoved; + } + this._movesHead = this._movesTail = null; + this._removalsHead = this._removalsTail = null; + } + }, + _mismatch: function(record, item, index) { + var previousRecord; + if (record === null) { + previousRecord = this._itTail; + } else { + previousRecord = record._prev; + this._remove(record); + } + record = this._linkedRecords === null ? null : this._linkedRecords.get(item, index); + if (record !== null) { + this._moveAfter(record, previousRecord, index); + } else { + record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(item); + if (record !== null) { + this._reinsertAfter(record, previousRecord, index); + } else { + record = this._addAfter(new CollectionChangeRecord(item), previousRecord, index); + } + } + return record; + }, + _verifyReinsertion: function(record, item, index) { + var reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(item); + if (reinsertRecord !== null) { + record = this._reinsertAfter(reinsertRecord, record._prev, index); + } else if (record.currentIndex != index) { + record.currentIndex = index; + this._addToMoves(record, index); + } + return record; + }, + _truncate: function(record) { + while (record !== null) { + var nextRecord = record._next; + this._addToRemovals(this._unlink(record)); + record = nextRecord; + } + if (this._unlinkedRecords !== null) { + this._unlinkedRecords.clear(); + } + if (this._additionsTail !== null) { + this._additionsTail._nextAdded = null; + } + if (this._movesTail !== null) { + this._movesTail._nextMoved = null; + } + if (this._itTail !== null) { + this._itTail._next = null; + } + if (this._removalsTail !== null) { + this._removalsTail._nextRemoved = null; + } + }, + _reinsertAfter: function(record, prevRecord, index) { + if (this._unlinkedRecords !== null) { + this._unlinkedRecords.remove(record); + } + var prev = record._prevRemoved; + var next = record._nextRemoved; + if (prev === null) { + this._removalsHead = next; + } else { + prev._nextRemoved = next; + } + if (next === null) { + this._removalsTail = prev; + } else { + next._prevRemoved = prev; + } + this._insertAfter(record, prevRecord, index); + this._addToMoves(record, index); + return record; + }, + _moveAfter: function(record, prevRecord, index) { + this._unlink(record); + this._insertAfter(record, prevRecord, index); + this._addToMoves(record, index); + return record; + }, + _addAfter: function(record, prevRecord, index) { + this._insertAfter(record, prevRecord, index); + if (this._additionsTail === null) { + this._additionsTail = this._additionsHead = record; + } else { + this._additionsTail = this._additionsTail._nextAdded = record; + } + return record; + }, + _insertAfter: function(record, prevRecord, index) { + var next = prevRecord === null ? this._itHead : prevRecord._next; + record._next = next; + record._prev = prevRecord; + if (next === null) { + this._itTail = record; + } else { + next._prev = record; + } + if (prevRecord === null) { + this._itHead = record; + } else { + prevRecord._next = record; + } + if (this._linkedRecords === null) { + this._linkedRecords = new _DuplicateMap(); + } + this._linkedRecords.put(record); + record.currentIndex = index; + return record; + }, + _remove: function(record) { + return this._addToRemovals(this._unlink(record)); + }, + _unlink: function(record) { + if (this._linkedRecords !== null) { + this._linkedRecords.remove(record); + } + var prev = record._prev; + var next = record._next; + if (prev === null) { + this._itHead = next; + } else { + prev._next = next; + } + if (next === null) { + this._itTail = prev; + } else { + next._prev = prev; + } + return record; + }, + _addToMoves: function(record, toIndex) { + if (record.previousIndex === toIndex) { + return record; + } + if (this._movesTail === null) { + this._movesTail = this._movesHead = record; + } else { + this._movesTail = this._movesTail._nextMoved = record; + } + return record; + }, + _addToRemovals: function(record) { + if (this._unlinkedRecords === null) { + this._unlinkedRecords = new _DuplicateMap(); + } + this._unlinkedRecords.put(record); + record.currentIndex = null; + record._nextRemoved = null; + if (this._removalsTail === null) { + this._removalsTail = this._removalsHead = record; + record._prevRemoved = null; + } else { + record._prevRemoved = this._removalsTail; + this._removalsTail = this._removalsTail._nextRemoved = record; + } + return record; + }, + toString: function() { + var record; + var list = []; + for (record = this._itHead; record !== null; record = record._next) { + list.push(record); + } + var previous = []; + for (record = this._previousItHead; record !== null; record = record._nextPrevious) { + previous.push(record); + } + var additions = []; + for (record = this._additionsHead; record !== null; record = record._nextAdded) { + additions.push(record); + } + var moves = []; + for (record = this._movesHead; record !== null; record = record._nextMoved) { + moves.push(record); + } + var removals = []; + for (record = this._removalsHead; record !== null; record = record._nextRemoved) { + removals.push(record); + } + return "collection: " + list.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" + "additions: " + additions.join(', ') + "\n" + "moves: " + moves.join(', ') + "\n" + "removals: " + removals.join(', ') + "\n"; + } + }, {supportsObj: function(obj) { + return isListLikeIterable(obj); + }}, $__super); + }(BasePipe)); + $__export("IterableChanges", IterableChanges); + CollectionChangeRecord = (function() { + function CollectionChangeRecord(item) { + this.item = item; + this.currentIndex = null; + this.previousIndex = null; + this._nextPrevious = null; + this._prev = null; + this._next = null; + this._prevDup = null; + this._nextDup = null; + this._prevRemoved = null; + this._nextRemoved = null; + this._nextAdded = null; + this._nextMoved = null; + } + return ($traceurRuntime.createClass)(CollectionChangeRecord, {toString: function() { + return this.previousIndex === this.currentIndex ? stringify(this.item) : stringify(this.item) + '[' + stringify(this.previousIndex) + '->' + stringify(this.currentIndex) + ']'; + }}, {}); + }()); + $__export("CollectionChangeRecord", CollectionChangeRecord); + _DuplicateItemRecordList = (function() { + function _DuplicateItemRecordList() { + this._head = null; + this._tail = null; + } + return ($traceurRuntime.createClass)(_DuplicateItemRecordList, { + add: function(record) { + if (this._head === null) { + this._head = this._tail = record; + record._nextDup = null; + record._prevDup = null; + } else { + this._tail._nextDup = record; + record._prevDup = this._tail; + record._nextDup = null; + this._tail = record; + } + }, + get: function(item, afterIndex) { + var record; + for (record = this._head; record !== null; record = record._nextDup) { + if ((afterIndex === null || afterIndex < record.currentIndex) && looseIdentical(record.item, item)) { + return record; + } + } + return null; + }, + remove: function(record) { + var prev = record._prevDup; + var next = record._nextDup; + if (prev === null) { + this._head = next; + } else { + prev._nextDup = next; + } + if (next === null) { + this._tail = prev; + } else { + next._prevDup = prev; + } + return this._head === null; + } + }, {}); + }()); + _DuplicateMap = (function() { + function _DuplicateMap() { + this.map = new Map(); + } + return ($traceurRuntime.createClass)(_DuplicateMap, { + put: function(record) { + var key = getMapKey(record.item); + var duplicates = this.map.get(key); + if (!isPresent(duplicates)) { + duplicates = new _DuplicateItemRecordList(); + this.map.set(key, duplicates); + } + duplicates.add(record); + }, + get: function(value) { + var afterIndex = arguments[1] !== (void 0) ? arguments[1] : null; + var key = getMapKey(value); + var recordList = this.map.get(key); + return isBlank(recordList) ? null : recordList.get(value, afterIndex); + }, + remove: function(record) { + var key = getMapKey(record.item); + var recordList = this.map.get(key); + if (recordList.remove(record)) { + MapWrapper.delete(this.map, key); + } + return record; + }, + get isEmpty() { + return MapWrapper.size(this.map) === 0; + }, + clear: function() { + this.map.clear(); + }, + toString: function() { + return '_DuplicateMap(' + stringify(this.map) + ')'; + } + }, {}); + }()); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/keyvalue_changes", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/keyvalue_changes"; + var __decorate, + __metadata, + MapWrapper, + StringMapWrapper, + stringify, + looseIdentical, + isJsObject, + CONST, + WrappedValue, + BasePipe, + KeyValueChangesFactory, + KeyValueChanges, + KVChangeRecord; + return { + setters: [function($__m) { + MapWrapper = $__m.MapWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + stringify = $__m.stringify; + looseIdentical = $__m.looseIdentical; + isJsObject = $__m.isJsObject; + CONST = $__m.CONST; + }, function($__m) { + WrappedValue = $__m.WrappedValue; + BasePipe = $__m.BasePipe; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + KeyValueChangesFactory = (($traceurRuntime.createClass)(function() {}, { + supports: function(obj) { + return KeyValueChanges.supportsObj(obj); + }, + create: function(cdRef) { + return new KeyValueChanges(); + } + }, {})); + $__export("KeyValueChangesFactory", KeyValueChangesFactory); + $__export("KeyValueChangesFactory", KeyValueChangesFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], KeyValueChangesFactory)); + KeyValueChanges = (function($__super) { + function KeyValueChanges() { + var $__4; + for (var args = [], + $__3 = 0; $__3 < arguments.length; $__3++) + args[$__3] = arguments[$__3]; + ($__4 = $traceurRuntime.superConstructor(KeyValueChanges)).call.apply($__4, $traceurRuntime.spread([this], args)); + this._records = new Map(); + this._mapHead = null; + this._previousMapHead = null; + this._changesHead = null; + this._changesTail = null; + this._additionsHead = null; + this._additionsTail = null; + this._removalsHead = null; + this._removalsTail = null; + } + return ($traceurRuntime.createClass)(KeyValueChanges, { + supports: function(obj) { + return KeyValueChanges.supportsObj(obj); + }, + transform: function(map) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + if (this.check(map)) { + return WrappedValue.wrap(this); + } else { + return null; + } + }, + get isDirty() { + return this._additionsHead !== null || this._changesHead !== null || this._removalsHead !== null; + }, + forEachItem: function(fn) { + var record; + for (record = this._mapHead; record !== null; record = record._next) { + fn(record); + } + }, + forEachPreviousItem: function(fn) { + var record; + for (record = this._previousMapHead; record !== null; record = record._nextPrevious) { + fn(record); + } + }, + forEachChangedItem: function(fn) { + var record; + for (record = this._changesHead; record !== null; record = record._nextChanged) { + fn(record); + } + }, + forEachAddedItem: function(fn) { + var record; + for (record = this._additionsHead; record !== null; record = record._nextAdded) { + fn(record); + } + }, + forEachRemovedItem: function(fn) { + var record; + for (record = this._removalsHead; record !== null; record = record._nextRemoved) { + fn(record); + } + }, + check: function(map) { + var $__0 = this; + this._reset(); + var records = this._records; + var oldSeqRecord = this._mapHead; + var lastOldSeqRecord = null; + var lastNewSeqRecord = null; + var seqChanged = false; + this._forEach(map, (function(value, key) { + var newSeqRecord; + if (oldSeqRecord !== null && key === oldSeqRecord.key) { + newSeqRecord = oldSeqRecord; + if (!looseIdentical(value, oldSeqRecord.currentValue)) { + oldSeqRecord.previousValue = oldSeqRecord.currentValue; + oldSeqRecord.currentValue = value; + $__0._addToChanges(oldSeqRecord); + } + } else { + seqChanged = true; + if (oldSeqRecord !== null) { + oldSeqRecord._next = null; + $__0._removeFromSeq(lastOldSeqRecord, oldSeqRecord); + $__0._addToRemovals(oldSeqRecord); + } + if (records.has(key)) { + newSeqRecord = records.get(key); + } else { + newSeqRecord = new KVChangeRecord(key); + records.set(key, newSeqRecord); + newSeqRecord.currentValue = value; + $__0._addToAdditions(newSeqRecord); + } + } + if (seqChanged) { + if ($__0._isInRemovals(newSeqRecord)) { + $__0._removeFromRemovals(newSeqRecord); + } + if (lastNewSeqRecord == null) { + $__0._mapHead = newSeqRecord; + } else { + lastNewSeqRecord._next = newSeqRecord; + } + } + lastOldSeqRecord = oldSeqRecord; + lastNewSeqRecord = newSeqRecord; + oldSeqRecord = oldSeqRecord === null ? null : oldSeqRecord._next; + })); + this._truncate(lastOldSeqRecord, oldSeqRecord); + return this.isDirty; + }, + _reset: function() { + if (this.isDirty) { + var record; + for (record = this._previousMapHead = this._mapHead; record !== null; record = record._next) { + record._nextPrevious = record._next; + } + for (record = this._changesHead; record !== null; record = record._nextChanged) { + record.previousValue = record.currentValue; + } + for (record = this._additionsHead; record != null; record = record._nextAdded) { + record.previousValue = record.currentValue; + } + this._changesHead = this._changesTail = null; + this._additionsHead = this._additionsTail = null; + this._removalsHead = this._removalsTail = null; + } + }, + _truncate: function(lastRecord, record) { + while (record !== null) { + if (lastRecord === null) { + this._mapHead = null; + } else { + lastRecord._next = null; + } + var nextRecord = record._next; + this._addToRemovals(record); + lastRecord = record; + record = nextRecord; + } + for (var rec = this._removalsHead; rec !== null; rec = rec._nextRemoved) { + rec.previousValue = rec.currentValue; + rec.currentValue = null; + MapWrapper.delete(this._records, rec.key); + } + }, + _isInRemovals: function(record) { + return record === this._removalsHead || record._nextRemoved !== null || record._prevRemoved !== null; + }, + _addToRemovals: function(record) { + if (this._removalsHead === null) { + this._removalsHead = this._removalsTail = record; + } else { + this._removalsTail._nextRemoved = record; + record._prevRemoved = this._removalsTail; + this._removalsTail = record; + } + }, + _removeFromSeq: function(prev, record) { + var next = record._next; + if (prev === null) { + this._mapHead = next; + } else { + prev._next = next; + } + }, + _removeFromRemovals: function(record) { + var prev = record._prevRemoved; + var next = record._nextRemoved; + if (prev === null) { + this._removalsHead = next; + } else { + prev._nextRemoved = next; + } + if (next === null) { + this._removalsTail = prev; + } else { + next._prevRemoved = prev; + } + record._prevRemoved = record._nextRemoved = null; + }, + _addToAdditions: function(record) { + if (this._additionsHead === null) { + this._additionsHead = this._additionsTail = record; + } else { + this._additionsTail._nextAdded = record; + this._additionsTail = record; + } + }, + _addToChanges: function(record) { + if (this._changesHead === null) { + this._changesHead = this._changesTail = record; + } else { + this._changesTail._nextChanged = record; + this._changesTail = record; + } + }, + toString: function() { + var items = []; + var previous = []; + var changes = []; + var additions = []; + var removals = []; + var record; + for (record = this._mapHead; record !== null; record = record._next) { + items.push(stringify(record)); + } + for (record = this._previousMapHead; record !== null; record = record._nextPrevious) { + previous.push(stringify(record)); + } + for (record = this._changesHead; record !== null; record = record._nextChanged) { + changes.push(stringify(record)); + } + for (record = this._additionsHead; record !== null; record = record._nextAdded) { + additions.push(stringify(record)); + } + for (record = this._removalsHead; record !== null; record = record._nextRemoved) { + removals.push(stringify(record)); + } + return "map: " + items.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" + "additions: " + additions.join(', ') + "\n" + "changes: " + changes.join(', ') + "\n" + "removals: " + removals.join(', ') + "\n"; + }, + _forEach: function(obj, fn) { + if (obj instanceof Map) { + MapWrapper.forEach(obj, fn); + } else { + StringMapWrapper.forEach(obj, fn); + } + } + }, {supportsObj: function(obj) { + return obj instanceof Map || isJsObject(obj); + }}, $__super); + }(BasePipe)); + $__export("KeyValueChanges", KeyValueChanges); + KVChangeRecord = (function() { + function KVChangeRecord(key) { + this.key = key; + this.previousValue = null; + this.currentValue = null; + this._nextPrevious = null; + this._next = null; + this._nextAdded = null; + this._nextRemoved = null; + this._prevRemoved = null; + this._nextChanged = null; + } + return ($traceurRuntime.createClass)(KVChangeRecord, {toString: function() { + return looseIdentical(this.previousValue, this.currentValue) ? stringify(this.key) : (stringify(this.key) + '[' + stringify(this.previousValue) + '->' + stringify(this.currentValue) + ']'); + }}, {}); + }()); + $__export("KVChangeRecord", KVChangeRecord); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/observable_pipe", ["angular2/src/facade/async", "angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/observable_pipe"; + var __decorate, + __metadata, + ObservableWrapper, + isBlank, + isPresent, + CONST, + WrappedValue, + ObservablePipe, + ObservablePipeFactory; + return { + setters: [function($__m) { + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + CONST = $__m.CONST; + }, function($__m) { + WrappedValue = $__m.WrappedValue; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + ObservablePipe = (function() { + function ObservablePipe(_ref) { + this._ref = _ref; + this._latestValue = null; + this._latestReturnedValue = null; + this._subscription = null; + this._observable = null; + } + return ($traceurRuntime.createClass)(ObservablePipe, { + supports: function(obs) { + return ObservableWrapper.isObservable(obs); + }, + onDestroy: function() { + if (isPresent(this._subscription)) { + this._dispose(); + } + }, + transform: function(obs) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + if (isBlank(this._subscription)) { + this._subscribe(obs); + return null; + } + if (obs !== this._observable) { + this._dispose(); + return this.transform(obs); + } + if (this._latestValue === this._latestReturnedValue) { + return this._latestReturnedValue; + } else { + this._latestReturnedValue = this._latestValue; + return WrappedValue.wrap(this._latestValue); + } + }, + _subscribe: function(obs) { + var $__0 = this; + this._observable = obs; + this._subscription = ObservableWrapper.subscribe(obs, (function(value) { + return $__0._updateLatestValue(value); + }), (function(e) { + throw e; + })); + }, + _dispose: function() { + ObservableWrapper.dispose(this._subscription); + this._latestValue = null; + this._latestReturnedValue = null; + this._subscription = null; + this._observable = null; + }, + _updateLatestValue: function(value) { + this._latestValue = value; + this._ref.requestCheck(); + } + }, {}); + }()); + $__export("ObservablePipe", ObservablePipe); + ObservablePipeFactory = (($traceurRuntime.createClass)(function() {}, { + supports: function(obs) { + return ObservableWrapper.isObservable(obs); + }, + create: function(cdRef) { + return new ObservablePipe(cdRef); + } + }, {})); + $__export("ObservablePipeFactory", ObservablePipeFactory); + $__export("ObservablePipeFactory", ObservablePipeFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], ObservablePipeFactory)); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/promise_pipe", ["angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/promise_pipe"; + var __decorate, + __metadata, + isBlank, + isPresent, + isPromise, + CONST, + WrappedValue, + PromisePipe, + PromisePipeFactory; + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + isPromise = $__m.isPromise; + CONST = $__m.CONST; + }, function($__m) { + WrappedValue = $__m.WrappedValue; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + PromisePipe = (function() { + function PromisePipe(_ref) { + this._ref = _ref; + this._latestValue = null; + this._latestReturnedValue = null; + } + return ($traceurRuntime.createClass)(PromisePipe, { + supports: function(promise) { + return isPromise(promise); + }, + onDestroy: function() { + if (isPresent(this._sourcePromise)) { + this._latestValue = null; + this._latestReturnedValue = null; + this._sourcePromise = null; + } + }, + transform: function(promise) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + var $__0 = this; + if (isBlank(this._sourcePromise)) { + this._sourcePromise = promise; + promise.then((function(val) { + if ($__0._sourcePromise === promise) { + $__0._updateLatestValue(val); + } + })); + return null; + } + if (promise !== this._sourcePromise) { + this._sourcePromise = null; + return this.transform(promise); + } + if (this._latestValue === this._latestReturnedValue) { + return this._latestReturnedValue; + } else { + this._latestReturnedValue = this._latestValue; + return WrappedValue.wrap(this._latestValue); + } + }, + _updateLatestValue: function(value) { + this._latestValue = value; + this._ref.requestCheck(); + } + }, {}); + }()); + $__export("PromisePipe", PromisePipe); + PromisePipeFactory = (($traceurRuntime.createClass)(function() {}, { + supports: function(promise) { + return isPromise(promise); + }, + create: function(cdRef) { + return new PromisePipe(cdRef); + } + }, {})); + $__export("PromisePipeFactory", PromisePipeFactory); + $__export("PromisePipeFactory", PromisePipeFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], PromisePipeFactory)); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/uppercase_pipe", ["angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/uppercase_pipe"; + var __decorate, + __metadata, + isString, + StringWrapper, + CONST, + BasePipe, + UpperCasePipe; + return { + setters: [function($__m) { + isString = $__m.isString; + StringWrapper = $__m.StringWrapper; + CONST = $__m.CONST; + }, function($__m) { + BasePipe = $__m.BasePipe; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + UpperCasePipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, { + supports: function(str) { + return isString(str); + }, + transform: function(value) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + return StringWrapper.toUpperCase(value); + }, + create: function(cdRef) { + return this; + } + }, {}, $__super); + }(BasePipe)); + $__export("UpperCasePipe", UpperCasePipe); + $__export("UpperCasePipe", UpperCasePipe = __decorate([CONST(), __metadata('design:paramtypes', [])], UpperCasePipe)); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/lowercase_pipe", ["angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/lowercase_pipe"; + var __decorate, + __metadata, + isString, + StringWrapper, + CONST, + BasePipe, + LowerCasePipe; + return { + setters: [function($__m) { + isString = $__m.isString; + StringWrapper = $__m.StringWrapper; + CONST = $__m.CONST; + }, function($__m) { + BasePipe = $__m.BasePipe; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + LowerCasePipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, { + supports: function(str) { + return isString(str); + }, + transform: function(value) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + return StringWrapper.toLowerCase(value); + }, + create: function(cdRef) { + return this; + } + }, {}, $__super); + }(BasePipe)); + $__export("LowerCasePipe", LowerCasePipe); + $__export("LowerCasePipe", LowerCasePipe = __decorate([CONST(), __metadata('design:paramtypes', [])], LowerCasePipe)); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/json_pipe", ["angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/json_pipe"; + var __decorate, + __metadata, + Json, + CONST, + BasePipe, + JsonPipe; + return { + setters: [function($__m) { + Json = $__m.Json; + CONST = $__m.CONST; + }, function($__m) { + BasePipe = $__m.BasePipe; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + JsonPipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, { + transform: function(value) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + return Json.stringify(value); + }, + create: function(cdRef) { + return this; + } + }, {}, $__super); + }(BasePipe)); + $__export("JsonPipe", JsonPipe); + $__export("JsonPipe", JsonPipe = __decorate([CONST(), __metadata('design:paramtypes', [])], JsonPipe)); + } + }; +}); + +System.register("angular2/src/facade/math", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/facade/math"; + var global, + Math, + NaN; + return { + setters: [function($__m) { + global = $__m.global; + }], + execute: function() { + Math = global.Math; + $__export("Math", Math); + NaN = typeof NaN; + $__export("NaN", NaN); + } + }; +}); + +System.register("angular2/src/facade/intl", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/facade/intl"; + var NumberFormatStyle, + NumberFormatter, + dateFormatterCache, + DateFormatter; + function digitCondition(len) { + return len == 2 ? '2-digit' : 'numeric'; + } + function nameCondition(len) { + return len < 4 ? 'short' : 'long'; + } + function extractComponents(pattern) { + var ret = {}; + var i = 0, + j; + while (i < pattern.length) { + j = i; + while (j < pattern.length && pattern[j] == pattern[i]) + j++; + var len = j - i; + switch (pattern[i]) { + case 'G': + ret.era = nameCondition(len); + break; + case 'y': + ret.year = digitCondition(len); + break; + case 'M': + if (len >= 3) + ret.month = nameCondition(len); + else + ret.month = digitCondition(len); + break; + case 'd': + ret.day = digitCondition(len); + break; + case 'E': + ret.weekday = nameCondition(len); + break; + case 'j': + ret.hour = digitCondition(len); + break; + case 'h': + ret.hour = digitCondition(len); + ret.hour12 = true; + break; + case 'H': + ret.hour = digitCondition(len); + ret.hour12 = false; + break; + case 'm': + ret.minute = digitCondition(len); + break; + case 's': + ret.second = digitCondition(len); + break; + case 'z': + ret.timeZoneName = 'long'; + break; + case 'Z': + ret.timeZoneName = 'short'; + break; + } + i = j; + } + return ret; + } + return { + setters: [], + execute: function() { + $__export("NumberFormatStyle", NumberFormatStyle); + (function(NumberFormatStyle) { + NumberFormatStyle[NumberFormatStyle["DECIMAL"] = 0] = "DECIMAL"; + NumberFormatStyle[NumberFormatStyle["PERCENT"] = 1] = "PERCENT"; + NumberFormatStyle[NumberFormatStyle["CURRENCY"] = 2] = "CURRENCY"; + })(NumberFormatStyle || ($__export("NumberFormatStyle", NumberFormatStyle = {}))); + NumberFormatter = (function() { + function NumberFormatter() {} + return ($traceurRuntime.createClass)(NumberFormatter, {}, {format: function(number, locale, style) { + var $__2, + $__3, + $__4, + $__5; + var $__1 = arguments[3] !== (void 0) ? arguments[3] : {}, + minimumIntegerDigits = ($__2 = $__1.minimumIntegerDigits) === void 0 ? 1 : $__2, + minimumFractionDigits = ($__3 = $__1.minimumFractionDigits) === void 0 ? 0 : $__3, + maximumFractionDigits = ($__4 = $__1.maximumFractionDigits) === void 0 ? 3 : $__4, + currency = $__1.currency, + currencyAsSymbol = ($__5 = $__1.currencyAsSymbol) === void 0 ? false : $__5; + var intlOptions = { + minimumIntegerDigits: minimumIntegerDigits, + minimumFractionDigits: minimumFractionDigits, + maximumFractionDigits: maximumFractionDigits + }; + intlOptions.style = NumberFormatStyle[style].toLowerCase(); + if (style == NumberFormatStyle.CURRENCY) { + intlOptions.currency = currency; + intlOptions.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code'; + } + return new Intl.NumberFormat(locale, intlOptions).format(number); + }}); + }()); + $__export("NumberFormatter", NumberFormatter); + dateFormatterCache = new Map(); + DateFormatter = (function() { + function DateFormatter() {} + return ($traceurRuntime.createClass)(DateFormatter, {}, {format: function(date, locale, pattern) { + var key = locale + pattern; + if (dateFormatterCache.has(key)) { + return dateFormatterCache.get(key).format(date); + } + var formatter = new Intl.DateTimeFormat(locale, extractComponents(pattern)); + dateFormatterCache.set(key, formatter); + return formatter.format(date); + }}); + }()); + $__export("DateFormatter", DateFormatter); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/number_pipe", ["angular2/src/facade/lang", "angular2/src/facade/intl", "angular2/src/facade/collection", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/number_pipe"; + var __decorate, + __metadata, + isNumber, + isPresent, + isBlank, + NumberWrapper, + RegExpWrapper, + BaseException, + CONST, + NumberFormatter, + NumberFormatStyle, + ListWrapper, + BasePipe, + defaultLocale, + _re, + NumberPipe, + DecimalPipe, + PercentPipe, + CurrencyPipe; + return { + setters: [function($__m) { + isNumber = $__m.isNumber; + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + NumberWrapper = $__m.NumberWrapper; + RegExpWrapper = $__m.RegExpWrapper; + BaseException = $__m.BaseException; + CONST = $__m.CONST; + }, function($__m) { + NumberFormatter = $__m.NumberFormatter; + NumberFormatStyle = $__m.NumberFormatStyle; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + BasePipe = $__m.BasePipe; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + defaultLocale = 'en-US'; + _re = RegExpWrapper.create('^(\\d+)?\\.((\\d+)(\\-(\\d+))?)?$'); + NumberPipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, { + supports: function(obj) { + return isNumber(obj); + }, + create: function(cdRef) { + return this; + } + }, {_format: function(value, style, digits) { + var currency = arguments[3] !== (void 0) ? arguments[3] : null; + var currencyAsSymbol = arguments[4] !== (void 0) ? arguments[4] : false; + var minInt = 1, + minFraction = 0, + maxFraction = 3; + if (isPresent(digits)) { + var parts = RegExpWrapper.firstMatch(_re, digits); + if (isBlank(parts)) { + throw new BaseException((digits + " is not a valid digit info for number pipes")); + } + if (isPresent(parts[1])) { + minInt = NumberWrapper.parseIntAutoRadix(parts[1]); + } + if (isPresent(parts[3])) { + minFraction = NumberWrapper.parseIntAutoRadix(parts[3]); + } + if (isPresent(parts[5])) { + maxFraction = NumberWrapper.parseIntAutoRadix(parts[5]); + } + } + return NumberFormatter.format(value, defaultLocale, style, { + minimumIntegerDigits: minInt, + minimumFractionDigits: minFraction, + maximumFractionDigits: maxFraction, + currency: currency, + currencyAsSymbol: currencyAsSymbol + }); + }}, $__super); + }(BasePipe)); + $__export("NumberPipe", NumberPipe); + $__export("NumberPipe", NumberPipe = __decorate([CONST(), __metadata('design:paramtypes', [])], NumberPipe)); + DecimalPipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, {transform: function(value, args) { + var digits = ListWrapper.first(args); + return NumberPipe._format(value, NumberFormatStyle.DECIMAL, digits); + }}, {}, $__super); + }(NumberPipe)); + $__export("DecimalPipe", DecimalPipe); + $__export("DecimalPipe", DecimalPipe = __decorate([CONST(), __metadata('design:paramtypes', [])], DecimalPipe)); + PercentPipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, {transform: function(value, args) { + var digits = ListWrapper.first(args); + return NumberPipe._format(value, NumberFormatStyle.PERCENT, digits); + }}, {}, $__super); + }(NumberPipe)); + $__export("PercentPipe", PercentPipe); + $__export("PercentPipe", PercentPipe = __decorate([CONST(), __metadata('design:paramtypes', [])], PercentPipe)); + CurrencyPipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, {transform: function(value, args) { + var currencyCode = isPresent(args) && args.length > 0 ? args[0] : 'USD'; + var symbolDisplay = isPresent(args) && args.length > 1 ? args[1] : false; + var digits = isPresent(args) && args.length > 2 ? args[2] : null; + return NumberPipe._format(value, NumberFormatStyle.CURRENCY, digits, currencyCode, symbolDisplay); + }}, {}, $__super); + }(NumberPipe)); + $__export("CurrencyPipe", CurrencyPipe); + $__export("CurrencyPipe", CurrencyPipe = __decorate([CONST(), __metadata('design:paramtypes', [])], CurrencyPipe)); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/null_pipe", ["angular2/src/facade/lang", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/null_pipe"; + var __decorate, + __metadata, + isBlank, + CONST, + BasePipe, + WrappedValue, + NullPipeFactory, + NullPipe; + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + CONST = $__m.CONST; + }, function($__m) { + BasePipe = $__m.BasePipe; + WrappedValue = $__m.WrappedValue; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + NullPipeFactory = (($traceurRuntime.createClass)(function() {}, { + supports: function(obj) { + return NullPipe.supportsObj(obj); + }, + create: function(cdRef) { + return new NullPipe(); + } + }, {})); + $__export("NullPipeFactory", NullPipeFactory); + $__export("NullPipeFactory", NullPipeFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], NullPipeFactory)); + NullPipe = (function($__super) { + function NullPipe() { + var $__3; + for (var args = [], + $__2 = 0; $__2 < arguments.length; $__2++) + args[$__2] = arguments[$__2]; + ($__3 = $traceurRuntime.superConstructor(NullPipe)).call.apply($__3, $traceurRuntime.spread([this], args)); + this.called = false; + } + return ($traceurRuntime.createClass)(NullPipe, { + supports: function(obj) { + return NullPipe.supportsObj(obj); + }, + transform: function(value) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + if (!this.called) { + this.called = true; + return WrappedValue.wrap(null); + } else { + return null; + } + } + }, {supportsObj: function(obj) { + return isBlank(obj); + }}, $__super); + }(BasePipe)); + $__export("NullPipe", NullPipe); + } + }; +}); + +System.register("angular2/src/change_detection/interfaces", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/interfaces"; + var __decorate, + __metadata, + CONST, + ChangeDetection, + ChangeDetectorDefinition; + return { + setters: [function($__m) { + CONST = $__m.CONST; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + ChangeDetection = (($traceurRuntime.createClass)(function() {}, {createProtoChangeDetector: function(definition) { + return null; + }}, {})); + $__export("ChangeDetection", ChangeDetection); + $__export("ChangeDetection", ChangeDetection = __decorate([CONST(), __metadata('design:paramtypes', [])], ChangeDetection)); + ChangeDetectorDefinition = (function() { + function ChangeDetectorDefinition(id, strategy, variableNames, bindingRecords, directiveRecords, generateCheckNoChanges) { + this.id = id; + this.strategy = strategy; + this.variableNames = variableNames; + this.bindingRecords = bindingRecords; + this.directiveRecords = directiveRecords; + this.generateCheckNoChanges = generateCheckNoChanges; + } + return ($traceurRuntime.createClass)(ChangeDetectorDefinition, {}, {}); + }()); + $__export("ChangeDetectorDefinition", ChangeDetectorDefinition); + } + }; +}); + +System.register("angular2/src/change_detection/parser/lexer", ["angular2/src/di/decorators", "angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/parser/lexer"; + var __decorate, + __metadata, + Injectable, + SetWrapper, + NumberWrapper, + StringJoiner, + StringWrapper, + BaseException, + isPresent, + TokenType, + Lexer, + Token, + EOF, + $EOF, + $TAB, + $LF, + $VTAB, + $FF, + $CR, + $SPACE, + $BANG, + $DQ, + $HASH, + $$, + $PERCENT, + $AMPERSAND, + $SQ, + $LPAREN, + $RPAREN, + $STAR, + $PLUS, + $COMMA, + $MINUS, + $PERIOD, + $SLASH, + $COLON, + $SEMICOLON, + $LT, + $EQ, + $GT, + $QUESTION, + $0, + $9, + $A, + $E, + $Z, + $LBRACKET, + $BACKSLASH, + $RBRACKET, + $CARET, + $_, + $a, + $e, + $f, + $n, + $r, + $t, + $u, + $v, + $z, + $LBRACE, + $BAR, + $RBRACE, + $NBSP, + ScannerError, + _Scanner, + OPERATORS, + KEYWORDS; + function newCharacterToken(index, code) { + return new Token(index, TokenType.CHARACTER, code, StringWrapper.fromCharCode(code)); + } + function newIdentifierToken(index, text) { + return new Token(index, TokenType.IDENTIFIER, 0, text); + } + function newKeywordToken(index, text) { + return new Token(index, TokenType.KEYWORD, 0, text); + } + function newOperatorToken(index, text) { + return new Token(index, TokenType.OPERATOR, 0, text); + } + function newStringToken(index, text) { + return new Token(index, TokenType.STRING, 0, text); + } + function newNumberToken(index, n) { + return new Token(index, TokenType.NUMBER, n, ""); + } + function isWhitespace(code) { + return (code >= $TAB && code <= $SPACE) || (code == $NBSP); + } + function isIdentifierStart(code) { + return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || (code == $_) || (code == $$); + } + function isIdentifierPart(code) { + return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || ($0 <= code && code <= $9) || (code == $_) || (code == $$); + } + function isDigit(code) { + return $0 <= code && code <= $9; + } + function isExponentStart(code) { + return code == $e || code == $E; + } + function isExponentSign(code) { + return code == $MINUS || code == $PLUS; + } + function unescape(code) { + switch (code) { + case $n: + return $LF; + case $f: + return $FF; + case $r: + return $CR; + case $t: + return $TAB; + case $v: + return $VTAB; + default: + return code; + } + } + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + SetWrapper = $__m.SetWrapper; + }, function($__m) { + NumberWrapper = $__m.NumberWrapper; + StringJoiner = $__m.StringJoiner; + StringWrapper = $__m.StringWrapper; + BaseException = $__m.BaseException; + isPresent = $__m.isPresent; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + $__export("TokenType", TokenType); + (function(TokenType) { + TokenType[TokenType["CHARACTER"] = 0] = "CHARACTER"; + TokenType[TokenType["IDENTIFIER"] = 1] = "IDENTIFIER"; + TokenType[TokenType["KEYWORD"] = 2] = "KEYWORD"; + TokenType[TokenType["STRING"] = 3] = "STRING"; + TokenType[TokenType["OPERATOR"] = 4] = "OPERATOR"; + TokenType[TokenType["NUMBER"] = 5] = "NUMBER"; + })(TokenType || ($__export("TokenType", TokenType = {}))); + Lexer = (($traceurRuntime.createClass)(function() {}, {tokenize: function(text) { + var scanner = new _Scanner(text); + var tokens = []; + var token = scanner.scanToken(); + while (token != null) { + tokens.push(token); + token = scanner.scanToken(); + } + return tokens; + }}, {})); + $__export("Lexer", Lexer); + $__export("Lexer", Lexer = __decorate([Injectable(), __metadata('design:paramtypes', [])], Lexer)); + Token = (function() { + function Token(index, type, numValue, strValue) { + this.index = index; + this.type = type; + this.numValue = numValue; + this.strValue = strValue; + } + return ($traceurRuntime.createClass)(Token, { + isCharacter: function(code) { + return (this.type == TokenType.CHARACTER && this.numValue == code); + }, + isNumber: function() { + return (this.type == TokenType.NUMBER); + }, + isString: function() { + return (this.type == TokenType.STRING); + }, + isOperator: function(operater) { + return (this.type == TokenType.OPERATOR && this.strValue == operater); + }, + isIdentifier: function() { + return (this.type == TokenType.IDENTIFIER); + }, + isKeyword: function() { + return (this.type == TokenType.KEYWORD); + }, + isKeywordVar: function() { + return (this.type == TokenType.KEYWORD && this.strValue == "var"); + }, + isKeywordNull: function() { + return (this.type == TokenType.KEYWORD && this.strValue == "null"); + }, + isKeywordUndefined: function() { + return (this.type == TokenType.KEYWORD && this.strValue == "undefined"); + }, + isKeywordTrue: function() { + return (this.type == TokenType.KEYWORD && this.strValue == "true"); + }, + isKeywordIf: function() { + return (this.type == TokenType.KEYWORD && this.strValue == "if"); + }, + isKeywordElse: function() { + return (this.type == TokenType.KEYWORD && this.strValue == "else"); + }, + isKeywordFalse: function() { + return (this.type == TokenType.KEYWORD && this.strValue == "false"); + }, + toNumber: function() { + return (this.type == TokenType.NUMBER) ? this.numValue : -1; + }, + toString: function() { + switch (this.type) { + case TokenType.CHARACTER: + case TokenType.STRING: + case TokenType.IDENTIFIER: + case TokenType.KEYWORD: + return this.strValue; + case TokenType.NUMBER: + return this.numValue.toString(); + default: + return null; + } + } + }, {}); + }()); + $__export("Token", Token); + EOF = new Token(-1, TokenType.CHARACTER, 0, ""); + $__export("EOF", EOF); + $EOF = 0; + $__export("$EOF", $EOF); + $TAB = 9; + $__export("$TAB", $TAB); + $LF = 10; + $__export("$LF", $LF); + $VTAB = 11; + $__export("$VTAB", $VTAB); + $FF = 12; + $__export("$FF", $FF); + $CR = 13; + $__export("$CR", $CR); + $SPACE = 32; + $__export("$SPACE", $SPACE); + $BANG = 33; + $__export("$BANG", $BANG); + $DQ = 34; + $__export("$DQ", $DQ); + $HASH = 35; + $__export("$HASH", $HASH); + $$ = 36; + $__export("$$", $$); + $PERCENT = 37; + $__export("$PERCENT", $PERCENT); + $AMPERSAND = 38; + $__export("$AMPERSAND", $AMPERSAND); + $SQ = 39; + $__export("$SQ", $SQ); + $LPAREN = 40; + $__export("$LPAREN", $LPAREN); + $RPAREN = 41; + $__export("$RPAREN", $RPAREN); + $STAR = 42; + $__export("$STAR", $STAR); + $PLUS = 43; + $__export("$PLUS", $PLUS); + $COMMA = 44; + $__export("$COMMA", $COMMA); + $MINUS = 45; + $__export("$MINUS", $MINUS); + $PERIOD = 46; + $__export("$PERIOD", $PERIOD); + $SLASH = 47; + $__export("$SLASH", $SLASH); + $COLON = 58; + $__export("$COLON", $COLON); + $SEMICOLON = 59; + $__export("$SEMICOLON", $SEMICOLON); + $LT = 60; + $__export("$LT", $LT); + $EQ = 61; + $__export("$EQ", $EQ); + $GT = 62; + $__export("$GT", $GT); + $QUESTION = 63; + $__export("$QUESTION", $QUESTION); + $0 = 48; + $9 = 57; + $A = 65, $E = 69, $Z = 90; + $LBRACKET = 91; + $__export("$LBRACKET", $LBRACKET); + $BACKSLASH = 92; + $__export("$BACKSLASH", $BACKSLASH); + $RBRACKET = 93; + $__export("$RBRACKET", $RBRACKET); + $CARET = 94; + $_ = 95; + $a = 97, $e = 101, $f = 102, $n = 110, $r = 114, $t = 116, $u = 117, $v = 118, $z = 122; + $LBRACE = 123; + $__export("$LBRACE", $LBRACE); + $BAR = 124; + $__export("$BAR", $BAR); + $RBRACE = 125; + $__export("$RBRACE", $RBRACE); + $NBSP = 160; + ScannerError = (function($__super) { + function ScannerError(message) { + $traceurRuntime.superConstructor(ScannerError).call(this); + this.message = message; + } + return ($traceurRuntime.createClass)(ScannerError, {toString: function() { + return this.message; + }}, {}, $__super); + }(BaseException)); + $__export("ScannerError", ScannerError); + _Scanner = (function() { + function _Scanner(input) { + this.input = input; + this.peek = 0; + this.index = -1; + this.length = input.length; + this.advance(); + } + return ($traceurRuntime.createClass)(_Scanner, { + advance: function() { + this.peek = ++this.index >= this.length ? $EOF : StringWrapper.charCodeAt(this.input, this.index); + }, + scanToken: function() { + var input = this.input, + length = this.length, + peek = this.peek, + index = this.index; + while (peek <= $SPACE) { + if (++index >= length) { + peek = $EOF; + break; + } else { + peek = StringWrapper.charCodeAt(input, index); + } + } + this.peek = peek; + this.index = index; + if (index >= length) { + return null; + } + if (isIdentifierStart(peek)) + return this.scanIdentifier(); + if (isDigit(peek)) + return this.scanNumber(index); + var start = index; + switch (peek) { + case $PERIOD: + this.advance(); + return isDigit(this.peek) ? this.scanNumber(start) : newCharacterToken(start, $PERIOD); + case $LPAREN: + case $RPAREN: + case $LBRACE: + case $RBRACE: + case $LBRACKET: + case $RBRACKET: + case $COMMA: + case $COLON: + case $SEMICOLON: + return this.scanCharacter(start, peek); + case $SQ: + case $DQ: + return this.scanString(); + case $HASH: + case $PLUS: + case $MINUS: + case $STAR: + case $SLASH: + case $PERCENT: + case $CARET: + return this.scanOperator(start, StringWrapper.fromCharCode(peek)); + case $QUESTION: + return this.scanComplexOperator(start, '?', $PERIOD, '.'); + case $LT: + case $GT: + return this.scanComplexOperator(start, StringWrapper.fromCharCode(peek), $EQ, '='); + case $BANG: + case $EQ: + return this.scanComplexOperator(start, StringWrapper.fromCharCode(peek), $EQ, '=', $EQ, '='); + case $AMPERSAND: + return this.scanComplexOperator(start, '&', $AMPERSAND, '&'); + case $BAR: + return this.scanComplexOperator(start, '|', $BAR, '|'); + case $NBSP: + while (isWhitespace(this.peek)) + this.advance(); + return this.scanToken(); + } + this.error(("Unexpected character [" + StringWrapper.fromCharCode(peek) + "]"), 0); + return null; + }, + scanCharacter: function(start, code) { + assert(this.peek == code); + this.advance(); + return newCharacterToken(start, code); + }, + scanOperator: function(start, str) { + assert(this.peek == StringWrapper.charCodeAt(str, 0)); + assert(SetWrapper.has(OPERATORS, str)); + this.advance(); + return newOperatorToken(start, str); + }, + scanComplexOperator: function(start, one, twoCode, two, threeCode, three) { + assert(this.peek == StringWrapper.charCodeAt(one, 0)); + this.advance(); + var str = one; + if (this.peek == twoCode) { + this.advance(); + str += two; + } + if (isPresent(threeCode) && this.peek == threeCode) { + this.advance(); + str += three; + } + assert(SetWrapper.has(OPERATORS, str)); + return newOperatorToken(start, str); + }, + scanIdentifier: function() { + assert(isIdentifierStart(this.peek)); + var start = this.index; + this.advance(); + while (isIdentifierPart(this.peek)) + this.advance(); + var str = this.input.substring(start, this.index); + if (SetWrapper.has(KEYWORDS, str)) { + return newKeywordToken(start, str); + } else { + return newIdentifierToken(start, str); + } + }, + scanNumber: function(start) { + assert(isDigit(this.peek)); + var simple = (this.index === start); + this.advance(); + while (true) { + if (isDigit(this.peek)) {} else if (this.peek == $PERIOD) { + simple = false; + } else if (isExponentStart(this.peek)) { + this.advance(); + if (isExponentSign(this.peek)) + this.advance(); + if (!isDigit(this.peek)) + this.error('Invalid exponent', -1); + simple = false; + } else { + break; + } + this.advance(); + } + var str = this.input.substring(start, this.index); + var value = simple ? NumberWrapper.parseIntAutoRadix(str) : NumberWrapper.parseFloat(str); + return newNumberToken(start, value); + }, + scanString: function() { + assert(this.peek == $SQ || this.peek == $DQ); + var start = this.index; + var quote = this.peek; + this.advance(); + var buffer; + var marker = this.index; + var input = this.input; + while (this.peek != quote) { + if (this.peek == $BACKSLASH) { + if (buffer == null) + buffer = new StringJoiner(); + buffer.add(input.substring(marker, this.index)); + this.advance(); + var unescapedCode = void 0; + if (this.peek == $u) { + var hex = input.substring(this.index + 1, this.index + 5); + try { + unescapedCode = NumberWrapper.parseInt(hex, 16); + } catch (e) { + this.error(("Invalid unicode escape [\\u" + hex + "]"), 0); + } + for (var i = 0; i < 5; i++) { + this.advance(); + } + } else { + unescapedCode = unescape(this.peek); + this.advance(); + } + buffer.add(StringWrapper.fromCharCode(unescapedCode)); + marker = this.index; + } else if (this.peek == $EOF) { + this.error('Unterminated quote', 0); + } else { + this.advance(); + } + } + var last = input.substring(marker, this.index); + this.advance(); + var unescaped = last; + if (buffer != null) { + buffer.add(last); + unescaped = buffer.toString(); + } + return newStringToken(start, unescaped); + }, + error: function(message, offset) { + var position = this.index + offset; + throw new ScannerError(("Lexer Error: " + message + " at column " + position + " in expression [" + this.input + "]")); + } + }, {}); + }()); + OPERATORS = SetWrapper.createFromList(['+', '-', '*', '/', '%', '^', '=', '==', '!=', '===', '!==', '<', '>', '<=', '>=', '&&', '||', '&', '|', '!', '?', '#', '?.']); + KEYWORDS = SetWrapper.createFromList(['var', 'null', 'undefined', 'true', 'false', 'if', 'else']); + } + }; +}); + +System.register("angular2/src/change_detection/parser/parser", ["angular2/src/di/decorators", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/parser/lexer", "angular2/src/reflection/reflection", "angular2/src/change_detection/parser/ast"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/parser/parser"; + var __decorate, + __metadata, + Injectable, + isBlank, + isPresent, + BaseException, + StringWrapper, + ListWrapper, + Lexer, + EOF, + $PERIOD, + $COLON, + $SEMICOLON, + $LBRACKET, + $RBRACKET, + $COMMA, + $LBRACE, + $RBRACE, + $LPAREN, + $RPAREN, + reflector, + Reflector, + EmptyExpr, + ImplicitReceiver, + AccessMember, + SafeAccessMember, + LiteralPrimitive, + Binary, + PrefixNot, + Conditional, + If, + BindingPipe, + Assignment, + Chain, + KeyedAccess, + LiteralArray, + LiteralMap, + Interpolation, + MethodCall, + SafeMethodCall, + FunctionCall, + TemplateBinding, + ASTWithSource, + _implicitReceiver, + INTERPOLATION_REGEXP, + Parser, + _ParseAST, + SimpleExpressionChecker; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + Lexer = $__m.Lexer; + EOF = $__m.EOF; + $PERIOD = $__m.$PERIOD; + $COLON = $__m.$COLON; + $SEMICOLON = $__m.$SEMICOLON; + $LBRACKET = $__m.$LBRACKET; + $RBRACKET = $__m.$RBRACKET; + $COMMA = $__m.$COMMA; + $LBRACE = $__m.$LBRACE; + $RBRACE = $__m.$RBRACE; + $LPAREN = $__m.$LPAREN; + $RPAREN = $__m.$RPAREN; + }, function($__m) { + reflector = $__m.reflector; + Reflector = $__m.Reflector; + }, function($__m) { + EmptyExpr = $__m.EmptyExpr; + ImplicitReceiver = $__m.ImplicitReceiver; + AccessMember = $__m.AccessMember; + SafeAccessMember = $__m.SafeAccessMember; + LiteralPrimitive = $__m.LiteralPrimitive; + Binary = $__m.Binary; + PrefixNot = $__m.PrefixNot; + Conditional = $__m.Conditional; + If = $__m.If; + BindingPipe = $__m.BindingPipe; + Assignment = $__m.Assignment; + Chain = $__m.Chain; + KeyedAccess = $__m.KeyedAccess; + LiteralArray = $__m.LiteralArray; + LiteralMap = $__m.LiteralMap; + Interpolation = $__m.Interpolation; + MethodCall = $__m.MethodCall; + SafeMethodCall = $__m.SafeMethodCall; + FunctionCall = $__m.FunctionCall; + TemplateBinding = $__m.TemplateBinding; + ASTWithSource = $__m.ASTWithSource; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + _implicitReceiver = new ImplicitReceiver(); + INTERPOLATION_REGEXP = /\{\{(.*?)\}\}/g; + Parser = (($traceurRuntime.createClass)(function(_lexer) { + var providedReflector = arguments[1] !== (void 0) ? arguments[1] : null; + this._lexer = _lexer; + this._reflector = isPresent(providedReflector) ? providedReflector : reflector; + }, { + parseAction: function(input, location) { + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, true).parseChain(); + return new ASTWithSource(ast, input, location); + }, + parseBinding: function(input, location) { + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); + return new ASTWithSource(ast, input, location); + }, + parseSimpleBinding: function(input, location) { + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseSimpleBinding(); + return new ASTWithSource(ast, input, location); + }, + parseTemplateBindings: function(input, location) { + var tokens = this._lexer.tokenize(input); + return new _ParseAST(input, location, tokens, this._reflector, false).parseTemplateBindings(); + }, + parseInterpolation: function(input, location) { + var parts = StringWrapper.split(input, INTERPOLATION_REGEXP); + if (parts.length <= 1) { + return null; + } + var strings = []; + var expressions = []; + for (var i = 0; i < parts.length; i++) { + var part = parts[i]; + if (i % 2 === 0) { + strings.push(part); + } else { + var tokens = this._lexer.tokenize(part); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); + expressions.push(ast); + } + } + return new ASTWithSource(new Interpolation(strings, expressions), input, location); + }, + wrapLiteralPrimitive: function(input, location) { + return new ASTWithSource(new LiteralPrimitive(input), input, location); + } + }, {})); + $__export("Parser", Parser); + $__export("Parser", Parser = __decorate([Injectable(), __metadata('design:paramtypes', [Lexer, Reflector])], Parser)); + _ParseAST = (function() { + function _ParseAST(input, location, tokens, reflector, parseAction) { + this.input = input; + this.location = location; + this.tokens = tokens; + this.reflector = reflector; + this.parseAction = parseAction; + this.index = 0; + } + return ($traceurRuntime.createClass)(_ParseAST, { + peek: function(offset) { + var i = this.index + offset; + return i < this.tokens.length ? this.tokens[i] : EOF; + }, + get next() { + return this.peek(0); + }, + get inputIndex() { + return (this.index < this.tokens.length) ? this.next.index : this.input.length; + }, + advance: function() { + this.index++; + }, + optionalCharacter: function(code) { + if (this.next.isCharacter(code)) { + this.advance(); + return true; + } else { + return false; + } + }, + optionalKeywordVar: function() { + if (this.peekKeywordVar()) { + this.advance(); + return true; + } else { + return false; + } + }, + peekKeywordVar: function() { + return this.next.isKeywordVar() || this.next.isOperator('#'); + }, + expectCharacter: function(code) { + if (this.optionalCharacter(code)) + return ; + this.error(("Missing expected " + StringWrapper.fromCharCode(code))); + }, + optionalOperator: function(op) { + if (this.next.isOperator(op)) { + this.advance(); + return true; + } else { + return false; + } + }, + expectOperator: function(operator) { + if (this.optionalOperator(operator)) + return ; + this.error(("Missing expected operator " + operator)); + }, + expectIdentifierOrKeyword: function() { + var n = this.next; + if (!n.isIdentifier() && !n.isKeyword()) { + this.error(("Unexpected token " + n + ", expected identifier or keyword")); + } + this.advance(); + return n.toString(); + }, + expectIdentifierOrKeywordOrString: function() { + var n = this.next; + if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) { + this.error(("Unexpected token " + n + ", expected identifier, keyword, or string")); + } + this.advance(); + return n.toString(); + }, + parseChain: function() { + var exprs = []; + while (this.index < this.tokens.length) { + var expr = this.parsePipe(); + exprs.push(expr); + if (this.optionalCharacter($SEMICOLON)) { + if (!this.parseAction) { + this.error("Binding expression cannot contain chained expression"); + } + while (this.optionalCharacter($SEMICOLON)) {} + } else if (this.index < this.tokens.length) { + this.error(("Unexpected token '" + this.next + "'")); + } + } + if (exprs.length == 0) + return new EmptyExpr(); + if (exprs.length == 1) + return exprs[0]; + return new Chain(exprs); + }, + parseSimpleBinding: function() { + var ast = this.parseChain(); + if (!SimpleExpressionChecker.check(ast)) { + this.error("Simple binding expression can only contain field access and constants'"); + } + return ast; + }, + parsePipe: function() { + var result = this.parseExpression(); + if (this.optionalOperator("|")) { + if (this.parseAction) { + this.error("Cannot have a pipe in an action expression"); + } + do { + var name = this.expectIdentifierOrKeyword(); + var args = []; + while (this.optionalCharacter($COLON)) { + args.push(this.parsePipe()); + } + result = new BindingPipe(result, name, args); + } while (this.optionalOperator("|")); + } + return result; + }, + parseExpression: function() { + var start = this.inputIndex; + var result = this.parseConditional(); + while (this.next.isOperator('=')) { + if (!result.isAssignable) { + var end = this.inputIndex; + var expression = this.input.substring(start, end); + this.error(("Expression " + expression + " is not assignable")); + } + if (!this.parseAction) { + this.error("Binding expression cannot contain assignments"); + } + this.expectOperator('='); + result = new Assignment(result, this.parseConditional()); + } + return result; + }, + parseConditional: function() { + var start = this.inputIndex; + var result = this.parseLogicalOr(); + if (this.optionalOperator('?')) { + var yes = this.parsePipe(); + if (!this.optionalCharacter($COLON)) { + var end = this.inputIndex; + var expression = this.input.substring(start, end); + this.error(("Conditional expression " + expression + " requires all 3 expressions")); + } + var no = this.parsePipe(); + return new Conditional(result, yes, no); + } else { + return result; + } + }, + parseLogicalOr: function() { + var result = this.parseLogicalAnd(); + while (this.optionalOperator('||')) { + result = new Binary('||', result, this.parseLogicalAnd()); + } + return result; + }, + parseLogicalAnd: function() { + var result = this.parseEquality(); + while (this.optionalOperator('&&')) { + result = new Binary('&&', result, this.parseEquality()); + } + return result; + }, + parseEquality: function() { + var result = this.parseRelational(); + while (true) { + if (this.optionalOperator('==')) { + result = new Binary('==', result, this.parseRelational()); + } else if (this.optionalOperator('===')) { + result = new Binary('===', result, this.parseRelational()); + } else if (this.optionalOperator('!=')) { + result = new Binary('!=', result, this.parseRelational()); + } else if (this.optionalOperator('!==')) { + result = new Binary('!==', result, this.parseRelational()); + } else { + return result; + } + } + }, + parseRelational: function() { + var result = this.parseAdditive(); + while (true) { + if (this.optionalOperator('<')) { + result = new Binary('<', result, this.parseAdditive()); + } else if (this.optionalOperator('>')) { + result = new Binary('>', result, this.parseAdditive()); + } else if (this.optionalOperator('<=')) { + result = new Binary('<=', result, this.parseAdditive()); + } else if (this.optionalOperator('>=')) { + result = new Binary('>=', result, this.parseAdditive()); + } else { + return result; + } + } + }, + parseAdditive: function() { + var result = this.parseMultiplicative(); + while (true) { + if (this.optionalOperator('+')) { + result = new Binary('+', result, this.parseMultiplicative()); + } else if (this.optionalOperator('-')) { + result = new Binary('-', result, this.parseMultiplicative()); + } else { + return result; + } + } + }, + parseMultiplicative: function() { + var result = this.parsePrefix(); + while (true) { + if (this.optionalOperator('*')) { + result = new Binary('*', result, this.parsePrefix()); + } else if (this.optionalOperator('%')) { + result = new Binary('%', result, this.parsePrefix()); + } else if (this.optionalOperator('/')) { + result = new Binary('/', result, this.parsePrefix()); + } else { + return result; + } + } + }, + parsePrefix: function() { + if (this.optionalOperator('+')) { + return this.parsePrefix(); + } else if (this.optionalOperator('-')) { + return new Binary('-', new LiteralPrimitive(0), this.parsePrefix()); + } else if (this.optionalOperator('!')) { + return new PrefixNot(this.parsePrefix()); + } else { + return this.parseCallChain(); + } + }, + parseCallChain: function() { + var result = this.parsePrimary(); + while (true) { + if (this.optionalCharacter($PERIOD)) { + result = this.parseAccessMemberOrMethodCall(result, false); + } else if (this.optionalOperator('?.')) { + result = this.parseAccessMemberOrMethodCall(result, true); + } else if (this.optionalCharacter($LBRACKET)) { + var key = this.parsePipe(); + this.expectCharacter($RBRACKET); + result = new KeyedAccess(result, key); + } else if (this.optionalCharacter($LPAREN)) { + var args = this.parseCallArguments(); + this.expectCharacter($RPAREN); + result = new FunctionCall(result, args); + } else { + return result; + } + } + }, + parsePrimary: function() { + if (this.optionalCharacter($LPAREN)) { + var result = this.parsePipe(); + this.expectCharacter($RPAREN); + return result; + } else if (this.next.isKeywordNull() || this.next.isKeywordUndefined()) { + this.advance(); + return new LiteralPrimitive(null); + } else if (this.next.isKeywordTrue()) { + this.advance(); + return new LiteralPrimitive(true); + } else if (this.next.isKeywordFalse()) { + this.advance(); + return new LiteralPrimitive(false); + } else if (this.parseAction && this.next.isKeywordIf()) { + this.advance(); + this.expectCharacter($LPAREN); + var condition = this.parseExpression(); + this.expectCharacter($RPAREN); + var ifExp = this.parseExpressionOrBlock(); + var elseExp; + if (this.next.isKeywordElse()) { + this.advance(); + elseExp = this.parseExpressionOrBlock(); + } + return new If(condition, ifExp, elseExp); + } else if (this.optionalCharacter($LBRACKET)) { + var elements = this.parseExpressionList($RBRACKET); + this.expectCharacter($RBRACKET); + return new LiteralArray(elements); + } else if (this.next.isCharacter($LBRACE)) { + return this.parseLiteralMap(); + } else if (this.next.isIdentifier()) { + return this.parseAccessMemberOrMethodCall(_implicitReceiver, false); + } else if (this.next.isNumber()) { + var value = this.next.toNumber(); + this.advance(); + return new LiteralPrimitive(value); + } else if (this.next.isString()) { + var literalValue = this.next.toString(); + this.advance(); + return new LiteralPrimitive(literalValue); + } else if (this.index >= this.tokens.length) { + this.error(("Unexpected end of expression: " + this.input)); + } else { + this.error(("Unexpected token " + this.next)); + } + throw new BaseException("Fell through all cases in parsePrimary"); + }, + parseExpressionList: function(terminator) { + var result = []; + if (!this.next.isCharacter(terminator)) { + do { + result.push(this.parsePipe()); + } while (this.optionalCharacter($COMMA)); + } + return result; + }, + parseLiteralMap: function() { + var keys = []; + var values = []; + this.expectCharacter($LBRACE); + if (!this.optionalCharacter($RBRACE)) { + do { + var key = this.expectIdentifierOrKeywordOrString(); + keys.push(key); + this.expectCharacter($COLON); + values.push(this.parsePipe()); + } while (this.optionalCharacter($COMMA)); + this.expectCharacter($RBRACE); + } + return new LiteralMap(keys, values); + }, + parseAccessMemberOrMethodCall: function(receiver) { + var isSafe = arguments[1] !== (void 0) ? arguments[1] : false; + var id = this.expectIdentifierOrKeyword(); + if (this.optionalCharacter($LPAREN)) { + var args = this.parseCallArguments(); + this.expectCharacter($RPAREN); + var fn = this.reflector.method(id); + return isSafe ? new SafeMethodCall(receiver, id, fn, args) : new MethodCall(receiver, id, fn, args); + } else { + var getter = this.reflector.getter(id); + var setter = this.reflector.setter(id); + return isSafe ? new SafeAccessMember(receiver, id, getter, setter) : new AccessMember(receiver, id, getter, setter); + } + }, + parseCallArguments: function() { + if (this.next.isCharacter($RPAREN)) + return []; + var positionals = []; + do { + positionals.push(this.parsePipe()); + } while (this.optionalCharacter($COMMA)); + return positionals; + }, + parseExpressionOrBlock: function() { + if (this.optionalCharacter($LBRACE)) { + var block = this.parseBlockContent(); + this.expectCharacter($RBRACE); + return block; + } + return this.parseExpression(); + }, + parseBlockContent: function() { + if (!this.parseAction) { + this.error("Binding expression cannot contain chained expression"); + } + var exprs = []; + while (this.index < this.tokens.length && !this.next.isCharacter($RBRACE)) { + var expr = this.parseExpression(); + exprs.push(expr); + if (this.optionalCharacter($SEMICOLON)) { + while (this.optionalCharacter($SEMICOLON)) {} + } + } + if (exprs.length == 0) + return new EmptyExpr(); + if (exprs.length == 1) + return exprs[0]; + return new Chain(exprs); + }, + expectTemplateBindingKey: function() { + var result = ''; + var operatorFound = false; + do { + result += this.expectIdentifierOrKeywordOrString(); + operatorFound = this.optionalOperator('-'); + if (operatorFound) { + result += '-'; + } + } while (operatorFound); + return result.toString(); + }, + parseTemplateBindings: function() { + var bindings = []; + var prefix = null; + while (this.index < this.tokens.length) { + var keyIsVar = this.optionalKeywordVar(); + var key = this.expectTemplateBindingKey(); + if (!keyIsVar) { + if (prefix == null) { + prefix = key; + } else { + key = prefix + '-' + key; + } + } + this.optionalCharacter($COLON); + var name = null; + var expression = null; + if (keyIsVar) { + if (this.optionalOperator("=")) { + name = this.expectTemplateBindingKey(); + } else { + name = '\$implicit'; + } + } else if (this.next !== EOF && !this.peekKeywordVar()) { + var start = this.inputIndex; + var ast = this.parsePipe(); + var source = this.input.substring(start, this.inputIndex); + expression = new ASTWithSource(ast, source, this.location); + } + bindings.push(new TemplateBinding(key, keyIsVar, name, expression)); + if (!this.optionalCharacter($SEMICOLON)) { + this.optionalCharacter($COMMA); + } + } + return bindings; + }, + error: function(message) { + var index = arguments[1] !== (void 0) ? arguments[1] : null; + if (isBlank(index)) + index = this.index; + var location = (index < this.tokens.length) ? ("at column " + (this.tokens[index].index + 1) + " in") : "at the end of the expression"; + throw new BaseException(("Parser Error: " + message + " " + location + " [" + this.input + "] in " + this.location)); + } + }, {}); + }()); + $__export("_ParseAST", _ParseAST); + SimpleExpressionChecker = (function() { + function SimpleExpressionChecker() { + this.simple = true; + } + return ($traceurRuntime.createClass)(SimpleExpressionChecker, { + visitImplicitReceiver: function(ast) {}, + visitInterpolation: function(ast) { + this.simple = false; + }, + visitLiteralPrimitive: function(ast) {}, + visitAccessMember: function(ast) {}, + visitSafeAccessMember: function(ast) { + this.simple = false; + }, + visitMethodCall: function(ast) { + this.simple = false; + }, + visitSafeMethodCall: function(ast) { + this.simple = false; + }, + visitFunctionCall: function(ast) { + this.simple = false; + }, + visitLiteralArray: function(ast) { + this.visitAll(ast.expressions); + }, + visitLiteralMap: function(ast) { + this.visitAll(ast.values); + }, + visitBinary: function(ast) { + this.simple = false; + }, + visitPrefixNot: function(ast) { + this.simple = false; + }, + visitConditional: function(ast) { + this.simple = false; + }, + visitPipe: function(ast) { + this.simple = false; + }, + visitKeyedAccess: function(ast) { + this.simple = false; + }, + visitAll: function(asts) { + var res = ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }, + visitChain: function(ast) { + this.simple = false; + }, + visitAssignment: function(ast) { + this.simple = false; + }, + visitIf: function(ast) { + this.simple = false; + } + }, {check: function(ast) { + var s = new SimpleExpressionChecker(); + ast.visit(s); + return s.simple; + }}); + }()); + } + }; +}); + +System.register("angular2/src/change_detection/parser/locals", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/parser/locals"; + var isPresent, + BaseException, + MapWrapper, + Locals; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + }, function($__m) { + MapWrapper = $__m.MapWrapper; + }], + execute: function() { + Locals = (function() { + function Locals(parent, current) { + this.parent = parent; + this.current = current; + } + return ($traceurRuntime.createClass)(Locals, { + contains: function(name) { + if (this.current.has(name)) { + return true; + } + if (isPresent(this.parent)) { + return this.parent.contains(name); + } + return false; + }, + get: function(name) { + if (this.current.has(name)) { + return this.current.get(name); + } + if (isPresent(this.parent)) { + return this.parent.get(name); + } + throw new BaseException(("Cannot find '" + name + "'")); + }, + set: function(name, value) { + if (this.current.has(name)) { + this.current.set(name, value); + } else { + throw new BaseException(("Setting of new keys post-construction is not supported. Key: " + name + ".")); + } + }, + clearValues: function() { + MapWrapper.clearValues(this.current); + } + }, {}); + }()); + $__export("Locals", Locals); + } + }; +}); + +System.register("angular2/src/change_detection/binding_record", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/binding_record"; + var isPresent, + DIRECTIVE, + DIRECTIVE_LIFECYCLE, + ELEMENT_PROPERTY, + ELEMENT_ATTRIBUTE, + ELEMENT_CLASS, + ELEMENT_STYLE, + TEXT_NODE, + BindingRecord; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }], + execute: function() { + DIRECTIVE = "directive"; + DIRECTIVE_LIFECYCLE = "directiveLifecycle"; + ELEMENT_PROPERTY = "elementProperty"; + ELEMENT_ATTRIBUTE = "elementAttribute"; + ELEMENT_CLASS = "elementClass"; + ELEMENT_STYLE = "elementStyle"; + TEXT_NODE = "textNode"; + BindingRecord = (function() { + function BindingRecord(mode, implicitReceiver, ast, elementIndex, propertyName, propertyUnit, setter, lifecycleEvent, directiveRecord) { + this.mode = mode; + this.implicitReceiver = implicitReceiver; + this.ast = ast; + this.elementIndex = elementIndex; + this.propertyName = propertyName; + this.propertyUnit = propertyUnit; + this.setter = setter; + this.lifecycleEvent = lifecycleEvent; + this.directiveRecord = directiveRecord; + } + return ($traceurRuntime.createClass)(BindingRecord, { + callOnChange: function() { + return isPresent(this.directiveRecord) && this.directiveRecord.callOnChange; + }, + isOnPushChangeDetection: function() { + return isPresent(this.directiveRecord) && this.directiveRecord.isOnPushChangeDetection(); + }, + isDirective: function() { + return this.mode === DIRECTIVE; + }, + isDirectiveLifecycle: function() { + return this.mode === DIRECTIVE_LIFECYCLE; + }, + isElementProperty: function() { + return this.mode === ELEMENT_PROPERTY; + }, + isElementAttribute: function() { + return this.mode === ELEMENT_ATTRIBUTE; + }, + isElementClass: function() { + return this.mode === ELEMENT_CLASS; + }, + isElementStyle: function() { + return this.mode === ELEMENT_STYLE; + }, + isTextNode: function() { + return this.mode === TEXT_NODE; + } + }, { + createForDirective: function(ast, propertyName, setter, directiveRecord) { + return new BindingRecord(DIRECTIVE, 0, ast, 0, propertyName, null, setter, null, directiveRecord); + }, + createDirectiveOnCheck: function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, 0, null, 0, null, null, null, "onCheck", directiveRecord); + }, + createDirectiveOnInit: function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, 0, null, 0, null, null, null, "onInit", directiveRecord); + }, + createDirectiveOnChange: function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, 0, null, 0, null, null, null, "onChange", directiveRecord); + }, + createForElementProperty: function(ast, elementIndex, propertyName) { + return new BindingRecord(ELEMENT_PROPERTY, 0, ast, elementIndex, propertyName, null, null, null, null); + }, + createForElementAttribute: function(ast, elementIndex, attributeName) { + return new BindingRecord(ELEMENT_ATTRIBUTE, 0, ast, elementIndex, attributeName, null, null, null, null); + }, + createForElementClass: function(ast, elementIndex, className) { + return new BindingRecord(ELEMENT_CLASS, 0, ast, elementIndex, className, null, null, null, null); + }, + createForElementStyle: function(ast, elementIndex, styleName, unit) { + return new BindingRecord(ELEMENT_STYLE, 0, ast, elementIndex, styleName, unit, null, null, null); + }, + createForHostProperty: function(directiveIndex, ast, propertyName) { + return new BindingRecord(ELEMENT_PROPERTY, directiveIndex, ast, directiveIndex.elementIndex, propertyName, null, null, null, null); + }, + createForHostAttribute: function(directiveIndex, ast, attributeName) { + return new BindingRecord(ELEMENT_ATTRIBUTE, directiveIndex, ast, directiveIndex.elementIndex, attributeName, null, null, null, null); + }, + createForHostClass: function(directiveIndex, ast, className) { + return new BindingRecord(ELEMENT_CLASS, directiveIndex, ast, directiveIndex.elementIndex, className, null, null, null, null); + }, + createForHostStyle: function(directiveIndex, ast, styleName, unit) { + return new BindingRecord(ELEMENT_STYLE, directiveIndex, ast, directiveIndex.elementIndex, styleName, unit, null, null, null); + }, + createForTextNode: function(ast, elementIndex) { + return new BindingRecord(TEXT_NODE, 0, ast, elementIndex, null, null, null, null, null); + } + }); + }()); + $__export("BindingRecord", BindingRecord); + } + }; +}); + +System.register("angular2/src/core/compiler/element_binder", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/element_binder"; + var isBlank, + isPresent, + BaseException, + ElementBinder; + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + }], + execute: function() { + ElementBinder = (function() { + function ElementBinder(index, parent, distanceToParent, protoElementInjector, componentDirective) { + this.index = index; + this.parent = parent; + this.distanceToParent = distanceToParent; + this.protoElementInjector = protoElementInjector; + this.componentDirective = componentDirective; + this.nestedProtoView = null; + this.hostListeners = null; + if (isBlank(index)) { + throw new BaseException('null index not allowed.'); + } + } + return ($traceurRuntime.createClass)(ElementBinder, { + hasStaticComponent: function() { + return isPresent(this.componentDirective) && isPresent(this.nestedProtoView); + }, + hasEmbeddedProtoView: function() { + return !isPresent(this.componentDirective) && isPresent(this.nestedProtoView); + } + }, {}); + }()); + $__export("ElementBinder", ElementBinder); + } + }; +}); + +System.register("angular2/src/core/compiler/view_ref", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view_ref"; + var isPresent, + ViewRef, + ProtoViewRef; + function internalView(viewRef) { + return viewRef._view; + } + function internalProtoView(protoViewRef) { + return isPresent(protoViewRef) ? protoViewRef._protoView : null; + } + $__export("internalView", internalView); + $__export("internalProtoView", internalProtoView); + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }], + execute: function() { + ViewRef = (function() { + function ViewRef(_view) { + this._view = _view; + } + return ($traceurRuntime.createClass)(ViewRef, { + get render() { + return this._view.render; + }, + get renderFragment() { + return this._view.renderFragment; + }, + setLocal: function(contextName, value) { + this._view.setLocal(contextName, value); + } + }, {}); + }()); + $__export("ViewRef", ViewRef); + ProtoViewRef = (function() { + function ProtoViewRef(_protoView) { + this._protoView = _protoView; + } + return ($traceurRuntime.createClass)(ProtoViewRef, {}, {}); + }()); + $__export("ProtoViewRef", ProtoViewRef); + } + }; +}); + +System.register("angular2/src/core/annotations_impl/di", ["angular2/src/facade/lang", "angular2/src/di/metadata", "angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/annotations_impl/di"; + var __decorate, + __metadata, + CONST, + stringify, + StringWrapper, + isString, + DependencyMetadata, + resolveForwardRef, + Attribute, + Query, + ViewQuery; + return { + setters: [function($__m) { + CONST = $__m.CONST; + stringify = $__m.stringify; + StringWrapper = $__m.StringWrapper; + isString = $__m.isString; + }, function($__m) { + DependencyMetadata = $__m.DependencyMetadata; + }, function($__m) { + resolveForwardRef = $__m.resolveForwardRef; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Attribute = (function($__super) { + function $__0(attributeName) { + $traceurRuntime.superConstructor($__0).call(this); + this.attributeName = attributeName; + } + return ($traceurRuntime.createClass)($__0, { + get token() { + return this; + }, + toString: function() { + return ("@Attribute(" + stringify(this.attributeName) + ")"); + } + }, {}, $__super); + }(DependencyMetadata)); + $__export("Attribute", Attribute); + $__export("Attribute", Attribute = __decorate([CONST(), __metadata('design:paramtypes', [String])], Attribute)); + Query = (function($__super) { + function $__0(_selector) { + var $__3; + var $__2 = arguments[1] !== (void 0) ? arguments[1] : {}, + descendants = ($__3 = $__2.descendants) === void 0 ? false : $__3; + $traceurRuntime.superConstructor($__0).call(this); + this._selector = _selector; + this.descendants = descendants; + } + return ($traceurRuntime.createClass)($__0, { + get isViewQuery() { + return false; + }, + get selector() { + return resolveForwardRef(this._selector); + }, + get isVarBindingQuery() { + return isString(this.selector); + }, + get varBindings() { + return StringWrapper.split(this.selector, new RegExp(",")); + }, + toString: function() { + return ("@Query(" + stringify(this.selector) + ")"); + } + }, {}, $__super); + }(DependencyMetadata)); + $__export("Query", Query); + $__export("Query", Query = __decorate([CONST(), __metadata('design:paramtypes', [Object, Object])], Query)); + ViewQuery = (function($__super) { + function $__0(_selector) { + var $__3; + var $__2 = arguments[1] !== (void 0) ? arguments[1] : {}, + descendants = ($__3 = $__2.descendants) === void 0 ? false : $__3; + $traceurRuntime.superConstructor($__0).call(this, _selector, {descendants: descendants}); + } + return ($traceurRuntime.createClass)($__0, { + get isViewQuery() { + return true; + }, + toString: function() { + return ("@ViewQuery(" + stringify(this.selector) + ")"); + } + }, {}, $__super); + }(Query)); + $__export("ViewQuery", ViewQuery); + $__export("ViewQuery", ViewQuery = __decorate([CONST(), __metadata('design:paramtypes', [Object, Object])], ViewQuery)); + } + }; +}); + +System.register("angular2/src/render/api", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/api"; + var isPresent, + isBlank, + RegExpWrapper, + Map, + MapWrapper, + EventBinding, + PropertyBindingType, + ElementPropertyBinding, + ElementBinder, + DirectiveBinder, + ViewType, + ProtoViewDto, + DirectiveMetadata, + RenderProtoViewRef, + RenderFragmentRef, + RenderViewRef, + ViewEncapsulation, + ViewDefinition, + RenderProtoViewMergeMapping, + RenderCompiler, + RenderViewWithFragments, + Renderer; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + RegExpWrapper = $__m.RegExpWrapper; + }, function($__m) { + Map = $__m.Map; + MapWrapper = $__m.MapWrapper; + }], + execute: function() { + EventBinding = (function() { + function EventBinding(fullName, source) { + this.fullName = fullName; + this.source = source; + } + return ($traceurRuntime.createClass)(EventBinding, {}, {}); + }()); + $__export("EventBinding", EventBinding); + $__export("PropertyBindingType", PropertyBindingType); + (function(PropertyBindingType) { + PropertyBindingType[PropertyBindingType["PROPERTY"] = 0] = "PROPERTY"; + PropertyBindingType[PropertyBindingType["ATTRIBUTE"] = 1] = "ATTRIBUTE"; + PropertyBindingType[PropertyBindingType["CLASS"] = 2] = "CLASS"; + PropertyBindingType[PropertyBindingType["STYLE"] = 3] = "STYLE"; + })(PropertyBindingType || ($__export("PropertyBindingType", PropertyBindingType = {}))); + ElementPropertyBinding = (function() { + function ElementPropertyBinding(type, astWithSource, property) { + var unit = arguments[3] !== (void 0) ? arguments[3] : null; + this.type = type; + this.astWithSource = astWithSource; + this.property = property; + this.unit = unit; + } + return ($traceurRuntime.createClass)(ElementPropertyBinding, {}, {}); + }()); + $__export("ElementPropertyBinding", ElementPropertyBinding); + ElementBinder = (function() { + function ElementBinder() { + var $__1 = arguments[0] !== (void 0) ? arguments[0] : {}, + index = $__1.index, + parentIndex = $__1.parentIndex, + distanceToParent = $__1.distanceToParent, + directives = $__1.directives, + nestedProtoView = $__1.nestedProtoView, + propertyBindings = $__1.propertyBindings, + variableBindings = $__1.variableBindings, + eventBindings = $__1.eventBindings, + readAttributes = $__1.readAttributes; + this.index = index; + this.parentIndex = parentIndex; + this.distanceToParent = distanceToParent; + this.directives = directives; + this.nestedProtoView = nestedProtoView; + this.propertyBindings = propertyBindings; + this.variableBindings = variableBindings; + this.eventBindings = eventBindings; + this.readAttributes = readAttributes; + } + return ($traceurRuntime.createClass)(ElementBinder, {}, {}); + }()); + $__export("ElementBinder", ElementBinder); + DirectiveBinder = (function() { + function DirectiveBinder($__1) { + var $__2 = $__1, + directiveIndex = $__2.directiveIndex, + propertyBindings = $__2.propertyBindings, + eventBindings = $__2.eventBindings, + hostPropertyBindings = $__2.hostPropertyBindings; + this.directiveIndex = directiveIndex; + this.propertyBindings = propertyBindings; + this.eventBindings = eventBindings; + this.hostPropertyBindings = hostPropertyBindings; + } + return ($traceurRuntime.createClass)(DirectiveBinder, {}, {}); + }()); + $__export("DirectiveBinder", DirectiveBinder); + $__export("ViewType", ViewType); + (function(ViewType) { + ViewType[ViewType["HOST"] = 0] = "HOST"; + ViewType[ViewType["COMPONENT"] = 1] = "COMPONENT"; + ViewType[ViewType["EMBEDDED"] = 2] = "EMBEDDED"; + })(ViewType || ($__export("ViewType", ViewType = {}))); + ProtoViewDto = (function() { + function ProtoViewDto($__1) { + var $__2 = $__1, + render = $__2.render, + elementBinders = $__2.elementBinders, + variableBindings = $__2.variableBindings, + type = $__2.type, + textBindings = $__2.textBindings, + transitiveNgContentCount = $__2.transitiveNgContentCount; + this.render = render; + this.elementBinders = elementBinders; + this.variableBindings = variableBindings; + this.type = type; + this.textBindings = textBindings; + this.transitiveNgContentCount = transitiveNgContentCount; + } + return ($traceurRuntime.createClass)(ProtoViewDto, {}, {}); + }()); + $__export("ProtoViewDto", ProtoViewDto); + DirectiveMetadata = (function() { + function DirectiveMetadata($__1) { + var $__2 = $__1, + id = $__2.id, + selector = $__2.selector, + compileChildren = $__2.compileChildren, + events = $__2.events, + hostListeners = $__2.hostListeners, + hostProperties = $__2.hostProperties, + hostAttributes = $__2.hostAttributes, + hostActions = $__2.hostActions, + properties = $__2.properties, + readAttributes = $__2.readAttributes, + type = $__2.type, + callOnDestroy = $__2.callOnDestroy, + callOnChange = $__2.callOnChange, + callOnCheck = $__2.callOnCheck, + callOnInit = $__2.callOnInit, + callOnAllChangesDone = $__2.callOnAllChangesDone, + changeDetection = $__2.changeDetection, + exportAs = $__2.exportAs; + this.id = id; + this.selector = selector; + this.compileChildren = isPresent(compileChildren) ? compileChildren : true; + this.events = events; + this.hostListeners = hostListeners; + this.hostAttributes = hostAttributes; + this.hostProperties = hostProperties; + this.hostActions = hostActions; + this.properties = properties; + this.readAttributes = readAttributes; + this.type = type; + this.callOnDestroy = callOnDestroy; + this.callOnChange = callOnChange; + this.callOnCheck = callOnCheck; + this.callOnInit = callOnInit; + this.callOnAllChangesDone = callOnAllChangesDone; + this.changeDetection = changeDetection; + this.exportAs = exportAs; + } + return ($traceurRuntime.createClass)(DirectiveMetadata, {}, { + get DIRECTIVE_TYPE() { + return 0; + }, + get COMPONENT_TYPE() { + return 1; + }, + create: function($__1) { + var $__2 = $__1, + id = $__2.id, + selector = $__2.selector, + compileChildren = $__2.compileChildren, + events = $__2.events, + host = $__2.host, + properties = $__2.properties, + readAttributes = $__2.readAttributes, + type = $__2.type, + callOnDestroy = $__2.callOnDestroy, + callOnChange = $__2.callOnChange, + callOnCheck = $__2.callOnCheck, + callOnInit = $__2.callOnInit, + callOnAllChangesDone = $__2.callOnAllChangesDone, + changeDetection = $__2.changeDetection, + exportAs = $__2.exportAs; + var hostListeners = new Map(); + var hostProperties = new Map(); + var hostAttributes = new Map(); + var hostActions = new Map(); + if (isPresent(host)) { + MapWrapper.forEach(host, (function(value, key) { + var matches = RegExpWrapper.firstMatch(DirectiveMetadata._hostRegExp, key); + if (isBlank(matches)) { + hostAttributes.set(key, value); + } else if (isPresent(matches[1])) { + hostProperties.set(matches[1], value); + } else if (isPresent(matches[2])) { + hostListeners.set(matches[2], value); + } else if (isPresent(matches[3])) { + hostActions.set(matches[3], value); + } + })); + } + return new DirectiveMetadata({ + id: id, + selector: selector, + compileChildren: compileChildren, + events: events, + hostListeners: hostListeners, + hostProperties: hostProperties, + hostAttributes: hostAttributes, + hostActions: hostActions, + properties: properties, + readAttributes: readAttributes, + type: type, + callOnDestroy: callOnDestroy, + callOnChange: callOnChange, + callOnCheck: callOnCheck, + callOnInit: callOnInit, + callOnAllChangesDone: callOnAllChangesDone, + changeDetection: changeDetection, + exportAs: exportAs + }); + } + }); + }()); + $__export("DirectiveMetadata", DirectiveMetadata); + DirectiveMetadata._hostRegExp = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\))|(?:@(.+)))$/g; + RenderProtoViewRef = (function() { + function RenderProtoViewRef() {} + return ($traceurRuntime.createClass)(RenderProtoViewRef, {}, {}); + }()); + $__export("RenderProtoViewRef", RenderProtoViewRef); + RenderFragmentRef = (function() { + function RenderFragmentRef() {} + return ($traceurRuntime.createClass)(RenderFragmentRef, {}, {}); + }()); + $__export("RenderFragmentRef", RenderFragmentRef); + RenderViewRef = (function() { + function RenderViewRef() {} + return ($traceurRuntime.createClass)(RenderViewRef, {}, {}); + }()); + $__export("RenderViewRef", RenderViewRef); + $__export("ViewEncapsulation", ViewEncapsulation); + (function(ViewEncapsulation) { + ViewEncapsulation[ViewEncapsulation["EMULATED"] = 0] = "EMULATED"; + ViewEncapsulation[ViewEncapsulation["NATIVE"] = 1] = "NATIVE"; + ViewEncapsulation[ViewEncapsulation["NONE"] = 2] = "NONE"; + })(ViewEncapsulation || ($__export("ViewEncapsulation", ViewEncapsulation = {}))); + ViewDefinition = (function() { + function ViewDefinition() { + var $__1 = arguments[0] !== (void 0) ? arguments[0] : {}, + componentId = $__1.componentId, + templateAbsUrl = $__1.templateAbsUrl, + template = $__1.template, + styleAbsUrls = $__1.styleAbsUrls, + styles = $__1.styles, + directives = $__1.directives, + encapsulation = $__1.encapsulation; + this.componentId = componentId; + this.templateAbsUrl = templateAbsUrl; + this.template = template; + this.styleAbsUrls = styleAbsUrls; + this.styles = styles; + this.directives = directives; + this.encapsulation = isPresent(encapsulation) ? encapsulation : ViewEncapsulation.EMULATED; + } + return ($traceurRuntime.createClass)(ViewDefinition, {}, {}); + }()); + $__export("ViewDefinition", ViewDefinition); + RenderProtoViewMergeMapping = (function() { + function RenderProtoViewMergeMapping(mergedProtoViewRef, fragmentCount, mappedElementIndices, mappedElementCount, mappedTextIndices, hostElementIndicesByViewIndex, nestedViewCountByViewIndex) { + this.mergedProtoViewRef = mergedProtoViewRef; + this.fragmentCount = fragmentCount; + this.mappedElementIndices = mappedElementIndices; + this.mappedElementCount = mappedElementCount; + this.mappedTextIndices = mappedTextIndices; + this.hostElementIndicesByViewIndex = hostElementIndicesByViewIndex; + this.nestedViewCountByViewIndex = nestedViewCountByViewIndex; + } + return ($traceurRuntime.createClass)(RenderProtoViewMergeMapping, {}, {}); + }()); + $__export("RenderProtoViewMergeMapping", RenderProtoViewMergeMapping); + RenderCompiler = (function() { + function RenderCompiler() {} + return ($traceurRuntime.createClass)(RenderCompiler, { + compileHost: function(directiveMetadata) { + return null; + }, + compile: function(view) { + return null; + }, + mergeProtoViewsRecursively: function(protoViewRefs) { + return null; + } + }, {}); + }()); + $__export("RenderCompiler", RenderCompiler); + RenderViewWithFragments = (function() { + function RenderViewWithFragments(viewRef, fragmentRefs) { + this.viewRef = viewRef; + this.fragmentRefs = fragmentRefs; + } + return ($traceurRuntime.createClass)(RenderViewWithFragments, {}, {}); + }()); + $__export("RenderViewWithFragments", RenderViewWithFragments); + Renderer = (function() { + function Renderer() {} + return ($traceurRuntime.createClass)(Renderer, { + createRootHostView: function(hostProtoViewRef, fragmentCount, hostElementSelector) { + return null; + }, + createView: function(protoViewRef, fragmentCount) { + return null; + }, + destroyView: function(viewRef) {}, + attachFragmentAfterFragment: function(previousFragmentRef, fragmentRef) {}, + attachFragmentAfterElement: function(elementRef, fragmentRef) {}, + detachFragment: function(fragmentRef) {}, + hydrateView: function(viewRef) {}, + dehydrateView: function(viewRef) {}, + getNativeElementSync: function(location) { + return null; + }, + setElementProperty: function(location, propertyName, propertyValue) {}, + setElementAttribute: function(location, attributeName, attributeValue) {}, + setElementClass: function(location, className, isAdd) {}, + setElementStyle: function(location, styleName, styleValue) {}, + invokeElementMethod: function(location, methodName, args) {}, + setText: function(viewRef, textNodeIndex, text) {}, + setEventDispatcher: function(viewRef, dispatcher) {} + }, {}); + }()); + $__export("Renderer", Renderer); + } + }; +}); + +System.register("angular2/src/core/compiler/element_ref", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/element_ref"; + var BaseException, + ElementRef; + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + }], + execute: function() { + ElementRef = (function() { + function ElementRef(parentView, boundElementIndex, renderBoundElementIndex, _renderer) { + this._renderer = _renderer; + this.parentView = parentView; + this.boundElementIndex = boundElementIndex; + this.renderBoundElementIndex = renderBoundElementIndex; + } + return ($traceurRuntime.createClass)(ElementRef, { + get renderView() { + return this.parentView.render; + }, + set renderView(viewRef) { + throw new BaseException('Abstract setter'); + }, + get nativeElement() { + return this._renderer.getNativeElementSync(this); + } + }, {}); + }()); + $__export("ElementRef", ElementRef); + } + }; +}); + +System.register("angular2/src/core/compiler/template_ref", ["angular2/src/core/compiler/view_ref"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/template_ref"; + var internalView, + TemplateRef; + return { + setters: [function($__m) { + internalView = $__m.internalView; + }], + execute: function() { + TemplateRef = (function() { + function TemplateRef(elementRef) { + this.elementRef = elementRef; + } + return ($traceurRuntime.createClass)(TemplateRef, { + _getProtoView: function() { + var parentView = internalView(this.elementRef.parentView); + return parentView.proto.elementBinders[this.elementRef.boundElementIndex - parentView.elementOffset].nestedProtoView; + }, + get protoViewRef() { + return this._getProtoView().ref; + }, + hasLocal: function(name) { + return this._getProtoView().protoLocals.has(name); + } + }, {}); + }()); + $__export("TemplateRef", TemplateRef); + } + }; +}); + +System.register("angular2/src/core/compiler/view_pool", ["angular2/di", "angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view_pool"; + var __decorate, + __metadata, + __param, + Inject, + Injectable, + OpaqueToken, + ListWrapper, + Map, + isPresent, + isBlank, + CONST_EXPR, + APP_VIEW_POOL_CAPACITY, + AppViewPool; + return { + setters: [function($__m) { + Inject = $__m.Inject; + Injectable = $__m.Injectable; + OpaqueToken = $__m.OpaqueToken; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + Map = $__m.Map; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + CONST_EXPR = $__m.CONST_EXPR; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + APP_VIEW_POOL_CAPACITY = CONST_EXPR(new OpaqueToken('AppViewPool.viewPoolCapacity')); + $__export("APP_VIEW_POOL_CAPACITY", APP_VIEW_POOL_CAPACITY); + AppViewPool = (($traceurRuntime.createClass)(function(poolCapacityPerProtoView) { + this._pooledViewsPerProtoView = new Map(); + this._poolCapacityPerProtoView = poolCapacityPerProtoView; + }, { + getView: function(protoView) { + var pooledViews = this._pooledViewsPerProtoView.get(protoView); + if (isPresent(pooledViews) && pooledViews.length > 0) { + return ListWrapper.removeLast(pooledViews); + } + return null; + }, + returnView: function(view) { + var protoView = view.proto; + var pooledViews = this._pooledViewsPerProtoView.get(protoView); + if (isBlank(pooledViews)) { + pooledViews = []; + this._pooledViewsPerProtoView.set(protoView, pooledViews); + } + var haveRemainingCapacity = pooledViews.length < this._poolCapacityPerProtoView; + if (haveRemainingCapacity) { + pooledViews.push(view); + } + return haveRemainingCapacity; + } + }, {})); + $__export("AppViewPool", AppViewPool); + $__export("AppViewPool", AppViewPool = __decorate([Injectable(), __param(0, Inject(APP_VIEW_POOL_CAPACITY)), __metadata('design:paramtypes', [Object])], AppViewPool)); + } + }; +}); + +System.register("angular2/src/core/compiler/view_listener", ["angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view_listener"; + var __decorate, + __metadata, + Injectable, + AppViewListener; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + AppViewListener = (($traceurRuntime.createClass)(function() {}, { + viewCreated: function(view) {}, + viewDestroyed: function(view) {} + }, {})); + $__export("AppViewListener", AppViewListener); + $__export("AppViewListener", AppViewListener = __decorate([Injectable(), __metadata('design:paramtypes', [])], AppViewListener)); + } + }; +}); + +System.register("angular2/src/core/compiler/view_container_ref", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/core/compiler/view_ref"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view_container_ref"; + var ListWrapper, + isPresent, + internalView, + ViewContainerRef; + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + internalView = $__m.internalView; + }], + execute: function() { + ViewContainerRef = (function() { + function ViewContainerRef(viewManager, element) { + this.viewManager = viewManager; + this.element = element; + } + return ($traceurRuntime.createClass)(ViewContainerRef, { + _getViews: function() { + var vc = internalView(this.element.parentView).viewContainers[this.element.boundElementIndex]; + return isPresent(vc) ? vc.views : []; + }, + clear: function() { + for (var i = this.length - 1; i >= 0; i--) { + this.remove(i); + } + }, + get: function(index) { + return this._getViews()[index].ref; + }, + get length() { + return this._getViews().length; + }, + createEmbeddedView: function(templateRef) { + var atIndex = arguments[1] !== (void 0) ? arguments[1] : -1; + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.createEmbeddedViewInContainer(this.element, atIndex, templateRef); + }, + createHostView: function() { + var protoViewRef = arguments[0] !== (void 0) ? arguments[0] : null; + var atIndex = arguments[1] !== (void 0) ? arguments[1] : -1; + var dynamicallyCreatedBindings = arguments[2] !== (void 0) ? arguments[2] : null; + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.createHostViewInContainer(this.element, atIndex, protoViewRef, dynamicallyCreatedBindings); + }, + insert: function(viewRef) { + var atIndex = arguments[1] !== (void 0) ? arguments[1] : -1; + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.attachViewInContainer(this.element, atIndex, viewRef); + }, + indexOf: function(viewRef) { + return ListWrapper.indexOf(this._getViews(), internalView(viewRef)); + }, + remove: function() { + var atIndex = arguments[0] !== (void 0) ? arguments[0] : -1; + if (atIndex == -1) + atIndex = this.length - 1; + this.viewManager.destroyViewInContainer(this.element, atIndex); + }, + detach: function() { + var atIndex = arguments[0] !== (void 0) ? arguments[0] : -1; + if (atIndex == -1) + atIndex = this.length - 1; + return this.viewManager.detachViewInContainer(this.element, atIndex); + } + }, {}); + }()); + $__export("ViewContainerRef", ViewContainerRef); + } + }; +}); + +System.register("angular2/src/core/compiler/directive_lifecycle_reflector", ["angular2/src/facade/lang", "angular2/src/core/annotations_impl/annotations"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/directive_lifecycle_reflector"; + var Type, + isPresent, + LifecycleEvent; + function hasLifecycleHook(e, type, annotation) { + if (isPresent(annotation.lifecycle)) { + return annotation.lifecycle.indexOf(e) !== -1; + } else { + if (!(type instanceof Type)) + return false; + var proto = type.prototype; + switch (e) { + case LifecycleEvent.onAllChangesDone: + return !!proto.onAllChangesDone; + case LifecycleEvent.onChange: + return !!proto.onChange; + case LifecycleEvent.onCheck: + return !!proto.onCheck; + case LifecycleEvent.onDestroy: + return !!proto.onDestroy; + case LifecycleEvent.onInit: + return !!proto.onInit; + default: + return false; + } + } + } + $__export("hasLifecycleHook", hasLifecycleHook); + return { + setters: [function($__m) { + Type = $__m.Type; + isPresent = $__m.isPresent; + }, function($__m) { + LifecycleEvent = $__m.LifecycleEvent; + }], + execute: function() { + } + }; +}); + +System.register("angular2/src/core/compiler/query_list", ["angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/query_list"; + var ListWrapper, + QueryList; + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + }], + execute: function() { + QueryList = (function() { + var $__1; + function QueryList() { + this._results = []; + this._callbacks = []; + this._dirty = false; + } + return ($traceurRuntime.createClass)(QueryList, ($__1 = {}, Object.defineProperty($__1, "reset", { + value: function(newList) { + this._results = newList; + this._dirty = true; + }, + configurable: true, + enumerable: true, + writable: true + }), Object.defineProperty($__1, "add", { + value: function(obj) { + this._results.push(obj); + this._dirty = true; + }, + configurable: true, + enumerable: true, + writable: true + }), Object.defineProperty($__1, "fireCallbacks", { + value: function() { + if (this._dirty) { + ListWrapper.forEach(this._callbacks, (function(c) { + return c(); + })); + this._dirty = false; + } + }, + configurable: true, + enumerable: true, + writable: true + }), Object.defineProperty($__1, "onChange", { + value: function(callback) { + this._callbacks.push(callback); + }, + configurable: true, + enumerable: true, + writable: true + }), Object.defineProperty($__1, "removeCallback", { + value: function(callback) { + ListWrapper.remove(this._callbacks, callback); + }, + configurable: true, + enumerable: true, + writable: true + }), Object.defineProperty($__1, "length", { + get: function() { + return this._results.length; + }, + configurable: true, + enumerable: true + }), Object.defineProperty($__1, "first", { + get: function() { + return ListWrapper.first(this._results); + }, + configurable: true, + enumerable: true + }), Object.defineProperty($__1, "last", { + get: function() { + return ListWrapper.last(this._results); + }, + configurable: true, + enumerable: true + }), Object.defineProperty($__1, "map", { + value: function(fn) { + return this._results.map(fn); + }, + configurable: true, + enumerable: true, + writable: true + }), Object.defineProperty($__1, Symbol.iterator, { + value: function() { + return this._results[Symbol.iterator](); + }, + configurable: true, + enumerable: true, + writable: true + }), $__1), {}); + }()); + $__export("QueryList", QueryList); + } + }; +}); + +System.register("angular2/src/core/annotations_impl/view", ["angular2/src/facade/lang", "angular2/src/render/api"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/annotations_impl/view"; + var __decorate, + __metadata, + CONST, + View; + return { + setters: [function($__m) { + CONST = $__m.CONST; + }, function($__m) { + $__export("ViewEncapsulation", $__m.ViewEncapsulation); + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + View = (($traceurRuntime.createClass)(function() { + var $__2 = arguments[0] !== (void 0) ? arguments[0] : {}, + templateUrl = $__2.templateUrl, + template = $__2.template, + directives = $__2.directives, + encapsulation = $__2.encapsulation, + styles = $__2.styles, + styleUrls = $__2.styleUrls; + this.templateUrl = templateUrl; + this.template = template; + this.styleUrls = styleUrls; + this.styles = styles; + this.directives = directives; + this.encapsulation = encapsulation; + }, {}, {})); + $__export("View", View); + $__export("View", View = __decorate([CONST(), __metadata('design:paramtypes', [Object])], View)); + } + }; +}); + +System.register("angular2/src/core/compiler/component_url_mapper", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/component_url_mapper"; + var __decorate, + __metadata, + Injectable, + isPresent, + Map, + ComponentUrlMapper, + RuntimeComponentUrlMapper; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + Map = $__m.Map; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + ComponentUrlMapper = (($traceurRuntime.createClass)(function() {}, {getUrl: function(component) { + return './'; + }}, {})); + $__export("ComponentUrlMapper", ComponentUrlMapper); + $__export("ComponentUrlMapper", ComponentUrlMapper = __decorate([Injectable(), __metadata('design:paramtypes', [])], ComponentUrlMapper)); + RuntimeComponentUrlMapper = (function($__super) { + function RuntimeComponentUrlMapper() { + $traceurRuntime.superConstructor(RuntimeComponentUrlMapper).call(this); + this._componentUrls = new Map(); + } + return ($traceurRuntime.createClass)(RuntimeComponentUrlMapper, { + setComponentUrl: function(component, url) { + this._componentUrls.set(component, url); + }, + getUrl: function(component) { + var url = this._componentUrls.get(component); + if (isPresent(url)) + return url; + return $traceurRuntime.superGet(this, RuntimeComponentUrlMapper.prototype, "getUrl").call(this, component); + } + }, {}, $__super); + }(ComponentUrlMapper)); + $__export("RuntimeComponentUrlMapper", RuntimeComponentUrlMapper); + } + }; +}); + +System.register("angular2/src/core/compiler/proto_view_factory", ["angular2/di", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/reflection/reflection", "angular2/src/change_detection/change_detection", "angular2/src/render/api", "angular2/src/core/compiler/view", "angular2/src/core/compiler/element_injector"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/proto_view_factory"; + var __decorate, + __metadata, + Injectable, + ListWrapper, + MapWrapper, + isPresent, + isBlank, + BaseException, + assertionsEnabled, + reflector, + ChangeDetection, + DirectiveIndex, + BindingRecord, + DirectiveRecord, + DEFAULT, + ChangeDetectorDefinition, + renderApi, + AppProtoView, + ProtoElementInjector, + BindingRecordsCreator, + ProtoViewFactory, + RenderProtoViewWithIndex, + ParentProtoElementInjectorWithDistance; + function getChangeDetectorDefinitions(hostComponentMetadata, rootRenderProtoView, allRenderDirectiveMetadata) { + var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); + var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); + return _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata); + } + function _collectNestedProtoViews(renderProtoView) { + var parentIndex = arguments[1] !== (void 0) ? arguments[1] : null; + var boundElementIndex = arguments[2] !== (void 0) ? arguments[2] : null; + var result = arguments[3] !== (void 0) ? arguments[3] : null; + if (isBlank(result)) { + result = []; + } + result.push(new RenderProtoViewWithIndex(renderProtoView, result.length, parentIndex, boundElementIndex)); + var currentIndex = result.length - 1; + var childBoundElementIndex = 0; + ListWrapper.forEach(renderProtoView.elementBinders, (function(elementBinder) { + if (isPresent(elementBinder.nestedProtoView)) { + _collectNestedProtoViews(elementBinder.nestedProtoView, currentIndex, childBoundElementIndex, result); + } + childBoundElementIndex++; + })); + return result; + } + function _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata) { + return ListWrapper.map(nestedPvsWithIndex, (function(pvWithIndex) { + var elementBinders = pvWithIndex.renderProtoView.elementBinders; + var bindingRecordsCreator = new BindingRecordsCreator(); + var bindingRecords = bindingRecordsCreator.getBindingRecords(pvWithIndex.renderProtoView.textBindings, elementBinders, allRenderDirectiveMetadata); + var directiveRecords = bindingRecordsCreator.getDirectiveRecords(elementBinders, allRenderDirectiveMetadata); + var strategyName = DEFAULT; + var typeString; + if (pvWithIndex.renderProtoView.type === renderApi.ViewType.COMPONENT) { + strategyName = hostComponentMetadata.changeDetection; + typeString = 'comp'; + } else if (pvWithIndex.renderProtoView.type === renderApi.ViewType.HOST) { + typeString = 'host'; + } else { + typeString = 'embedded'; + } + var id = (hostComponentMetadata.id + "_" + typeString + "_" + pvWithIndex.index); + var variableNames = nestedPvVariableNames[pvWithIndex.index]; + return new ChangeDetectorDefinition(id, strategyName, variableNames, bindingRecords, directiveRecords, assertionsEnabled()); + })); + } + function _createAppProtoView(renderProtoView, protoChangeDetector, variableBindings, allDirectives) { + var elementBinders = renderProtoView.elementBinders; + var protoView = new AppProtoView(renderProtoView.type, renderProtoView.transitiveNgContentCount > 0, renderProtoView.render, protoChangeDetector, variableBindings, createVariableLocations(elementBinders), renderProtoView.textBindings.length); + _createElementBinders(protoView, elementBinders, allDirectives); + _bindDirectiveEvents(protoView, elementBinders); + return protoView; + } + function _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex) { + return ListWrapper.map(nestedPvsWithIndex, (function(pvWithIndex) { + return _createVariableBindings(pvWithIndex.renderProtoView); + })); + } + function _createVariableBindings(renderProtoView) { + var variableBindings = new Map(); + MapWrapper.forEach(renderProtoView.variableBindings, (function(mappedName, varName) { + variableBindings.set(varName, mappedName); + })); + return variableBindings; + } + function _collectNestedProtoViewsVariableNames(nestedPvsWithIndex) { + var nestedPvVariableNames = ListWrapper.createFixedSize(nestedPvsWithIndex.length); + ListWrapper.forEach(nestedPvsWithIndex, (function(pvWithIndex) { + var parentVariableNames = isPresent(pvWithIndex.parentIndex) ? nestedPvVariableNames[pvWithIndex.parentIndex] : null; + nestedPvVariableNames[pvWithIndex.index] = _createVariableNames(parentVariableNames, pvWithIndex.renderProtoView); + })); + return nestedPvVariableNames; + } + function _createVariableNames(parentVariableNames, renderProtoView) { + var res = isBlank(parentVariableNames) ? [] : ListWrapper.clone(parentVariableNames); + MapWrapper.forEach(renderProtoView.variableBindings, (function(mappedName, varName) { + res.push(mappedName); + })); + ListWrapper.forEach(renderProtoView.elementBinders, (function(binder) { + MapWrapper.forEach(binder.variableBindings, (function(mappedName, varName) { + res.push(mappedName); + })); + })); + return res; + } + function createVariableLocations(elementBinders) { + var variableLocations = new Map(); + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + MapWrapper.forEach(binder.variableBindings, (function(mappedName, varName) { + variableLocations.set(mappedName, i); + })); + } + return variableLocations; + } + function _createElementBinders(protoView, elementBinders, allDirectiveBindings) { + for (var i = 0; i < elementBinders.length; i++) { + var renderElementBinder = elementBinders[i]; + var dirs = elementBinders[i].directives; + var parentPeiWithDistance = _findParentProtoElementInjectorWithDistance(i, protoView.elementBinders, elementBinders); + var directiveBindings = ListWrapper.map(dirs, (function(dir) { + return allDirectiveBindings[dir.directiveIndex]; + })); + var componentDirectiveBinding = null; + if (directiveBindings.length > 0) { + if (directiveBindings[0].metadata.type === renderApi.DirectiveMetadata.COMPONENT_TYPE) { + componentDirectiveBinding = directiveBindings[0]; + } + } + var protoElementInjector = _createProtoElementInjector(i, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings); + _createElementBinder(protoView, i, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings); + } + } + function _findParentProtoElementInjectorWithDistance(binderIndex, elementBinders, renderElementBinders) { + var distance = 0; + do { + var renderElementBinder = renderElementBinders[binderIndex]; + binderIndex = renderElementBinder.parentIndex; + if (binderIndex !== -1) { + distance += renderElementBinder.distanceToParent; + var elementBinder = elementBinders[binderIndex]; + if (isPresent(elementBinder.protoElementInjector)) { + return new ParentProtoElementInjectorWithDistance(elementBinder.protoElementInjector, distance); + } + } + } while (binderIndex !== -1); + return new ParentProtoElementInjectorWithDistance(null, 0); + } + function _createProtoElementInjector(binderIndex, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings) { + var protoElementInjector = null; + var hasVariables = MapWrapper.size(renderElementBinder.variableBindings) > 0; + if (directiveBindings.length > 0 || hasVariables) { + var directiveVariableBindings = createDirectiveVariableBindings(renderElementBinder, directiveBindings); + protoElementInjector = ProtoElementInjector.create(parentPeiWithDistance.protoElementInjector, binderIndex, directiveBindings, isPresent(componentDirectiveBinding), parentPeiWithDistance.distance, directiveVariableBindings); + protoElementInjector.attributes = renderElementBinder.readAttributes; + } + return protoElementInjector; + } + function _createElementBinder(protoView, boundElementIndex, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings) { + var parent = null; + if (renderElementBinder.parentIndex !== -1) { + parent = protoView.elementBinders[renderElementBinder.parentIndex]; + } + var elBinder = protoView.bindElement(parent, renderElementBinder.distanceToParent, protoElementInjector, componentDirectiveBinding); + protoView.bindEvent(renderElementBinder.eventBindings, boundElementIndex, -1); + MapWrapper.forEach(renderElementBinder.variableBindings, (function(mappedName, varName) { + protoView.protoLocals.set(mappedName, null); + })); + return elBinder; + } + function createDirectiveVariableBindings(renderElementBinder, directiveBindings) { + var directiveVariableBindings = new Map(); + MapWrapper.forEach(renderElementBinder.variableBindings, (function(templateName, exportAs) { + var dirIndex = _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs); + directiveVariableBindings.set(templateName, dirIndex); + })); + return directiveVariableBindings; + } + function _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs) { + var matchedDirectiveIndex = null; + var matchedDirective; + for (var i = 0; i < directiveBindings.length; ++i) { + var directive = directiveBindings[i]; + if (_directiveExportAs(directive) == exportAs) { + if (isPresent(matchedDirective)) { + throw new BaseException(("More than one directive have exportAs = '" + exportAs + "'. Directives: [" + matchedDirective.displayName + ", " + directive.displayName + "]")); + } + matchedDirectiveIndex = i; + matchedDirective = directive; + } + } + if (isBlank(matchedDirective) && exportAs !== "$implicit") { + throw new BaseException(("Cannot find directive with exportAs = '" + exportAs + "'")); + } + return matchedDirectiveIndex; + } + function _directiveExportAs(directive) { + var directiveExportAs = directive.metadata.exportAs; + if (isBlank(directiveExportAs) && directive.metadata.type === renderApi.DirectiveMetadata.COMPONENT_TYPE) { + return "$implicit"; + } else { + return directiveExportAs; + } + } + function _bindDirectiveEvents(protoView, elementBinders) { + for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; ++boundElementIndex) { + var dirs = elementBinders[boundElementIndex].directives; + for (var i = 0; i < dirs.length; i++) { + var directiveBinder = dirs[i]; + protoView.bindEvent(directiveBinder.eventBindings, boundElementIndex, i); + } + } + } + $__export("getChangeDetectorDefinitions", getChangeDetectorDefinitions); + $__export("createVariableLocations", createVariableLocations); + $__export("createDirectiveVariableBindings", createDirectiveVariableBindings); + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + MapWrapper = $__m.MapWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + assertionsEnabled = $__m.assertionsEnabled; + }, function($__m) { + reflector = $__m.reflector; + }, function($__m) { + ChangeDetection = $__m.ChangeDetection; + DirectiveIndex = $__m.DirectiveIndex; + BindingRecord = $__m.BindingRecord; + DirectiveRecord = $__m.DirectiveRecord; + DEFAULT = $__m.DEFAULT; + ChangeDetectorDefinition = $__m.ChangeDetectorDefinition; + }, function($__m) { + renderApi = $__m; + }, function($__m) { + AppProtoView = $__m.AppProtoView; + }, function($__m) { + ProtoElementInjector = $__m.ProtoElementInjector; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + BindingRecordsCreator = (function() { + function BindingRecordsCreator() { + this._directiveRecordsMap = new Map(); + } + return ($traceurRuntime.createClass)(BindingRecordsCreator, { + getBindingRecords: function(textBindings, elementBinders, allDirectiveMetadatas) { + var bindings = []; + this._createTextNodeRecords(bindings, textBindings); + for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; boundElementIndex++) { + var renderElementBinder = elementBinders[boundElementIndex]; + this._createElementPropertyRecords(bindings, boundElementIndex, renderElementBinder); + this._createDirectiveRecords(bindings, boundElementIndex, renderElementBinder.directives, allDirectiveMetadatas); + } + return bindings; + }, + getDirectiveRecords: function(elementBinders, allDirectiveMetadatas) { + var directiveRecords = []; + for (var elementIndex = 0; elementIndex < elementBinders.length; ++elementIndex) { + var dirs = elementBinders[elementIndex].directives; + for (var dirIndex = 0; dirIndex < dirs.length; ++dirIndex) { + directiveRecords.push(this._getDirectiveRecord(elementIndex, dirIndex, allDirectiveMetadatas[dirs[dirIndex].directiveIndex])); + } + } + return directiveRecords; + }, + _createTextNodeRecords: function(bindings, textBindings) { + for (var i = 0; i < textBindings.length; i++) { + bindings.push(BindingRecord.createForTextNode(textBindings[i], i)); + } + }, + _createElementPropertyRecords: function(bindings, boundElementIndex, renderElementBinder) { + ListWrapper.forEach(renderElementBinder.propertyBindings, (function(binding) { + if (binding.type === renderApi.PropertyBindingType.PROPERTY) { + bindings.push(BindingRecord.createForElementProperty(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === renderApi.PropertyBindingType.ATTRIBUTE) { + bindings.push(BindingRecord.createForElementAttribute(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === renderApi.PropertyBindingType.CLASS) { + bindings.push(BindingRecord.createForElementClass(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === renderApi.PropertyBindingType.STYLE) { + bindings.push(BindingRecord.createForElementStyle(binding.astWithSource, boundElementIndex, binding.property, binding.unit)); + } + })); + }, + _createDirectiveRecords: function(bindings, boundElementIndex, directiveBinders, allDirectiveMetadatas) { + for (var i = 0; i < directiveBinders.length; i++) { + var directiveBinder = directiveBinders[i]; + var directiveMetadata = allDirectiveMetadatas[directiveBinder.directiveIndex]; + var directiveRecord = this._getDirectiveRecord(boundElementIndex, i, directiveMetadata); + MapWrapper.forEach(directiveBinder.propertyBindings, (function(astWithSource, propertyName) { + var setter = reflector.setter(propertyName); + bindings.push(BindingRecord.createForDirective(astWithSource, propertyName, setter, directiveRecord)); + })); + if (directiveRecord.callOnChange) { + bindings.push(BindingRecord.createDirectiveOnChange(directiveRecord)); + } + if (directiveRecord.callOnInit) { + bindings.push(BindingRecord.createDirectiveOnInit(directiveRecord)); + } + if (directiveRecord.callOnCheck) { + bindings.push(BindingRecord.createDirectiveOnCheck(directiveRecord)); + } + } + for (var i = 0; i < directiveBinders.length; i++) { + var directiveBinder = directiveBinders[i]; + ListWrapper.forEach(directiveBinder.hostPropertyBindings, (function(binding) { + var dirIndex = new DirectiveIndex(boundElementIndex, i); + if (binding.type === renderApi.PropertyBindingType.PROPERTY) { + bindings.push(BindingRecord.createForHostProperty(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === renderApi.PropertyBindingType.ATTRIBUTE) { + bindings.push(BindingRecord.createForHostAttribute(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === renderApi.PropertyBindingType.CLASS) { + bindings.push(BindingRecord.createForHostClass(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === renderApi.PropertyBindingType.STYLE) { + bindings.push(BindingRecord.createForHostStyle(dirIndex, binding.astWithSource, binding.property, binding.unit)); + } + })); + } + }, + _getDirectiveRecord: function(boundElementIndex, directiveIndex, directiveMetadata) { + var id = boundElementIndex * 100 + directiveIndex; + if (!this._directiveRecordsMap.has(id)) { + this._directiveRecordsMap.set(id, new DirectiveRecord({ + directiveIndex: new DirectiveIndex(boundElementIndex, directiveIndex), + callOnAllChangesDone: directiveMetadata.callOnAllChangesDone, + callOnChange: directiveMetadata.callOnChange, + callOnCheck: directiveMetadata.callOnCheck, + callOnInit: directiveMetadata.callOnInit, + changeDetection: directiveMetadata.changeDetection + })); + } + return this._directiveRecordsMap.get(id); + } + }, {}); + }()); + ProtoViewFactory = (($traceurRuntime.createClass)(function(_changeDetection) { + this._changeDetection = _changeDetection; + }, {createAppProtoViews: function(hostComponentBinding, rootRenderProtoView, allDirectives) { + var $__0 = this; + var allRenderDirectiveMetadata = ListWrapper.map(allDirectives, (function(directiveBinding) { + return directiveBinding.metadata; + })); + var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); + var nestedPvVariableBindings = _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex); + var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); + var changeDetectorDefs = _getChangeDetectorDefinitions(hostComponentBinding.metadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata); + var protoChangeDetectors = ListWrapper.map(changeDetectorDefs, (function(changeDetectorDef) { + return $__0._changeDetection.createProtoChangeDetector(changeDetectorDef); + })); + var appProtoViews = ListWrapper.createFixedSize(nestedPvsWithIndex.length); + ListWrapper.forEach(nestedPvsWithIndex, (function(pvWithIndex) { + var appProtoView = _createAppProtoView(pvWithIndex.renderProtoView, protoChangeDetectors[pvWithIndex.index], nestedPvVariableBindings[pvWithIndex.index], allDirectives); + if (isPresent(pvWithIndex.parentIndex)) { + var parentView = appProtoViews[pvWithIndex.parentIndex]; + parentView.elementBinders[pvWithIndex.boundElementIndex].nestedProtoView = appProtoView; + } + appProtoViews[pvWithIndex.index] = appProtoView; + })); + return appProtoViews; + }}, {})); + $__export("ProtoViewFactory", ProtoViewFactory); + $__export("ProtoViewFactory", ProtoViewFactory = __decorate([Injectable(), __metadata('design:paramtypes', [ChangeDetection])], ProtoViewFactory)); + RenderProtoViewWithIndex = (function() { + function RenderProtoViewWithIndex(renderProtoView, index, parentIndex, boundElementIndex) { + this.renderProtoView = renderProtoView; + this.index = index; + this.parentIndex = parentIndex; + this.boundElementIndex = boundElementIndex; + } + return ($traceurRuntime.createClass)(RenderProtoViewWithIndex, {}, {}); + }()); + ParentProtoElementInjectorWithDistance = (function() { + function ParentProtoElementInjectorWithDistance(protoElementInjector, distance) { + this.protoElementInjector = protoElementInjector; + this.distance = distance; + } + return ($traceurRuntime.createClass)(ParentProtoElementInjectorWithDistance, {}, {}); + }()); + } + }; +}); + +System.register("angular2/src/services/url_resolver", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/services/url_resolver"; + var __decorate, + __metadata, + Injectable, + isPresent, + isBlank, + RegExpWrapper, + ListWrapper, + UrlResolver, + _splitRe, + _ComponentIndex; + function _buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) { + var out = []; + if (isPresent(opt_scheme)) { + out.push(opt_scheme + ':'); + } + if (isPresent(opt_domain)) { + out.push('//'); + if (isPresent(opt_userInfo)) { + out.push(opt_userInfo + '@'); + } + out.push(opt_domain); + if (isPresent(opt_port)) { + out.push(':' + opt_port); + } + } + if (isPresent(opt_path)) { + out.push(opt_path); + } + if (isPresent(opt_queryData)) { + out.push('?' + opt_queryData); + } + if (isPresent(opt_fragment)) { + out.push('#' + opt_fragment); + } + return out.join(''); + } + function _split(uri) { + return RegExpWrapper.firstMatch(_splitRe, uri); + } + function _removeDotSegments(path) { + if (path == '/') + return '/'; + var leadingSlash = path[0] == '/' ? '/' : ''; + var trailingSlash = path[path.length - 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 > 0) { + ListWrapper.removeAt(out, out.length - 1); + } else { + up++; + } + break; + default: + out.push(segment); + } + } + if (leadingSlash == '') { + while (up-- > 0) { + ListWrapper.insert(out, 0, '..'); + } + if (out.length === 0) + out.push('.'); + } + return leadingSlash + out.join('/') + trailingSlash; + } + function _joinAndCanonicalizePath(parts) { + var path = parts[_ComponentIndex.PATH]; + path = isBlank(path) ? '' : _removeDotSegments(path); + parts[_ComponentIndex.PATH] = path; + return _buildFromEncodedParts(parts[_ComponentIndex.SCHEME], parts[_ComponentIndex.USER_INFO], parts[_ComponentIndex.DOMAIN], parts[_ComponentIndex.PORT], path, parts[_ComponentIndex.QUERY_DATA], parts[_ComponentIndex.FRAGMENT]); + } + function _resolveUrl(base, url) { + var parts = _split(url); + var baseParts = _split(base); + if (isPresent(parts[_ComponentIndex.SCHEME])) { + return _joinAndCanonicalizePath(parts); + } else { + parts[_ComponentIndex.SCHEME] = baseParts[_ComponentIndex.SCHEME]; + } + for (var i = _ComponentIndex.SCHEME; i <= _ComponentIndex.PORT; i++) { + if (isBlank(parts[i])) { + parts[i] = baseParts[i]; + } + } + if (parts[_ComponentIndex.PATH][0] == '/') { + return _joinAndCanonicalizePath(parts); + } + var path = baseParts[_ComponentIndex.PATH]; + if (isBlank(path)) + path = '/'; + var index = path.lastIndexOf('/'); + path = path.substring(0, index + 1) + parts[_ComponentIndex.PATH]; + parts[_ComponentIndex.PATH] = path; + return _joinAndCanonicalizePath(parts); + } + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + RegExpWrapper = $__m.RegExpWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + UrlResolver = (($traceurRuntime.createClass)(function() {}, {resolve: function(baseUrl, url) { + return _resolveUrl(baseUrl, url); + }}, {})); + $__export("UrlResolver", UrlResolver); + $__export("UrlResolver", UrlResolver = __decorate([Injectable(), __metadata('design:paramtypes', [])], UrlResolver)); + _splitRe = RegExpWrapper.create('^' + '(?:' + '([^:/?#.]+)' + ':)?' + '(?://' + '(?:([^/?#]*)@)?' + '([\\w\\d\\-\\u0100-\\uffff.%]*)' + '(?::([0-9]+))?' + ')?' + '([^?#]+)?' + '(?:\\?([^#]*))?' + '(?:#(.*))?' + '$'); + (function(_ComponentIndex) { + _ComponentIndex[_ComponentIndex["SCHEME"] = 1] = "SCHEME"; + _ComponentIndex[_ComponentIndex["USER_INFO"] = 2] = "USER_INFO"; + _ComponentIndex[_ComponentIndex["DOMAIN"] = 3] = "DOMAIN"; + _ComponentIndex[_ComponentIndex["PORT"] = 4] = "PORT"; + _ComponentIndex[_ComponentIndex["PATH"] = 5] = "PATH"; + _ComponentIndex[_ComponentIndex["QUERY_DATA"] = 6] = "QUERY_DATA"; + _ComponentIndex[_ComponentIndex["FRAGMENT"] = 7] = "FRAGMENT"; + })(_ComponentIndex || (_ComponentIndex = {})); + } + }; +}); + +System.register("angular2/src/services/app_root_url", ["angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/services/app_root_url"; + var __decorate, + __metadata, + Injectable, + AppRootUrl; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + AppRootUrl = (($traceurRuntime.createClass)(function(value) { + this._value = value; + }, { + get value() { + return this._value; + }, + set value(value) { + this._value = value; + } + }, {})); + $__export("AppRootUrl", AppRootUrl); + $__export("AppRootUrl", AppRootUrl = __decorate([Injectable(), __metadata('design:paramtypes', [String])], AppRootUrl)); + } + }; +}); + +System.register("angular2/src/core/exception_handler", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/exception_handler"; + var __decorate, + __metadata, + Injectable, + isPresent, + isBlank, + BaseException, + isListLikeIterable, + _ArrayLogger, + ExceptionHandler; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + isListLikeIterable = $__m.isListLikeIterable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + _ArrayLogger = (function() { + function _ArrayLogger() { + this.res = []; + } + return ($traceurRuntime.createClass)(_ArrayLogger, { + log: function(s) { + this.res.push(s); + }, + logGroup: function(s) { + this.res.push(s); + }, + logGroupEnd: function() {} + }, {}); + }()); + ExceptionHandler = (($traceurRuntime.createClass)(function(logger) { + var rethrowException = arguments[1] !== (void 0) ? arguments[1] : true; + this.logger = logger; + this.rethrowException = rethrowException; + }, { + call: function(exception) { + var stackTrace = arguments[1] !== (void 0) ? arguments[1] : null; + var reason = arguments[2] !== (void 0) ? arguments[2] : null; + var originalException = this._findOriginalException(exception); + var originalStack = this._findOriginalStack(exception); + var context = this._findContext(exception); + this.logger.logGroup(("EXCEPTION: " + exception)); + if (isPresent(stackTrace) && isBlank(originalStack)) { + this.logger.log("STACKTRACE:"); + this.logger.log(this._longStackTrace(stackTrace)); + } + if (isPresent(reason)) { + this.logger.log(("REASON: " + reason)); + } + if (isPresent(originalException)) { + this.logger.log(("ORIGINAL EXCEPTION: " + originalException)); + } + if (isPresent(originalStack)) { + this.logger.log("ORIGINAL STACKTRACE:"); + this.logger.log(this._longStackTrace(originalStack)); + } + if (isPresent(context)) { + this.logger.log("ERROR CONTEXT:"); + this.logger.log(context); + } + this.logger.logGroupEnd(); + if (this.rethrowException) + throw exception; + }, + _longStackTrace: function(stackTrace) { + return isListLikeIterable(stackTrace) ? stackTrace.join("\n\n-----async gap-----\n") : stackTrace.toString(); + }, + _findContext: function(exception) { + try { + if (!(exception instanceof BaseException)) + return null; + return isPresent(exception.context) ? exception.context : this._findContext(exception.originalException); + } catch (e) { + return null; + } + }, + _findOriginalException: function(exception) { + if (!(exception instanceof BaseException)) + return null; + var e = exception.originalException; + while (e instanceof BaseException && isPresent(e.originalException)) { + e = e.originalException; + } + return e; + }, + _findOriginalStack: function(exception) { + if (!(exception instanceof BaseException)) + return null; + var e = exception; + var stack = exception.originalStack; + while (e instanceof BaseException && isPresent(e.originalException)) { + e = e.originalException; + if (e instanceof BaseException && isPresent(e.originalException)) { + stack = e.originalStack; + } + } + return stack; + } + }, {exceptionToString: function(exception) { + var stackTrace = arguments[1] !== (void 0) ? arguments[1] : null; + var reason = arguments[2] !== (void 0) ? arguments[2] : null; + var l = new _ArrayLogger(); + var e = new ExceptionHandler(l, false); + e.call(exception, stackTrace, reason); + return l.res.join("\n"); + }})); + $__export("ExceptionHandler", ExceptionHandler); + $__export("ExceptionHandler", ExceptionHandler = __decorate([Injectable(), __metadata('design:paramtypes', [Object, Boolean])], ExceptionHandler)); + } + }; +}); + +System.register("angular2/src/render/xhr", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/xhr"; + var XHR; + return { + setters: [], + execute: function() { + XHR = (function() { + function XHR() {} + return ($traceurRuntime.createClass)(XHR, {get: function(url) { + return null; + }}, {}); + }()); + $__export("XHR", XHR); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/style_url_resolver", ["angular2/di", "angular2/src/facade/lang", "angular2/src/services/url_resolver"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/style_url_resolver"; + var __decorate, + __metadata, + Injectable, + StringWrapper, + UrlResolver, + StyleUrlResolver, + _cssUrlRe, + _cssImportRe, + _quoteRe; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + StringWrapper = $__m.StringWrapper; + }, function($__m) { + UrlResolver = $__m.UrlResolver; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + StyleUrlResolver = (($traceurRuntime.createClass)(function(_resolver) { + this._resolver = _resolver; + }, { + resolveUrls: function(cssText, baseUrl) { + cssText = this._replaceUrls(cssText, _cssUrlRe, baseUrl); + cssText = this._replaceUrls(cssText, _cssImportRe, baseUrl); + return cssText; + }, + _replaceUrls: function(cssText, re, baseUrl) { + var $__0 = this; + return StringWrapper.replaceAllMapped(cssText, re, (function(m) { + var pre = m[1]; + var url = StringWrapper.replaceAll(m[2], _quoteRe, ''); + var post = m[3]; + var resolvedUrl = $__0._resolver.resolve(baseUrl, url); + return pre + "'" + resolvedUrl + "'" + post; + })); + } + }, {})); + $__export("StyleUrlResolver", StyleUrlResolver); + $__export("StyleUrlResolver", StyleUrlResolver = __decorate([Injectable(), __metadata('design:paramtypes', [UrlResolver])], StyleUrlResolver)); + _cssUrlRe = /(url\()([^)]*)(\))/g; + _cssImportRe = /(@import[\s]+(?!url\())['"]([^'"]*)['"](.*;)/g; + _quoteRe = /['"]/g; + } + }; +}); + +System.register("angular2/src/core/zone/ng_zone", ["angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/zone/ng_zone"; + var ListWrapper, + StringMapWrapper, + normalizeBlank, + isPresent, + global, + NgZone; + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + normalizeBlank = $__m.normalizeBlank; + isPresent = $__m.isPresent; + global = $__m.global; + }], + execute: function() { + NgZone = (function() { + function NgZone($__3) { + var enableLongStackTrace = $__3.enableLongStackTrace; + this._inVmTurnDone = false; + this._pendingTimeouts = []; + this._onTurnStart = null; + this._onTurnDone = null; + this._onEventDone = null; + this._onErrorHandler = null; + this._pendingMicrotasks = 0; + this._hasExecutedCodeInInnerZone = false; + this._nestedRun = 0; + if (global.zone) { + this._disabled = false; + this._mountZone = global.zone; + this._innerZone = this._createInnerZone(this._mountZone, enableLongStackTrace); + } else { + this._disabled = true; + this._mountZone = null; + } + } + return ($traceurRuntime.createClass)(NgZone, { + overrideOnTurnStart: function(onTurnStartFn) { + this._onTurnStart = normalizeBlank(onTurnStartFn); + }, + overrideOnTurnDone: function(onTurnDoneFn) { + this._onTurnDone = normalizeBlank(onTurnDoneFn); + }, + overrideOnEventDone: function(onEventDoneFn, opt_waitForAsync) { + var $__0 = this; + var normalizedOnEventDone = normalizeBlank(onEventDoneFn); + if (opt_waitForAsync) { + this._onEventDone = (function() { + if (!$__0._pendingTimeouts.length) { + normalizedOnEventDone(); + } + }); + } else { + this._onEventDone = normalizedOnEventDone; + } + }, + overrideOnErrorHandler: function(errorHandlingFn) { + this._onErrorHandler = normalizeBlank(errorHandlingFn); + }, + run: function(fn) { + if (this._disabled) { + return fn(); + } else { + return this._innerZone.run(fn); + } + }, + runOutsideAngular: function(fn) { + if (this._disabled) { + return fn(); + } else { + return this._mountZone.run(fn); + } + }, + _createInnerZone: function(zone, enableLongStackTrace) { + var ngZone = this; + var errorHandling; + if (enableLongStackTrace) { + errorHandling = StringMapWrapper.merge(Zone.longStackTraceZone, {onError: function(e) { + ngZone._onError(this, e); + }}); + } else { + errorHandling = {onError: function(e) { + ngZone._onError(this, e); + }}; + } + return zone.fork(errorHandling).fork({ + '$run': function(parentRun) { + return function() { + try { + ngZone._nestedRun++; + if (!ngZone._hasExecutedCodeInInnerZone) { + ngZone._hasExecutedCodeInInnerZone = true; + if (ngZone._onTurnStart) { + parentRun.call(ngZone._innerZone, ngZone._onTurnStart); + } + } + return parentRun.apply(this, arguments); + } finally { + ngZone._nestedRun--; + if (ngZone._pendingMicrotasks == 0 && ngZone._nestedRun == 0 && !this._inVmTurnDone) { + if (ngZone._onTurnDone && ngZone._hasExecutedCodeInInnerZone) { + try { + this._inVmTurnDone = true; + parentRun.call(ngZone._innerZone, ngZone._onTurnDone); + if (ngZone._pendingMicrotasks === 0 && isPresent(ngZone._onEventDone)) { + ngZone.runOutsideAngular(ngZone._onEventDone); + } + } finally { + this._inVmTurnDone = false; + ngZone._hasExecutedCodeInInnerZone = false; + } + } + } + } + }; + }, + '$scheduleMicrotask': function(parentScheduleMicrotask) { + return function(fn) { + ngZone._pendingMicrotasks++; + var microtask = function() { + try { + fn(); + } finally { + ngZone._pendingMicrotasks--; + } + }; + parentScheduleMicrotask.call(this, microtask); + }; + }, + '$setTimeout': function(parentSetTimeout) { + return function(fn, delay) { + for (var args = [], + $__2 = 2; $__2 < arguments.length; $__2++) + args[$__2 - 2] = arguments[$__2]; + var id; + var cb = function() { + fn(); + ListWrapper.remove(ngZone._pendingTimeouts, id); + }; + id = parentSetTimeout(cb, delay, args); + ngZone._pendingTimeouts.push(id); + return id; + }; + }, + '$clearTimeout': function(parentClearTimeout) { + return function(id) { + parentClearTimeout(id); + ListWrapper.remove(ngZone._pendingTimeouts, id); + }; + }, + _innerZone: true + }); + }, + _onError: function(zone, e) { + if (isPresent(this._onErrorHandler)) { + var trace = [normalizeBlank(e.stack)]; + while (zone && zone.constructedAtException) { + trace.push(zone.constructedAtException.get()); + zone = zone.parent; + } + this._onErrorHandler(e, trace); + } else { + console.log('## _onError ##'); + console.log(e.stack); + throw e; + } + } + }, {}); + }()); + $__export("NgZone", NgZone); + } + }; +}); + +System.register("angular2/src/core/life_cycle/life_cycle", ["angular2/di", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/life_cycle/life_cycle"; + var __decorate, + __metadata, + Injectable, + isPresent, + BaseException, + LifeCycle; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + LifeCycle = (($traceurRuntime.createClass)(function() { + var changeDetector = arguments[0] !== (void 0) ? arguments[0] : null; + var enforceNoNewChanges = arguments[1] !== (void 0) ? arguments[1] : false; + this._runningTick = false; + this._changeDetector = changeDetector; + this._enforceNoNewChanges = enforceNoNewChanges; + }, { + registerWith: function(zone) { + var changeDetector = arguments[1] !== (void 0) ? arguments[1] : null; + var $__0 = this; + if (isPresent(changeDetector)) { + this._changeDetector = changeDetector; + } + zone.overrideOnTurnDone((function() { + return $__0.tick(); + })); + }, + tick: function() { + if (this._runningTick) { + throw new BaseException("LifeCycle.tick is called recursively"); + } + try { + this._runningTick = true; + this._changeDetector.detectChanges(); + if (this._enforceNoNewChanges) { + this._changeDetector.checkNoChanges(); + } + } finally { + this._runningTick = false; + } + } + }, {})); + $__export("LifeCycle", LifeCycle); + $__export("LifeCycle", LifeCycle = __decorate([Injectable(), __metadata('design:paramtypes', [Object, Boolean])], LifeCycle)); + } + }; +}); + +System.register("angular2/src/render/xhr_impl", ["angular2/di", "angular2/src/facade/async", "angular2/src/render/xhr"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/xhr_impl"; + var __decorate, + __metadata, + Injectable, + PromiseWrapper, + XHR, + XHRImpl; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }, function($__m) { + XHR = $__m.XHR; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + XHRImpl = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, {get: function(url) { + var completer = PromiseWrapper.completer(); + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, true); + xhr.responseType = 'text'; + xhr.onload = function() { + var response = ('response' in xhr) ? xhr.response : xhr.responseText; + var status = xhr.status === 1223 ? 204 : xhr.status; + if (status === 0) { + status = response ? 200 : 0; + } + if (200 <= status && status <= 300) { + completer.resolve(response); + } else { + completer.reject(("Failed to load " + url), null); + } + }; + xhr.onerror = function() { + completer.reject(("Failed to load " + url), null); + }; + xhr.send(); + return completer.promise; + }}, {}, $__super); + }(XHR)); + $__export("XHRImpl", XHRImpl); + $__export("XHRImpl", XHRImpl = __decorate([Injectable(), __metadata('design:paramtypes', [])], XHRImpl)); + } + }; +}); + +System.register("angular2/src/render/dom/events/event_manager", ["angular2/src/facade/lang", "angular2/src/dom/dom_adapter"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/events/event_manager"; + var BaseException, + StringWrapper, + DOM, + BUBBLE_SYMBOL, + EventManager, + EventManagerPlugin, + DomEventsPlugin; + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + DOM = $__m.DOM; + }], + execute: function() { + BUBBLE_SYMBOL = '^'; + EventManager = (function() { + function EventManager(_plugins, _zone) { + this._plugins = _plugins; + this._zone = _zone; + for (var i = 0; i < _plugins.length; i++) { + _plugins[i].manager = this; + } + } + return ($traceurRuntime.createClass)(EventManager, { + addEventListener: function(element, eventName, handler) { + var withoutBubbleSymbol = this._removeBubbleSymbol(eventName); + var plugin = this._findPluginFor(withoutBubbleSymbol); + plugin.addEventListener(element, withoutBubbleSymbol, handler, withoutBubbleSymbol != eventName); + }, + addGlobalEventListener: function(target, eventName, handler) { + var withoutBubbleSymbol = this._removeBubbleSymbol(eventName); + var plugin = this._findPluginFor(withoutBubbleSymbol); + return plugin.addGlobalEventListener(target, withoutBubbleSymbol, handler, withoutBubbleSymbol != eventName); + }, + getZone: function() { + return this._zone; + }, + _findPluginFor: function(eventName) { + var plugins = this._plugins; + for (var i = 0; i < plugins.length; i++) { + var plugin = plugins[i]; + if (plugin.supports(eventName)) { + return plugin; + } + } + throw new BaseException(("No event manager plugin found for event " + eventName)); + }, + _removeBubbleSymbol: function(eventName) { + return eventName[0] == BUBBLE_SYMBOL ? StringWrapper.substring(eventName, 1) : eventName; + } + }, {}); + }()); + $__export("EventManager", EventManager); + EventManagerPlugin = (function() { + function EventManagerPlugin() {} + return ($traceurRuntime.createClass)(EventManagerPlugin, { + supports: function(eventName) { + return false; + }, + addEventListener: function(element, eventName, handler, shouldSupportBubble) { + throw "not implemented"; + }, + addGlobalEventListener: function(element, eventName, handler, shouldSupportBubble) { + throw "not implemented"; + } + }, {}); + }()); + $__export("EventManagerPlugin", EventManagerPlugin); + DomEventsPlugin = (function($__super) { + function DomEventsPlugin() { + $traceurRuntime.superConstructor(DomEventsPlugin).apply(this, arguments); + } + return ($traceurRuntime.createClass)(DomEventsPlugin, { + supports: function(eventName) { + return true; + }, + addEventListener: function(element, eventName, handler, shouldSupportBubble) { + var outsideHandler = this._getOutsideHandler(shouldSupportBubble, element, handler, this.manager._zone); + this.manager._zone.runOutsideAngular((function() { + DOM.on(element, eventName, outsideHandler); + })); + }, + addGlobalEventListener: function(target, eventName, handler, shouldSupportBubble) { + var element = DOM.getGlobalEventTarget(target); + var outsideHandler = this._getOutsideHandler(shouldSupportBubble, element, handler, this.manager._zone); + return this.manager._zone.runOutsideAngular((function() { + return DOM.onAndCancel(element, eventName, outsideHandler); + })); + }, + _getOutsideHandler: function(shouldSupportBubble, element, handler, zone) { + return shouldSupportBubble ? DomEventsPlugin.bubbleCallback(element, handler, zone) : DomEventsPlugin.sameElementCallback(element, handler, zone); + } + }, { + sameElementCallback: function(element, handler, zone) { + return (function(event) { + if (event.target === element) { + zone.run((function() { + return handler(event); + })); + } + }); + }, + bubbleCallback: function(element, handler, zone) { + return (function(event) { + return zone.run((function() { + return handler(event); + })); + }); + } + }, $__super); + }(EventManagerPlugin)); + $__export("DomEventsPlugin", DomEventsPlugin); + } + }; +}); + +System.register("angular2/src/render/dom/events/key_events", ["angular2/src/dom/dom_adapter", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/render/dom/events/event_manager"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/events/key_events"; + var DOM, + isPresent, + StringWrapper, + StringMapWrapper, + ListWrapper, + EventManagerPlugin, + modifierKeys, + modifierKeyGetters, + KeyEventsPlugin; + return { + setters: [function($__m) { + DOM = $__m.DOM; + }, function($__m) { + isPresent = $__m.isPresent; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + ListWrapper = $__m.ListWrapper; + }, function($__m) { + EventManagerPlugin = $__m.EventManagerPlugin; + }], + execute: function() { + modifierKeys = ['alt', 'control', 'meta', 'shift']; + modifierKeyGetters = { + 'alt': (function(event) { + return event.altKey; + }), + 'control': (function(event) { + return event.ctrlKey; + }), + 'meta': (function(event) { + return event.metaKey; + }), + 'shift': (function(event) { + return event.shiftKey; + }) + }; + KeyEventsPlugin = (function($__super) { + function KeyEventsPlugin() { + $traceurRuntime.superConstructor(KeyEventsPlugin).call(this); + } + return ($traceurRuntime.createClass)(KeyEventsPlugin, { + supports: function(eventName) { + return isPresent(KeyEventsPlugin.parseEventName(eventName)); + }, + addEventListener: function(element, eventName, handler, shouldSupportBubble) { + var parsedEvent = KeyEventsPlugin.parseEventName(eventName); + var outsideHandler = KeyEventsPlugin.eventCallback(element, shouldSupportBubble, StringMapWrapper.get(parsedEvent, 'fullKey'), handler, this.manager.getZone()); + this.manager.getZone().runOutsideAngular((function() { + DOM.on(element, StringMapWrapper.get(parsedEvent, 'domEventName'), outsideHandler); + })); + } + }, { + parseEventName: function(eventName) { + var parts = eventName.toLowerCase().split('.'); + var domEventName = ListWrapper.removeAt(parts, 0); + if ((parts.length === 0) || !(StringWrapper.equals(domEventName, 'keydown') || StringWrapper.equals(domEventName, 'keyup'))) { + return null; + } + var key = KeyEventsPlugin._normalizeKey(ListWrapper.removeLast(parts)); + var fullKey = ''; + ListWrapper.forEach(modifierKeys, (function(modifierName) { + if (ListWrapper.contains(parts, modifierName)) { + ListWrapper.remove(parts, modifierName); + fullKey += modifierName + '.'; + } + })); + fullKey += key; + if (parts.length != 0 || key.length === 0) { + return null; + } + var result = StringMapWrapper.create(); + StringMapWrapper.set(result, 'domEventName', domEventName); + StringMapWrapper.set(result, 'fullKey', fullKey); + return result; + }, + getEventFullKey: function(event) { + var fullKey = ''; + var key = DOM.getEventKey(event); + key = key.toLowerCase(); + if (StringWrapper.equals(key, ' ')) { + key = 'space'; + } else if (StringWrapper.equals(key, '.')) { + key = 'dot'; + } + ListWrapper.forEach(modifierKeys, (function(modifierName) { + if (modifierName != key) { + var modifierGetter = StringMapWrapper.get(modifierKeyGetters, modifierName); + if (modifierGetter(event)) { + fullKey += modifierName + '.'; + } + } + })); + fullKey += key; + return fullKey; + }, + eventCallback: function(element, shouldSupportBubble, fullKey, handler, zone) { + return (function(event) { + var correctElement = shouldSupportBubble || event.target === element; + if (correctElement && StringWrapper.equals(KeyEventsPlugin.getEventFullKey(event), fullKey)) { + zone.run((function() { + return handler(event); + })); + } + }); + }, + _normalizeKey: function(keyName) { + switch (keyName) { + case 'esc': + return 'escape'; + default: + return keyName; + } + } + }, $__super); + }(EventManagerPlugin)); + $__export("KeyEventsPlugin", KeyEventsPlugin); + } + }; +}); + +System.register("angular2/src/render/dom/events/hammer_common", ["angular2/src/render/dom/events/event_manager", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/events/hammer_common"; + var EventManagerPlugin, + StringMapWrapper, + _eventNames, + HammerGesturesPluginCommon; + return { + setters: [function($__m) { + EventManagerPlugin = $__m.EventManagerPlugin; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + }], + execute: function() { + _eventNames = { + 'pan': true, + 'panstart': true, + 'panmove': true, + 'panend': true, + 'pancancel': true, + 'panleft': true, + 'panright': true, + 'panup': true, + 'pandown': true, + 'pinch': true, + 'pinchstart': true, + 'pinchmove': true, + 'pinchend': true, + 'pinchcancel': true, + 'pinchin': true, + 'pinchout': true, + 'press': true, + 'pressup': true, + 'rotate': true, + 'rotatestart': true, + 'rotatemove': true, + 'rotateend': true, + 'rotatecancel': true, + 'swipe': true, + 'swipeleft': true, + 'swiperight': true, + 'swipeup': true, + 'swipedown': true, + 'tap': true + }; + HammerGesturesPluginCommon = (function($__super) { + function HammerGesturesPluginCommon() { + $traceurRuntime.superConstructor(HammerGesturesPluginCommon).call(this); + } + return ($traceurRuntime.createClass)(HammerGesturesPluginCommon, {supports: function(eventName) { + eventName = eventName.toLowerCase(); + return StringMapWrapper.contains(_eventNames, eventName); + }}, {}, $__super); + }(EventManagerPlugin)); + $__export("HammerGesturesPluginCommon", HammerGesturesPluginCommon); + } + }; +}); + +System.register("angular2/src/services/anchor_based_app_root_url", ["angular2/src/services/app_root_url", "angular2/src/dom/dom_adapter", "angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/services/anchor_based_app_root_url"; + var __decorate, + __metadata, + AppRootUrl, + DOM, + Injectable, + AnchorBasedAppRootUrl; + return { + setters: [function($__m) { + AppRootUrl = $__m.AppRootUrl; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + Injectable = $__m.Injectable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + AnchorBasedAppRootUrl = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).call(this, ""); + var rootUrl; + var a = DOM.createElement('a'); + DOM.resolveAndSetHref(a, './', null); + rootUrl = DOM.getHref(a); + this.value = rootUrl; + } + return ($traceurRuntime.createClass)($__0, {}, {}, $__super); + }(AppRootUrl)); + $__export("AnchorBasedAppRootUrl", AnchorBasedAppRootUrl); + $__export("AnchorBasedAppRootUrl", AnchorBasedAppRootUrl = __decorate([Injectable(), __metadata('design:paramtypes', [])], AnchorBasedAppRootUrl)); + } + }; +}); + +System.register("angular2/src/core/compiler/dynamic_component_loader", ["angular2/di", "angular2/src/core/compiler/compiler", "angular2/src/core/compiler/view_manager"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/dynamic_component_loader"; + var __decorate, + __metadata, + Injectable, + Compiler, + AppViewManager, + ComponentRef, + DynamicComponentLoader; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + Compiler = $__m.Compiler; + }, function($__m) { + AppViewManager = $__m.AppViewManager; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + ComponentRef = (function() { + function ComponentRef(location, instance, _dispose) { + this._dispose = _dispose; + this.location = location; + this.instance = instance; + } + return ($traceurRuntime.createClass)(ComponentRef, { + get hostView() { + return this.location.parentView; + }, + dispose: function() { + this._dispose(); + } + }, {}); + }()); + $__export("ComponentRef", ComponentRef); + DynamicComponentLoader = (($traceurRuntime.createClass)(function(_compiler, _viewManager) { + this._compiler = _compiler; + this._viewManager = _viewManager; + }, { + loadAsRoot: function(typeOrBinding, overrideSelector, injector) { + var $__0 = this; + return this._compiler.compileInHost(typeOrBinding).then((function(hostProtoViewRef) { + var hostViewRef = $__0._viewManager.createRootHostView(hostProtoViewRef, overrideSelector, injector); + var newLocation = $__0._viewManager.getHostElement(hostViewRef); + var component = $__0._viewManager.getComponent(newLocation); + var dispose = (function() { + $__0._viewManager.destroyRootHostView(hostViewRef); + }); + return new ComponentRef(newLocation, component, dispose); + })); + }, + loadIntoLocation: function(typeOrBinding, hostLocation, anchorName) { + var bindings = arguments[3] !== (void 0) ? arguments[3] : null; + return this.loadNextToLocation(typeOrBinding, this._viewManager.getNamedElementInComponentView(hostLocation, anchorName), bindings); + }, + loadNextToLocation: function(typeOrBinding, location) { + var bindings = arguments[2] !== (void 0) ? arguments[2] : null; + var $__0 = this; + return this._compiler.compileInHost(typeOrBinding).then((function(hostProtoViewRef) { + var viewContainer = $__0._viewManager.getViewContainer(location); + var hostViewRef = viewContainer.createHostView(hostProtoViewRef, viewContainer.length, bindings); + var newLocation = $__0._viewManager.getHostElement(hostViewRef); + var component = $__0._viewManager.getComponent(newLocation); + var dispose = (function() { + var index = viewContainer.indexOf(hostViewRef); + if (index !== -1) { + viewContainer.remove(index); + } + }); + return new ComponentRef(newLocation, component, dispose); + })); + } + }, {})); + $__export("DynamicComponentLoader", DynamicComponentLoader); + $__export("DynamicComponentLoader", DynamicComponentLoader = __decorate([Injectable(), __metadata('design:paramtypes', [Compiler, AppViewManager])], DynamicComponentLoader)); + } + }; +}); + +System.register("angular2/src/core/testability/get_testability", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/testability/get_testability"; + var global, + PublicTestability, + GetTestability; + return { + setters: [function($__m) { + global = $__m.global; + }], + execute: function() { + PublicTestability = (function() { + function PublicTestability(testability) { + this._testability = testability; + } + return ($traceurRuntime.createClass)(PublicTestability, { + whenStable: function(callback) { + this._testability.whenStable(callback); + }, + findBindings: function(using, binding, exactMatch) { + return this._testability.findBindings(using, binding, exactMatch); + } + }, {}); + }()); + GetTestability = (function() { + function GetTestability() {} + return ($traceurRuntime.createClass)(GetTestability, {}, {addToWindow: function(registry) { + global.getAngularTestability = function(elem) { + var testability = registry.findTestabilityInTree(elem); + if (testability == null) { + throw new Error('Could not find testability for element.'); + } + return new PublicTestability(testability); + }; + }}); + }()); + $__export("GetTestability", GetTestability); + } + }; +}); + +System.register("angular2/src/render/dom/dom_tokens", ["angular2/di", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/dom_tokens"; + var OpaqueToken, + bind, + CONST_EXPR, + StringWrapper, + Math, + DOCUMENT_TOKEN, + DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES, + APP_ID_TOKEN, + APP_ID_RANDOM_BINDING; + function randomChar() { + return StringWrapper.fromCharCode(97 + Math.floor(Math.random() * 25)); + } + return { + setters: [function($__m) { + OpaqueToken = $__m.OpaqueToken; + bind = $__m.bind; + }, function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + StringWrapper = $__m.StringWrapper; + Math = $__m.Math; + }], + execute: function() { + DOCUMENT_TOKEN = CONST_EXPR(new OpaqueToken('DocumentToken')); + $__export("DOCUMENT_TOKEN", DOCUMENT_TOKEN); + DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES = CONST_EXPR(new OpaqueToken('DomReflectPropertiesAsAttributes')); + $__export("DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES", DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES); + APP_ID_TOKEN = CONST_EXPR(new OpaqueToken('AppId')); + $__export("APP_ID_TOKEN", APP_ID_TOKEN); + APP_ID_RANDOM_BINDING = bind(APP_ID_TOKEN).toFactory((function() { + return ("" + randomChar() + randomChar() + randomChar()); + }), []); + $__export("APP_ID_RANDOM_BINDING", APP_ID_RANDOM_BINDING); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/compile_element", ["angular2/src/facade/collection", "angular2/src/dom/dom_adapter", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/compile_element"; + var MapWrapper, + DOM, + isBlank, + isPresent, + StringJoiner, + assertionsEnabled, + CompileElement; + function getElementDescription(domElement) { + var buf = new StringJoiner(); + var atts = DOM.attributeMap(domElement); + buf.add("<"); + buf.add(DOM.tagName(domElement).toLowerCase()); + addDescriptionAttribute(buf, "id", atts.get("id")); + addDescriptionAttribute(buf, "class", atts.get("class")); + MapWrapper.forEach(atts, (function(attValue, attName) { + if (attName !== "id" && attName !== "class") { + addDescriptionAttribute(buf, attName, attValue); + } + })); + buf.add(">"); + return buf.toString(); + } + function addDescriptionAttribute(buffer, attName, attValue) { + if (isPresent(attValue)) { + if (attValue.length === 0) { + buffer.add(' ' + attName); + } else { + buffer.add(' ' + attName + '="' + attValue + '"'); + } + } + } + return { + setters: [function($__m) { + MapWrapper = $__m.MapWrapper; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + StringJoiner = $__m.StringJoiner; + assertionsEnabled = $__m.assertionsEnabled; + }], + execute: function() { + CompileElement = (function() { + function CompileElement(element) { + var compilationUnit = arguments[1] !== (void 0) ? arguments[1] : ''; + this.element = element; + this._attrs = null; + this._classList = null; + this.isViewRoot = false; + this.inheritedProtoView = null; + this.distanceToInheritedBinder = 0; + this.inheritedElementBinder = null; + this.compileChildren = true; + var tplDesc = assertionsEnabled() ? getElementDescription(element) : null; + if (compilationUnit !== '') { + this.elementDescription = compilationUnit; + if (isPresent(tplDesc)) + this.elementDescription += ": " + tplDesc; + } else { + this.elementDescription = tplDesc; + } + } + return ($traceurRuntime.createClass)(CompileElement, { + isBound: function() { + return isPresent(this.inheritedElementBinder) && this.distanceToInheritedBinder === 0; + }, + bindElement: function() { + if (!this.isBound()) { + var parentBinder = this.inheritedElementBinder; + this.inheritedElementBinder = this.inheritedProtoView.bindElement(this.element, this.elementDescription); + if (isPresent(parentBinder)) { + this.inheritedElementBinder.setParent(parentBinder, this.distanceToInheritedBinder); + } + this.distanceToInheritedBinder = 0; + } + return this.inheritedElementBinder; + }, + refreshAttrs: function() { + this._attrs = null; + }, + attrs: function() { + if (isBlank(this._attrs)) { + this._attrs = DOM.attributeMap(this.element); + } + return this._attrs; + }, + refreshClassList: function() { + this._classList = null; + }, + classList: function() { + if (isBlank(this._classList)) { + this._classList = []; + var elClassList = DOM.classList(this.element); + for (var i = 0; i < elClassList.length; i++) { + this._classList.push(elClassList[i]); + } + } + return this._classList; + } + }, {}); + }()); + $__export("CompileElement", CompileElement); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/compile_control", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/compile_control"; + var isBlank, + CompileControl; + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + }], + execute: function() { + CompileControl = (function() { + function CompileControl(_steps) { + this._steps = _steps; + this._currentStepIndex = 0; + this._parent = null; + this._results = null; + this._additionalChildren = null; + } + return ($traceurRuntime.createClass)(CompileControl, { + internalProcess: function(results, startStepIndex, parent, current) { + this._results = results; + var previousStepIndex = this._currentStepIndex; + var previousParent = this._parent; + this._ignoreCurrentElement = false; + for (var i = startStepIndex; i < this._steps.length && !this._ignoreCurrentElement; i++) { + var step = this._steps[i]; + this._parent = parent; + this._currentStepIndex = i; + step.processElement(parent, current, this); + parent = this._parent; + } + if (!this._ignoreCurrentElement) { + results.push(current); + } + this._currentStepIndex = previousStepIndex; + this._parent = previousParent; + var localAdditionalChildren = this._additionalChildren; + this._additionalChildren = null; + return localAdditionalChildren; + }, + addParent: function(newElement) { + this.internalProcess(this._results, this._currentStepIndex + 1, this._parent, newElement); + this._parent = newElement; + }, + addChild: function(element) { + if (isBlank(this._additionalChildren)) { + this._additionalChildren = []; + } + this._additionalChildren.push(element); + }, + ignoreCurrentElement: function() { + this._ignoreCurrentElement = true; + } + }, {}); + }()); + $__export("CompileControl", CompileControl); + } + }; +}); + +System.register("angular2/src/render/dom/view/proto_view", ["angular2/src/render/api", "angular2/src/dom/dom_adapter"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/view/proto_view"; + var RenderProtoViewRef, + DOM, + DomProtoViewRef, + DomProtoView; + function resolveInternalDomProtoView(protoViewRef) { + return protoViewRef._protoView; + } + $__export("resolveInternalDomProtoView", resolveInternalDomProtoView); + return { + setters: [function($__m) { + RenderProtoViewRef = $__m.RenderProtoViewRef; + }, function($__m) { + DOM = $__m.DOM; + }], + execute: function() { + DomProtoViewRef = (function($__super) { + function DomProtoViewRef(_protoView) { + $traceurRuntime.superConstructor(DomProtoViewRef).call(this); + this._protoView = _protoView; + } + return ($traceurRuntime.createClass)(DomProtoViewRef, {}, {}, $__super); + }(RenderProtoViewRef)); + $__export("DomProtoViewRef", DomProtoViewRef); + DomProtoView = (function() { + function DomProtoView(type, rootElement, encapsulation, elementBinders, hostAttributes, rootTextNodeIndices, boundTextNodeCount, fragmentsRootNodeCount, isSingleElementFragment) { + this.type = type; + this.rootElement = rootElement; + this.encapsulation = encapsulation; + this.elementBinders = elementBinders; + this.hostAttributes = hostAttributes; + this.rootTextNodeIndices = rootTextNodeIndices; + this.boundTextNodeCount = boundTextNodeCount; + this.fragmentsRootNodeCount = fragmentsRootNodeCount; + this.isSingleElementFragment = isSingleElementFragment; + } + return ($traceurRuntime.createClass)(DomProtoView, {}, {create: function(type, rootElement, viewEncapsulation, fragmentsRootNodeCount, rootTextNodeIndices, elementBinders, hostAttributes) { + var boundTextNodeCount = rootTextNodeIndices.length; + for (var i = 0; i < elementBinders.length; i++) { + boundTextNodeCount += elementBinders[i].textNodeIndices.length; + } + var isSingleElementFragment = fragmentsRootNodeCount.length === 1 && fragmentsRootNodeCount[0] === 1 && DOM.isElementNode(DOM.firstChild(DOM.content(rootElement))); + return new DomProtoView(type, rootElement, viewEncapsulation, elementBinders, hostAttributes, rootTextNodeIndices, boundTextNodeCount, fragmentsRootNodeCount, isSingleElementFragment); + }}); + }()); + $__export("DomProtoView", DomProtoView); + } + }; +}); + +System.register("angular2/src/render/dom/view/element_binder", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/view/element_binder"; + var isPresent, + DomElementBinder, + Event, + HostAction; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }], + execute: function() { + DomElementBinder = (function() { + function DomElementBinder() { + var $__1 = arguments[0] !== (void 0) ? arguments[0] : {}, + textNodeIndices = $__1.textNodeIndices, + hasNestedProtoView = $__1.hasNestedProtoView, + eventLocals = $__1.eventLocals, + localEvents = $__1.localEvents, + globalEvents = $__1.globalEvents, + hasNativeShadowRoot = $__1.hasNativeShadowRoot; + this.textNodeIndices = textNodeIndices; + this.hasNestedProtoView = hasNestedProtoView; + this.eventLocals = eventLocals; + this.localEvents = localEvents; + this.globalEvents = globalEvents; + this.hasNativeShadowRoot = isPresent(hasNativeShadowRoot) ? hasNativeShadowRoot : false; + } + return ($traceurRuntime.createClass)(DomElementBinder, {}, {}); + }()); + $__export("DomElementBinder", DomElementBinder); + Event = (function() { + function Event(name, target, fullName) { + this.name = name; + this.target = target; + this.fullName = fullName; + } + return ($traceurRuntime.createClass)(Event, {}, {}); + }()); + $__export("Event", Event); + HostAction = (function() { + function HostAction(actionName, actionExpression, expression) { + this.actionName = actionName; + this.actionExpression = actionExpression; + this.expression = expression; + } + return ($traceurRuntime.createClass)(HostAction, {}, {}); + }()); + $__export("HostAction", HostAction); + } + }; +}); + +System.register("angular2/src/render/dom/util", ["angular2/src/facade/lang", "angular2/src/dom/dom_adapter", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/util"; + var StringWrapper, + isPresent, + isBlank, + DOM, + ListWrapper, + NG_BINDING_CLASS_SELECTOR, + NG_BINDING_CLASS, + EVENT_TARGET_SEPARATOR, + NG_CONTENT_ELEMENT_NAME, + NG_SHADOW_ROOT_ELEMENT_NAME, + CAMEL_CASE_REGEXP, + DASH_CASE_REGEXP, + ClonedProtoView; + function camelCaseToDashCase(input) { + return StringWrapper.replaceAllMapped(input, CAMEL_CASE_REGEXP, (function(m) { + return '-' + m[1].toLowerCase(); + })); + } + function dashCaseToCamelCase(input) { + return StringWrapper.replaceAllMapped(input, DASH_CASE_REGEXP, (function(m) { + return m[1].toUpperCase(); + })); + } + function queryBoundElements(templateContent, isSingleElementChild) { + var result; + var dynamicElementList; + var elementIdx = 0; + if (isSingleElementChild) { + var rootElement = DOM.firstChild(templateContent); + var rootHasBinding = DOM.hasClass(rootElement, NG_BINDING_CLASS); + dynamicElementList = DOM.getElementsByClassName(rootElement, NG_BINDING_CLASS); + result = ListWrapper.createFixedSize(dynamicElementList.length + (rootHasBinding ? 1 : 0)); + if (rootHasBinding) { + result[elementIdx++] = rootElement; + } + } else { + dynamicElementList = DOM.querySelectorAll(templateContent, NG_BINDING_CLASS_SELECTOR); + result = ListWrapper.createFixedSize(dynamicElementList.length); + } + for (var i = 0; i < dynamicElementList.length; i++) { + result[elementIdx++] = dynamicElementList[i]; + } + return result; + } + function cloneAndQueryProtoView(pv, importIntoDocument) { + var templateContent = importIntoDocument ? DOM.importIntoDoc(DOM.content(pv.rootElement)) : DOM.clone(DOM.content(pv.rootElement)); + var boundElements = queryBoundElements(templateContent, pv.isSingleElementFragment); + var boundTextNodes = queryBoundTextNodes(templateContent, pv.rootTextNodeIndices, boundElements, pv.elementBinders, pv.boundTextNodeCount); + var fragments = queryFragments(templateContent, pv.fragmentsRootNodeCount); + return new ClonedProtoView(pv, fragments, boundElements, boundTextNodes); + } + function queryFragments(templateContent, fragmentsRootNodeCount) { + var fragments = ListWrapper.createGrowableSize(fragmentsRootNodeCount.length); + var childNode = DOM.firstChild(templateContent); + for (var fragmentIndex = 0; fragmentIndex < fragments.length; fragmentIndex++) { + var fragment = ListWrapper.createFixedSize(fragmentsRootNodeCount[fragmentIndex]); + fragments[fragmentIndex] = fragment; + for (var i = 0; i < fragment.length; i++) { + fragment[i] = childNode; + childNode = DOM.nextSibling(childNode); + } + } + return fragments; + } + function queryBoundTextNodes(templateContent, rootTextNodeIndices, boundElements, elementBinders, boundTextNodeCount) { + var boundTextNodes = ListWrapper.createFixedSize(boundTextNodeCount); + var textNodeIndex = 0; + if (rootTextNodeIndices.length > 0) { + var rootChildNodes = DOM.childNodes(templateContent); + for (var i = 0; i < rootTextNodeIndices.length; i++) { + boundTextNodes[textNodeIndex++] = rootChildNodes[rootTextNodeIndices[i]]; + } + } + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + var element = boundElements[i]; + if (binder.textNodeIndices.length > 0) { + var childNodes = DOM.childNodes(element); + for (var j = 0; j < binder.textNodeIndices.length; j++) { + boundTextNodes[textNodeIndex++] = childNodes[binder.textNodeIndices[j]]; + } + } + } + return boundTextNodes; + } + function isElementWithTag(node, elementName) { + return DOM.isElementNode(node) && DOM.tagName(node).toLowerCase() == elementName.toLowerCase(); + } + function queryBoundTextNodeIndices(parentNode, boundTextNodes, resultCallback) { + var childNodes = DOM.childNodes(parentNode); + for (var j = 0; j < childNodes.length; j++) { + var node = childNodes[j]; + if (boundTextNodes.has(node)) { + resultCallback(node, j, boundTextNodes.get(node)); + } + } + } + function prependAll(parentNode, nodes) { + var lastInsertedNode = null; + nodes.forEach((function(node) { + if (isBlank(lastInsertedNode)) { + var firstChild = DOM.firstChild(parentNode); + if (isPresent(firstChild)) { + DOM.insertBefore(firstChild, node); + } else { + DOM.appendChild(parentNode, node); + } + } else { + DOM.insertAfter(lastInsertedNode, node); + } + lastInsertedNode = node; + })); + } + $__export("camelCaseToDashCase", camelCaseToDashCase); + $__export("dashCaseToCamelCase", dashCaseToCamelCase); + $__export("queryBoundElements", queryBoundElements); + $__export("cloneAndQueryProtoView", cloneAndQueryProtoView); + $__export("isElementWithTag", isElementWithTag); + $__export("queryBoundTextNodeIndices", queryBoundTextNodeIndices); + $__export("prependAll", prependAll); + return { + setters: [function($__m) { + StringWrapper = $__m.StringWrapper; + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }], + execute: function() { + NG_BINDING_CLASS_SELECTOR = '.ng-binding'; + $__export("NG_BINDING_CLASS_SELECTOR", NG_BINDING_CLASS_SELECTOR); + NG_BINDING_CLASS = 'ng-binding'; + $__export("NG_BINDING_CLASS", NG_BINDING_CLASS); + EVENT_TARGET_SEPARATOR = ':'; + $__export("EVENT_TARGET_SEPARATOR", EVENT_TARGET_SEPARATOR); + NG_CONTENT_ELEMENT_NAME = 'ng-content'; + $__export("NG_CONTENT_ELEMENT_NAME", NG_CONTENT_ELEMENT_NAME); + NG_SHADOW_ROOT_ELEMENT_NAME = 'shadow-root'; + $__export("NG_SHADOW_ROOT_ELEMENT_NAME", NG_SHADOW_ROOT_ELEMENT_NAME); + CAMEL_CASE_REGEXP = /([A-Z])/g; + DASH_CASE_REGEXP = /-([a-z])/g; + ClonedProtoView = (function() { + function ClonedProtoView(original, fragments, boundElements, boundTextNodes) { + this.original = original; + this.fragments = fragments; + this.boundElements = boundElements; + this.boundTextNodes = boundTextNodes; + } + return ($traceurRuntime.createClass)(ClonedProtoView, {}, {}); + }()); + $__export("ClonedProtoView", ClonedProtoView); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/property_binding_parser", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/render/dom/util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/property_binding_parser"; + var isPresent, + RegExpWrapper, + StringWrapper, + MapWrapper, + dashCaseToCamelCase, + BIND_NAME_REGEXP, + PropertyBindingParser; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + RegExpWrapper = $__m.RegExpWrapper; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + MapWrapper = $__m.MapWrapper; + }, function($__m) { + dashCaseToCamelCase = $__m.dashCaseToCamelCase; + }], + execute: function() { + BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(var-|#)|(on-)|(bindon-))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/g; + PropertyBindingParser = (function() { + function PropertyBindingParser(_parser) { + this._parser = _parser; + } + return ($traceurRuntime.createClass)(PropertyBindingParser, { + processStyle: function(style) { + return style; + }, + processElement: function(parent, current, control) { + var $__0 = this; + var attrs = current.attrs(); + var newAttrs = new Map(); + MapWrapper.forEach(attrs, (function(attrValue, attrName) { + attrName = $__0._normalizeAttributeName(attrName); + var bindParts = RegExpWrapper.firstMatch(BIND_NAME_REGEXP, attrName); + if (isPresent(bindParts)) { + if (isPresent(bindParts[1])) { + $__0._bindProperty(bindParts[5], attrValue, current, newAttrs); + } else if (isPresent(bindParts[2])) { + var identifier = bindParts[5]; + var value = attrValue == '' ? '\$implicit' : attrValue; + $__0._bindVariable(identifier, value, current, newAttrs); + } else if (isPresent(bindParts[3])) { + $__0._bindEvent(bindParts[5], attrValue, current, newAttrs); + } else if (isPresent(bindParts[4])) { + $__0._bindProperty(bindParts[5], attrValue, current, newAttrs); + $__0._bindAssignmentEvent(bindParts[5], attrValue, current, newAttrs); + } else if (isPresent(bindParts[6])) { + $__0._bindProperty(bindParts[6], attrValue, current, newAttrs); + $__0._bindAssignmentEvent(bindParts[6], attrValue, current, newAttrs); + } else if (isPresent(bindParts[7])) { + $__0._bindProperty(bindParts[7], attrValue, current, newAttrs); + } else if (isPresent(bindParts[8])) { + $__0._bindEvent(bindParts[8], attrValue, current, newAttrs); + } + } else { + var expr = $__0._parser.parseInterpolation(attrValue, current.elementDescription); + if (isPresent(expr)) { + $__0._bindPropertyAst(attrName, expr, current, newAttrs); + } + } + })); + MapWrapper.forEach(newAttrs, (function(attrValue, attrName) { + attrs.set(attrName, attrValue); + })); + }, + _normalizeAttributeName: function(attrName) { + return StringWrapper.startsWith(attrName, 'data-') ? StringWrapper.substring(attrName, 5) : attrName; + }, + _bindVariable: function(identifier, value, current, newAttrs) { + current.bindElement().bindVariable(dashCaseToCamelCase(identifier), value); + newAttrs.set(identifier, value); + }, + _bindProperty: function(name, expression, current, newAttrs) { + this._bindPropertyAst(name, this._parser.parseBinding(expression, current.elementDescription), current, newAttrs); + }, + _bindPropertyAst: function(name, ast, current, newAttrs) { + var binder = current.bindElement(); + binder.bindProperty(dashCaseToCamelCase(name), ast); + newAttrs.set(name, ast.source); + }, + _bindAssignmentEvent: function(name, expression, current, newAttrs) { + this._bindEvent(name, (expression + "=$event"), current, newAttrs); + }, + _bindEvent: function(name, expression, current, newAttrs) { + current.bindElement().bindEvent(dashCaseToCamelCase(name), this._parser.parseAction(expression, current.elementDescription)); + } + }, {}); + }()); + $__export("PropertyBindingParser", PropertyBindingParser); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/text_interpolation_parser", ["angular2/src/facade/lang", "angular2/src/dom/dom_adapter"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/text_interpolation_parser"; + var isPresent, + DOM, + TextInterpolationParser; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + DOM = $__m.DOM; + }], + execute: function() { + TextInterpolationParser = (function() { + function TextInterpolationParser(_parser) { + this._parser = _parser; + } + return ($traceurRuntime.createClass)(TextInterpolationParser, { + processStyle: function(style) { + return style; + }, + processElement: function(parent, current, control) { + if (!current.compileChildren) { + return ; + } + var element = current.element; + var childNodes = DOM.childNodes(DOM.templateAwareRoot(element)); + for (var i = 0; i < childNodes.length; i++) { + var node = childNodes[i]; + if (DOM.isTextNode(node)) { + var textNode = node; + var text = DOM.nodeValue(textNode); + var expr = this._parser.parseInterpolation(text, current.elementDescription); + if (isPresent(expr)) { + DOM.setText(textNode, ' '); + if (current.element === current.inheritedProtoView.rootElement) { + current.inheritedProtoView.bindRootText(textNode, expr); + } else { + current.bindElement().bindText(textNode, expr); + } + } + } + } + } + }, {}); + }()); + $__export("TextInterpolationParser", TextInterpolationParser); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/selector", ["angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/selector"; + var Map, + ListWrapper, + isPresent, + isBlank, + RegExpWrapper, + RegExpMatcherWrapper, + StringWrapper, + BaseException, + _EMPTY_ATTR_VALUE, + _SELECTOR_REGEXP, + CssSelector, + SelectorMatcher, + SelectorListContext, + SelectorContext; + return { + setters: [function($__m) { + Map = $__m.Map; + ListWrapper = $__m.ListWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + RegExpWrapper = $__m.RegExpWrapper; + RegExpMatcherWrapper = $__m.RegExpMatcherWrapper; + StringWrapper = $__m.StringWrapper; + BaseException = $__m.BaseException; + }], + execute: function() { + _EMPTY_ATTR_VALUE = ''; + _SELECTOR_REGEXP = RegExpWrapper.create('(\\:not\\()|' + '([-\\w]+)|' + '(?:\\.([-\\w]+))|' + '(?:\\[([-\\w*]+)(?:=([^\\]]*))?\\])|' + '(\\))|' + '(\\s*,\\s*)'); + CssSelector = (function() { + function CssSelector() { + this.element = null; + this.classNames = []; + this.attrs = []; + this.notSelectors = []; + } + return ($traceurRuntime.createClass)(CssSelector, { + isElementSelector: function() { + return isPresent(this.element) && ListWrapper.isEmpty(this.classNames) && ListWrapper.isEmpty(this.attrs) && this.notSelectors.length === 0; + }, + setElement: function() { + var element = arguments[0] !== (void 0) ? arguments[0] : null; + if (isPresent(element)) { + element = element.toLowerCase(); + } + this.element = element; + }, + addAttribute: function(name) { + var value = arguments[1] !== (void 0) ? arguments[1] : _EMPTY_ATTR_VALUE; + this.attrs.push(name.toLowerCase()); + if (isPresent(value)) { + value = value.toLowerCase(); + } else { + value = _EMPTY_ATTR_VALUE; + } + this.attrs.push(value); + }, + addClassName: function(name) { + this.classNames.push(name.toLowerCase()); + }, + toString: function() { + var res = ''; + if (isPresent(this.element)) { + res += this.element; + } + if (isPresent(this.classNames)) { + for (var i = 0; i < this.classNames.length; i++) { + res += '.' + this.classNames[i]; + } + } + if (isPresent(this.attrs)) { + for (var i = 0; i < this.attrs.length; ) { + var attrName = this.attrs[i++]; + var attrValue = this.attrs[i++]; + res += '[' + attrName; + if (attrValue.length > 0) { + res += '=' + attrValue; + } + res += ']'; + } + } + ListWrapper.forEach(this.notSelectors, (function(notSelector) { + res += ":not(" + notSelector.toString() + ")"; + })); + return res; + } + }, {parse: function(selector) { + var results = []; + var _addResult = (function(res, cssSel) { + if (cssSel.notSelectors.length > 0 && isBlank(cssSel.element) && ListWrapper.isEmpty(cssSel.classNames) && ListWrapper.isEmpty(cssSel.attrs)) { + cssSel.element = "*"; + } + res.push(cssSel); + }); + var cssSelector = new CssSelector(); + var matcher = RegExpWrapper.matcher(_SELECTOR_REGEXP, selector); + var match; + var current = cssSelector; + var inNot = false; + while (isPresent(match = RegExpMatcherWrapper.next(matcher))) { + if (isPresent(match[1])) { + if (inNot) { + throw new BaseException('Nesting :not is not allowed in a selector'); + } + inNot = true; + current = new CssSelector(); + cssSelector.notSelectors.push(current); + } + if (isPresent(match[2])) { + current.setElement(match[2]); + } + if (isPresent(match[3])) { + current.addClassName(match[3]); + } + if (isPresent(match[4])) { + current.addAttribute(match[4], match[5]); + } + if (isPresent(match[6])) { + inNot = false; + current = cssSelector; + } + if (isPresent(match[7])) { + if (inNot) { + throw new BaseException('Multiple selectors in :not are not supported'); + } + _addResult(results, cssSelector); + cssSelector = current = new CssSelector(); + } + } + _addResult(results, cssSelector); + return results; + }}); + }()); + $__export("CssSelector", CssSelector); + SelectorMatcher = (function() { + function SelectorMatcher() { + this._elementMap = new Map(); + this._elementPartialMap = new Map(); + this._classMap = new Map(); + this._classPartialMap = new Map(); + this._attrValueMap = new Map(); + this._attrValuePartialMap = new Map(); + this._listContexts = []; + } + return ($traceurRuntime.createClass)(SelectorMatcher, { + addSelectables: function(cssSelectors, callbackCtxt) { + var listContext = null; + if (cssSelectors.length > 1) { + listContext = new SelectorListContext(cssSelectors); + this._listContexts.push(listContext); + } + for (var i = 0; i < cssSelectors.length; i++) { + this._addSelectable(cssSelectors[i], callbackCtxt, listContext); + } + }, + _addSelectable: function(cssSelector, callbackCtxt, listContext) { + var matcher = this; + var element = cssSelector.element; + var classNames = cssSelector.classNames; + var attrs = cssSelector.attrs; + var selectable = new SelectorContext(cssSelector, callbackCtxt, listContext); + if (isPresent(element)) { + var isTerminal = attrs.length === 0 && classNames.length === 0; + if (isTerminal) { + this._addTerminal(matcher._elementMap, element, selectable); + } else { + matcher = this._addPartial(matcher._elementPartialMap, element); + } + } + if (isPresent(classNames)) { + for (var index = 0; index < classNames.length; index++) { + var isTerminal = attrs.length === 0 && index === classNames.length - 1; + var className = classNames[index]; + if (isTerminal) { + this._addTerminal(matcher._classMap, className, selectable); + } else { + matcher = this._addPartial(matcher._classPartialMap, className); + } + } + } + if (isPresent(attrs)) { + for (var index = 0; index < attrs.length; ) { + var isTerminal = index === attrs.length - 2; + var attrName = attrs[index++]; + var attrValue = attrs[index++]; + if (isTerminal) { + var terminalMap = matcher._attrValueMap; + var terminalValuesMap = terminalMap.get(attrName); + if (isBlank(terminalValuesMap)) { + terminalValuesMap = new Map(); + terminalMap.set(attrName, terminalValuesMap); + } + this._addTerminal(terminalValuesMap, attrValue, selectable); + } else { + var parttialMap = matcher._attrValuePartialMap; + var partialValuesMap = parttialMap.get(attrName); + if (isBlank(partialValuesMap)) { + partialValuesMap = new Map(); + parttialMap.set(attrName, partialValuesMap); + } + matcher = this._addPartial(partialValuesMap, attrValue); + } + } + } + }, + _addTerminal: function(map, name, selectable) { + var terminalList = map.get(name); + if (isBlank(terminalList)) { + terminalList = []; + map.set(name, terminalList); + } + terminalList.push(selectable); + }, + _addPartial: function(map, name) { + var matcher = map.get(name); + if (isBlank(matcher)) { + matcher = new SelectorMatcher(); + map.set(name, matcher); + } + return matcher; + }, + match: function(cssSelector, matchedCallback) { + var result = false; + var element = cssSelector.element; + var classNames = cssSelector.classNames; + var attrs = cssSelector.attrs; + for (var i = 0; i < this._listContexts.length; i++) { + this._listContexts[i].alreadyMatched = false; + } + result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result; + result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) || result; + if (isPresent(classNames)) { + for (var index = 0; index < classNames.length; index++) { + var className = classNames[index]; + result = this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result; + result = this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) || result; + } + } + if (isPresent(attrs)) { + for (var index = 0; index < attrs.length; ) { + var attrName = attrs[index++]; + var attrValue = attrs[index++]; + var terminalValuesMap = this._attrValueMap.get(attrName); + if (!StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchTerminal(terminalValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result; + } + result = this._matchTerminal(terminalValuesMap, attrValue, cssSelector, matchedCallback) || result; + var partialValuesMap = this._attrValuePartialMap.get(attrName); + if (!StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchPartial(partialValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result; + } + result = this._matchPartial(partialValuesMap, attrValue, cssSelector, matchedCallback) || result; + } + } + return result; + }, + _matchTerminal: function(map, name, cssSelector, matchedCallback) { + if (isBlank(map) || isBlank(name)) { + return false; + } + var selectables = map.get(name); + var starSelectables = map.get("*"); + if (isPresent(starSelectables)) { + selectables = ListWrapper.concat(selectables, starSelectables); + } + if (isBlank(selectables)) { + return false; + } + var selectable; + var result = false; + for (var index = 0; index < selectables.length; index++) { + selectable = selectables[index]; + result = selectable.finalize(cssSelector, matchedCallback) || result; + } + return result; + }, + _matchPartial: function(map, name, cssSelector, matchedCallback) { + if (isBlank(map) || isBlank(name)) { + return false; + } + var nestedSelector = map.get(name); + if (isBlank(nestedSelector)) { + return false; + } + return nestedSelector.match(cssSelector, matchedCallback); + } + }, {createNotMatcher: function(notSelectors) { + var notMatcher = new SelectorMatcher(); + notMatcher.addSelectables(notSelectors, null); + return notMatcher; + }}); + }()); + $__export("SelectorMatcher", SelectorMatcher); + SelectorListContext = (function() { + function SelectorListContext(selectors) { + this.selectors = selectors; + this.alreadyMatched = false; + } + return ($traceurRuntime.createClass)(SelectorListContext, {}, {}); + }()); + $__export("SelectorListContext", SelectorListContext); + SelectorContext = (function() { + function SelectorContext(selector, cbContext, listContext) { + this.selector = selector; + this.cbContext = cbContext; + this.listContext = listContext; + this.notSelectors = selector.notSelectors; + } + return ($traceurRuntime.createClass)(SelectorContext, {finalize: function(cssSelector, callback) { + var result = true; + if (this.notSelectors.length > 0 && (isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + var notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors); + result = !notMatcher.match(cssSelector, null); + } + if (result && isPresent(callback) && (isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + if (isPresent(this.listContext)) { + this.listContext.alreadyMatched = true; + } + callback(this.selector, this.cbContext); + } + return result; + }}, {}); + }()); + $__export("SelectorContext", SelectorContext); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/view_splitter", ["angular2/src/facade/lang", "angular2/src/dom/dom_adapter", "angular2/src/facade/collection", "angular2/src/render/dom/compiler/compile_element", "angular2/src/render/dom/util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/view_splitter"; + var isPresent, + BaseException, + StringWrapper, + DOM, + MapWrapper, + CompileElement, + dashCaseToCamelCase, + ViewSplitter; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + MapWrapper = $__m.MapWrapper; + }, function($__m) { + CompileElement = $__m.CompileElement; + }, function($__m) { + dashCaseToCamelCase = $__m.dashCaseToCamelCase; + }], + execute: function() { + ViewSplitter = (function() { + function ViewSplitter(_parser) { + this._parser = _parser; + } + return ($traceurRuntime.createClass)(ViewSplitter, { + processStyle: function(style) { + return style; + }, + processElement: function(parent, current, control) { + var attrs = current.attrs(); + var templateBindings = attrs.get('template'); + var hasTemplateBinding = isPresent(templateBindings); + MapWrapper.forEach(attrs, (function(attrValue, attrName) { + if (StringWrapper.startsWith(attrName, '*')) { + var key = StringWrapper.substring(attrName, 1); + if (hasTemplateBinding) { + throw new BaseException("Only one template directive per element is allowed: " + (templateBindings + " and " + key + " cannot be used simultaneously ") + ("in " + current.elementDescription)); + } else { + templateBindings = (attrValue.length == 0) ? key : key + ' ' + attrValue; + hasTemplateBinding = true; + } + } + })); + if (isPresent(parent)) { + if (DOM.isTemplateElement(current.element)) { + if (!current.isViewRoot) { + var viewRoot = new CompileElement(DOM.createTemplate('')); + viewRoot.inheritedProtoView = current.bindElement().bindNestedProtoView(viewRoot.element); + viewRoot.elementDescription = current.elementDescription; + viewRoot.isViewRoot = true; + this._moveChildNodes(DOM.content(current.element), DOM.content(viewRoot.element)); + control.addChild(viewRoot); + } + } + if (hasTemplateBinding) { + var anchor = new CompileElement(DOM.createTemplate('')); + anchor.inheritedProtoView = current.inheritedProtoView; + anchor.inheritedElementBinder = current.inheritedElementBinder; + anchor.distanceToInheritedBinder = current.distanceToInheritedBinder; + anchor.elementDescription = current.elementDescription; + var viewRoot = new CompileElement(DOM.createTemplate('')); + viewRoot.inheritedProtoView = anchor.bindElement().bindNestedProtoView(viewRoot.element); + viewRoot.elementDescription = current.elementDescription; + viewRoot.isViewRoot = true; + current.inheritedProtoView = viewRoot.inheritedProtoView; + current.inheritedElementBinder = null; + current.distanceToInheritedBinder = 0; + this._parseTemplateBindings(templateBindings, anchor); + DOM.insertBefore(current.element, anchor.element); + control.addParent(anchor); + DOM.appendChild(DOM.content(viewRoot.element), current.element); + control.addParent(viewRoot); + } + } + }, + _moveChildNodes: function(source, target) { + var next = DOM.firstChild(source); + while (isPresent(next)) { + DOM.appendChild(target, next); + next = DOM.firstChild(source); + } + }, + _parseTemplateBindings: function(templateBindings, compileElement) { + var bindings = this._parser.parseTemplateBindings(templateBindings, compileElement.elementDescription); + for (var i = 0; i < bindings.length; i++) { + var binding = bindings[i]; + if (binding.keyIsVar) { + compileElement.bindElement().bindVariable(dashCaseToCamelCase(binding.key), binding.name); + compileElement.attrs().set(binding.key, binding.name); + } else if (isPresent(binding.expression)) { + compileElement.bindElement().bindProperty(dashCaseToCamelCase(binding.key), binding.expression); + compileElement.attrs().set(binding.key, binding.expression.source); + } else { + DOM.setAttribute(compileElement.element, binding.key, ''); + } + } + } + }, {}); + }()); + $__export("ViewSplitter", ViewSplitter); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/shadow_css", ["angular2/src/dom/dom_adapter", "angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/shadow_css"; + var DOM, + ListWrapper, + StringWrapper, + RegExpWrapper, + RegExpMatcherWrapper, + isPresent, + isBlank, + ShadowCss, + _cssContentNextSelectorRe, + _cssContentRuleRe, + _cssContentUnscopedRuleRe, + _polyfillHost, + _polyfillHostContext, + _parenSuffix, + _cssColonHostRe, + _cssColonHostContextRe, + _polyfillHostNoCombinator, + _shadowDOMSelectorsRe, + _selectorReSuffix, + _polyfillHostRe, + _colonHostRe, + _colonHostContextRe; + function _cssToRules(cssText) { + return DOM.cssToRules(cssText); + } + function _withCssRules(cssText, callback) { + if (isBlank(callback)) + return ; + var rules = _cssToRules(cssText); + callback(rules); + } + return { + setters: [function($__m) { + DOM = $__m.DOM; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + StringWrapper = $__m.StringWrapper; + RegExpWrapper = $__m.RegExpWrapper; + RegExpMatcherWrapper = $__m.RegExpMatcherWrapper; + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + }], + execute: function() { + ShadowCss = (function() { + function ShadowCss() { + this.strictStyling = true; + } + return ($traceurRuntime.createClass)(ShadowCss, { + shimStyle: function(style, selector) { + var hostSelector = arguments[2] !== (void 0) ? arguments[2] : ''; + var cssText = DOM.getText(style); + return this.shimCssText(cssText, selector, hostSelector); + }, + shimCssText: function(cssText, selector) { + var hostSelector = arguments[2] !== (void 0) ? arguments[2] : ''; + cssText = this._insertDirectives(cssText); + return this._scopeCssText(cssText, selector, hostSelector); + }, + _insertDirectives: function(cssText) { + cssText = this._insertPolyfillDirectivesInCssText(cssText); + return this._insertPolyfillRulesInCssText(cssText); + }, + _insertPolyfillDirectivesInCssText: function(cssText) { + return StringWrapper.replaceAllMapped(cssText, _cssContentNextSelectorRe, function(m) { + return m[1] + '{'; + }); + }, + _insertPolyfillRulesInCssText: function(cssText) { + return StringWrapper.replaceAllMapped(cssText, _cssContentRuleRe, function(m) { + var rule = m[0]; + rule = StringWrapper.replace(rule, m[1], ''); + rule = StringWrapper.replace(rule, m[2], ''); + return m[3] + rule; + }); + }, + _scopeCssText: function(cssText, scopeSelector, hostSelector) { + var $__0 = this; + var unscoped = this._extractUnscopedRulesFromCssText(cssText); + cssText = this._insertPolyfillHostInCssText(cssText); + cssText = this._convertColonHost(cssText); + cssText = this._convertColonHostContext(cssText); + cssText = this._convertShadowDOMSelectors(cssText); + if (isPresent(scopeSelector)) { + _withCssRules(cssText, (function(rules) { + cssText = $__0._scopeRules(rules, scopeSelector, hostSelector); + })); + } + cssText = cssText + '\n' + unscoped; + return cssText.trim(); + }, + _extractUnscopedRulesFromCssText: function(cssText) { + var r = '', + m; + var matcher = RegExpWrapper.matcher(_cssContentUnscopedRuleRe, cssText); + while (isPresent(m = RegExpMatcherWrapper.next(matcher))) { + var rule = m[0]; + rule = StringWrapper.replace(rule, m[2], ''); + rule = StringWrapper.replace(rule, m[1], m[3]); + r += rule + '\n\n'; + } + return r; + }, + _convertColonHost: function(cssText) { + return this._convertColonRule(cssText, _cssColonHostRe, this._colonHostPartReplacer); + }, + _convertColonHostContext: function(cssText) { + return this._convertColonRule(cssText, _cssColonHostContextRe, this._colonHostContextPartReplacer); + }, + _convertColonRule: function(cssText, regExp, partReplacer) { + return StringWrapper.replaceAllMapped(cssText, regExp, function(m) { + if (isPresent(m[2])) { + var parts = m[2].split(','), + r = []; + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + if (isBlank(p)) + break; + p = p.trim(); + r.push(partReplacer(_polyfillHostNoCombinator, p, m[3])); + } + return r.join(','); + } else { + return _polyfillHostNoCombinator + m[3]; + } + }); + }, + _colonHostContextPartReplacer: function(host, part, suffix) { + if (StringWrapper.contains(part, _polyfillHost)) { + return this._colonHostPartReplacer(host, part, suffix); + } else { + return host + part + suffix + ', ' + part + ' ' + host + suffix; + } + }, + _colonHostPartReplacer: function(host, part, suffix) { + return host + StringWrapper.replace(part, _polyfillHost, '') + suffix; + }, + _convertShadowDOMSelectors: function(cssText) { + for (var i = 0; i < _shadowDOMSelectorsRe.length; i++) { + cssText = StringWrapper.replaceAll(cssText, _shadowDOMSelectorsRe[i], ' '); + } + return cssText; + }, + _scopeRules: function(cssRules, scopeSelector, hostSelector) { + var cssText = ''; + if (isPresent(cssRules)) { + for (var i = 0; i < cssRules.length; i++) { + var rule = cssRules[i]; + if (DOM.isStyleRule(rule) || DOM.isPageRule(rule)) { + cssText += this._scopeSelector(rule.selectorText, scopeSelector, hostSelector, this.strictStyling) + ' {\n'; + cssText += this._propertiesFromRule(rule) + '\n}\n\n'; + } else if (DOM.isMediaRule(rule)) { + cssText += '@media ' + rule.media.mediaText + ' {\n'; + cssText += this._scopeRules(rule.cssRules, scopeSelector, hostSelector); + cssText += '\n}\n\n'; + } else { + try { + if (isPresent(rule.cssText)) { + cssText += rule.cssText + '\n\n'; + } + } catch (x) { + if (DOM.isKeyframesRule(rule) && isPresent(rule.cssRules)) { + cssText += this._ieSafeCssTextFromKeyFrameRule(rule); + } + } + } + } + } + return cssText; + }, + _ieSafeCssTextFromKeyFrameRule: function(rule) { + var cssText = '@keyframes ' + rule.name + ' {'; + for (var i = 0; i < rule.cssRules.length; i++) { + var r = rule.cssRules[i]; + cssText += ' ' + r.keyText + ' {' + r.style.cssText + '}'; + } + cssText += ' }'; + return cssText; + }, + _scopeSelector: function(selector, scopeSelector, hostSelector, strict) { + var r = [], + parts = selector.split(','); + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + p = p.trim(); + if (this._selectorNeedsScoping(p, scopeSelector)) { + p = strict && !StringWrapper.contains(p, _polyfillHostNoCombinator) ? this._applyStrictSelectorScope(p, scopeSelector) : this._applySelectorScope(p, scopeSelector, hostSelector); + } + r.push(p); + } + return r.join(', '); + }, + _selectorNeedsScoping: function(selector, scopeSelector) { + var re = this._makeScopeMatcher(scopeSelector); + return !isPresent(RegExpWrapper.firstMatch(re, selector)); + }, + _makeScopeMatcher: function(scopeSelector) { + var lre = /\[/g; + var rre = /\]/g; + scopeSelector = StringWrapper.replaceAll(scopeSelector, lre, '\\['); + scopeSelector = StringWrapper.replaceAll(scopeSelector, rre, '\\]'); + return RegExpWrapper.create('^(' + scopeSelector + ')' + _selectorReSuffix, 'm'); + }, + _applySelectorScope: function(selector, scopeSelector, hostSelector) { + return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector); + }, + _applySimpleSelectorScope: function(selector, scopeSelector, hostSelector) { + if (isPresent(RegExpWrapper.firstMatch(_polyfillHostRe, selector))) { + var replaceBy = this.strictStyling ? ("[" + hostSelector + "]") : scopeSelector; + selector = StringWrapper.replace(selector, _polyfillHostNoCombinator, replaceBy); + return StringWrapper.replaceAll(selector, _polyfillHostRe, replaceBy + ' '); + } else { + return scopeSelector + ' ' + selector; + } + }, + _applyStrictSelectorScope: function(selector, scopeSelector) { + var isRe = /\[is=([^\]]*)\]/g; + scopeSelector = StringWrapper.replaceAllMapped(scopeSelector, isRe, (function(m) { + return m[1]; + })); + var splits = [' ', '>', '+', '~'], + scoped = selector, + attrName = '[' + scopeSelector + ']'; + for (var i = 0; i < splits.length; i++) { + var sep = splits[i]; + var parts = scoped.split(sep); + scoped = ListWrapper.map(parts, function(p) { + var t = StringWrapper.replaceAll(p.trim(), _polyfillHostRe, ''); + if (t.length > 0 && !ListWrapper.contains(splits, t) && !StringWrapper.contains(t, attrName)) { + var re = /([^:]*)(:*)(.*)/g; + var m = RegExpWrapper.firstMatch(re, t); + if (isPresent(m)) { + p = m[1] + attrName + m[2] + m[3]; + } + } + return p; + }).join(sep); + } + return scoped; + }, + _insertPolyfillHostInCssText: function(selector) { + selector = StringWrapper.replaceAll(selector, _colonHostContextRe, _polyfillHostContext); + selector = StringWrapper.replaceAll(selector, _colonHostRe, _polyfillHost); + return selector; + }, + _propertiesFromRule: function(rule) { + var cssText = rule.style.cssText; + var attrRe = /['"]+|attr/g; + if (rule.style.content.length > 0 && !isPresent(RegExpWrapper.firstMatch(attrRe, rule.style.content))) { + var contentRe = /content:[^;]*;/g; + cssText = StringWrapper.replaceAll(cssText, contentRe, 'content: \'' + rule.style.content + '\';'); + } + return cssText; + } + }, {}); + }()); + $__export("ShadowCss", ShadowCss); + _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim; + _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim; + _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim; + _polyfillHost = '-shadowcsshost'; + _polyfillHostContext = '-shadowcsscontext'; + _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)'; + _cssColonHostRe = RegExpWrapper.create('(' + _polyfillHost + _parenSuffix, 'im'); + _cssColonHostContextRe = RegExpWrapper.create('(' + _polyfillHostContext + _parenSuffix, 'im'); + _polyfillHostNoCombinator = _polyfillHost + '-no-combinator'; + _shadowDOMSelectorsRe = [/>>>/g, /::shadow/g, /::content/g, /\/deep\//g, /\/shadow-deep\//g, /\/shadow\//g]; + _selectorReSuffix = '([>\\s~+\[.,{:][\\s\\S]*)?$'; + _polyfillHostRe = RegExpWrapper.create(_polyfillHost, 'im'); + _colonHostRe = /:host/gim; + _colonHostContextRe = /:host-context/gim; + } + }; +}); + +System.register("angular2/src/render/dom/view/proto_view_merger", ["angular2/src/dom/dom_adapter", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/render/dom/view/proto_view", "angular2/src/render/dom/view/element_binder", "angular2/src/render/api", "angular2/src/render/dom/util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/view/proto_view_merger"; + var DOM, + isPresent, + isBlank, + isArray, + ListWrapper, + SetWrapper, + MapWrapper, + DomProtoView, + DomProtoViewRef, + resolveInternalDomProtoView, + DomElementBinder, + RenderProtoViewMergeMapping, + ViewType, + ViewEncapsulation, + NG_BINDING_CLASS, + NG_CONTENT_ELEMENT_NAME, + cloneAndQueryProtoView, + queryBoundElements, + queryBoundTextNodeIndices, + NG_SHADOW_ROOT_ELEMENT_NAME; + function mergeProtoViewsRecursively(protoViewRefs) { + var clonedProtoViews = []; + var hostViewAndBinderIndices = []; + cloneProtoViews(protoViewRefs, clonedProtoViews, hostViewAndBinderIndices); + var mainProtoView = clonedProtoViews[0]; + mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices); + var fragments = []; + var elementsWithNativeShadowRoot = new Set(); + mergeComponents(clonedProtoViews, hostViewAndBinderIndices, fragments, elementsWithNativeShadowRoot); + markBoundTextNodeParentsAsBoundElements(clonedProtoViews); + var rootElement = createRootElementFromFragments(fragments); + var fragmentsRootNodeCount = fragments.map((function(fragment) { + return fragment.length; + })); + var rootNode = DOM.content(rootElement); + var mergedBoundElements = queryBoundElements(rootNode, false); + var mergedBoundTextIndices = new Map(); + var boundTextNodeMap = indexBoundTextNodes(clonedProtoViews); + var rootTextNodeIndices = calcRootTextNodeIndices(rootNode, boundTextNodeMap, mergedBoundTextIndices); + var mergedElementBinders = calcElementBinders(clonedProtoViews, mergedBoundElements, elementsWithNativeShadowRoot, boundTextNodeMap, mergedBoundTextIndices); + var mappedElementIndices = calcMappedElementIndices(clonedProtoViews, mergedBoundElements); + var mappedTextIndices = calcMappedTextIndices(clonedProtoViews, mergedBoundTextIndices); + var hostElementIndicesByViewIndex = calcHostElementIndicesByViewIndex(clonedProtoViews, hostViewAndBinderIndices); + var nestedViewCounts = calcNestedViewCounts(hostViewAndBinderIndices); + var mergedProtoView = DomProtoView.create(mainProtoView.original.type, rootElement, mainProtoView.original.encapsulation, fragmentsRootNodeCount, rootTextNodeIndices, mergedElementBinders, new Map()); + return new RenderProtoViewMergeMapping(new DomProtoViewRef(mergedProtoView), fragmentsRootNodeCount.length, mappedElementIndices, mergedBoundElements.length, mappedTextIndices, hostElementIndicesByViewIndex, nestedViewCounts); + } + function cloneProtoViews(protoViewRefs, targetClonedProtoViews, targetHostViewAndBinderIndices) { + var hostProtoView = resolveInternalDomProtoView(protoViewRefs[0]); + var hostPvIdx = targetClonedProtoViews.length; + targetClonedProtoViews.push(cloneAndQueryProtoView(hostProtoView, false)); + if (targetHostViewAndBinderIndices.length === 0) { + targetHostViewAndBinderIndices.push([null, null]); + } + var protoViewIdx = 1; + for (var i = 0; i < hostProtoView.elementBinders.length; i++) { + var binder = hostProtoView.elementBinders[i]; + if (binder.hasNestedProtoView) { + var nestedEntry = protoViewRefs[protoViewIdx++]; + if (isPresent(nestedEntry)) { + targetHostViewAndBinderIndices.push([hostPvIdx, i]); + if (isArray(nestedEntry)) { + cloneProtoViews(nestedEntry, targetClonedProtoViews, targetHostViewAndBinderIndices); + } else { + targetClonedProtoViews.push(cloneAndQueryProtoView(resolveInternalDomProtoView(nestedEntry), false)); + } + } + } + } + } + function markBoundTextNodeParentsAsBoundElements(mergableProtoViews) { + mergableProtoViews.forEach((function(mergableProtoView) { + mergableProtoView.boundTextNodes.forEach((function(textNode) { + var parentNode = textNode.parentNode; + if (isPresent(parentNode) && DOM.isElementNode(parentNode)) { + DOM.addClass(parentNode, NG_BINDING_CLASS); + } + })); + })); + } + function indexBoundTextNodes(mergableProtoViews) { + var boundTextNodeMap = new Map(); + for (var pvIndex = 0; pvIndex < mergableProtoViews.length; pvIndex++) { + var mergableProtoView = mergableProtoViews[pvIndex]; + mergableProtoView.boundTextNodes.forEach((function(textNode) { + boundTextNodeMap.set(textNode, null); + })); + } + return boundTextNodeMap; + } + function mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices) { + var nearestHostComponentOrRootPvIndices = calcNearestHostComponentOrRootPvIndices(clonedProtoViews, hostViewAndBinderIndices); + for (var viewIdx = 1; viewIdx < clonedProtoViews.length; viewIdx++) { + var clonedProtoView = clonedProtoViews[viewIdx]; + if (clonedProtoView.original.type === ViewType.EMBEDDED) { + var hostComponentIdx = nearestHostComponentOrRootPvIndices[viewIdx]; + var hostPv = clonedProtoViews[hostComponentIdx]; + clonedProtoView.fragments.forEach((function(fragment) { + return hostPv.fragments.push(fragment); + })); + } + } + } + function calcNearestHostComponentOrRootPvIndices(clonedProtoViews, hostViewAndBinderIndices) { + var nearestHostComponentOrRootPvIndices = ListWrapper.createFixedSize(clonedProtoViews.length); + nearestHostComponentOrRootPvIndices[0] = null; + for (var viewIdx = 1; viewIdx < hostViewAndBinderIndices.length; viewIdx++) { + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostProtoView = clonedProtoViews[hostViewIdx]; + if (hostViewIdx === 0 || hostProtoView.original.type === ViewType.COMPONENT) { + nearestHostComponentOrRootPvIndices[viewIdx] = hostViewIdx; + } else { + nearestHostComponentOrRootPvIndices[viewIdx] = nearestHostComponentOrRootPvIndices[hostViewIdx]; + } + } + return nearestHostComponentOrRootPvIndices; + } + function mergeComponents(clonedProtoViews, hostViewAndBinderIndices, targetFragments, targetElementsWithNativeShadowRoot) { + var hostProtoView = clonedProtoViews[0]; + hostProtoView.fragments.forEach((function(fragment) { + return targetFragments.push(fragment); + })); + for (var viewIdx = 1; viewIdx < clonedProtoViews.length; viewIdx++) { + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostBinderIdx = hostViewAndBinderIndices[viewIdx][1]; + var hostProtoView = clonedProtoViews[hostViewIdx]; + var clonedProtoView = clonedProtoViews[viewIdx]; + if (clonedProtoView.original.type === ViewType.COMPONENT) { + mergeComponent(hostProtoView, hostBinderIdx, clonedProtoView, targetFragments, targetElementsWithNativeShadowRoot); + } + } + } + function mergeComponent(hostProtoView, binderIdx, nestedProtoView, targetFragments, targetElementsWithNativeShadowRoot) { + var hostElement = hostProtoView.boundElements[binderIdx]; + var fragmentElements = mapFragmentsIntoElements(nestedProtoView.fragments); + var contentElements = findContentElements(fragmentElements); + var projectableNodes = DOM.childNodesAsList(hostElement); + for (var i = 0; i < contentElements.length; i++) { + var contentElement = contentElements[i]; + var select = DOM.getAttribute(contentElement, 'select'); + projectableNodes = projectMatchingNodes(select, contentElement, projectableNodes); + } + var fragments = extractFragmentNodesFromElements(fragmentElements); + var useNativeShadowRoot = nestedProtoView.original.encapsulation === ViewEncapsulation.NATIVE; + if (useNativeShadowRoot) { + targetElementsWithNativeShadowRoot.add(hostElement); + } + MapWrapper.forEach(nestedProtoView.original.hostAttributes, (function(attrValue, attrName) { + DOM.setAttribute(hostElement, attrName, attrValue); + })); + appendComponentNodesToHost(hostProtoView, binderIdx, fragments[0], useNativeShadowRoot); + for (var i = 1; i < fragments.length; i++) { + targetFragments.push(fragments[i]); + } + } + function mapFragmentsIntoElements(fragments) { + return fragments.map((function(fragment) { + var fragmentElement = DOM.createTemplate(''); + fragment.forEach((function(node) { + return DOM.appendChild(DOM.content(fragmentElement), node); + })); + return fragmentElement; + })); + } + function extractFragmentNodesFromElements(fragmentElements) { + return fragmentElements.map((function(fragmentElement) { + return DOM.childNodesAsList(DOM.content(fragmentElement)); + })); + } + function findContentElements(fragmentElements) { + var contentElements = []; + fragmentElements.forEach((function(fragmentElement) { + var fragmentContentElements = DOM.querySelectorAll(DOM.content(fragmentElement), NG_CONTENT_ELEMENT_NAME); + for (var i = 0; i < fragmentContentElements.length; i++) { + contentElements.push(fragmentContentElements[i]); + } + })); + return sortContentElements(contentElements); + } + function appendComponentNodesToHost(hostProtoView, binderIdx, componentRootNodes, useNativeShadowRoot) { + var hostElement = hostProtoView.boundElements[binderIdx]; + if (useNativeShadowRoot) { + var shadowRootWrapper = DOM.createElement(NG_SHADOW_ROOT_ELEMENT_NAME); + for (var i = 0; i < componentRootNodes.length; i++) { + DOM.appendChild(shadowRootWrapper, componentRootNodes[i]); + } + var firstChild = DOM.firstChild(hostElement); + if (isPresent(firstChild)) { + DOM.insertBefore(firstChild, shadowRootWrapper); + } else { + DOM.appendChild(hostElement, shadowRootWrapper); + } + } else { + DOM.clearNodes(hostElement); + for (var i = 0; i < componentRootNodes.length; i++) { + DOM.appendChild(hostElement, componentRootNodes[i]); + } + } + } + function projectMatchingNodes(selector, contentElement, nodes) { + var remaining = []; + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var matches = false; + if (isWildcard(selector)) { + matches = true; + } else if (DOM.isElementNode(node) && DOM.elementMatches(node, selector)) { + matches = true; + } + if (matches) { + DOM.insertBefore(contentElement, node); + } else { + remaining.push(node); + } + } + DOM.remove(contentElement); + return remaining; + } + function isWildcard(selector) { + return isBlank(selector) || selector.length === 0 || selector == '*'; + } + function sortContentElements(contentElements) { + var firstWildcard = null; + var sorted = []; + contentElements.forEach((function(contentElement) { + var select = DOM.getAttribute(contentElement, 'select'); + if (isWildcard(select)) { + if (isBlank(firstWildcard)) { + firstWildcard = contentElement; + } + } else { + sorted.push(contentElement); + } + })); + if (isPresent(firstWildcard)) { + sorted.push(firstWildcard); + } + return sorted; + } + function createRootElementFromFragments(fragments) { + var rootElement = DOM.createTemplate(''); + var rootNode = DOM.content(rootElement); + fragments.forEach((function(fragment) { + fragment.forEach((function(node) { + DOM.appendChild(rootNode, node); + })); + })); + return rootElement; + } + function calcRootTextNodeIndices(rootNode, boundTextNodes, targetBoundTextIndices) { + var rootTextNodeIndices = []; + queryBoundTextNodeIndices(rootNode, boundTextNodes, (function(textNode, nodeIndex, _) { + rootTextNodeIndices.push(nodeIndex); + targetBoundTextIndices.set(textNode, targetBoundTextIndices.size); + })); + return rootTextNodeIndices; + } + function calcElementBinders(clonedProtoViews, mergedBoundElements, elementsWithNativeShadowRoot, boundTextNodes, targetBoundTextIndices) { + var elementBinderByElement = indexElementBindersByElement(clonedProtoViews); + var mergedElementBinders = []; + for (var i = 0; i < mergedBoundElements.length; i++) { + var element = mergedBoundElements[i]; + var textNodeIndices = []; + queryBoundTextNodeIndices(element, boundTextNodes, (function(textNode, nodeIndex, _) { + textNodeIndices.push(nodeIndex); + targetBoundTextIndices.set(textNode, targetBoundTextIndices.size); + })); + mergedElementBinders.push(updateElementBinders(elementBinderByElement.get(element), textNodeIndices, SetWrapper.has(elementsWithNativeShadowRoot, element))); + } + return mergedElementBinders; + } + function indexElementBindersByElement(mergableProtoViews) { + var elementBinderByElement = new Map(); + mergableProtoViews.forEach((function(mergableProtoView) { + for (var i = 0; i < mergableProtoView.boundElements.length; i++) { + var el = mergableProtoView.boundElements[i]; + if (isPresent(el)) { + elementBinderByElement.set(el, mergableProtoView.original.elementBinders[i]); + } + } + })); + return elementBinderByElement; + } + function updateElementBinders(elementBinder, textNodeIndices, hasNativeShadowRoot) { + var result; + if (isBlank(elementBinder)) { + result = new DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: false, + eventLocals: null, + localEvents: [], + globalEvents: [], + hasNativeShadowRoot: false + }); + } else { + result = new DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: false, + eventLocals: elementBinder.eventLocals, + localEvents: elementBinder.localEvents, + globalEvents: elementBinder.globalEvents, + hasNativeShadowRoot: hasNativeShadowRoot + }); + } + return result; + } + function calcMappedElementIndices(clonedProtoViews, mergedBoundElements) { + var mergedBoundElementIndices = indexArray(mergedBoundElements); + var mappedElementIndices = []; + clonedProtoViews.forEach((function(clonedProtoView) { + clonedProtoView.boundElements.forEach((function(boundElement) { + var mappedElementIndex = mergedBoundElementIndices.get(boundElement); + mappedElementIndices.push(mappedElementIndex); + })); + })); + return mappedElementIndices; + } + function calcMappedTextIndices(clonedProtoViews, mergedBoundTextIndices) { + var mappedTextIndices = []; + clonedProtoViews.forEach((function(clonedProtoView) { + clonedProtoView.boundTextNodes.forEach((function(textNode) { + var mappedTextIndex = mergedBoundTextIndices.get(textNode); + mappedTextIndices.push(mappedTextIndex); + })); + })); + return mappedTextIndices; + } + function calcHostElementIndicesByViewIndex(clonedProtoViews, hostViewAndBinderIndices) { + var hostElementIndices = [null]; + var viewElementOffsets = [0]; + var elementIndex = clonedProtoViews[0].original.elementBinders.length; + for (var viewIdx = 1; viewIdx < hostViewAndBinderIndices.length; viewIdx++) { + viewElementOffsets.push(elementIndex); + elementIndex += clonedProtoViews[viewIdx].original.elementBinders.length; + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostBinderIdx = hostViewAndBinderIndices[viewIdx][1]; + hostElementIndices.push(viewElementOffsets[hostViewIdx] + hostBinderIdx); + } + return hostElementIndices; + } + function calcNestedViewCounts(hostViewAndBinderIndices) { + var nestedViewCounts = ListWrapper.createFixedSize(hostViewAndBinderIndices.length); + ListWrapper.fill(nestedViewCounts, 0); + for (var viewIdx = hostViewAndBinderIndices.length - 1; viewIdx >= 1; viewIdx--) { + var hostViewAndElementIdx = hostViewAndBinderIndices[viewIdx]; + if (isPresent(hostViewAndElementIdx)) { + nestedViewCounts[hostViewAndElementIdx[0]] += nestedViewCounts[viewIdx] + 1; + } + } + return nestedViewCounts; + } + function indexArray(arr) { + var map = new Map(); + for (var i = 0; i < arr.length; i++) { + map.set(arr[i], i); + } + return map; + } + $__export("mergeProtoViewsRecursively", mergeProtoViewsRecursively); + return { + setters: [function($__m) { + DOM = $__m.DOM; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + isArray = $__m.isArray; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + SetWrapper = $__m.SetWrapper; + MapWrapper = $__m.MapWrapper; + }, function($__m) { + DomProtoView = $__m.DomProtoView; + DomProtoViewRef = $__m.DomProtoViewRef; + resolveInternalDomProtoView = $__m.resolveInternalDomProtoView; + }, function($__m) { + DomElementBinder = $__m.DomElementBinder; + }, function($__m) { + RenderProtoViewMergeMapping = $__m.RenderProtoViewMergeMapping; + ViewType = $__m.ViewType; + ViewEncapsulation = $__m.ViewEncapsulation; + }, function($__m) { + NG_BINDING_CLASS = $__m.NG_BINDING_CLASS; + NG_CONTENT_ELEMENT_NAME = $__m.NG_CONTENT_ELEMENT_NAME; + cloneAndQueryProtoView = $__m.cloneAndQueryProtoView; + queryBoundElements = $__m.queryBoundElements; + queryBoundTextNodeIndices = $__m.queryBoundTextNodeIndices; + NG_SHADOW_ROOT_ELEMENT_NAME = $__m.NG_SHADOW_ROOT_ELEMENT_NAME; + }], + execute: function() { + } + }; +}); + +System.register("angular2/src/render/dom/view/view", ["angular2/src/dom/dom_adapter", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/render/api", "angular2/src/render/dom/util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/view/view"; + var DOM, + Map, + isPresent, + stringify, + RenderViewRef, + camelCaseToDashCase, + DomViewRef, + DomView; + function resolveInternalDomView(viewRef) { + return viewRef._view; + } + $__export("resolveInternalDomView", resolveInternalDomView); + return { + setters: [function($__m) { + DOM = $__m.DOM; + }, function($__m) { + Map = $__m.Map; + }, function($__m) { + isPresent = $__m.isPresent; + stringify = $__m.stringify; + }, function($__m) { + RenderViewRef = $__m.RenderViewRef; + }, function($__m) { + camelCaseToDashCase = $__m.camelCaseToDashCase; + }], + execute: function() { + DomViewRef = (function($__super) { + function DomViewRef(_view) { + $traceurRuntime.superConstructor(DomViewRef).call(this); + this._view = _view; + } + return ($traceurRuntime.createClass)(DomViewRef, {}, {}, $__super); + }(RenderViewRef)); + $__export("DomViewRef", DomViewRef); + DomView = (function() { + function DomView(proto, boundTextNodes, boundElements) { + this.proto = proto; + this.boundTextNodes = boundTextNodes; + this.boundElements = boundElements; + this.hydrated = false; + this.eventDispatcher = null; + this.eventHandlerRemovers = []; + } + return ($traceurRuntime.createClass)(DomView, { + setElementProperty: function(elementIndex, propertyName, value) { + DOM.setProperty(this.boundElements[elementIndex], propertyName, value); + }, + setElementAttribute: function(elementIndex, attributeName, value) { + var element = this.boundElements[elementIndex]; + var dashCasedAttributeName = camelCaseToDashCase(attributeName); + if (isPresent(value)) { + DOM.setAttribute(element, dashCasedAttributeName, stringify(value)); + } else { + DOM.removeAttribute(element, dashCasedAttributeName); + } + }, + setElementClass: function(elementIndex, className, isAdd) { + var element = this.boundElements[elementIndex]; + if (isAdd) { + DOM.addClass(element, className); + } else { + DOM.removeClass(element, className); + } + }, + setElementStyle: function(elementIndex, styleName, value) { + var element = this.boundElements[elementIndex]; + var dashCasedStyleName = camelCaseToDashCase(styleName); + if (isPresent(value)) { + DOM.setStyle(element, dashCasedStyleName, stringify(value)); + } else { + DOM.removeStyle(element, dashCasedStyleName); + } + }, + invokeElementMethod: function(elementIndex, methodName, args) { + var element = this.boundElements[elementIndex]; + DOM.invoke(element, methodName, args); + }, + setText: function(textIndex, value) { + DOM.setText(this.boundTextNodes[textIndex], value); + }, + dispatchEvent: function(elementIndex, eventName, event) { + var allowDefaultBehavior = true; + if (isPresent(this.eventDispatcher)) { + var evalLocals = new Map(); + evalLocals.set('$event', event); + allowDefaultBehavior = this.eventDispatcher.dispatchRenderEvent(elementIndex, eventName, evalLocals); + if (!allowDefaultBehavior) { + event.preventDefault(); + } + } + return allowDefaultBehavior; + } + }, {}); + }()); + $__export("DomView", DomView); + } + }; +}); + +System.register("angular2/src/render/dom/view/fragment", ["angular2/src/render/api"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/view/fragment"; + var RenderFragmentRef, + DomFragmentRef; + function resolveInternalDomFragment(fragmentRef) { + return fragmentRef._nodes; + } + $__export("resolveInternalDomFragment", resolveInternalDomFragment); + return { + setters: [function($__m) { + RenderFragmentRef = $__m.RenderFragmentRef; + }], + execute: function() { + DomFragmentRef = (function($__super) { + function DomFragmentRef(_nodes) { + $traceurRuntime.superConstructor(DomFragmentRef).call(this); + this._nodes = _nodes; + } + return ($traceurRuntime.createClass)(DomFragmentRef, {}, {}, $__super); + }(RenderFragmentRef)); + $__export("DomFragmentRef", DomFragmentRef); + } + }; +}); + +System.register("angular2/src/core/application_tokens", ["angular2/di", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/application_tokens"; + var OpaqueToken, + CONST_EXPR, + appComponentRefPromiseToken, + appComponentTypeToken; + return { + setters: [function($__m) { + OpaqueToken = $__m.OpaqueToken; + }, function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }], + execute: function() { + appComponentRefPromiseToken = CONST_EXPR(new OpaqueToken('Promise')); + $__export("appComponentRefPromiseToken", appComponentRefPromiseToken); + appComponentTypeToken = CONST_EXPR(new OpaqueToken('RootComponent')); + $__export("appComponentTypeToken", appComponentTypeToken); + } + }; +}); + +System.register("angular2/src/core/annotations/annotations", ["angular2/src/core/annotations_impl/annotations"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/annotations/annotations"; + return { + setters: [function($__m) { + $__export("ComponentAnnotation", $__m.Component); + $__export("DirectiveAnnotation", $__m.Directive); + $__export("LifecycleEvent", $__m.LifecycleEvent); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/core/annotations/view", ["angular2/src/core/annotations_impl/view"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/annotations/view"; + return { + setters: [function($__m) { + $__export("ViewAnnotation", $__m.View); + $__export("ViewEncapsulation", $__m.ViewEncapsulation); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/core/annotations/di", ["angular2/src/core/annotations_impl/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/annotations/di"; + return { + setters: [function($__m) { + $__export("QueryAnnotation", $__m.Query); + $__export("ViewQueryAnnotation", $__m.ViewQuery); + $__export("AttributeAnnotation", $__m.Attribute); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/core/annotations/decorators", ["angular2/src/core/annotations/annotations", "angular2/src/core/annotations/view", "angular2/src/core/annotations/di", "angular2/src/util/decorators"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/annotations/decorators"; + var ComponentAnnotation, + DirectiveAnnotation, + ViewAnnotation, + AttributeAnnotation, + QueryAnnotation, + ViewQueryAnnotation, + makeDecorator, + makeParamDecorator, + Component, + Directive, + View, + Attribute, + Query, + ViewQuery; + return { + setters: [function($__m) { + ComponentAnnotation = $__m.ComponentAnnotation; + DirectiveAnnotation = $__m.DirectiveAnnotation; + }, function($__m) { + ViewAnnotation = $__m.ViewAnnotation; + }, function($__m) { + AttributeAnnotation = $__m.AttributeAnnotation; + QueryAnnotation = $__m.QueryAnnotation; + ViewQueryAnnotation = $__m.ViewQueryAnnotation; + }, function($__m) { + makeDecorator = $__m.makeDecorator; + makeParamDecorator = $__m.makeParamDecorator; + }], + execute: function() { + Component = makeDecorator(ComponentAnnotation, (function(fn) { + return fn.View = View; + })); + $__export("Component", Component); + Directive = makeDecorator(DirectiveAnnotation); + $__export("Directive", Directive); + View = makeDecorator(ViewAnnotation, (function(fn) { + return fn.View = View; + })); + $__export("View", View); + Attribute = makeParamDecorator(AttributeAnnotation); + $__export("Attribute", Attribute); + Query = makeParamDecorator(QueryAnnotation); + $__export("Query", Query); + ViewQuery = makeParamDecorator(ViewQueryAnnotation); + $__export("ViewQuery", ViewQuery); + } + }; +}); + +System.register("angular2/core", ["angular2/src/core/application_tokens", "angular2/src/core/application_common", "angular2/src/services/app_root_url", "angular2/src/services/url_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/compiler", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/query_list", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/zone/ng_zone", "angular2/src/facade/async"], function($__export) { + "use strict"; + var __moduleName = "angular2/core"; + return { + setters: [function($__m) { + $__export("appComponentTypeToken", $__m.appComponentTypeToken); + }, function($__m) { + $__export("ApplicationRef", $__m.ApplicationRef); + }, function($__m) { + $__export("AppRootUrl", $__m.AppRootUrl); + }, function($__m) { + $__export("UrlResolver", $__m.UrlResolver); + }, function($__m) { + $__export("ComponentUrlMapper", $__m.ComponentUrlMapper); + }, function($__m) { + $__export("DirectiveResolver", $__m.DirectiveResolver); + }, function($__m) { + $__export("Compiler", $__m.Compiler); + }, function($__m) { + $__export("AppViewManager", $__m.AppViewManager); + }, function($__m) { + $__export("QueryList", $__m.QueryList); + }, function($__m) { + $__export("DynamicComponentLoader", $__m.DynamicComponentLoader); + $__export("ComponentRef", $__m.ComponentRef); + }, function($__m) { + $__export("ElementRef", $__m.ElementRef); + }, function($__m) { + $__export("TemplateRef", $__m.TemplateRef); + }, function($__m) { + $__export("ViewRef", $__m.ViewRef); + $__export("ProtoViewRef", $__m.ProtoViewRef); + }, function($__m) { + $__export("ViewContainerRef", $__m.ViewContainerRef); + }, function($__m) { + $__export("NgZone", $__m.NgZone); + }, function($__m) { + $__export("Observable", $__m.Observable); + $__export("EventEmitter", $__m.EventEmitter); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/directives/ng_for", ["angular2/annotations", "angular2/core", "angular2/change_detection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/directives/ng_for"; + var __decorate, + __metadata, + Directive, + LifecycleEvent, + ViewContainerRef, + TemplateRef, + ChangeDetectorRef, + Pipes, + isPresent, + isBlank, + NgFor, + RecordViewTuple; + return { + setters: [function($__m) { + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + ViewContainerRef = $__m.ViewContainerRef; + TemplateRef = $__m.TemplateRef; + }, function($__m) { + ChangeDetectorRef = $__m.ChangeDetectorRef; + Pipes = $__m.Pipes; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + NgFor = (($traceurRuntime.createClass)(function(viewContainer, templateRef, pipes, cdr) { + this.viewContainer = viewContainer; + this.templateRef = templateRef; + this.pipes = pipes; + this.cdr = cdr; + }, { + set ngForOf(value) { + this._ngForOf = value; + this._pipe = this.pipes.get("iterableDiff", value, this.cdr, this._pipe); + }, + onCheck: function() { + var diff = this._pipe.transform(this._ngForOf, null); + if (isPresent(diff)) + this._applyChanges(diff.wrapped); + }, + _applyChanges: function(changes) { + if (isBlank(changes)) { + this.viewContainer.clear(); + return ; + } + var recordViewTuples = []; + changes.forEachRemovedItem((function(removedRecord) { + return recordViewTuples.push(new RecordViewTuple(removedRecord, null)); + })); + changes.forEachMovedItem((function(movedRecord) { + return recordViewTuples.push(new RecordViewTuple(movedRecord, null)); + })); + var insertTuples = NgFor.bulkRemove(recordViewTuples, this.viewContainer); + changes.forEachAddedItem((function(addedRecord) { + return insertTuples.push(new RecordViewTuple(addedRecord, null)); + })); + NgFor.bulkInsert(insertTuples, this.viewContainer, this.templateRef); + for (var i = 0; i < insertTuples.length; i++) { + this._perViewChange(insertTuples[i].view, insertTuples[i].record); + } + }, + _perViewChange: function(view, record) { + view.setLocal('\$implicit', record.item); + view.setLocal('index', record.currentIndex); + } + }, { + bulkRemove: function(tuples, viewContainer) { + tuples.sort((function(a, b) { + return a.record.previousIndex - b.record.previousIndex; + })); + var movedTuples = []; + for (var i = tuples.length - 1; i >= 0; i--) { + var tuple = tuples[i]; + if (isPresent(tuple.record.currentIndex)) { + tuple.view = viewContainer.detach(tuple.record.previousIndex); + movedTuples.push(tuple); + } else { + viewContainer.remove(tuple.record.previousIndex); + } + } + return movedTuples; + }, + bulkInsert: function(tuples, viewContainer, templateRef) { + tuples.sort((function(a, b) { + return a.record.currentIndex - b.record.currentIndex; + })); + for (var i = 0; i < tuples.length; i++) { + var tuple = tuples[i]; + if (isPresent(tuple.view)) { + viewContainer.insert(tuple.view, tuple.record.currentIndex); + } else { + tuple.view = viewContainer.createEmbeddedView(templateRef, tuple.record.currentIndex); + } + } + return tuples; + } + })); + $__export("NgFor", NgFor); + $__export("NgFor", NgFor = __decorate([Directive({ + selector: '[ng-for][ng-for-of]', + properties: ['ngForOf'], + lifecycle: [LifecycleEvent.onCheck] + }), __metadata('design:paramtypes', [ViewContainerRef, TemplateRef, Pipes, ChangeDetectorRef])], NgFor)); + RecordViewTuple = (function() { + function RecordViewTuple(record, view) { + this.record = record; + this.view = view; + } + return ($traceurRuntime.createClass)(RecordViewTuple, {}, {}); + }()); + $__export("RecordViewTuple", RecordViewTuple); + } + }; +}); + +System.register("angular2/src/directives/ng_if", ["angular2/annotations", "angular2/core", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/directives/ng_if"; + var __decorate, + __metadata, + Directive, + ViewContainerRef, + TemplateRef, + isBlank, + NgIf; + return { + setters: [function($__m) { + Directive = $__m.Directive; + }, function($__m) { + ViewContainerRef = $__m.ViewContainerRef; + TemplateRef = $__m.TemplateRef; + }, function($__m) { + isBlank = $__m.isBlank; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + NgIf = (($traceurRuntime.createClass)(function(viewContainer, templateRef) { + this.viewContainer = viewContainer; + this.prevCondition = null; + this.templateRef = templateRef; + }, {set ngIf(newCondition) { + if (newCondition && (isBlank(this.prevCondition) || !this.prevCondition)) { + this.prevCondition = true; + this.viewContainer.createEmbeddedView(this.templateRef); + } else if (!newCondition && (isBlank(this.prevCondition) || this.prevCondition)) { + this.prevCondition = false; + this.viewContainer.clear(); + } + }}, {})); + $__export("NgIf", NgIf); + $__export("NgIf", NgIf = __decorate([Directive({ + selector: '[ng-if]', + properties: ['ngIf'] + }), __metadata('design:paramtypes', [ViewContainerRef, TemplateRef])], NgIf)); + } + }; +}); + +System.register("angular2/src/directives/ng_non_bindable", ["angular2/annotations"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/directives/ng_non_bindable"; + var __decorate, + __metadata, + Directive, + NgNonBindable; + return { + setters: [function($__m) { + Directive = $__m.Directive; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + NgNonBindable = (($traceurRuntime.createClass)(function() {}, {}, {})); + $__export("NgNonBindable", NgNonBindable); + $__export("NgNonBindable", NgNonBindable = __decorate([Directive({ + selector: '[ng-non-bindable]', + compileChildren: false + }), __metadata('design:paramtypes', [])], NgNonBindable)); + } + }; +}); + +System.register("angular2/src/directives/ng_switch", ["angular2/annotations", "angular2/di", "angular2/core", "angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/directives/ng_switch"; + var __decorate, + __metadata, + __param, + Directive, + Ancestor, + ViewContainerRef, + TemplateRef, + isPresent, + isBlank, + normalizeBlank, + ListWrapper, + MapWrapper, + Map, + SwitchView, + NgSwitch, + NgSwitchWhen, + NgSwitchDefault, + _whenDefault; + return { + setters: [function($__m) { + Directive = $__m.Directive; + }, function($__m) { + Ancestor = $__m.Ancestor; + }, function($__m) { + ViewContainerRef = $__m.ViewContainerRef; + TemplateRef = $__m.TemplateRef; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + normalizeBlank = $__m.normalizeBlank; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + MapWrapper = $__m.MapWrapper; + Map = $__m.Map; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + SwitchView = (function() { + function SwitchView(viewContainerRef, templateRef) { + this._templateRef = templateRef; + this._viewContainerRef = viewContainerRef; + } + return ($traceurRuntime.createClass)(SwitchView, { + create: function() { + this._viewContainerRef.createEmbeddedView(this._templateRef); + }, + destroy: function() { + this._viewContainerRef.clear(); + } + }, {}); + }()); + $__export("SwitchView", SwitchView); + NgSwitch = (($traceurRuntime.createClass)(function() { + this._valueViews = new Map(); + this._activeViews = []; + this._useDefault = false; + }, { + set ngSwitch(value) { + this._emptyAllActiveViews(); + this._useDefault = false; + var views = this._valueViews.get(value); + if (isBlank(views)) { + this._useDefault = true; + views = normalizeBlank(this._valueViews.get(_whenDefault)); + } + this._activateViews(views); + this._switchValue = value; + }, + _onWhenValueChanged: function(oldWhen, newWhen, view) { + this._deregisterView(oldWhen, view); + this._registerView(newWhen, view); + if (oldWhen === this._switchValue) { + view.destroy(); + ListWrapper.remove(this._activeViews, view); + } else if (newWhen === this._switchValue) { + if (this._useDefault) { + this._useDefault = false; + this._emptyAllActiveViews(); + } + view.create(); + this._activeViews.push(view); + } + if (this._activeViews.length === 0 && !this._useDefault) { + this._useDefault = true; + this._activateViews(this._valueViews.get(_whenDefault)); + } + }, + _emptyAllActiveViews: function() { + var activeContainers = this._activeViews; + for (var i = 0; i < activeContainers.length; i++) { + activeContainers[i].destroy(); + } + this._activeViews = []; + }, + _activateViews: function(views) { + if (isPresent(views)) { + for (var i = 0; i < views.length; i++) { + views[i].create(); + } + this._activeViews = views; + } + }, + _registerView: function(value, view) { + var views = this._valueViews.get(value); + if (isBlank(views)) { + views = []; + this._valueViews.set(value, views); + } + views.push(view); + }, + _deregisterView: function(value, view) { + if (value == _whenDefault) + return ; + var views = this._valueViews.get(value); + if (views.length == 1) { + MapWrapper.delete(this._valueViews, value); + } else { + ListWrapper.remove(views, view); + } + } + }, {})); + $__export("NgSwitch", NgSwitch); + $__export("NgSwitch", NgSwitch = __decorate([Directive({ + selector: '[ng-switch]', + properties: ['ngSwitch'] + }), __metadata('design:paramtypes', [])], NgSwitch)); + NgSwitchWhen = (($traceurRuntime.createClass)(function(viewContainer, templateRef, sswitch) { + this._value = _whenDefault; + this._switch = sswitch; + this._view = new SwitchView(viewContainer, templateRef); + }, { + onDestroy: function() { + this._switch; + }, + set ngSwitchWhen(value) { + this._switch._onWhenValueChanged(this._value, value, this._view); + this._value = value; + } + }, {})); + $__export("NgSwitchWhen", NgSwitchWhen); + $__export("NgSwitchWhen", NgSwitchWhen = __decorate([Directive({ + selector: '[ng-switch-when]', + properties: ['ngSwitchWhen'] + }), __param(2, Ancestor()), __metadata('design:paramtypes', [ViewContainerRef, TemplateRef, NgSwitch])], NgSwitchWhen)); + NgSwitchDefault = (($traceurRuntime.createClass)(function(viewContainer, templateRef, sswitch) { + sswitch._registerView(_whenDefault, new SwitchView(viewContainer, templateRef)); + }, {}, {})); + $__export("NgSwitchDefault", NgSwitchDefault); + $__export("NgSwitchDefault", NgSwitchDefault = __decorate([Directive({selector: '[ng-switch-default]'}), __param(2, Ancestor()), __metadata('design:paramtypes', [ViewContainerRef, TemplateRef, NgSwitch])], NgSwitchDefault)); + _whenDefault = new Object(); + } + }; +}); + +System.register("angular2/src/directives/class", ["angular2/annotations", "angular2/core", "angular2/src/change_detection/pipes/pipes", "angular2/src/render/api", "angular2/src/change_detection/pipes/iterable_changes", "angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/directives/class"; + var __decorate, + __metadata, + Directive, + LifecycleEvent, + ElementRef, + Pipes, + Renderer, + IterableChanges, + isPresent, + isString, + ListWrapper, + StringMapWrapper, + isListLikeIterable, + CSSClass; + return { + setters: [function($__m) { + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + ElementRef = $__m.ElementRef; + }, function($__m) { + Pipes = $__m.Pipes; + }, function($__m) { + Renderer = $__m.Renderer; + }, function($__m) { + IterableChanges = $__m.IterableChanges; + }, function($__m) { + isPresent = $__m.isPresent; + isString = $__m.isString; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + StringMapWrapper = $__m.StringMapWrapper; + isListLikeIterable = $__m.isListLikeIterable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + CSSClass = (($traceurRuntime.createClass)(function(_pipes, _ngEl, _renderer) { + this._pipes = _pipes; + this._ngEl = _ngEl; + this._renderer = _renderer; + }, { + set rawClass(v) { + this._cleanupClasses(this._rawClass); + if (isString(v)) { + v = v.split(' '); + } + this._rawClass = v; + this._pipe = this._pipes.get(isListLikeIterable(v) ? 'iterableDiff' : 'keyValDiff', v); + }, + onCheck: function() { + var diff = this._pipe.transform(this._rawClass, null); + if (isPresent(diff) && isPresent(diff.wrapped)) { + if (diff.wrapped instanceof IterableChanges) { + this._applyArrayChanges(diff.wrapped); + } else { + this._applyObjectChanges(diff.wrapped); + } + } + }, + onDestroy: function() { + this._cleanupClasses(this._rawClass); + }, + _cleanupClasses: function(rawClassVal) { + var $__0 = this; + if (isPresent(rawClassVal)) { + if (isListLikeIterable(rawClassVal)) { + ListWrapper.forEach(rawClassVal, (function(className) { + $__0._toggleClass(className, false); + })); + } else { + StringMapWrapper.forEach(rawClassVal, (function(expVal, className) { + if (expVal) + $__0._toggleClass(className, false); + })); + } + } + }, + _applyObjectChanges: function(diff) { + var $__0 = this; + diff.forEachAddedItem((function(record) { + $__0._toggleClass(record.key, record.currentValue); + })); + diff.forEachChangedItem((function(record) { + $__0._toggleClass(record.key, record.currentValue); + })); + diff.forEachRemovedItem((function(record) { + if (record.previousValue) { + $__0._toggleClass(record.key, false); + } + })); + }, + _applyArrayChanges: function(diff) { + var $__0 = this; + diff.forEachAddedItem((function(record) { + $__0._toggleClass(record.item, true); + })); + diff.forEachRemovedItem((function(record) { + $__0._toggleClass(record.item, false); + })); + }, + _toggleClass: function(className, enabled) { + this._renderer.setElementClass(this._ngEl, className, enabled); + } + }, {})); + $__export("CSSClass", CSSClass); + $__export("CSSClass", CSSClass = __decorate([Directive({ + selector: '[class]', + lifecycle: [LifecycleEvent.onCheck, LifecycleEvent.onDestroy], + properties: ['rawClass: class'] + }), __metadata('design:paramtypes', [Pipes, ElementRef, Renderer])], CSSClass)); + } + }; +}); + +System.register("angular2/src/directives/ng_style", ["angular2/annotations", "angular2/core", "angular2/src/change_detection/pipes/pipes", "angular2/src/facade/lang", "angular2/src/render/api"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/directives/ng_style"; + var __decorate, + __metadata, + Directive, + LifecycleEvent, + ElementRef, + Pipes, + isPresent, + Renderer, + NgStyle; + return { + setters: [function($__m) { + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + ElementRef = $__m.ElementRef; + }, function($__m) { + Pipes = $__m.Pipes; + }, function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + Renderer = $__m.Renderer; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + NgStyle = (($traceurRuntime.createClass)(function(_pipes, _ngEl, _renderer) { + this._pipes = _pipes; + this._ngEl = _ngEl; + this._renderer = _renderer; + }, { + set rawStyle(v) { + this._rawStyle = v; + this._pipe = this._pipes.get('keyValDiff', this._rawStyle); + }, + onCheck: function() { + var diff = this._pipe.transform(this._rawStyle, null); + if (isPresent(diff) && isPresent(diff.wrapped)) { + this._applyChanges(diff.wrapped); + } + }, + _applyChanges: function(diff) { + var $__0 = this; + diff.forEachAddedItem((function(record) { + $__0._setStyle(record.key, record.currentValue); + })); + diff.forEachChangedItem((function(record) { + $__0._setStyle(record.key, record.currentValue); + })); + diff.forEachRemovedItem((function(record) { + $__0._setStyle(record.key, null); + })); + }, + _setStyle: function(name, val) { + this._renderer.setElementStyle(this._ngEl, name, val); + } + }, {})); + $__export("NgStyle", NgStyle); + $__export("NgStyle", NgStyle = __decorate([Directive({ + selector: '[ng-style]', + lifecycle: [LifecycleEvent.onCheck], + properties: ['rawStyle: ng-style'] + }), __metadata('design:paramtypes', [Pipes, ElementRef, Renderer])], NgStyle)); + } + }; +}); + +System.register("angular2/src/http/interfaces", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/interfaces"; + var BaseException, + ConnectionBackend, + Connection; + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + }], + execute: function() { + ConnectionBackend = (function() { + function ConnectionBackend() {} + return ($traceurRuntime.createClass)(ConnectionBackend, {createConnection: function(request) { + throw new BaseException('Abstract!'); + }}, {}); + }()); + $__export("ConnectionBackend", ConnectionBackend); + Connection = (function() { + function Connection() {} + return ($traceurRuntime.createClass)(Connection, {dispose: function() { + throw new BaseException('Abstract!'); + }}, {}); + }()); + $__export("Connection", Connection); + } + }; +}); + +System.register("angular2/src/http/headers", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/headers"; + var isBlank, + BaseException, + isListLikeIterable, + Map, + MapWrapper, + ListWrapper, + StringMap, + Headers; + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + isListLikeIterable = $__m.isListLikeIterable; + Map = $__m.Map; + MapWrapper = $__m.MapWrapper; + ListWrapper = $__m.ListWrapper; + StringMap = $__m.StringMap; + }], + execute: function() { + Headers = (function() { + function Headers(headers) { + var $__0 = this; + if (isBlank(headers)) { + this._headersMap = new Map(); + return ; + } + if (headers instanceof Headers) { + this._headersMap = headers._headersMap; + } else if (headers instanceof StringMap) { + this._headersMap = MapWrapper.createFromStringMap(headers); + MapWrapper.forEach(this._headersMap, (function(v, k) { + if (!isListLikeIterable(v)) { + var list = []; + list.push(v); + $__0._headersMap.set(k, list); + } + })); + } + } + return ($traceurRuntime.createClass)(Headers, { + append: function(name, value) { + var mapName = this._headersMap.get(name); + var list = isListLikeIterable(mapName) ? mapName : []; + list.push(value); + this._headersMap.set(name, list); + }, + delete: function(name) { + MapWrapper.delete(this._headersMap, name); + }, + forEach: function(fn) { + MapWrapper.forEach(this._headersMap, fn); + }, + get: function(header) { + return ListWrapper.first(this._headersMap.get(header)); + }, + has: function(header) { + return this._headersMap.has(header); + }, + keys: function() { + return MapWrapper.keys(this._headersMap); + }, + set: function(header, value) { + var list = []; + if (isListLikeIterable(value)) { + var pushValue = value.join(','); + list.push(pushValue); + } else { + list.push(value); + } + this._headersMap.set(header, list); + }, + values: function() { + return MapWrapper.values(this._headersMap); + }, + getAll: function(header) { + var headers = this._headersMap.get(header); + return isListLikeIterable(headers) ? headers : []; + }, + entries: function() { + throw new BaseException('"entries" method is not implemented on Headers class'); + } + }, {}); + }()); + $__export("Headers", Headers); + } + }; +}); + +System.register("angular2/src/http/enums", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/enums"; + var RequestModesOpts, + RequestCacheOpts, + RequestCredentialsOpts, + RequestMethods, + RequestMethodsMap, + ReadyStates, + ResponseTypes; + return { + setters: [], + execute: function() { + $__export("RequestModesOpts", RequestModesOpts); + (function(RequestModesOpts) { + RequestModesOpts[RequestModesOpts["Cors"] = 0] = "Cors"; + RequestModesOpts[RequestModesOpts["NoCors"] = 1] = "NoCors"; + RequestModesOpts[RequestModesOpts["SameOrigin"] = 2] = "SameOrigin"; + })(RequestModesOpts || ($__export("RequestModesOpts", RequestModesOpts = {}))); + $__export("RequestCacheOpts", RequestCacheOpts); + (function(RequestCacheOpts) { + RequestCacheOpts[RequestCacheOpts["Default"] = 0] = "Default"; + RequestCacheOpts[RequestCacheOpts["NoStore"] = 1] = "NoStore"; + RequestCacheOpts[RequestCacheOpts["Reload"] = 2] = "Reload"; + RequestCacheOpts[RequestCacheOpts["NoCache"] = 3] = "NoCache"; + RequestCacheOpts[RequestCacheOpts["ForceCache"] = 4] = "ForceCache"; + RequestCacheOpts[RequestCacheOpts["OnlyIfCached"] = 5] = "OnlyIfCached"; + })(RequestCacheOpts || ($__export("RequestCacheOpts", RequestCacheOpts = {}))); + $__export("RequestCredentialsOpts", RequestCredentialsOpts); + (function(RequestCredentialsOpts) { + RequestCredentialsOpts[RequestCredentialsOpts["Omit"] = 0] = "Omit"; + RequestCredentialsOpts[RequestCredentialsOpts["SameOrigin"] = 1] = "SameOrigin"; + RequestCredentialsOpts[RequestCredentialsOpts["Include"] = 2] = "Include"; + })(RequestCredentialsOpts || ($__export("RequestCredentialsOpts", RequestCredentialsOpts = {}))); + $__export("RequestMethods", RequestMethods); + (function(RequestMethods) { + RequestMethods[RequestMethods["GET"] = 0] = "GET"; + RequestMethods[RequestMethods["POST"] = 1] = "POST"; + RequestMethods[RequestMethods["PUT"] = 2] = "PUT"; + RequestMethods[RequestMethods["DELETE"] = 3] = "DELETE"; + RequestMethods[RequestMethods["OPTIONS"] = 4] = "OPTIONS"; + RequestMethods[RequestMethods["HEAD"] = 5] = "HEAD"; + RequestMethods[RequestMethods["PATCH"] = 6] = "PATCH"; + })(RequestMethods || ($__export("RequestMethods", RequestMethods = {}))); + RequestMethodsMap = (function() { + function RequestMethodsMap() { + this._methods = ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'HEAD', 'PATCH']; + } + return ($traceurRuntime.createClass)(RequestMethodsMap, {getMethod: function(method) { + return this._methods[method]; + }}, {}); + }()); + $__export("RequestMethodsMap", RequestMethodsMap); + $__export("ReadyStates", ReadyStates); + (function(ReadyStates) { + ReadyStates[ReadyStates["UNSENT"] = 0] = "UNSENT"; + ReadyStates[ReadyStates["OPEN"] = 1] = "OPEN"; + ReadyStates[ReadyStates["HEADERS_RECEIVED"] = 2] = "HEADERS_RECEIVED"; + ReadyStates[ReadyStates["LOADING"] = 3] = "LOADING"; + ReadyStates[ReadyStates["DONE"] = 4] = "DONE"; + ReadyStates[ReadyStates["CANCELLED"] = 5] = "CANCELLED"; + })(ReadyStates || ($__export("ReadyStates", ReadyStates = {}))); + $__export("ResponseTypes", ResponseTypes); + (function(ResponseTypes) { + ResponseTypes[ResponseTypes["Basic"] = 0] = "Basic"; + ResponseTypes[ResponseTypes["Cors"] = 1] = "Cors"; + ResponseTypes[ResponseTypes["Default"] = 2] = "Default"; + ResponseTypes[ResponseTypes["Error"] = 3] = "Error"; + ResponseTypes[ResponseTypes["Opaque"] = 4] = "Opaque"; + })(ResponseTypes || ($__export("ResponseTypes", ResponseTypes = {}))); + } + }; +}); + +System.register("angular2/src/http/http_utils", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/http_utils"; + return { + setters: [function($__m) { + $__export("isJsObject", $__m.isJsObject); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/http/base_response_options", ["angular2/di", "angular2/src/facade/lang", "angular2/src/http/headers", "angular2/src/http/enums"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/base_response_options"; + var __decorate, + __metadata, + Injectable, + isPresent, + Headers, + ResponseTypes, + ResponseOptions, + BaseResponseOptions; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + Headers = $__m.Headers; + }, function($__m) { + ResponseTypes = $__m.ResponseTypes; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + ResponseOptions = (function() { + function ResponseOptions() { + var $__2 = arguments[0] !== (void 0) ? arguments[0] : {}, + body = $__2.body, + status = $__2.status, + headers = $__2.headers, + statusText = $__2.statusText, + type = $__2.type, + url = $__2.url; + this.body = isPresent(body) ? body : null; + this.status = isPresent(status) ? status : null; + this.headers = isPresent(headers) ? headers : null; + this.statusText = isPresent(statusText) ? statusText : null; + this.type = isPresent(type) ? type : null; + this.url = isPresent(url) ? url : null; + } + return ($traceurRuntime.createClass)(ResponseOptions, {merge: function(options) { + return new ResponseOptions({ + body: isPresent(options) && isPresent(options.body) ? options.body : this.body, + status: isPresent(options) && isPresent(options.status) ? options.status : this.status, + headers: isPresent(options) && isPresent(options.headers) ? options.headers : this.headers, + statusText: isPresent(options) && isPresent(options.statusText) ? options.statusText : this.statusText, + type: isPresent(options) && isPresent(options.type) ? options.type : this.type, + url: isPresent(options) && isPresent(options.url) ? options.url : this.url + }); + }}, {}); + }()); + $__export("ResponseOptions", ResponseOptions); + BaseResponseOptions = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).call(this, { + status: 200, + statusText: 'Ok', + type: ResponseTypes.Default, + headers: new Headers() + }); + } + return ($traceurRuntime.createClass)($__0, {}, {}, $__super); + }(ResponseOptions)); + $__export("BaseResponseOptions", BaseResponseOptions); + $__export("BaseResponseOptions", BaseResponseOptions = __decorate([Injectable(), __metadata('design:paramtypes', [])], BaseResponseOptions)); + } + }; +}); + +System.register("angular2/src/http/backends/browser_xhr", ["angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/backends/browser_xhr"; + var __decorate, + __metadata, + Injectable, + BrowserXhr; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + BrowserXhr = (($traceurRuntime.createClass)(function() {}, {build: function() { + return (new XMLHttpRequest()); + }}, {})); + $__export("BrowserXhr", BrowserXhr); + $__export("BrowserXhr", BrowserXhr = __decorate([Injectable(), __metadata('design:paramtypes', [])], BrowserXhr)); + } + }; +}); + +System.register("angular2/src/http/backends/browser_jsonp", ["angular2/di", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/backends/browser_jsonp"; + var __decorate, + __metadata, + Injectable, + global, + _nextRequestId, + JSONP_HOME, + _jsonpConnections, + BrowserJsonp; + function _getJsonpConnections() { + if (_jsonpConnections === null) { + _jsonpConnections = global[JSONP_HOME] = {}; + } + return _jsonpConnections; + } + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + global = $__m.global; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + _nextRequestId = 0; + JSONP_HOME = '__ng_jsonp__'; + $__export("JSONP_HOME", JSONP_HOME); + _jsonpConnections = null; + BrowserJsonp = (($traceurRuntime.createClass)(function() {}, { + build: function(url) { + var node = document.createElement('script'); + node.src = url; + return node; + }, + nextRequestID: function() { + return ("__req" + _nextRequestId++); + }, + requestCallback: function(id) { + return (JSONP_HOME + "." + id + ".finished"); + }, + exposeConnection: function(id, connection) { + var connections = _getJsonpConnections(); + connections[id] = connection; + }, + removeConnection: function(id) { + var connections = _getJsonpConnections(); + connections[id] = null; + }, + send: function(node) { + document.body.appendChild((node)); + }, + cleanup: function(node) { + if (node.parentNode) { + node.parentNode.removeChild((node)); + } + } + }, {})); + $__export("BrowserJsonp", BrowserJsonp); + $__export("BrowserJsonp", BrowserJsonp = __decorate([Injectable(), __metadata('design:paramtypes', [])], BrowserJsonp)); + } + }; +}); + +System.register("angular2/src/http/backends/mock_backend", ["angular2/di", "angular2/src/http/static_request", "angular2/src/http/enums", "angular2/src/http/interfaces", "angular2/src/facade/async", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/backends/mock_backend"; + var __decorate, + __metadata, + Injectable, + Request, + ReadyStates, + Connection, + ConnectionBackend, + ObservableWrapper, + EventEmitter, + isPresent, + IMPLEMENTS, + BaseException, + MockConnection, + MockBackend; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + Request = $__m.Request; + }, function($__m) { + ReadyStates = $__m.ReadyStates; + }, function($__m) { + Connection = $__m.Connection; + ConnectionBackend = $__m.ConnectionBackend; + }, function($__m) { + ObservableWrapper = $__m.ObservableWrapper; + EventEmitter = $__m.EventEmitter; + }, function($__m) { + isPresent = $__m.isPresent; + IMPLEMENTS = $__m.IMPLEMENTS; + BaseException = $__m.BaseException; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + MockConnection = (($traceurRuntime.createClass)(function(req) { + this.response = new EventEmitter(); + this.readyState = ReadyStates.OPEN; + this.request = req; + }, { + dispose: function() { + if (this.readyState !== ReadyStates.DONE) { + this.readyState = ReadyStates.CANCELLED; + } + }, + mockRespond: function(res) { + if (this.readyState === ReadyStates.DONE || this.readyState === ReadyStates.CANCELLED) { + throw new BaseException('Connection has already been resolved'); + } + this.readyState = ReadyStates.DONE; + ObservableWrapper.callNext(this.response, res); + ObservableWrapper.callReturn(this.response); + }, + mockDownload: function(res) {}, + mockError: function(err) { + this.readyState = ReadyStates.DONE; + ObservableWrapper.callThrow(this.response, err); + ObservableWrapper.callReturn(this.response); + } + }, {})); + $__export("MockConnection", MockConnection); + $__export("MockConnection", MockConnection = __decorate([IMPLEMENTS(Connection), __metadata('design:paramtypes', [Request])], MockConnection)); + MockBackend = (($traceurRuntime.createClass)(function() { + var $__0 = this; + this.connectionsArray = []; + this.connections = new EventEmitter(); + ObservableWrapper.subscribe(this.connections, (function(connection) { + return $__0.connectionsArray.push(connection); + })); + this.pendingConnections = new EventEmitter(); + }, { + verifyNoPendingRequests: function() { + var pending = 0; + ObservableWrapper.subscribe(this.pendingConnections, (function(c) { + return pending++; + })); + if (pending > 0) + throw new BaseException((pending + " pending connections to be resolved")); + }, + resolveAllConnections: function() { + ObservableWrapper.subscribe(this.connections, (function(c) { + return c.readyState = 4; + })); + }, + createConnection: function(req) { + if (!isPresent(req) || !(req instanceof Request)) { + throw new BaseException(("createConnection requires an instance of Request, got " + req)); + } + var connection = new MockConnection(req); + ObservableWrapper.callNext(this.connections, connection); + return connection; + } + }, {})); + $__export("MockBackend", MockBackend); + $__export("MockBackend", MockBackend = __decorate([Injectable(), IMPLEMENTS(ConnectionBackend), __metadata('design:paramtypes', [])], MockBackend)); + } + }; +}); + +System.register("angular2/src/http/url_search_params", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/url_search_params"; + var isPresent, + StringWrapper, + Map, + MapWrapper, + ListWrapper, + isListLikeIterable, + URLSearchParams; + function paramParser(rawParams) { + var map = new Map(); + var params = StringWrapper.split(rawParams, new RegExp('&')); + ListWrapper.forEach(params, (function(param) { + var split = StringWrapper.split(param, new RegExp('=')); + var key = ListWrapper.get(split, 0); + var val = ListWrapper.get(split, 1); + var list = isPresent(map.get(key)) ? map.get(key) : []; + list.push(val); + map.set(key, list); + })); + return map; + } + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + Map = $__m.Map; + MapWrapper = $__m.MapWrapper; + ListWrapper = $__m.ListWrapper; + isListLikeIterable = $__m.isListLikeIterable; + }], + execute: function() { + URLSearchParams = (function() { + function URLSearchParams(rawParams) { + this.rawParams = rawParams; + this.paramsMap = paramParser(rawParams); + } + return ($traceurRuntime.createClass)(URLSearchParams, { + has: function(param) { + return this.paramsMap.has(param); + }, + get: function(param) { + var storedParam = this.paramsMap.get(param); + if (isListLikeIterable(storedParam)) { + return ListWrapper.first(storedParam); + } else { + return null; + } + }, + getAll: function(param) { + var mapParam = this.paramsMap.get(param); + return isPresent(mapParam) ? mapParam : []; + }, + append: function(param, val) { + var mapParam = this.paramsMap.get(param); + var list = isPresent(mapParam) ? mapParam : []; + list.push(val); + this.paramsMap.set(param, list); + }, + toString: function() { + var paramsList = []; + MapWrapper.forEach(this.paramsMap, (function(values, k) { + ListWrapper.forEach(values, (function(v) { + paramsList.push(k + '=' + v); + })); + })); + return ListWrapper.join(paramsList, '&'); + }, + delete: function(param) { + MapWrapper.delete(this.paramsMap, param); + } + }, {}); + }()); + $__export("URLSearchParams", URLSearchParams); + } + }; +}); + +System.register("angular2/src/forms/validators", ["angular2/src/facade/lang", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/validators"; + var isBlank, + isPresent, + ListWrapper, + StringMapWrapper, + Validators; + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }], + execute: function() { + Validators = (function() { + function Validators() {} + return ($traceurRuntime.createClass)(Validators, {}, { + required: function(c) { + return isBlank(c.value) || c.value == "" ? {"required": true} : null; + }, + nullValidator: function(c) { + return null; + }, + compose: function(validators) { + return function(c) { + var res = ListWrapper.reduce(validators, (function(res, validator) { + var errors = validator(c); + return isPresent(errors) ? StringMapWrapper.merge(res, errors) : res; + }), {}); + return StringMapWrapper.isEmpty(res) ? null : res; + }; + }, + group: function(c) { + var res = {}; + StringMapWrapper.forEach(c.controls, (function(control, name) { + if (c.contains(name) && isPresent(control.errors)) { + Validators._mergeErrors(control, res); + } + })); + return StringMapWrapper.isEmpty(res) ? null : res; + }, + array: function(c) { + var res = {}; + ListWrapper.forEach(c.controls, (function(control) { + if (isPresent(control.errors)) { + Validators._mergeErrors(control, res); + } + })); + return StringMapWrapper.isEmpty(res) ? null : res; + }, + _mergeErrors: function(control, res) { + StringMapWrapper.forEach(control.errors, (function(value, error) { + if (!StringMapWrapper.contains(res, error)) { + res[error] = []; + } + var current = res[error]; + current.push(control); + })); + } + }); + }()); + $__export("Validators", Validators); + } + }; +}); + +System.register("angular2/src/forms/directives/abstract_control_directive", [], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/abstract_control_directive"; + var AbstractControlDirective; + return { + setters: [], + execute: function() { + AbstractControlDirective = (function() { + function AbstractControlDirective() {} + return ($traceurRuntime.createClass)(AbstractControlDirective, { + get control() { + return null; + }, + get value() { + return this.control.value; + }, + get valid() { + return this.control.valid; + }, + get errors() { + return this.control.errors; + }, + get pristine() { + return this.control.pristine; + }, + get dirty() { + return this.control.dirty; + }, + get touched() { + return this.control.touched; + }, + get untouched() { + return this.control.untouched; + } + }, {}); + }()); + $__export("AbstractControlDirective", AbstractControlDirective); + } + }; +}); + +System.register("angular2/src/forms/directives/control_container", ["angular2/src/forms/directives/abstract_control_directive"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/control_container"; + var AbstractControlDirective, + ControlContainer; + return { + setters: [function($__m) { + AbstractControlDirective = $__m.AbstractControlDirective; + }], + execute: function() { + ControlContainer = (function($__super) { + function ControlContainer() { + $traceurRuntime.superConstructor(ControlContainer).apply(this, arguments); + } + return ($traceurRuntime.createClass)(ControlContainer, { + get formDirective() { + return null; + }, + get path() { + return null; + } + }, {}, $__super); + }(AbstractControlDirective)); + $__export("ControlContainer", ControlContainer); + } + }; +}); + +System.register("angular2/src/forms/directives/ng_control", ["angular2/src/forms/directives/abstract_control_directive"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/ng_control"; + var AbstractControlDirective, + NgControl; + return { + setters: [function($__m) { + AbstractControlDirective = $__m.AbstractControlDirective; + }], + execute: function() { + NgControl = (function($__super) { + function NgControl() { + var $__2; + for (var args = [], + $__1 = 0; $__1 < arguments.length; $__1++) + args[$__1] = arguments[$__1]; + ($__2 = $traceurRuntime.superConstructor(NgControl)).call.apply($__2, $traceurRuntime.spread([this], args)); + this.name = null; + this.valueAccessor = null; + } + return ($traceurRuntime.createClass)(NgControl, { + get validator() { + return null; + }, + get path() { + return null; + }, + viewToModelUpdate: function(newValue) {} + }, {}, $__super); + }(AbstractControlDirective)); + $__export("NgControl", NgControl); + } + }; +}); + +System.register("angular2/src/forms/directives/validators", ["angular2/di", "angular2/src/facade/lang", "angular2/annotations", "angular2/src/forms/validators"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/validators"; + var __decorate, + __metadata, + forwardRef, + Binding, + CONST_EXPR, + Directive, + Validators, + NgValidator, + requiredValidatorBinding, + NgRequiredValidator; + return { + setters: [function($__m) { + forwardRef = $__m.forwardRef; + Binding = $__m.Binding; + }, function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + Directive = $__m.Directive; + }, function($__m) { + Validators = $__m.Validators; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + NgValidator = (function() { + function NgValidator() {} + return ($traceurRuntime.createClass)(NgValidator, {get validator() { + throw "Is not implemented"; + }}, {}); + }()); + $__export("NgValidator", NgValidator); + requiredValidatorBinding = CONST_EXPR(new Binding(NgValidator, {toAlias: forwardRef((function() { + return NgRequiredValidator; + }))})); + NgRequiredValidator = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, {get validator() { + return Validators.required; + }}, {}, $__super); + }(NgValidator)); + $__export("NgRequiredValidator", NgRequiredValidator); + $__export("NgRequiredValidator", NgRequiredValidator = __decorate([Directive({ + selector: '[required][ng-control],[required][ng-form-control],[required][ng-model]', + hostInjector: [requiredValidatorBinding] + }), __metadata('design:paramtypes', [])], NgRequiredValidator)); + } + }; +}); + +System.register("angular2/src/forms/directives/shared", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/forms/validators"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/shared"; + var ListWrapper, + StringMapWrapper, + isBlank, + BaseException, + looseIdentical, + Validators; + function controlPath(name, parent) { + var p = ListWrapper.clone(parent.path); + p.push(name); + return p; + } + function setUpControl(c, dir) { + if (isBlank(c)) + _throwError(dir, "Cannot find control"); + if (isBlank(dir.valueAccessor)) + _throwError(dir, "No value accessor for"); + c.validator = Validators.compose([c.validator, dir.validator]); + dir.valueAccessor.writeValue(c.value); + dir.valueAccessor.registerOnChange((function(newValue) { + dir.viewToModelUpdate(newValue); + c.updateValue(newValue, {emitModelToViewChange: false}); + c.markAsDirty(); + })); + c.registerOnChange((function(newValue) { + return dir.valueAccessor.writeValue(newValue); + })); + dir.valueAccessor.registerOnTouched((function() { + return c.markAsTouched(); + })); + } + function composeNgValidator(ngValidators) { + if (isBlank(ngValidators)) + return Validators.nullValidator; + return Validators.compose(ngValidators.map((function(v) { + return v.validator; + }))); + } + function _throwError(dir, message) { + var path = ListWrapper.join(dir.path, " -> "); + throw new BaseException((message + " '" + path + "'")); + } + function setProperty(renderer, elementRef, propName, propValue) { + renderer.setElementProperty(elementRef, propName, propValue); + } + function isPropertyUpdated(changes, viewModel) { + if (!StringMapWrapper.contains(changes, "model")) + return false; + var change = changes["model"]; + if (change.isFirstChange()) + return true; + return !looseIdentical(viewModel, change.currentValue); + } + $__export("controlPath", controlPath); + $__export("setUpControl", setUpControl); + $__export("composeNgValidator", composeNgValidator); + $__export("setProperty", setProperty); + $__export("isPropertyUpdated", isPropertyUpdated); + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + looseIdentical = $__m.looseIdentical; + }, function($__m) { + Validators = $__m.Validators; + }], + execute: function() { + } + }; +}); + +System.register("angular2/src/forms/directives/ng_form_control", ["angular2/src/facade/lang", "angular2/src/facade/async", "angular2/core", "angular2/annotations", "angular2/di", "angular2/src/forms/directives/ng_control", "angular2/src/forms/directives/validators", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/ng_form_control"; + var __decorate, + __metadata, + __param, + CONST_EXPR, + EventEmitter, + ObservableWrapper, + QueryList, + Query, + Directive, + LifecycleEvent, + forwardRef, + Binding, + NgControl, + NgValidator, + setUpControl, + composeNgValidator, + isPropertyUpdated, + formControlBinding, + NgFormControl; + return { + setters: [function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + QueryList = $__m.QueryList; + }, function($__m) { + Query = $__m.Query; + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + forwardRef = $__m.forwardRef; + Binding = $__m.Binding; + }, function($__m) { + NgControl = $__m.NgControl; + }, function($__m) { + NgValidator = $__m.NgValidator; + }, function($__m) { + setUpControl = $__m.setUpControl; + composeNgValidator = $__m.composeNgValidator; + isPropertyUpdated = $__m.isPropertyUpdated; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + formControlBinding = CONST_EXPR(new Binding(NgControl, {toAlias: forwardRef((function() { + return NgFormControl; + }))})); + NgFormControl = (function($__super) { + function $__0(ngValidators) { + $traceurRuntime.superConstructor($__0).call(this); + this.update = new EventEmitter(); + this._added = false; + this.ngValidators = ngValidators; + } + return ($traceurRuntime.createClass)($__0, { + onChange: function(c) { + if (!this._added) { + setUpControl(this.form, this); + this.form.updateValidity(); + this._added = true; + } + if (isPropertyUpdated(c, this.viewModel)) { + this.form.updateValue(this.model); + } + }, + get path() { + return []; + }, + get control() { + return this.form; + }, + get validator() { + return composeNgValidator(this.ngValidators); + }, + viewToModelUpdate: function(newValue) { + this.viewModel = newValue; + ObservableWrapper.callNext(this.update, newValue); + } + }, {}, $__super); + }(NgControl)); + $__export("NgFormControl", NgFormControl); + $__export("NgFormControl", NgFormControl = __decorate([Directive({ + selector: '[ng-form-control]', + hostInjector: [formControlBinding], + properties: ['form: ngFormControl', 'model: ngModel'], + events: ['update: ngModel'], + lifecycle: [LifecycleEvent.onChange], + exportAs: 'form' + }), __param(0, Query(NgValidator)), __metadata('design:paramtypes', [QueryList])], NgFormControl)); + } + }; +}); + +System.register("angular2/src/forms/directives/ng_model", ["angular2/src/facade/lang", "angular2/src/facade/async", "angular2/core", "angular2/annotations", "angular2/di", "angular2/src/forms/directives/ng_control", "angular2/src/forms/model", "angular2/src/forms/directives/validators", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/ng_model"; + var __decorate, + __metadata, + __param, + CONST_EXPR, + EventEmitter, + ObservableWrapper, + QueryList, + Query, + Directive, + LifecycleEvent, + forwardRef, + Binding, + NgControl, + Control, + NgValidator, + setUpControl, + composeNgValidator, + isPropertyUpdated, + formControlBinding, + NgModel; + return { + setters: [function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + QueryList = $__m.QueryList; + }, function($__m) { + Query = $__m.Query; + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + forwardRef = $__m.forwardRef; + Binding = $__m.Binding; + }, function($__m) { + NgControl = $__m.NgControl; + }, function($__m) { + Control = $__m.Control; + }, function($__m) { + NgValidator = $__m.NgValidator; + }, function($__m) { + setUpControl = $__m.setUpControl; + composeNgValidator = $__m.composeNgValidator; + isPropertyUpdated = $__m.isPropertyUpdated; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + formControlBinding = CONST_EXPR(new Binding(NgControl, {toAlias: forwardRef((function() { + return NgModel; + }))})); + NgModel = (function($__super) { + function $__0(ngValidators) { + $traceurRuntime.superConstructor($__0).call(this); + this._control = new Control(); + this._added = false; + this.update = new EventEmitter(); + this.ngValidators = ngValidators; + } + return ($traceurRuntime.createClass)($__0, { + onChange: function(c) { + if (!this._added) { + setUpControl(this._control, this); + this._control.updateValidity(); + this._added = true; + } + if (isPropertyUpdated(c, this.viewModel)) { + this._control.updateValue(this.model); + } + }, + get control() { + return this._control; + }, + get path() { + return []; + }, + get validator() { + return composeNgValidator(this.ngValidators); + }, + viewToModelUpdate: function(newValue) { + this.viewModel = newValue; + ObservableWrapper.callNext(this.update, newValue); + } + }, {}, $__super); + }(NgControl)); + $__export("NgModel", NgModel); + $__export("NgModel", NgModel = __decorate([Directive({ + selector: '[ng-model]:not([ng-control]):not([ng-form-control])', + hostInjector: [formControlBinding], + properties: ['model: ngModel'], + events: ['update: ngModel'], + lifecycle: [LifecycleEvent.onChange], + exportAs: 'form' + }), __param(0, Query(NgValidator)), __metadata('design:paramtypes', [QueryList])], NgModel)); + } + }; +}); + +System.register("angular2/src/forms/directives/ng_control_group", ["angular2/annotations", "angular2/di", "angular2/src/facade/lang", "angular2/src/forms/directives/control_container", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/ng_control_group"; + var __decorate, + __metadata, + __param, + Directive, + LifecycleEvent, + Ancestor, + forwardRef, + Binding, + CONST_EXPR, + ControlContainer, + controlPath, + controlGroupBinding, + NgControlGroup; + return { + setters: [function($__m) { + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + Ancestor = $__m.Ancestor; + forwardRef = $__m.forwardRef; + Binding = $__m.Binding; + }, function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + ControlContainer = $__m.ControlContainer; + }, function($__m) { + controlPath = $__m.controlPath; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + controlGroupBinding = CONST_EXPR(new Binding(ControlContainer, {toAlias: forwardRef((function() { + return NgControlGroup; + }))})); + NgControlGroup = (function($__super) { + function $__0(_parent) { + $traceurRuntime.superConstructor($__0).call(this); + this._parent = _parent; + } + return ($traceurRuntime.createClass)($__0, { + onInit: function() { + this.formDirective.addControlGroup(this); + }, + onDestroy: function() { + this.formDirective.removeControlGroup(this); + }, + get control() { + return this.formDirective.getControlGroup(this); + }, + get path() { + return controlPath(this.name, this._parent); + }, + get formDirective() { + return this._parent.formDirective; + } + }, {}, $__super); + }(ControlContainer)); + $__export("NgControlGroup", NgControlGroup); + $__export("NgControlGroup", NgControlGroup = __decorate([Directive({ + selector: '[ng-control-group]', + hostInjector: [controlGroupBinding], + properties: ['name: ng-control-group'], + lifecycle: [LifecycleEvent.onInit, LifecycleEvent.onDestroy], + exportAs: 'form' + }), __param(0, Ancestor()), __metadata('design:paramtypes', [ControlContainer])], NgControlGroup)); + } + }; +}); + +System.register("angular2/src/forms/directives/ng_form_model", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/facade/async", "angular2/annotations", "angular2/di", "angular2/src/forms/directives/control_container", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/ng_form_model"; + var __decorate, + __metadata, + CONST_EXPR, + ListWrapper, + ObservableWrapper, + EventEmitter, + Directive, + LifecycleEvent, + forwardRef, + Binding, + ControlContainer, + setUpControl, + formDirectiveBinding, + NgFormModel; + return { + setters: [function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + ObservableWrapper = $__m.ObservableWrapper; + EventEmitter = $__m.EventEmitter; + }, function($__m) { + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + forwardRef = $__m.forwardRef; + Binding = $__m.Binding; + }, function($__m) { + ControlContainer = $__m.ControlContainer; + }, function($__m) { + setUpControl = $__m.setUpControl; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + formDirectiveBinding = CONST_EXPR(new Binding(ControlContainer, {toAlias: forwardRef((function() { + return NgFormModel; + }))})); + NgFormModel = (function($__super) { + function $__1() { + var $__4; + for (var args = [], + $__3 = 0; $__3 < arguments.length; $__3++) + args[$__3] = arguments[$__3]; + ($__4 = $traceurRuntime.superConstructor($__1)).call.apply($__4, $traceurRuntime.spread([this], args)); + this.form = null; + this.directives = []; + this.ngSubmit = new EventEmitter(); + } + return ($traceurRuntime.createClass)($__1, { + onChange: function(_) { + this._updateDomValue(); + }, + get formDirective() { + return this; + }, + get control() { + return this.form; + }, + get path() { + return []; + }, + addControl: function(dir) { + var c = this.form.find(dir.path); + setUpControl(c, dir); + c.updateValidity(); + this.directives.push(dir); + }, + getControl: function(dir) { + return this.form.find(dir.path); + }, + removeControl: function(dir) { + ListWrapper.remove(this.directives, dir); + }, + addControlGroup: function(dir) {}, + removeControlGroup: function(dir) {}, + getControlGroup: function(dir) { + return this.form.find(dir.path); + }, + updateModel: function(dir, value) { + var c = this.form.find(dir.path); + c.updateValue(value); + }, + onSubmit: function() { + ObservableWrapper.callNext(this.ngSubmit, null); + return false; + }, + _updateDomValue: function() { + var $__0 = this; + ListWrapper.forEach(this.directives, (function(dir) { + var c = $__0.form.find(dir.path); + dir.valueAccessor.writeValue(c.value); + })); + } + }, {}, $__super); + }(ControlContainer)); + $__export("NgFormModel", NgFormModel); + $__export("NgFormModel", NgFormModel = __decorate([Directive({ + selector: '[ng-form-model]', + hostInjector: [formDirectiveBinding], + properties: ['form: ng-form-model'], + lifecycle: [LifecycleEvent.onChange], + host: {'(submit)': 'onSubmit()'}, + events: ['ngSubmit'], + exportAs: 'form' + }), __metadata('design:paramtypes', [])], NgFormModel)); + } + }; +}); + +System.register("angular2/src/forms/directives/ng_form", ["angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/annotations", "angular2/di", "angular2/src/forms/directives/control_container", "angular2/src/forms/model", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/ng_form"; + var __decorate, + __metadata, + PromiseWrapper, + ObservableWrapper, + EventEmitter, + ListWrapper, + isPresent, + CONST_EXPR, + Directive, + forwardRef, + Binding, + ControlContainer, + ControlGroup, + Control, + setUpControl, + formDirectiveBinding, + NgForm; + return { + setters: [function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + ObservableWrapper = $__m.ObservableWrapper; + EventEmitter = $__m.EventEmitter; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + Directive = $__m.Directive; + }, function($__m) { + forwardRef = $__m.forwardRef; + Binding = $__m.Binding; + }, function($__m) { + ControlContainer = $__m.ControlContainer; + }, function($__m) { + ControlGroup = $__m.ControlGroup; + Control = $__m.Control; + }, function($__m) { + setUpControl = $__m.setUpControl; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + formDirectiveBinding = CONST_EXPR(new Binding(ControlContainer, {toAlias: forwardRef((function() { + return NgForm; + }))})); + NgForm = (function($__super) { + function $__1() { + $traceurRuntime.superConstructor($__1).call(this); + this.ngSubmit = new EventEmitter(); + this.form = new ControlGroup({}); + } + return ($traceurRuntime.createClass)($__1, { + get formDirective() { + return this; + }, + get control() { + return this.form; + }, + get path() { + return []; + }, + get controls() { + return this.form.controls; + }, + addControl: function(dir) { + var $__0 = this; + this._later((function(_) { + var container = $__0._findContainer(dir.path); + var c = new Control(); + setUpControl(c, dir); + container.addControl(dir.name, c); + c.updateValidity(); + })); + }, + getControl: function(dir) { + return this.form.find(dir.path); + }, + removeControl: function(dir) { + var $__0 = this; + this._later((function(_) { + var container = $__0._findContainer(dir.path); + if (isPresent(container)) { + container.removeControl(dir.name); + container.updateValidity(); + } + })); + }, + addControlGroup: function(dir) { + var $__0 = this; + this._later((function(_) { + var container = $__0._findContainer(dir.path); + var c = new ControlGroup({}); + container.addControl(dir.name, c); + c.updateValidity(); + })); + }, + removeControlGroup: function(dir) { + var $__0 = this; + this._later((function(_) { + var container = $__0._findContainer(dir.path); + if (isPresent(container)) { + container.removeControl(dir.name); + container.updateValidity(); + } + })); + }, + getControlGroup: function(dir) { + return this.form.find(dir.path); + }, + updateModel: function(dir, value) { + var $__0 = this; + this._later((function(_) { + var c = $__0.form.find(dir.path); + c.updateValue(value); + })); + }, + onSubmit: function() { + ObservableWrapper.callNext(this.ngSubmit, null); + return false; + }, + _findContainer: function(path) { + ListWrapper.removeLast(path); + return ListWrapper.isEmpty(path) ? this.form : this.form.find(path); + }, + _later: function(fn) { + var c = PromiseWrapper.completer(); + PromiseWrapper.then(c.promise, fn, (function(_) {})); + c.resolve(null); + } + }, {}, $__super); + }(ControlContainer)); + $__export("NgForm", NgForm); + $__export("NgForm", NgForm = __decorate([Directive({ + selector: 'form:not([ng-no-form]):not([ng-form-model]),ng-form,[ng-form]', + hostInjector: [formDirectiveBinding], + host: {'(submit)': 'onSubmit()'}, + events: ['ngSubmit'], + exportAs: 'form' + }), __metadata('design:paramtypes', [])], NgForm)); + } + }; +}); + +System.register("angular2/render", ["angular2/src/render/render"], function($__export) { + "use strict"; + var __moduleName = "angular2/render"; + return { + setters: [function($__m) { + $__export("Renderer", $__m.Renderer); + $__export("RenderViewRef", $__m.RenderViewRef); + $__export("RenderProtoViewRef", $__m.RenderProtoViewRef); + $__export("RenderFragmentRef", $__m.RenderFragmentRef); + $__export("RenderViewWithFragments", $__m.RenderViewWithFragments); + $__export("DomRenderer", $__m.DomRenderer); + $__export("DOCUMENT_TOKEN", $__m.DOCUMENT_TOKEN); + $__export("APP_ID_TOKEN", $__m.APP_ID_TOKEN); + $__export("DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES", $__m.DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/forms/directives/checkbox_value_accessor", ["angular2/render", "angular2/annotations", "angular2/core", "angular2/di", "angular2/src/forms/directives/ng_control", "angular2/src/facade/lang", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/checkbox_value_accessor"; + var __decorate, + __metadata, + __param, + Renderer, + Directive, + ElementRef, + Self, + NgControl, + isPresent, + setProperty, + CheckboxControlValueAccessor; + return { + setters: [function($__m) { + Renderer = $__m.Renderer; + }, function($__m) { + Directive = $__m.Directive; + }, function($__m) { + ElementRef = $__m.ElementRef; + }, function($__m) { + Self = $__m.Self; + }, function($__m) { + NgControl = $__m.NgControl; + }, function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + setProperty = $__m.setProperty; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + CheckboxControlValueAccessor = (($traceurRuntime.createClass)(function(cd, renderer, elementRef) { + this.renderer = renderer; + this.elementRef = elementRef; + this.onChange = (function(_) {}); + this.onTouched = (function() {}); + this.cd = cd; + cd.valueAccessor = this; + }, { + writeValue: function(value) { + setProperty(this.renderer, this.elementRef, "checked", value); + }, + get ngClassUntouched() { + return isPresent(this.cd.control) ? this.cd.control.untouched : false; + }, + get ngClassTouched() { + return isPresent(this.cd.control) ? this.cd.control.touched : false; + }, + get ngClassPristine() { + return isPresent(this.cd.control) ? this.cd.control.pristine : false; + }, + get ngClassDirty() { + return isPresent(this.cd.control) ? this.cd.control.dirty : false; + }, + get ngClassValid() { + return isPresent(this.cd.control) ? this.cd.control.valid : false; + }, + get ngClassInvalid() { + return isPresent(this.cd.control) ? !this.cd.control.valid : false; + }, + registerOnChange: function(fn) { + this.onChange = fn; + }, + registerOnTouched: function(fn) { + this.onTouched = fn; + } + }, {})); + $__export("CheckboxControlValueAccessor", CheckboxControlValueAccessor); + $__export("CheckboxControlValueAccessor", CheckboxControlValueAccessor = __decorate([Directive({ + selector: 'input[type=checkbox][ng-control],input[type=checkbox][ng-form-control],input[type=checkbox][ng-model]', + host: { + '(change)': 'onChange($event.target.checked)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, Self()), __metadata('design:paramtypes', [NgControl, Renderer, ElementRef])], CheckboxControlValueAccessor)); + } + }; +}); + +System.register("angular2/src/forms/directives/select_control_value_accessor", ["angular2/render", "angular2/core", "angular2/di", "angular2/annotations", "angular2/src/forms/directives/ng_control", "angular2/src/facade/lang", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/select_control_value_accessor"; + var __decorate, + __metadata, + __param, + Renderer, + ElementRef, + QueryList, + Self, + Query, + Directive, + NgControl, + isPresent, + setProperty, + NgSelectOption, + SelectControlValueAccessor; + return { + setters: [function($__m) { + Renderer = $__m.Renderer; + }, function($__m) { + ElementRef = $__m.ElementRef; + QueryList = $__m.QueryList; + }, function($__m) { + Self = $__m.Self; + }, function($__m) { + Query = $__m.Query; + Directive = $__m.Directive; + }, function($__m) { + NgControl = $__m.NgControl; + }, function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + setProperty = $__m.setProperty; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + NgSelectOption = (($traceurRuntime.createClass)(function() {}, {}, {})); + $__export("NgSelectOption", NgSelectOption); + $__export("NgSelectOption", NgSelectOption = __decorate([Directive({selector: 'option'}), __metadata('design:paramtypes', [])], NgSelectOption)); + SelectControlValueAccessor = (($traceurRuntime.createClass)(function(cd, renderer, elementRef, query) { + this.renderer = renderer; + this.elementRef = elementRef; + this.onChange = (function(_) {}); + this.onTouched = (function() {}); + this.cd = cd; + cd.valueAccessor = this; + this._updateValueWhenListOfOptionsChanges(query); + }, { + writeValue: function(value) { + this.value = value; + setProperty(this.renderer, this.elementRef, "value", value); + }, + get ngClassUntouched() { + return isPresent(this.cd.control) ? this.cd.control.untouched : false; + }, + get ngClassTouched() { + return isPresent(this.cd.control) ? this.cd.control.touched : false; + }, + get ngClassPristine() { + return isPresent(this.cd.control) ? this.cd.control.pristine : false; + }, + get ngClassDirty() { + return isPresent(this.cd.control) ? this.cd.control.dirty : false; + }, + get ngClassValid() { + return isPresent(this.cd.control) ? this.cd.control.valid : false; + }, + get ngClassInvalid() { + return isPresent(this.cd.control) ? !this.cd.control.valid : false; + }, + registerOnChange: function(fn) { + this.onChange = fn; + }, + registerOnTouched: function(fn) { + this.onTouched = fn; + }, + _updateValueWhenListOfOptionsChanges: function(query) { + var $__0 = this; + query.onChange((function() { + return $__0.writeValue($__0.value); + })); + } + }, {})); + $__export("SelectControlValueAccessor", SelectControlValueAccessor); + $__export("SelectControlValueAccessor", SelectControlValueAccessor = __decorate([Directive({ + selector: 'select[ng-control],select[ng-form-control],select[ng-model]', + host: { + '(change)': 'onChange($event.target.value)', + '(input)': 'onChange($event.target.value)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, Self()), __param(3, Query(NgSelectOption, {descendants: true})), __metadata('design:paramtypes', [NgControl, Renderer, ElementRef, QueryList])], SelectControlValueAccessor)); + } + }; +}); + +System.register("angular2/src/forms/directives", ["angular2/src/facade/lang", "angular2/src/forms/directives/ng_control_name", "angular2/src/forms/directives/ng_form_control", "angular2/src/forms/directives/ng_model", "angular2/src/forms/directives/ng_control_group", "angular2/src/forms/directives/ng_form_model", "angular2/src/forms/directives/ng_form", "angular2/src/forms/directives/default_value_accessor", "angular2/src/forms/directives/checkbox_value_accessor", "angular2/src/forms/directives/select_control_value_accessor", "angular2/src/forms/directives/validators", "angular2/src/forms/directives/ng_control"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives"; + var CONST_EXPR, + NgControlName, + NgFormControl, + NgModel, + NgControlGroup, + NgFormModel, + NgForm, + DefaultValueAccessor, + CheckboxControlValueAccessor, + SelectControlValueAccessor, + NgSelectOption, + NgRequiredValidator, + formDirectives; + return { + setters: [function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + NgControlName = $__m.NgControlName; + $__export("NgControlName", $__m.NgControlName); + }, function($__m) { + NgFormControl = $__m.NgFormControl; + $__export("NgFormControl", $__m.NgFormControl); + }, function($__m) { + NgModel = $__m.NgModel; + $__export("NgModel", $__m.NgModel); + }, function($__m) { + NgControlGroup = $__m.NgControlGroup; + $__export("NgControlGroup", $__m.NgControlGroup); + }, function($__m) { + NgFormModel = $__m.NgFormModel; + $__export("NgFormModel", $__m.NgFormModel); + }, function($__m) { + NgForm = $__m.NgForm; + $__export("NgForm", $__m.NgForm); + }, function($__m) { + DefaultValueAccessor = $__m.DefaultValueAccessor; + $__export("DefaultValueAccessor", $__m.DefaultValueAccessor); + }, function($__m) { + CheckboxControlValueAccessor = $__m.CheckboxControlValueAccessor; + $__export("CheckboxControlValueAccessor", $__m.CheckboxControlValueAccessor); + }, function($__m) { + SelectControlValueAccessor = $__m.SelectControlValueAccessor; + NgSelectOption = $__m.NgSelectOption; + $__export("SelectControlValueAccessor", $__m.SelectControlValueAccessor); + $__export("NgSelectOption", $__m.NgSelectOption); + }, function($__m) { + NgRequiredValidator = $__m.NgRequiredValidator; + $__export("NgValidator", $__m.NgValidator); + $__export("NgRequiredValidator", $__m.NgRequiredValidator); + }, function($__m) { + $__export("NgControl", $__m.NgControl); + }], + execute: function() { + formDirectives = CONST_EXPR([NgControlName, NgControlGroup, NgFormControl, NgModel, NgFormModel, NgForm, NgSelectOption, DefaultValueAccessor, CheckboxControlValueAccessor, SelectControlValueAccessor, NgRequiredValidator]); + $__export("formDirectives", formDirectives); + } + }; +}); + +System.register("angular2/src/forms/form_builder", ["angular2/di", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/forms/model"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/form_builder"; + var __decorate, + __metadata, + Injectable, + StringMapWrapper, + ListWrapper, + isPresent, + isArray, + modelModule, + FormBuilder; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + ListWrapper = $__m.ListWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + isArray = $__m.isArray; + }, function($__m) { + modelModule = $__m; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + FormBuilder = (($traceurRuntime.createClass)(function() {}, { + group: function(controlsConfig) { + var extra = arguments[1] !== (void 0) ? arguments[1] : null; + var controls = this._reduceControls(controlsConfig); + var optionals = isPresent(extra) ? StringMapWrapper.get(extra, "optionals") : null; + var validator = isPresent(extra) ? StringMapWrapper.get(extra, "validator") : null; + if (isPresent(validator)) { + return new modelModule.ControlGroup(controls, optionals, validator); + } else { + return new modelModule.ControlGroup(controls, optionals); + } + }, + control: function(value) { + var validator = arguments[1] !== (void 0) ? arguments[1] : null; + if (isPresent(validator)) { + return new modelModule.Control(value, validator); + } else { + return new modelModule.Control(value); + } + }, + array: function(controlsConfig) { + var validator = arguments[1] !== (void 0) ? arguments[1] : null; + var $__0 = this; + var controls = ListWrapper.map(controlsConfig, (function(c) { + return $__0._createControl(c); + })); + if (isPresent(validator)) { + return new modelModule.ControlArray(controls, validator); + } else { + return new modelModule.ControlArray(controls); + } + }, + _reduceControls: function(controlsConfig) { + var $__0 = this; + var controls = {}; + StringMapWrapper.forEach(controlsConfig, (function(controlConfig, controlName) { + controls[controlName] = $__0._createControl(controlConfig); + })); + return controls; + }, + _createControl: function(controlConfig) { + if (controlConfig instanceof modelModule.Control || controlConfig instanceof modelModule.ControlGroup || controlConfig instanceof modelModule.ControlArray) { + return controlConfig; + } else if (isArray(controlConfig)) { + var value = ListWrapper.get(controlConfig, 0); + var validator = controlConfig.length > 1 ? controlConfig[1] : null; + return this.control(value, validator); + } else { + return this.control(controlConfig); + } + } + }, {})); + $__export("FormBuilder", FormBuilder); + $__export("FormBuilder", FormBuilder = __decorate([Injectable(), __metadata('design:paramtypes', [])], FormBuilder)); + } + }; +}); + +System.register("angular2/src/router/lifecycle_annotations_impl", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/lifecycle_annotations_impl"; + var __decorate, + __metadata, + CONST, + CONST_EXPR, + RouteLifecycleHook, + CanActivate, + canReuse, + canDeactivate, + onActivate, + onReuse, + onDeactivate; + return { + setters: [function($__m) { + CONST = $__m.CONST; + CONST_EXPR = $__m.CONST_EXPR; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + RouteLifecycleHook = (($traceurRuntime.createClass)(function(name) { + this.name = name; + }, {}, {})); + $__export("RouteLifecycleHook", RouteLifecycleHook); + $__export("RouteLifecycleHook", RouteLifecycleHook = __decorate([CONST(), __metadata('design:paramtypes', [String])], RouteLifecycleHook)); + CanActivate = (($traceurRuntime.createClass)(function(fn) { + this.fn = fn; + }, {}, {})); + $__export("CanActivate", CanActivate); + $__export("CanActivate", CanActivate = __decorate([CONST(), __metadata('design:paramtypes', [Function])], CanActivate)); + canReuse = CONST_EXPR(new RouteLifecycleHook("canReuse")); + $__export("canReuse", canReuse); + canDeactivate = CONST_EXPR(new RouteLifecycleHook("canDeactivate")); + $__export("canDeactivate", canDeactivate); + onActivate = CONST_EXPR(new RouteLifecycleHook("onActivate")); + $__export("onActivate", onActivate); + onReuse = CONST_EXPR(new RouteLifecycleHook("onReuse")); + $__export("onReuse", onReuse); + onDeactivate = CONST_EXPR(new RouteLifecycleHook("onDeactivate")); + $__export("onDeactivate", onDeactivate); + } + }; +}); + +System.register("angular2/src/router/instruction", ["angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/instruction"; + var StringMapWrapper, + isPresent, + isBlank, + normalizeBlank, + RouteParams, + Instruction; + return { + setters: [function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + normalizeBlank = $__m.normalizeBlank; + }], + execute: function() { + RouteParams = (function() { + function RouteParams(params) { + this.params = params; + } + return ($traceurRuntime.createClass)(RouteParams, {get: function(param) { + return normalizeBlank(StringMapWrapper.get(this.params, param)); + }}, {}); + }()); + $__export("RouteParams", RouteParams); + Instruction = (function() { + function Instruction(component, capturedUrl, _recognizer) { + var child = arguments[3] !== (void 0) ? arguments[3] : null; + var _params = arguments[4] !== (void 0) ? arguments[4] : null; + this.component = component; + this.capturedUrl = capturedUrl; + this._recognizer = _recognizer; + this.child = child; + this._params = _params; + this.reuse = false; + this.accumulatedUrl = capturedUrl; + this.specificity = _recognizer.specificity; + if (isPresent(child)) { + this.child = child; + this.specificity += child.specificity; + var childUrl = child.accumulatedUrl; + if (isPresent(childUrl)) { + this.accumulatedUrl += childUrl; + } + } + } + return ($traceurRuntime.createClass)(Instruction, {params: function() { + if (isBlank(this._params)) { + this._params = this._recognizer.parseParams(this.capturedUrl); + } + return this._params; + }}, {}); + }()); + $__export("Instruction", Instruction); + } + }; +}); + +System.register("angular2/src/router/lifecycle_annotations", ["angular2/src/util/decorators", "angular2/src/router/lifecycle_annotations_impl"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/lifecycle_annotations"; + var makeDecorator, + CanActivateAnnotation, + CanActivate; + return { + setters: [function($__m) { + makeDecorator = $__m.makeDecorator; + }, function($__m) { + CanActivateAnnotation = $__m.CanActivate; + $__export("canReuse", $__m.canReuse); + $__export("canDeactivate", $__m.canDeactivate); + $__export("onActivate", $__m.onActivate); + $__export("onReuse", $__m.onReuse); + $__export("onDeactivate", $__m.onDeactivate); + }], + execute: function() { + CanActivate = makeDecorator(CanActivateAnnotation); + $__export("CanActivate", CanActivate); + } + }; +}); + +System.register("angular2/src/router/location_strategy", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/location_strategy"; + var BaseException, + LocationStrategy; + function _abstract() { + return new BaseException('This method is abstract'); + } + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + }], + execute: function() { + LocationStrategy = (function() { + function LocationStrategy() {} + return ($traceurRuntime.createClass)(LocationStrategy, { + path: function() { + throw _abstract(); + }, + pushState: function(ctx, title, url) { + throw _abstract(); + }, + forward: function() { + throw _abstract(); + }, + back: function() { + throw _abstract(); + }, + onPopState: function(fn) { + throw _abstract(); + }, + getBaseHref: function() { + throw _abstract(); + } + }, {}); + }()); + $__export("LocationStrategy", LocationStrategy); + } + }; +}); + +System.register("angular2/src/router/helpers", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/helpers"; + var isPresent; + function parseAndAssignParamString(splitToken, paramString, keyValueMap) { + var first = paramString[0]; + if (first == '?' || first == ';') { + paramString = paramString.substring(1); + } + paramString.split(splitToken).forEach((function(entry) { + var tuple = entry.split('='); + var key = tuple[0]; + if (!isPresent(keyValueMap[key])) { + var value = tuple.length > 1 ? tuple[1] : true; + keyValueMap[key] = value; + } + })); + } + $__export("parseAndAssignParamString", parseAndAssignParamString); + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }], + execute: function() { + } + }; +}); + +System.register("angular2/src/router/url", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/url"; + var RegExpWrapper, + StringWrapper, + specialCharacters, + escapeRe; + function escapeRegex(string) { + return StringWrapper.replaceAllMapped(string, escapeRe, (function(match) { + return "\\" + match; + })); + } + $__export("escapeRegex", escapeRegex); + return { + setters: [function($__m) { + RegExpWrapper = $__m.RegExpWrapper; + StringWrapper = $__m.StringWrapper; + }], + execute: function() { + specialCharacters = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\']; + escapeRe = RegExpWrapper.create('(\\' + specialCharacters.join('|\\') + ')', 'g'); + } + }; +}); + +System.register("angular2/src/router/route_config_impl", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/route_config_impl"; + var __decorate, + __metadata, + CONST, + RouteConfig, + Route, + AsyncRoute, + Redirect; + return { + setters: [function($__m) { + CONST = $__m.CONST; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + RouteConfig = (($traceurRuntime.createClass)(function(configs) { + this.configs = configs; + }, {}, {})); + $__export("RouteConfig", RouteConfig); + $__export("RouteConfig", RouteConfig = __decorate([CONST(), __metadata('design:paramtypes', [Object])], RouteConfig)); + Route = (($traceurRuntime.createClass)(function($__2) { + var $__3 = $__2, + path = $__3.path, + component = $__3.component, + as = $__3.as; + this.path = path; + this.component = component; + this.as = as; + }, {}, {})); + $__export("Route", Route); + $__export("Route", Route = __decorate([CONST(), __metadata('design:paramtypes', [Object])], Route)); + AsyncRoute = (($traceurRuntime.createClass)(function($__2) { + var $__3 = $__2, + path = $__3.path, + loader = $__3.loader, + as = $__3.as; + this.path = path; + this.loader = loader; + this.as = as; + }, {}, {})); + $__export("AsyncRoute", AsyncRoute); + $__export("AsyncRoute", AsyncRoute = __decorate([CONST(), __metadata('design:paramtypes', [Object])], AsyncRoute)); + Redirect = (($traceurRuntime.createClass)(function($__2) { + var $__3 = $__2, + path = $__3.path, + redirectTo = $__3.redirectTo; + this.as = null; + this.path = path; + this.redirectTo = redirectTo; + }, {}, {})); + $__export("Redirect", Redirect); + $__export("Redirect", Redirect = __decorate([CONST(), __metadata('design:paramtypes', [Object])], Redirect)); + } + }; +}); + +System.register("angular2/src/router/async_route_handler", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/async_route_handler"; + var isPresent, + AsyncRouteHandler; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }], + execute: function() { + AsyncRouteHandler = (function() { + function AsyncRouteHandler(_loader) { + this._loader = _loader; + this._resolvedComponent = null; + } + return ($traceurRuntime.createClass)(AsyncRouteHandler, {resolveComponentType: function() { + var $__0 = this; + if (isPresent(this._resolvedComponent)) { + return this._resolvedComponent; + } + return this._resolvedComponent = this._loader().then((function(componentType) { + $__0.componentType = componentType; + return componentType; + })); + }}, {}); + }()); + $__export("AsyncRouteHandler", AsyncRouteHandler); + } + }; +}); + +System.register("angular2/src/router/sync_route_handler", ["angular2/src/facade/async"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/sync_route_handler"; + var PromiseWrapper, + SyncRouteHandler; + return { + setters: [function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }], + execute: function() { + SyncRouteHandler = (function() { + function SyncRouteHandler(componentType) { + this.componentType = componentType; + this._resolvedComponent = null; + this._resolvedComponent = PromiseWrapper.resolve(componentType); + } + return ($traceurRuntime.createClass)(SyncRouteHandler, {resolveComponentType: function() { + return this._resolvedComponent; + }}, {}); + }()); + $__export("SyncRouteHandler", SyncRouteHandler); + } + }; +}); + +System.register("angular2/src/router/route_config_decorator", ["angular2/src/router/route_config_impl", "angular2/src/util/decorators"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/route_config_decorator"; + var RouteConfigAnnotation, + makeDecorator, + RouteConfig; + return { + setters: [function($__m) { + RouteConfigAnnotation = $__m.RouteConfig; + $__export("Route", $__m.Route); + $__export("Redirect", $__m.Redirect); + $__export("AsyncRoute", $__m.AsyncRoute); + }, function($__m) { + makeDecorator = $__m.makeDecorator; + }], + execute: function() { + RouteConfig = makeDecorator(RouteConfigAnnotation); + $__export("RouteConfig", RouteConfig); + } + }; +}); + +System.register("angular2/src/router/hash_location_strategy", ["angular2/src/dom/dom_adapter", "angular2/di", "angular2/src/router/location_strategy"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/hash_location_strategy"; + var __decorate, + __metadata, + DOM, + Injectable, + LocationStrategy, + HashLocationStrategy; + return { + setters: [function($__m) { + DOM = $__m.DOM; + }, function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + LocationStrategy = $__m.LocationStrategy; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + HashLocationStrategy = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).call(this); + this._location = DOM.getLocation(); + this._history = DOM.getHistory(); + } + return ($traceurRuntime.createClass)($__0, { + onPopState: function(fn) { + DOM.getGlobalEventTarget('window').addEventListener('popstate', fn, false); + }, + getBaseHref: function() { + return ''; + }, + path: function() { + var path = this._location.hash; + return path.length > 0 ? path.substring(1) : path; + }, + pushState: function(state, title, url) { + this._history.pushState(state, title, '#' + url); + }, + forward: function() { + this._history.forward(); + }, + back: function() { + this._history.back(); + } + }, {}, $__super); + }(LocationStrategy)); + $__export("HashLocationStrategy", HashLocationStrategy); + $__export("HashLocationStrategy", HashLocationStrategy = __decorate([Injectable(), __metadata('design:paramtypes', [])], HashLocationStrategy)); + } + }; +}); + +System.register("angular2/src/router/html5_location_strategy", ["angular2/src/dom/dom_adapter", "angular2/di", "angular2/src/router/location_strategy"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/html5_location_strategy"; + var __decorate, + __metadata, + DOM, + Injectable, + LocationStrategy, + HTML5LocationStrategy; + return { + setters: [function($__m) { + DOM = $__m.DOM; + }, function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + LocationStrategy = $__m.LocationStrategy; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + HTML5LocationStrategy = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).call(this); + this._location = DOM.getLocation(); + this._history = DOM.getHistory(); + this._baseHref = DOM.getBaseHref(); + } + return ($traceurRuntime.createClass)($__0, { + onPopState: function(fn) { + DOM.getGlobalEventTarget('window').addEventListener('popstate', fn, false); + }, + getBaseHref: function() { + return this._baseHref; + }, + path: function() { + return this._location.pathname; + }, + pushState: function(state, title, url) { + this._history.pushState(state, title, url); + }, + forward: function() { + this._history.forward(); + }, + back: function() { + this._history.back(); + } + }, {}, $__super); + }(LocationStrategy)); + $__export("HTML5LocationStrategy", HTML5LocationStrategy); + $__export("HTML5LocationStrategy", HTML5LocationStrategy = __decorate([Injectable(), __metadata('design:paramtypes', [])], HTML5LocationStrategy)); + } + }; +}); + +System.register("angular2/src/router/pipeline", ["angular2/src/facade/async", "angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/pipeline"; + var __decorate, + __metadata, + PromiseWrapper, + Injectable, + Pipeline; + return { + setters: [function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }, function($__m) { + Injectable = $__m.Injectable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Pipeline = (($traceurRuntime.createClass)(function() { + this.steps = [(function(instruction) { + return instruction.router.activateOutlets(instruction); + })]; + }, {process: function(instruction) { + var steps = this.steps, + currentStep = 0; + function processOne() { + var result = arguments[0] !== (void 0) ? arguments[0] : true; + if (currentStep >= steps.length) { + return PromiseWrapper.resolve(result); + } + var step = steps[currentStep]; + currentStep += 1; + return PromiseWrapper.resolve(step(instruction)).then(processOne); + } + return processOne(); + }}, {})); + $__export("Pipeline", Pipeline); + $__export("Pipeline", Pipeline = __decorate([Injectable(), __metadata('design:paramtypes', [])], Pipeline)); + } + }; +}); + +System.register("angular2/src/di/metadata", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/metadata"; + var __decorate, + __metadata, + CONST, + CONST_EXPR, + stringify, + isBlank, + InjectMetadata, + OptionalMetadata, + DependencyMetadata, + InjectableMetadata, + VisibilityMetadata, + SelfMetadata, + AncestorMetadata, + UnboundedMetadata, + DEFAULT_VISIBILITY; + return { + setters: [function($__m) { + CONST = $__m.CONST; + CONST_EXPR = $__m.CONST_EXPR; + stringify = $__m.stringify; + isBlank = $__m.isBlank; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + InjectMetadata = (($traceurRuntime.createClass)(function(token) { + this.token = token; + }, {toString: function() { + return ("@Inject(" + stringify(this.token) + ")"); + }}, {})); + $__export("InjectMetadata", InjectMetadata); + $__export("InjectMetadata", InjectMetadata = __decorate([CONST(), __metadata('design:paramtypes', [Object])], InjectMetadata)); + OptionalMetadata = (($traceurRuntime.createClass)(function() {}, {toString: function() { + return "@Optional()"; + }}, {})); + $__export("OptionalMetadata", OptionalMetadata); + $__export("OptionalMetadata", OptionalMetadata = __decorate([CONST(), __metadata('design:paramtypes', [])], OptionalMetadata)); + DependencyMetadata = (($traceurRuntime.createClass)(function() {}, {get token() { + return null; + }}, {})); + $__export("DependencyMetadata", DependencyMetadata); + $__export("DependencyMetadata", DependencyMetadata = __decorate([CONST(), __metadata('design:paramtypes', [])], DependencyMetadata)); + InjectableMetadata = (($traceurRuntime.createClass)(function() {}, {}, {})); + $__export("InjectableMetadata", InjectableMetadata); + $__export("InjectableMetadata", InjectableMetadata = __decorate([CONST(), __metadata('design:paramtypes', [])], InjectableMetadata)); + VisibilityMetadata = (($traceurRuntime.createClass)(function(crossBoundaries, _includeSelf) { + this.crossBoundaries = crossBoundaries; + this._includeSelf = _includeSelf; + }, { + get includeSelf() { + return isBlank(this._includeSelf) ? false : this._includeSelf; + }, + toString: function() { + return ("@Visibility(crossBoundaries: " + this.crossBoundaries + ", includeSelf: " + this.includeSelf + "})"); + } + }, {})); + $__export("VisibilityMetadata", VisibilityMetadata); + $__export("VisibilityMetadata", VisibilityMetadata = __decorate([CONST(), __metadata('design:paramtypes', [Boolean, Boolean])], VisibilityMetadata)); + SelfMetadata = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).call(this, false, true); + } + return ($traceurRuntime.createClass)($__0, {toString: function() { + return "@Self()"; + }}, {}, $__super); + }(VisibilityMetadata)); + $__export("SelfMetadata", SelfMetadata); + $__export("SelfMetadata", SelfMetadata = __decorate([CONST(), __metadata('design:paramtypes', [])], SelfMetadata)); + AncestorMetadata = (function($__super) { + function $__0() { + var self = (arguments[0] !== (void 0) ? arguments[0] : {}).self; + $traceurRuntime.superConstructor($__0).call(this, false, self); + } + return ($traceurRuntime.createClass)($__0, {toString: function() { + return ("@Ancestor(self: " + this.includeSelf + "})"); + }}, {}, $__super); + }(VisibilityMetadata)); + $__export("AncestorMetadata", AncestorMetadata); + $__export("AncestorMetadata", AncestorMetadata = __decorate([CONST(), __metadata('design:paramtypes', [Object])], AncestorMetadata)); + UnboundedMetadata = (function($__super) { + function $__0() { + var self = (arguments[0] !== (void 0) ? arguments[0] : {}).self; + $traceurRuntime.superConstructor($__0).call(this, true, self); + } + return ($traceurRuntime.createClass)($__0, {toString: function() { + return ("@Unbounded(self: " + this.includeSelf + "})"); + }}, {}, $__super); + }(VisibilityMetadata)); + $__export("UnboundedMetadata", UnboundedMetadata); + $__export("UnboundedMetadata", UnboundedMetadata = __decorate([CONST(), __metadata('design:paramtypes', [Object])], UnboundedMetadata)); + DEFAULT_VISIBILITY = CONST_EXPR(new UnboundedMetadata({self: true})); + $__export("DEFAULT_VISIBILITY", DEFAULT_VISIBILITY); + } + }; +}); + +System.register("angular2/src/di/decorators", ["angular2/src/di/metadata", "angular2/src/util/decorators"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/decorators"; + var InjectMetadata, + OptionalMetadata, + InjectableMetadata, + SelfMetadata, + AncestorMetadata, + UnboundedMetadata, + makeDecorator, + makeParamDecorator, + Inject, + Optional, + Injectable, + Self, + Ancestor, + Unbounded; + return { + setters: [function($__m) { + InjectMetadata = $__m.InjectMetadata; + OptionalMetadata = $__m.OptionalMetadata; + InjectableMetadata = $__m.InjectableMetadata; + SelfMetadata = $__m.SelfMetadata; + AncestorMetadata = $__m.AncestorMetadata; + UnboundedMetadata = $__m.UnboundedMetadata; + }, function($__m) { + makeDecorator = $__m.makeDecorator; + makeParamDecorator = $__m.makeParamDecorator; + }], + execute: function() { + Inject = makeParamDecorator(InjectMetadata); + $__export("Inject", Inject); + Optional = makeParamDecorator(OptionalMetadata); + $__export("Optional", Optional); + Injectable = makeDecorator(InjectableMetadata); + $__export("Injectable", Injectable); + Self = makeParamDecorator(SelfMetadata); + $__export("Self", Self); + Ancestor = makeParamDecorator(AncestorMetadata); + $__export("Ancestor", Ancestor); + Unbounded = makeParamDecorator(UnboundedMetadata); + $__export("Unbounded", Unbounded); + } + }; +}); + +System.register("angular2/src/reflection/reflection", ["angular2/src/reflection/reflector", "angular2/src/reflection/reflection_capabilities"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/reflection/reflection"; + var Reflector, + ReflectionCapabilities, + reflector; + return { + setters: [function($__m) { + Reflector = $__m.Reflector; + $__export("Reflector", $__m.Reflector); + $__export("ReflectionInfo", $__m.ReflectionInfo); + }, function($__m) { + ReflectionCapabilities = $__m.ReflectionCapabilities; + }], + execute: function() { + reflector = new Reflector(new ReflectionCapabilities()); + $__export("reflector", reflector); + } + }; +}); + +System.register("angular2/src/di/key", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/di/type_literal", "angular2/src/di/forward_ref"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/key"; + var MapWrapper, + stringify, + isBlank, + BaseException, + TypeLiteral, + resolveForwardRef, + Key, + KeyRegistry, + _globalKeyRegistry; + return { + setters: [function($__m) { + MapWrapper = $__m.MapWrapper; + }, function($__m) { + stringify = $__m.stringify; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + TypeLiteral = $__m.TypeLiteral; + $__export("TypeLiteral", $__m.TypeLiteral); + }, function($__m) { + resolveForwardRef = $__m.resolveForwardRef; + }], + execute: function() { + Key = (function() { + function Key(token, id) { + this.token = token; + this.id = id; + if (isBlank(token)) { + throw new BaseException('Token must be defined!'); + } + } + return ($traceurRuntime.createClass)(Key, {get displayName() { + return stringify(this.token); + }}, { + get: function(token) { + return _globalKeyRegistry.get(resolveForwardRef(token)); + }, + get numberOfKeys() { + return _globalKeyRegistry.numberOfKeys; + } + }); + }()); + $__export("Key", Key); + KeyRegistry = (function() { + function KeyRegistry() { + this._allKeys = new Map(); + } + return ($traceurRuntime.createClass)(KeyRegistry, { + get: function(token) { + if (token instanceof Key) + return token; + var theToken = token; + if (token instanceof TypeLiteral) { + theToken = token.type; + } + token = theToken; + if (this._allKeys.has(token)) { + return this._allKeys.get(token); + } + var newKey = new Key(token, Key.numberOfKeys); + this._allKeys.set(token, newKey); + return newKey; + }, + get numberOfKeys() { + return MapWrapper.size(this._allKeys); + } + }, {}); + }()); + $__export("KeyRegistry", KeyRegistry); + _globalKeyRegistry = new KeyRegistry(); + } + }; +}); + +System.register("angular2/src/dom/browser_adapter", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/dom/dom_adapter", "angular2/src/dom/generic_browser_adapter"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/dom/browser_adapter"; + var ListWrapper, + isBlank, + isPresent, + global, + setRootDomAdapter, + GenericBrowserDomAdapter, + _attrToPropMap, + DOM_KEY_LOCATION_NUMPAD, + _keyMap, + _chromeNumKeyPadMap, + BrowserDomAdapter, + baseElement, + urlParsingNode; + function getBaseElementHref() { + if (isBlank(baseElement)) { + baseElement = document.querySelector('base'); + if (isBlank(baseElement)) { + return null; + } + } + return baseElement.attr('href'); + } + function relativePath(url) { + if (isBlank(urlParsingNode)) { + urlParsingNode = document.createElement("a"); + } + urlParsingNode.setAttribute('href', url); + return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname : '/' + urlParsingNode.pathname; + } + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + global = $__m.global; + }, function($__m) { + setRootDomAdapter = $__m.setRootDomAdapter; + }, function($__m) { + GenericBrowserDomAdapter = $__m.GenericBrowserDomAdapter; + }], + execute: function() { + _attrToPropMap = { + 'innerHtml': 'innerHTML', + 'readonly': 'readOnly', + 'tabindex': 'tabIndex' + }; + DOM_KEY_LOCATION_NUMPAD = 3; + _keyMap = { + '\b': 'Backspace', + '\t': 'Tab', + '\x7F': 'Delete', + '\x1B': 'Escape', + 'Del': 'Delete', + 'Esc': 'Escape', + 'Left': 'ArrowLeft', + 'Right': 'ArrowRight', + 'Up': 'ArrowUp', + 'Down': 'ArrowDown', + 'Menu': 'ContextMenu', + 'Scroll': 'ScrollLock', + 'Win': 'OS' + }; + _chromeNumKeyPadMap = { + 'A': '1', + 'B': '2', + 'C': '3', + 'D': '4', + 'E': '5', + 'F': '6', + 'G': '7', + 'H': '8', + 'I': '9', + 'J': '*', + 'K': '+', + 'M': '-', + 'N': '.', + 'O': '/', + '\x60': '0', + '\x90': 'NumLock' + }; + BrowserDomAdapter = (function($__super) { + function BrowserDomAdapter() { + $traceurRuntime.superConstructor(BrowserDomAdapter).apply(this, arguments); + } + return ($traceurRuntime.createClass)(BrowserDomAdapter, { + hasProperty: function(element, name) { + return name in element; + }, + setProperty: function(el, name, value) { + el[name] = value; + }, + getProperty: function(el, name) { + return el[name]; + }, + invoke: function(el, methodName, args) { + el[methodName].apply(el, args); + }, + logError: function(error) { + window.console.error(error); + }, + log: function(error) { + window.console.log(error); + }, + logGroup: function(error) { + if (window.console.group) { + window.console.group(error); + } else { + window.console.log(error); + } + }, + logGroupEnd: function() { + if (window.console.groupEnd) { + window.console.groupEnd(); + } + }, + get attrToPropMap() { + return _attrToPropMap; + }, + query: function(selector) { + return document.querySelector(selector); + }, + querySelector: function(el, selector) { + return el.querySelector(selector); + }, + querySelectorAll: function(el, selector) { + return el.querySelectorAll(selector); + }, + on: function(el, evt, listener) { + el.addEventListener(evt, listener, false); + }, + onAndCancel: function(el, evt, listener) { + el.addEventListener(evt, listener, false); + return (function() { + el.removeEventListener(evt, listener, false); + }); + }, + dispatchEvent: function(el, evt) { + el.dispatchEvent(evt); + }, + createMouseEvent: function(eventType) { + var evt = document.createEvent('MouseEvent'); + evt.initEvent(eventType, true, true); + return evt; + }, + createEvent: function(eventType) { + var evt = document.createEvent('Event'); + evt.initEvent(eventType, true, true); + return evt; + }, + preventDefault: function(evt) { + evt.preventDefault(); + evt.returnValue = false; + }, + getInnerHTML: function(el) { + return el.innerHTML; + }, + getOuterHTML: function(el) { + return el.outerHTML; + }, + nodeName: function(node) { + return node.nodeName; + }, + nodeValue: function(node) { + return node.nodeValue; + }, + type: function(node) { + return node.type; + }, + content: function(node) { + if (this.hasProperty(node, "content")) { + return node.content; + } else { + return node; + } + }, + firstChild: function(el) { + return el.firstChild; + }, + nextSibling: function(el) { + return el.nextSibling; + }, + parentElement: function(el) { + return el.parentElement; + }, + childNodes: function(el) { + return el.childNodes; + }, + childNodesAsList: function(el) { + var childNodes = el.childNodes; + var res = ListWrapper.createFixedSize(childNodes.length); + for (var i = 0; i < childNodes.length; i++) { + res[i] = childNodes[i]; + } + return res; + }, + clearNodes: function(el) { + while (el.firstChild) { + el.firstChild.remove(); + } + }, + appendChild: function(el, node) { + el.appendChild(node); + }, + removeChild: function(el, node) { + el.removeChild(node); + }, + replaceChild: function(el, newChild, oldChild) { + el.replaceChild(newChild, oldChild); + }, + remove: function(node) { + node.remove(); + return node; + }, + insertBefore: function(el, node) { + el.parentNode.insertBefore(node, el); + }, + insertAllBefore: function(el, nodes) { + ListWrapper.forEach(nodes, (function(n) { + el.parentNode.insertBefore(n, el); + })); + }, + insertAfter: function(el, node) { + el.parentNode.insertBefore(node, el.nextSibling); + }, + setInnerHTML: function(el, value) { + el.innerHTML = value; + }, + getText: function(el) { + return el.textContent; + }, + setText: function(el, value) { + el.textContent = value; + }, + getValue: function(el) { + return el.value; + }, + setValue: function(el, value) { + el.value = value; + }, + getChecked: function(el) { + return el.checked; + }, + setChecked: function(el, value) { + el.checked = value; + }, + createTemplate: function(html) { + var t = document.createElement('template'); + t.innerHTML = html; + return t; + }, + createElement: function(tagName) { + var doc = arguments[1] !== (void 0) ? arguments[1] : document; + return doc.createElement(tagName); + }, + createTextNode: function(text) { + var doc = arguments[1] !== (void 0) ? arguments[1] : document; + return doc.createTextNode(text); + }, + createScriptTag: function(attrName, attrValue) { + var doc = arguments[2] !== (void 0) ? arguments[2] : document; + var el = doc.createElement('SCRIPT'); + el.setAttribute(attrName, attrValue); + return el; + }, + createStyleElement: function(css) { + var doc = arguments[1] !== (void 0) ? arguments[1] : document; + var style = doc.createElement('style'); + this.appendChild(style, this.createTextNode(css)); + return style; + }, + createShadowRoot: function(el) { + return el.createShadowRoot(); + }, + getShadowRoot: function(el) { + return el.shadowRoot; + }, + getHost: function(el) { + return el.host; + }, + clone: function(node) { + return node.cloneNode(true); + }, + getElementsByClassName: function(element, name) { + return element.getElementsByClassName(name); + }, + getElementsByTagName: function(element, name) { + return element.getElementsByTagName(name); + }, + classList: function(element) { + return Array.prototype.slice.call(element.classList, 0); + }, + addClass: function(element, classname) { + element.classList.add(classname); + }, + removeClass: function(element, classname) { + element.classList.remove(classname); + }, + hasClass: function(element, classname) { + return element.classList.contains(classname); + }, + setStyle: function(element, stylename, stylevalue) { + element.style[stylename] = stylevalue; + }, + removeStyle: function(element, stylename) { + element.style[stylename] = null; + }, + getStyle: function(element, stylename) { + return element.style[stylename]; + }, + tagName: function(element) { + return element.tagName; + }, + attributeMap: function(element) { + var res = new Map(); + var elAttrs = element.attributes; + for (var i = 0; i < elAttrs.length; i++) { + var attrib = elAttrs[i]; + res.set(attrib.name, attrib.value); + } + return res; + }, + hasAttribute: function(element, attribute) { + return element.hasAttribute(attribute); + }, + getAttribute: function(element, attribute) { + return element.getAttribute(attribute); + }, + setAttribute: function(element, name, value) { + element.setAttribute(name, value); + }, + removeAttribute: function(element, attribute) { + element.removeAttribute(attribute); + }, + templateAwareRoot: function(el) { + return this.isTemplateElement(el) ? this.content(el) : el; + }, + createHtmlDocument: function() { + return document.implementation.createHTMLDocument('fakeTitle'); + }, + defaultDoc: function() { + return document; + }, + getBoundingClientRect: function(el) { + try { + return el.getBoundingClientRect(); + } catch (e) { + return { + top: 0, + bottom: 0, + left: 0, + right: 0, + width: 0, + height: 0 + }; + } + }, + getTitle: function() { + return document.title; + }, + setTitle: function(newTitle) { + document.title = newTitle || ''; + }, + elementMatches: function(n, selector) { + return n instanceof HTMLElement && n.matches ? n.matches(selector) : n.msMatchesSelector(selector); + }, + isTemplateElement: function(el) { + return el instanceof HTMLElement && el.nodeName == "TEMPLATE"; + }, + isTextNode: function(node) { + return node.nodeType === Node.TEXT_NODE; + }, + isCommentNode: function(node) { + return node.nodeType === Node.COMMENT_NODE; + }, + isElementNode: function(node) { + return node.nodeType === Node.ELEMENT_NODE; + }, + hasShadowRoot: function(node) { + return node instanceof HTMLElement && isPresent(node.shadowRoot); + }, + isShadowRoot: function(node) { + return node instanceof DocumentFragment; + }, + importIntoDoc: function(node) { + var toImport = node; + if (this.isTemplateElement(node)) { + toImport = this.content(node); + } + return document.importNode(toImport, true); + }, + isPageRule: function(rule) { + return rule.type === CSSRule.PAGE_RULE; + }, + isStyleRule: function(rule) { + return rule.type === CSSRule.STYLE_RULE; + }, + isMediaRule: function(rule) { + return rule.type === CSSRule.MEDIA_RULE; + }, + isKeyframesRule: function(rule) { + return rule.type === CSSRule.KEYFRAMES_RULE; + }, + getHref: function(el) { + return el.href; + }, + getEventKey: function(event) { + var key = event.key; + if (isBlank(key)) { + key = event.keyIdentifier; + if (isBlank(key)) { + return 'Unidentified'; + } + if (key.startsWith('U+')) { + key = String.fromCharCode(parseInt(key.substring(2), 16)); + if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) { + key = _chromeNumKeyPadMap[key]; + } + } + } + if (_keyMap.hasOwnProperty(key)) { + key = _keyMap[key]; + } + return key; + }, + getGlobalEventTarget: function(target) { + if (target == "window") { + return window; + } else if (target == "document") { + return document; + } else if (target == "body") { + return document.body; + } + }, + getHistory: function() { + return window.history; + }, + getLocation: function() { + return window.location; + }, + getBaseHref: function() { + var href = getBaseElementHref(); + if (isBlank(href)) { + return null; + } + return relativePath(href); + }, + getUserAgent: function() { + return window.navigator.userAgent; + }, + setData: function(element, name, value) { + element.dataset[name] = value; + }, + getData: function(element, name) { + return element.dataset[name]; + }, + setGlobalVar: function(name, value) { + global[name] = value; + } + }, {makeCurrent: function() { + setRootDomAdapter(new BrowserDomAdapter()); + }}, $__super); + }(GenericBrowserDomAdapter)); + $__export("BrowserDomAdapter", BrowserDomAdapter); + baseElement = null; + urlParsingNode = null; + } + }; +}); + +System.register("angular2/src/facade/async", ["angular2/src/facade/lang", "rx"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/facade/async"; + var global, + Rx, + Promise, + PromiseWrapper, + TimerWrapper, + ObservableWrapper, + Observable, + EventEmitter; + return { + setters: [function($__m) { + global = $__m.global; + }, function($__m) { + Rx = $__m; + }], + execute: function() { + Promise = global.Promise; + $__export("Promise", Promise); + PromiseWrapper = (function() { + function PromiseWrapper() {} + return ($traceurRuntime.createClass)(PromiseWrapper, {}, { + resolve: function(obj) { + return Promise.resolve(obj); + }, + reject: function(obj, _) { + return Promise.reject(obj); + }, + catchError: function(promise, onError) { + return promise.catch(onError); + }, + all: function(promises) { + if (promises.length == 0) + return Promise.resolve([]); + return Promise.all(promises); + }, + then: function(promise, success, rejection) { + return promise.then(success, rejection); + }, + wrap: function(computation) { + return new Promise((function(res, rej) { + try { + res(computation()); + } catch (e) { + rej(e); + } + })); + }, + completer: function() { + var resolve; + var reject; + var p = new Promise(function(res, rej) { + resolve = res; + reject = rej; + }); + return { + promise: p, + resolve: resolve, + reject: reject + }; + } + }); + }()); + $__export("PromiseWrapper", PromiseWrapper); + TimerWrapper = (function() { + function TimerWrapper() {} + return ($traceurRuntime.createClass)(TimerWrapper, {}, { + setTimeout: function(fn, millis) { + return global.setTimeout(fn, millis); + }, + clearTimeout: function(id) { + global.clearTimeout(id); + }, + setInterval: function(fn, millis) { + return global.setInterval(fn, millis); + }, + clearInterval: function(id) { + global.clearInterval(id); + } + }); + }()); + $__export("TimerWrapper", TimerWrapper); + ObservableWrapper = (function() { + function ObservableWrapper() {} + return ($traceurRuntime.createClass)(ObservableWrapper, {}, { + subscribe: function(emitter, onNext) { + var onThrow = arguments[2] !== (void 0) ? arguments[2] : null; + var onReturn = arguments[3] !== (void 0) ? arguments[3] : null; + return emitter.observer({ + next: onNext, + throw: onThrow, + return: onReturn + }); + }, + isObservable: function(obs) { + return obs instanceof Observable; + }, + dispose: function(subscription) { + subscription.dispose(); + }, + callNext: function(emitter, value) { + emitter.next(value); + }, + callThrow: function(emitter, error) { + emitter.throw(error); + }, + callReturn: function(emitter) { + emitter.return(null); + } + }); + }()); + $__export("ObservableWrapper", ObservableWrapper); + Observable = (function() { + function Observable() {} + return ($traceurRuntime.createClass)(Observable, {observer: function(generator) { + return null; + }}, {}); + }()); + $__export("Observable", Observable); + EventEmitter = (function($__super) { + function EventEmitter() { + $traceurRuntime.superConstructor(EventEmitter).call(this); + if (Rx.hasOwnProperty('default')) { + this._subject = new Rx.default.Rx.Subject(); + this._immediateScheduler = Rx.default.Rx.Scheduler.immediate; + } else { + this._subject = new Rx.Subject(); + this._immediateScheduler = Rx.Scheduler.immediate; + } + } + return ($traceurRuntime.createClass)(EventEmitter, { + observer: function(generator) { + return this._subject.observeOn(this._immediateScheduler).subscribe((function(value) { + setTimeout((function() { + return generator.next(value); + })); + }), (function(error) { + return generator.throw ? generator.throw(error) : null; + }), (function() { + return generator.return ? generator.return() : null; + })); + }, + toRx: function() { + return this._subject; + }, + next: function(value) { + this._subject.onNext(value); + }, + throw: function(error) { + this._subject.onError(error); + }, + return: function(value) { + this._subject.onCompleted(); + } + }, {}, $__super); + }(Observable)); + $__export("EventEmitter", EventEmitter); + } + }; +}); + +System.register("angular2/src/change_detection/change_detector_ref", ["angular2/src/change_detection/constants"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/change_detector_ref"; + var DETACHED, + CHECK_ALWAYS, + ChangeDetectorRef; + return { + setters: [function($__m) { + DETACHED = $__m.DETACHED; + CHECK_ALWAYS = $__m.CHECK_ALWAYS; + }], + execute: function() { + ChangeDetectorRef = (function() { + function ChangeDetectorRef(_cd) { + this._cd = _cd; + } + return ($traceurRuntime.createClass)(ChangeDetectorRef, { + requestCheck: function() { + this._cd.markPathToRootAsCheckOnce(); + }, + detach: function() { + this._cd.mode = DETACHED; + }, + reattach: function() { + this._cd.mode = CHECK_ALWAYS; + this.requestCheck(); + } + }, {}); + }()); + $__export("ChangeDetectorRef", ChangeDetectorRef); + } + }; +}); + +System.register("angular2/src/change_detection/change_detection_util", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/exceptions", "angular2/src/change_detection/pipes/pipe", "angular2/src/change_detection/constants"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/change_detection_util"; + var CONST_EXPR, + isPresent, + isBlank, + BaseException, + StringMapWrapper, + DehydratedException, + ExpressionChangedAfterItHasBeenCheckedException, + WrappedValue, + CHECK_ALWAYS, + CHECK_ONCE, + ON_PUSH, + SimpleChange, + _simpleChangesIndex, + _simpleChanges, + ChangeDetectionUtil; + function _simpleChange(previousValue, currentValue) { + var index = _simpleChangesIndex++ % 20; + var s = _simpleChanges[index]; + s.previousValue = previousValue; + s.currentValue = currentValue; + return s; + } + return { + setters: [function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + DehydratedException = $__m.DehydratedException; + ExpressionChangedAfterItHasBeenCheckedException = $__m.ExpressionChangedAfterItHasBeenCheckedException; + }, function($__m) { + WrappedValue = $__m.WrappedValue; + }, function($__m) { + CHECK_ALWAYS = $__m.CHECK_ALWAYS; + CHECK_ONCE = $__m.CHECK_ONCE; + ON_PUSH = $__m.ON_PUSH; + }], + execute: function() { + SimpleChange = (function() { + function SimpleChange(previousValue, currentValue) { + this.previousValue = previousValue; + this.currentValue = currentValue; + } + return ($traceurRuntime.createClass)(SimpleChange, {isFirstChange: function() { + return this.previousValue === ChangeDetectionUtil.uninitialized; + }}, {}); + }()); + $__export("SimpleChange", SimpleChange); + _simpleChangesIndex = 0; + _simpleChanges = [new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null)]; + ChangeDetectionUtil = (function() { + function ChangeDetectionUtil() {} + return ($traceurRuntime.createClass)(ChangeDetectionUtil, {}, { + arrayFn0: function() { + return []; + }, + arrayFn1: function(a1) { + return [a1]; + }, + arrayFn2: function(a1, a2) { + return [a1, a2]; + }, + arrayFn3: function(a1, a2, a3) { + return [a1, a2, a3]; + }, + arrayFn4: function(a1, a2, a3, a4) { + return [a1, a2, a3, a4]; + }, + arrayFn5: function(a1, a2, a3, a4, a5) { + return [a1, a2, a3, a4, a5]; + }, + arrayFn6: function(a1, a2, a3, a4, a5, a6) { + return [a1, a2, a3, a4, a5, a6]; + }, + arrayFn7: function(a1, a2, a3, a4, a5, a6, a7) { + return [a1, a2, a3, a4, a5, a6, a7]; + }, + arrayFn8: function(a1, a2, a3, a4, a5, a6, a7, a8) { + return [a1, a2, a3, a4, a5, a6, a7, a8]; + }, + arrayFn9: function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return [a1, a2, a3, a4, a5, a6, a7, a8, a9]; + }, + operation_negate: function(value) { + return !value; + }, + operation_add: function(left, right) { + return left + right; + }, + operation_subtract: function(left, right) { + return left - right; + }, + operation_multiply: function(left, right) { + return left * right; + }, + operation_divide: function(left, right) { + return left / right; + }, + operation_remainder: function(left, right) { + return left % right; + }, + operation_equals: function(left, right) { + return left == right; + }, + operation_not_equals: function(left, right) { + return left != right; + }, + operation_identical: function(left, right) { + return left === right; + }, + operation_not_identical: function(left, right) { + return left !== right; + }, + operation_less_then: function(left, right) { + return left < right; + }, + operation_greater_then: function(left, right) { + return left > right; + }, + operation_less_or_equals_then: function(left, right) { + return left <= right; + }, + operation_greater_or_equals_then: function(left, right) { + return left >= right; + }, + operation_logical_and: function(left, right) { + return left && right; + }, + operation_logical_or: function(left, right) { + return left || right; + }, + cond: function(cond, trueVal, falseVal) { + return cond ? trueVal : falseVal; + }, + mapFn: function(keys) { + function buildMap(values) { + var res = StringMapWrapper.create(); + for (var i = 0; i < keys.length; ++i) { + StringMapWrapper.set(res, keys[i], values[i]); + } + return res; + } + switch (keys.length) { + case 0: + return (function() { + return []; + }); + case 1: + return (function(a1) { + return buildMap([a1]); + }); + case 2: + return (function(a1, a2) { + return buildMap([a1, a2]); + }); + case 3: + return (function(a1, a2, a3) { + return buildMap([a1, a2, a3]); + }); + case 4: + return (function(a1, a2, a3, a4) { + return buildMap([a1, a2, a3, a4]); + }); + case 5: + return (function(a1, a2, a3, a4, a5) { + return buildMap([a1, a2, a3, a4, a5]); + }); + case 6: + return (function(a1, a2, a3, a4, a5, a6) { + return buildMap([a1, a2, a3, a4, a5, a6]); + }); + case 7: + return (function(a1, a2, a3, a4, a5, a6, a7) { + return buildMap([a1, a2, a3, a4, a5, a6, a7]); + }); + case 8: + return (function(a1, a2, a3, a4, a5, a6, a7, a8) { + return buildMap([a1, a2, a3, a4, a5, a6, a7, a8]); + }); + case 9: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return buildMap([a1, a2, a3, a4, a5, a6, a7, a8, a9]); + }); + default: + throw new BaseException("Does not support literal maps with more than 9 elements"); + } + }, + keyedAccess: function(obj, args) { + return obj[args[0]]; + }, + unwrapValue: function(value) { + if (value instanceof WrappedValue) { + return value.wrapped; + } else { + return value; + } + }, + throwOnChange: function(proto, change) { + throw new ExpressionChangedAfterItHasBeenCheckedException(proto, change, null); + }, + throwDehydrated: function() { + throw new DehydratedException(); + }, + changeDetectionMode: function(strategy) { + return strategy == ON_PUSH ? CHECK_ONCE : CHECK_ALWAYS; + }, + simpleChange: function(previousValue, currentValue) { + return _simpleChange(previousValue, currentValue); + }, + addChange: function(changes, propertyName, change) { + if (isBlank(changes)) { + changes = {}; + } + changes[propertyName] = change; + return changes; + }, + isValueBlank: function(value) { + return isBlank(value); + }, + s: function(value) { + return isPresent(value) ? ("" + value) : ''; + } + }); + }()); + $__export("ChangeDetectionUtil", ChangeDetectionUtil); + ChangeDetectionUtil.uninitialized = CONST_EXPR(new Object()); + } + }; +}); + +System.register("angular2/src/change_detection/proto_change_detector", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/parser/ast", "angular2/src/change_detection/change_detection_util", "angular2/src/change_detection/dynamic_change_detector", "angular2/src/change_detection/directive_record", "angular2/src/change_detection/coalesce", "angular2/src/change_detection/proto_record"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/proto_change_detector"; + var BaseException, + isPresent, + isString, + ListWrapper, + ImplicitReceiver, + ChangeDetectionUtil, + DynamicChangeDetector, + DirectiveIndex, + coalesce, + ProtoRecord, + RecordType, + DynamicProtoChangeDetector, + ProtoRecordBuilder, + _ConvertAstIntoProtoRecords; + function _arrayFn(length) { + switch (length) { + case 0: + return ChangeDetectionUtil.arrayFn0; + case 1: + return ChangeDetectionUtil.arrayFn1; + case 2: + return ChangeDetectionUtil.arrayFn2; + case 3: + return ChangeDetectionUtil.arrayFn3; + case 4: + return ChangeDetectionUtil.arrayFn4; + case 5: + return ChangeDetectionUtil.arrayFn5; + case 6: + return ChangeDetectionUtil.arrayFn6; + case 7: + return ChangeDetectionUtil.arrayFn7; + case 8: + return ChangeDetectionUtil.arrayFn8; + case 9: + return ChangeDetectionUtil.arrayFn9; + default: + throw new BaseException("Does not support literal maps with more than 9 elements"); + } + } + function _mapPrimitiveName(keys) { + var stringifiedKeys = ListWrapper.join(ListWrapper.map(keys, (function(k) { + return isString(k) ? ("\"" + k + "\"") : ("" + k); + })), ", "); + return ("mapFn([" + stringifiedKeys + "])"); + } + function _operationToPrimitiveName(operation) { + switch (operation) { + case '+': + return "operation_add"; + case '-': + return "operation_subtract"; + case '*': + return "operation_multiply"; + case '/': + return "operation_divide"; + case '%': + return "operation_remainder"; + case '==': + return "operation_equals"; + case '!=': + return "operation_not_equals"; + case '===': + return "operation_identical"; + case '!==': + return "operation_not_identical"; + case '<': + return "operation_less_then"; + case '>': + return "operation_greater_then"; + case '<=': + return "operation_less_or_equals_then"; + case '>=': + return "operation_greater_or_equals_then"; + case '&&': + return "operation_logical_and"; + case '||': + return "operation_logical_or"; + default: + throw new BaseException(("Unsupported operation " + operation)); + } + } + function _operationToFunction(operation) { + switch (operation) { + case '+': + return ChangeDetectionUtil.operation_add; + case '-': + return ChangeDetectionUtil.operation_subtract; + case '*': + return ChangeDetectionUtil.operation_multiply; + case '/': + return ChangeDetectionUtil.operation_divide; + case '%': + return ChangeDetectionUtil.operation_remainder; + case '==': + return ChangeDetectionUtil.operation_equals; + case '!=': + return ChangeDetectionUtil.operation_not_equals; + case '===': + return ChangeDetectionUtil.operation_identical; + case '!==': + return ChangeDetectionUtil.operation_not_identical; + case '<': + return ChangeDetectionUtil.operation_less_then; + case '>': + return ChangeDetectionUtil.operation_greater_then; + case '<=': + return ChangeDetectionUtil.operation_less_or_equals_then; + case '>=': + return ChangeDetectionUtil.operation_greater_or_equals_then; + case '&&': + return ChangeDetectionUtil.operation_logical_and; + case '||': + return ChangeDetectionUtil.operation_logical_or; + default: + throw new BaseException(("Unsupported operation " + operation)); + } + } + function s(v) { + return isPresent(v) ? ("" + v) : ''; + } + function _interpolationFn(strings) { + var length = strings.length; + var c0 = length > 0 ? strings[0] : null; + var c1 = length > 1 ? strings[1] : null; + var c2 = length > 2 ? strings[2] : null; + var c3 = length > 3 ? strings[3] : null; + var c4 = length > 4 ? strings[4] : null; + var c5 = length > 5 ? strings[5] : null; + var c6 = length > 6 ? strings[6] : null; + var c7 = length > 7 ? strings[7] : null; + var c8 = length > 8 ? strings[8] : null; + var c9 = length > 9 ? strings[9] : null; + switch (length - 1) { + case 1: + return (function(a1) { + return c0 + s(a1) + c1; + }); + case 2: + return (function(a1, a2) { + return c0 + s(a1) + c1 + s(a2) + c2; + }); + case 3: + return (function(a1, a2, a3) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3; + }); + case 4: + return (function(a1, a2, a3, a4) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4; + }); + case 5: + return (function(a1, a2, a3, a4, a5) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5; + }); + case 6: + return (function(a1, a2, a3, a4, a5, a6) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6; + }); + case 7: + return (function(a1, a2, a3, a4, a5, a6, a7) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7; + }); + case 8: + return (function(a1, a2, a3, a4, a5, a6, a7, a8) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7 + s(a8) + c8; + }); + case 9: + return (function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7 + s(a8) + c8 + s(a9) + c9; + }); + default: + throw new BaseException("Does not support more than 9 expressions"); + } + } + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + isPresent = $__m.isPresent; + isString = $__m.isString; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + ImplicitReceiver = $__m.ImplicitReceiver; + }, function($__m) { + ChangeDetectionUtil = $__m.ChangeDetectionUtil; + }, function($__m) { + DynamicChangeDetector = $__m.DynamicChangeDetector; + }, function($__m) { + DirectiveIndex = $__m.DirectiveIndex; + }, function($__m) { + coalesce = $__m.coalesce; + }, function($__m) { + ProtoRecord = $__m.ProtoRecord; + RecordType = $__m.RecordType; + }], + execute: function() { + DynamicProtoChangeDetector = (function() { + function DynamicProtoChangeDetector(definition) { + this.definition = definition; + this._records = this._createRecords(definition); + } + return ($traceurRuntime.createClass)(DynamicProtoChangeDetector, { + instantiate: function(dispatcher) { + return new DynamicChangeDetector(this.definition.id, this.definition.strategy, dispatcher, this._records, this.definition.directiveRecords); + }, + _createRecords: function(definition) { + var recordBuilder = new ProtoRecordBuilder(); + ListWrapper.forEach(definition.bindingRecords, (function(b) { + recordBuilder.add(b, definition.variableNames); + })); + return coalesce(recordBuilder.records); + } + }, {}); + }()); + $__export("DynamicProtoChangeDetector", DynamicProtoChangeDetector); + ProtoRecordBuilder = (function() { + function ProtoRecordBuilder() { + this.records = []; + } + return ($traceurRuntime.createClass)(ProtoRecordBuilder, { + add: function(b) { + var variableNames = arguments[1] !== (void 0) ? arguments[1] : null; + var oldLast = ListWrapper.last(this.records); + if (isPresent(oldLast) && oldLast.bindingRecord.directiveRecord == b.directiveRecord) { + oldLast.lastInDirective = false; + } + this._appendRecords(b, variableNames); + var newLast = ListWrapper.last(this.records); + if (isPresent(newLast) && newLast !== oldLast) { + newLast.lastInBinding = true; + newLast.lastInDirective = true; + } + }, + _appendRecords: function(b, variableNames) { + if (b.isDirectiveLifecycle()) { + this.records.push(new ProtoRecord(RecordType.DIRECTIVE_LIFECYCLE, b.lifecycleEvent, null, [], [], -1, null, this.records.length + 1, b, null, false, false)); + } else { + _ConvertAstIntoProtoRecords.append(this.records, b, variableNames); + } + } + }, {}); + }()); + $__export("ProtoRecordBuilder", ProtoRecordBuilder); + _ConvertAstIntoProtoRecords = (function() { + function _ConvertAstIntoProtoRecords(_records, _bindingRecord, _expressionAsString, _variableNames) { + this._records = _records; + this._bindingRecord = _bindingRecord; + this._expressionAsString = _expressionAsString; + this._variableNames = _variableNames; + } + return ($traceurRuntime.createClass)(_ConvertAstIntoProtoRecords, { + visitImplicitReceiver: function(ast) { + return this._bindingRecord.implicitReceiver; + }, + visitInterpolation: function(ast) { + var args = this._visitAll(ast.expressions); + return this._addRecord(RecordType.INTERPOLATE, "interpolate", _interpolationFn(ast.strings), args, ast.strings, 0); + }, + visitLiteralPrimitive: function(ast) { + return this._addRecord(RecordType.CONST, "literal", ast.value, [], null, 0); + }, + visitAccessMember: function(ast) { + var receiver = ast.receiver.visit(this); + if (isPresent(this._variableNames) && ListWrapper.contains(this._variableNames, ast.name) && ast.receiver instanceof ImplicitReceiver) { + return this._addRecord(RecordType.LOCAL, ast.name, ast.name, [], null, receiver); + } else { + return this._addRecord(RecordType.PROPERTY, ast.name, ast.getter, [], null, receiver); + } + }, + visitSafeAccessMember: function(ast) { + var receiver = ast.receiver.visit(this); + return this._addRecord(RecordType.SAFE_PROPERTY, ast.name, ast.getter, [], null, receiver); + }, + visitMethodCall: function(ast) { + var receiver = ast.receiver.visit(this); + var args = this._visitAll(ast.args); + if (isPresent(this._variableNames) && ListWrapper.contains(this._variableNames, ast.name)) { + var target = this._addRecord(RecordType.LOCAL, ast.name, ast.name, [], null, receiver); + return this._addRecord(RecordType.INVOKE_CLOSURE, "closure", null, args, null, target); + } else { + return this._addRecord(RecordType.INVOKE_METHOD, ast.name, ast.fn, args, null, receiver); + } + }, + visitSafeMethodCall: function(ast) { + var receiver = ast.receiver.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(RecordType.SAFE_INVOKE_METHOD, ast.name, ast.fn, args, null, receiver); + }, + visitFunctionCall: function(ast) { + var target = ast.target.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(RecordType.INVOKE_CLOSURE, "closure", null, args, null, target); + }, + visitLiteralArray: function(ast) { + var primitiveName = ("arrayFn" + ast.expressions.length); + return this._addRecord(RecordType.PRIMITIVE_OP, primitiveName, _arrayFn(ast.expressions.length), this._visitAll(ast.expressions), null, 0); + }, + visitLiteralMap: function(ast) { + return this._addRecord(RecordType.PRIMITIVE_OP, _mapPrimitiveName(ast.keys), ChangeDetectionUtil.mapFn(ast.keys), this._visitAll(ast.values), null, 0); + }, + visitBinary: function(ast) { + var left = ast.left.visit(this); + var right = ast.right.visit(this); + return this._addRecord(RecordType.PRIMITIVE_OP, _operationToPrimitiveName(ast.operation), _operationToFunction(ast.operation), [left, right], null, 0); + }, + visitPrefixNot: function(ast) { + var exp = ast.expression.visit(this); + return this._addRecord(RecordType.PRIMITIVE_OP, "operation_negate", ChangeDetectionUtil.operation_negate, [exp], null, 0); + }, + visitConditional: function(ast) { + var c = ast.condition.visit(this); + var t = ast.trueExp.visit(this); + var f = ast.falseExp.visit(this); + return this._addRecord(RecordType.PRIMITIVE_OP, "cond", ChangeDetectionUtil.cond, [c, t, f], null, 0); + }, + visitPipe: function(ast) { + var value = ast.exp.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(RecordType.PIPE, ast.name, ast.name, args, null, value); + }, + visitKeyedAccess: function(ast) { + var obj = ast.obj.visit(this); + var key = ast.key.visit(this); + return this._addRecord(RecordType.KEYED_ACCESS, "keyedAccess", ChangeDetectionUtil.keyedAccess, [key], null, obj); + }, + visitAssignment: function(ast) { + throw new BaseException('Not supported'); + }, + visitChain: function(ast) { + throw new BaseException('Not supported'); + }, + visitIf: function(ast) { + throw new BaseException('Not supported'); + }, + _visitAll: function(asts) { + var res = ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }, + _addRecord: function(type, name, funcOrValue, args, fixedArgs, context) { + var selfIndex = this._records.length + 1; + if (context instanceof DirectiveIndex) { + this._records.push(new ProtoRecord(type, name, funcOrValue, args, fixedArgs, -1, context, selfIndex, this._bindingRecord, this._expressionAsString, false, false)); + } else { + this._records.push(new ProtoRecord(type, name, funcOrValue, args, fixedArgs, context, null, selfIndex, this._bindingRecord, this._expressionAsString, false, false)); + } + return selfIndex; + } + }, {append: function(records, b, variableNames) { + var c = new _ConvertAstIntoProtoRecords(records, b, b.ast.toString(), variableNames); + b.ast.visit(c); + }}); + }()); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/limit_to_pipe", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/facade/math"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/limit_to_pipe"; + var __decorate, + __metadata, + isBlank, + isString, + isArray, + StringWrapper, + BaseException, + CONST, + ListWrapper, + Math, + LimitToPipe, + LimitToPipeFactory; + return { + setters: [function($__m) { + isBlank = $__m.isBlank; + isString = $__m.isString; + isArray = $__m.isArray; + StringWrapper = $__m.StringWrapper; + BaseException = $__m.BaseException; + CONST = $__m.CONST; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + Math = $__m.Math; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + LimitToPipe = (function() { + function LimitToPipe() {} + return ($traceurRuntime.createClass)(LimitToPipe, { + supports: function(obj) { + return LimitToPipe.supportsObj(obj); + }, + transform: function(value) { + var args = arguments[1] !== (void 0) ? arguments[1] : null; + if (isBlank(args) || args.length == 0) { + throw new BaseException('limitTo pipe requires one argument'); + } + var limit = args[0]; + var left = 0, + right = Math.min(limit, value.length); + if (limit < 0) { + left = Math.max(0, value.length + limit); + right = value.length; + } + if (isString(value)) { + return StringWrapper.substring(value, left, right); + } + return ListWrapper.slice(value, left, right); + }, + onDestroy: function() {} + }, {supportsObj: function(obj) { + return isString(obj) || isArray(obj); + }}); + }()); + $__export("LimitToPipe", LimitToPipe); + LimitToPipeFactory = (($traceurRuntime.createClass)(function() {}, { + supports: function(obj) { + return LimitToPipe.supportsObj(obj); + }, + create: function(cdRef) { + return new LimitToPipe(); + } + }, {})); + $__export("LimitToPipeFactory", LimitToPipeFactory); + $__export("LimitToPipeFactory", LimitToPipeFactory = __decorate([CONST(), __metadata('design:paramtypes', [])], LimitToPipeFactory)); + } + }; +}); + +System.register("angular2/src/change_detection/pipes/date_pipe", ["angular2/src/facade/lang", "angular2/src/facade/intl", "angular2/src/facade/collection", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/pipes/date_pipe"; + var __decorate, + __metadata, + isDate, + isNumber, + isPresent, + DateWrapper, + CONST, + DateFormatter, + StringMapWrapper, + BasePipe, + defaultLocale, + DatePipe; + return { + setters: [function($__m) { + isDate = $__m.isDate; + isNumber = $__m.isNumber; + isPresent = $__m.isPresent; + DateWrapper = $__m.DateWrapper; + CONST = $__m.CONST; + }, function($__m) { + DateFormatter = $__m.DateFormatter; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + BasePipe = $__m.BasePipe; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + defaultLocale = 'en-US'; + DatePipe = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, { + transform: function(value, args) { + var pattern = isPresent(args) && args.length > 0 ? args[0] : 'mediumDate'; + if (isNumber(value)) { + value = DateWrapper.fromMillis(value); + } + if (StringMapWrapper.contains(DatePipe._ALIASES, pattern)) { + pattern = StringMapWrapper.get(DatePipe._ALIASES, pattern); + } + return DateFormatter.format(value, defaultLocale, pattern); + }, + supports: function(obj) { + return isDate(obj) || isNumber(obj); + }, + create: function(cdRef) { + return this; + } + }, {}, $__super); + }(BasePipe)); + $__export("DatePipe", DatePipe); + DatePipe._ALIASES = { + 'medium': 'yMMMdjms', + 'short': 'yMdjm', + 'fullDate': 'yMMMMEEEEd', + 'longDate': 'yMMMMd', + 'mediumDate': 'yMMMd', + 'shortDate': 'yMd', + 'mediumTime': 'jms', + 'shortTime': 'jm' + }; + $__export("DatePipe", DatePipe = __decorate([CONST(), __metadata('design:paramtypes', [])], DatePipe)); + } + }; +}); + +System.register("angular2/src/core/compiler/view", ["angular2/src/facade/collection", "angular2/src/change_detection/change_detection", "angular2/src/core/compiler/element_binder", "angular2/src/facade/lang", "angular2/src/core/compiler/view_ref"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view"; + var ListWrapper, + MapWrapper, + Map, + StringMapWrapper, + Locals, + ElementBinder, + isPresent, + isBlank, + BaseException, + ViewRef, + ProtoViewRef, + internalView, + AppProtoViewMergeMapping, + AppViewContainer, + AppView, + DebugContext, + _Context, + EventEvaluationError, + AppProtoView; + function inverseIndexMapping(input, resultLength) { + var result = ListWrapper.createGrowableSize(resultLength); + for (var i = 0; i < input.length; i++) { + var value = input[i]; + if (isPresent(value)) { + result[input[i]] = i; + } + } + return result; + } + function _localsToStringMap(locals) { + var res = {}; + var c = locals; + while (isPresent(c)) { + res = StringMapWrapper.merge(res, MapWrapper.toStringMap(c.current)); + c = c.parent; + } + return res; + } + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + MapWrapper = $__m.MapWrapper; + Map = $__m.Map; + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + Locals = $__m.Locals; + }, function($__m) { + ElementBinder = $__m.ElementBinder; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + ViewRef = $__m.ViewRef; + ProtoViewRef = $__m.ProtoViewRef; + internalView = $__m.internalView; + }], + execute: function() { + AppProtoViewMergeMapping = (function() { + function AppProtoViewMergeMapping(renderProtoViewMergeMapping) { + this.renderProtoViewRef = renderProtoViewMergeMapping.mergedProtoViewRef; + this.renderFragmentCount = renderProtoViewMergeMapping.fragmentCount; + this.renderElementIndices = renderProtoViewMergeMapping.mappedElementIndices; + this.renderInverseElementIndices = inverseIndexMapping(this.renderElementIndices, renderProtoViewMergeMapping.mappedElementCount); + this.renderTextIndices = renderProtoViewMergeMapping.mappedTextIndices; + this.hostElementIndicesByViewIndex = renderProtoViewMergeMapping.hostElementIndicesByViewIndex; + this.nestedViewIndicesByElementIndex = inverseIndexMapping(this.hostElementIndicesByViewIndex, this.renderElementIndices.length); + this.nestedViewCountByViewIndex = renderProtoViewMergeMapping.nestedViewCountByViewIndex; + } + return ($traceurRuntime.createClass)(AppProtoViewMergeMapping, {}, {}); + }()); + $__export("AppProtoViewMergeMapping", AppProtoViewMergeMapping); + AppViewContainer = (function() { + function AppViewContainer() { + this.views = []; + } + return ($traceurRuntime.createClass)(AppViewContainer, {}, {}); + }()); + $__export("AppViewContainer", AppViewContainer); + AppView = (function() { + function AppView(renderer, proto, mainMergeMapping, viewOffset, elementOffset, textOffset, protoLocals, render, renderFragment) { + this.renderer = renderer; + this.proto = proto; + this.mainMergeMapping = mainMergeMapping; + this.viewOffset = viewOffset; + this.elementOffset = elementOffset; + this.textOffset = textOffset; + this.render = render; + this.renderFragment = renderFragment; + this.views = null; + this.elementInjectors = null; + this.viewContainers = null; + this.preBuiltObjects = null; + this.changeDetector = null; + this.context = null; + this.ref = new ViewRef(this); + this.locals = new Locals(null, MapWrapper.clone(protoLocals)); + } + return ($traceurRuntime.createClass)(AppView, { + init: function(changeDetector, elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers) { + this.changeDetector = changeDetector; + this.elementInjectors = elementInjectors; + this.rootElementInjectors = rootElementInjectors; + this.preBuiltObjects = preBuiltObjects; + this.views = views; + this.elementRefs = elementRefs; + this.viewContainers = viewContainers; + }, + setLocal: function(contextName, value) { + if (!this.hydrated()) + throw new BaseException('Cannot set locals on dehydrated view.'); + if (!this.proto.variableBindings.has(contextName)) { + return ; + } + var templateName = this.proto.variableBindings.get(contextName); + this.locals.set(templateName, value); + }, + hydrated: function() { + return isPresent(this.context); + }, + triggerEventHandlers: function(eventName, eventObj, boundElementIndex) { + var locals = new Map(); + locals.set('$event', eventObj); + this.dispatchEvent(boundElementIndex, eventName, locals); + }, + notifyOnBinding: function(b, currentValue) { + if (b.isTextNode()) { + this.renderer.setText(this.render, this.mainMergeMapping.renderTextIndices[b.elementIndex + this.textOffset], currentValue); + } else { + var elementRef = this.elementRefs[this.elementOffset + b.elementIndex]; + if (b.isElementProperty()) { + this.renderer.setElementProperty(elementRef, b.propertyName, currentValue); + } else if (b.isElementAttribute()) { + this.renderer.setElementAttribute(elementRef, b.propertyName, currentValue); + } else if (b.isElementClass()) { + this.renderer.setElementClass(elementRef, b.propertyName, currentValue); + } else if (b.isElementStyle()) { + var unit = isPresent(b.propertyUnit) ? b.propertyUnit : ''; + this.renderer.setElementStyle(elementRef, b.propertyName, ("" + currentValue + unit)); + } else { + throw new BaseException('Unsupported directive record'); + } + } + }, + notifyOnAllChangesDone: function() { + var eiCount = this.proto.elementBinders.length; + var ei = this.elementInjectors; + for (var i = eiCount - 1; i >= 0; i--) { + if (isPresent(ei[i + this.elementOffset])) + ei[i + this.elementOffset].onAllChangesDone(); + } + }, + getDirectiveFor: function(directive) { + var elementInjector = this.elementInjectors[this.elementOffset + directive.elementIndex]; + return elementInjector.getDirectiveAtIndex(directive.directiveIndex); + }, + getNestedView: function(boundElementIndex) { + var viewIndex = this.mainMergeMapping.nestedViewIndicesByElementIndex[boundElementIndex]; + return isPresent(viewIndex) ? this.views[viewIndex] : null; + }, + getHostElement: function() { + var boundElementIndex = this.mainMergeMapping.hostElementIndicesByViewIndex[this.viewOffset]; + return isPresent(boundElementIndex) ? this.elementRefs[boundElementIndex] : null; + }, + getDebugContext: function(elementIndex, directiveIndex) { + try { + var offsettedIndex = this.elementOffset + elementIndex; + var hasRefForIndex = offsettedIndex < this.elementRefs.length; + var elementRef = hasRefForIndex ? this.elementRefs[this.elementOffset + elementIndex] : null; + var host = this.getHostElement(); + var ei = hasRefForIndex ? this.elementInjectors[this.elementOffset + elementIndex] : null; + var element = isPresent(elementRef) ? elementRef.nativeElement : null; + var componentElement = isPresent(host) ? host.nativeElement : null; + var directive = isPresent(directiveIndex) ? this.getDirectiveFor(directiveIndex) : null; + var injector = isPresent(ei) ? ei.getInjector() : null; + return new DebugContext(element, componentElement, directive, this.context, _localsToStringMap(this.locals), injector); + } catch (e) { + return null; + } + }, + getDetectorFor: function(directive) { + var childView = this.getNestedView(this.elementOffset + directive.elementIndex); + return isPresent(childView) ? childView.changeDetector : null; + }, + invokeElementMethod: function(elementIndex, methodName, args) { + this.renderer.invokeElementMethod(this.elementRefs[elementIndex], methodName, args); + }, + dispatchRenderEvent: function(renderElementIndex, eventName, locals) { + var elementRef = this.elementRefs[this.mainMergeMapping.renderInverseElementIndices[renderElementIndex]]; + var view = internalView(elementRef.parentView); + return view.dispatchEvent(elementRef.boundElementIndex, eventName, locals); + }, + dispatchEvent: function(boundElementIndex, eventName, locals) { + var $__0 = this; + try { + var allowDefaultBehavior = true; + if (this.hydrated()) { + var elBinder = this.proto.elementBinders[boundElementIndex - this.elementOffset]; + if (isBlank(elBinder.hostListeners)) + return allowDefaultBehavior; + var eventMap = elBinder.hostListeners[eventName]; + if (isBlank(eventMap)) + return allowDefaultBehavior; + MapWrapper.forEach(eventMap, (function(expr, directiveIndex) { + var context; + if (directiveIndex === -1) { + context = $__0.context; + } else { + context = $__0.elementInjectors[boundElementIndex].getDirectiveAtIndex(directiveIndex); + } + var result = expr.eval(context, new Locals($__0.locals, locals)); + if (isPresent(result)) { + allowDefaultBehavior = allowDefaultBehavior && result == true; + } + })); + } + return allowDefaultBehavior; + } catch (e) { + var c = this.getDebugContext(boundElementIndex - this.elementOffset, null); + var context = isPresent(c) ? new _Context(c.element, c.componentElement, c.context, c.locals, c.injector) : null; + throw new EventEvaluationError(eventName, e, e.stack, context); + } + } + }, {}); + }()); + $__export("AppView", AppView); + DebugContext = (function() { + function DebugContext(element, componentElement, directive, context, locals, injector) { + this.element = element; + this.componentElement = componentElement; + this.directive = directive; + this.context = context; + this.locals = locals; + this.injector = injector; + } + return ($traceurRuntime.createClass)(DebugContext, {}, {}); + }()); + $__export("DebugContext", DebugContext); + _Context = (function() { + function _Context(element, componentElement, context, locals, injector) { + this.element = element; + this.componentElement = componentElement; + this.context = context; + this.locals = locals; + this.injector = injector; + } + return ($traceurRuntime.createClass)(_Context, {}, {}); + }()); + EventEvaluationError = (function($__super) { + function EventEvaluationError(eventName, originalException, originalStack, context) { + $traceurRuntime.superConstructor(EventEvaluationError).call(this, ("Error during evaluation of \"" + eventName + "\""), originalException, originalStack, context); + } + return ($traceurRuntime.createClass)(EventEvaluationError, {}, {}, $__super); + }(BaseException)); + AppProtoView = (function() { + function AppProtoView(type, isEmbeddedFragment, render, protoChangeDetector, variableBindings, variableLocations, textBindingCount) { + var $__0 = this; + this.type = type; + this.isEmbeddedFragment = isEmbeddedFragment; + this.render = render; + this.protoChangeDetector = protoChangeDetector; + this.variableBindings = variableBindings; + this.variableLocations = variableLocations; + this.textBindingCount = textBindingCount; + this.elementBinders = []; + this.protoLocals = new Map(); + this.ref = new ProtoViewRef(this); + if (isPresent(variableBindings)) { + MapWrapper.forEach(variableBindings, (function(templateName, _) { + $__0.protoLocals.set(templateName, null); + })); + } + } + return ($traceurRuntime.createClass)(AppProtoView, { + bindElement: function(parent, distanceToParent, protoElementInjector) { + var componentDirective = arguments[3] !== (void 0) ? arguments[3] : null; + var elBinder = new ElementBinder(this.elementBinders.length, parent, distanceToParent, protoElementInjector, componentDirective); + this.elementBinders.push(elBinder); + return elBinder; + }, + bindEvent: function(eventBindings, boundElementIndex) { + var directiveIndex = arguments[2] !== (void 0) ? arguments[2] : -1; + var elBinder = this.elementBinders[boundElementIndex]; + var events = elBinder.hostListeners; + if (isBlank(events)) { + events = StringMapWrapper.create(); + elBinder.hostListeners = events; + } + for (var i = 0; i < eventBindings.length; i++) { + var eventBinding = eventBindings[i]; + var eventName = eventBinding.fullName; + var event = StringMapWrapper.get(events, eventName); + if (isBlank(event)) { + event = new Map(); + StringMapWrapper.set(events, eventName, event); + } + event.set(directiveIndex, eventBinding.source); + } + } + }, {}); + }()); + $__export("AppProtoView", AppProtoView); + } + }; +}); + +System.register("angular2/src/core/compiler/view_manager_utils", ["angular2/di", "angular2/src/facade/collection", "angular2/src/core/compiler/element_injector", "angular2/src/facade/lang", "angular2/src/core/compiler/view", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/render/api"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view_manager_utils"; + var __decorate, + __metadata, + Injector, + Injectable, + ListWrapper, + MapWrapper, + eli, + isPresent, + isBlank, + viewModule, + internalView, + ElementRef, + TemplateRef, + ViewType, + AppViewManagerUtils; + return { + setters: [function($__m) { + Injector = $__m.Injector; + Injectable = $__m.Injectable; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + MapWrapper = $__m.MapWrapper; + }, function($__m) { + eli = $__m; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + }, function($__m) { + viewModule = $__m; + }, function($__m) { + internalView = $__m.internalView; + }, function($__m) { + ElementRef = $__m.ElementRef; + }, function($__m) { + TemplateRef = $__m.TemplateRef; + }, function($__m) { + ViewType = $__m.ViewType; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + AppViewManagerUtils = (($traceurRuntime.createClass)(function() {}, { + getComponentInstance: function(parentView, boundElementIndex) { + var eli = parentView.elementInjectors[boundElementIndex]; + return eli.getComponent(); + }, + createView: function(mergedParentViewProto, renderViewWithFragments, viewManager, renderer) { + var renderFragments = renderViewWithFragments.fragmentRefs; + var renderView = renderViewWithFragments.viewRef; + var elementCount = mergedParentViewProto.mergeMapping.renderElementIndices.length; + var viewCount = mergedParentViewProto.mergeMapping.nestedViewCountByViewIndex[0] + 1; + var elementRefs = ListWrapper.createFixedSize(elementCount); + var viewContainers = ListWrapper.createFixedSize(elementCount); + var preBuiltObjects = ListWrapper.createFixedSize(elementCount); + var elementInjectors = ListWrapper.createFixedSize(elementCount); + var views = ListWrapper.createFixedSize(viewCount); + var elementOffset = 0; + var textOffset = 0; + var fragmentIdx = 0; + for (var viewOffset = 0; viewOffset < viewCount; viewOffset++) { + var hostElementIndex = mergedParentViewProto.mergeMapping.hostElementIndicesByViewIndex[viewOffset]; + var parentView = isPresent(hostElementIndex) ? internalView(elementRefs[hostElementIndex].parentView) : null; + var protoView = isPresent(hostElementIndex) ? parentView.proto.elementBinders[hostElementIndex - parentView.elementOffset].nestedProtoView : mergedParentViewProto; + var renderFragment = null; + if (viewOffset === 0 || protoView.type === ViewType.EMBEDDED) { + renderFragment = renderFragments[fragmentIdx++]; + } + var currentView = new viewModule.AppView(renderer, protoView, mergedParentViewProto.mergeMapping, viewOffset, elementOffset, textOffset, protoView.protoLocals, renderView, renderFragment); + views[viewOffset] = currentView; + var rootElementInjectors = []; + for (var binderIdx = 0; binderIdx < protoView.elementBinders.length; binderIdx++) { + var binder = protoView.elementBinders[binderIdx]; + var boundElementIndex = elementOffset + binderIdx; + var elementInjector = null; + var protoElementInjector = binder.protoElementInjector; + if (isPresent(protoElementInjector)) { + if (isPresent(protoElementInjector.parent)) { + var parentElementInjector = elementInjectors[elementOffset + protoElementInjector.parent.index]; + elementInjector = protoElementInjector.instantiate(parentElementInjector); + } else { + elementInjector = protoElementInjector.instantiate(null); + rootElementInjectors.push(elementInjector); + } + } + elementInjectors[boundElementIndex] = elementInjector; + var el = new ElementRef(currentView.ref, boundElementIndex, mergedParentViewProto.mergeMapping.renderElementIndices[boundElementIndex], renderer); + elementRefs[el.boundElementIndex] = el; + if (isPresent(elementInjector)) { + var templateRef = binder.hasEmbeddedProtoView() ? new TemplateRef(el) : null; + preBuiltObjects[boundElementIndex] = new eli.PreBuiltObjects(viewManager, currentView, el, templateRef); + } + } + currentView.init(protoView.protoChangeDetector.instantiate(currentView), elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers); + if (isPresent(parentView) && protoView.type === ViewType.COMPONENT) { + parentView.changeDetector.addShadowDomChild(currentView.changeDetector); + } + elementOffset += protoView.elementBinders.length; + textOffset += protoView.textBindingCount; + } + return views[0]; + }, + hydrateRootHostView: function(hostView, injector) { + this._hydrateView(hostView, injector, null, new Object(), null); + }, + attachViewInContainer: function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view) { + if (isBlank(contextView)) { + contextView = parentView; + contextBoundElementIndex = boundElementIndex; + } + parentView.changeDetector.addChild(view.changeDetector); + var viewContainer = parentView.viewContainers[boundElementIndex]; + if (isBlank(viewContainer)) { + viewContainer = new viewModule.AppViewContainer(); + parentView.viewContainers[boundElementIndex] = viewContainer; + } + ListWrapper.insert(viewContainer.views, atIndex, view); + var sibling; + if (atIndex == 0) { + sibling = null; + } else { + sibling = ListWrapper.last(viewContainer.views[atIndex - 1].rootElementInjectors); + } + var elementInjector = contextView.elementInjectors[contextBoundElementIndex]; + for (var i = view.rootElementInjectors.length - 1; i >= 0; i--) { + if (isPresent(elementInjector.parent)) { + view.rootElementInjectors[i].linkAfter(elementInjector.parent, sibling); + } else { + contextView.rootElementInjectors.push(view.rootElementInjectors[i]); + } + } + }, + detachViewInContainer: function(parentView, boundElementIndex, atIndex) { + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + view.changeDetector.remove(); + ListWrapper.removeAt(viewContainer.views, atIndex); + for (var i = 0; i < view.rootElementInjectors.length; ++i) { + var inj = view.rootElementInjectors[i]; + if (isPresent(inj.parent)) { + inj.unlink(); + } else { + var removeIdx = ListWrapper.indexOf(parentView.rootElementInjectors, inj); + if (removeIdx >= 0) { + ListWrapper.removeAt(parentView.rootElementInjectors, removeIdx); + } + } + } + }, + hydrateViewInContainer: function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, imperativelyCreatedBindings) { + if (isBlank(contextView)) { + contextView = parentView; + contextBoundElementIndex = boundElementIndex; + } + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + var elementInjector = contextView.elementInjectors[contextBoundElementIndex]; + var injector = isPresent(imperativelyCreatedBindings) ? Injector.fromResolvedBindings(imperativelyCreatedBindings) : null; + this._hydrateView(view, injector, elementInjector.getHost(), contextView.context, contextView.locals); + }, + _hydrateView: function(initView, imperativelyCreatedInjector, hostElementInjector, context, parentLocals) { + var viewIdx = initView.viewOffset; + var endViewOffset = viewIdx + initView.mainMergeMapping.nestedViewCountByViewIndex[viewIdx]; + while (viewIdx <= endViewOffset) { + var currView = initView.views[viewIdx]; + var currProtoView = currView.proto; + if (currView !== initView && currView.proto.type === ViewType.EMBEDDED) { + viewIdx += initView.mainMergeMapping.nestedViewCountByViewIndex[viewIdx] + 1; + } else { + if (currView !== initView) { + imperativelyCreatedInjector = null; + parentLocals = null; + var hostElementIndex = initView.mainMergeMapping.hostElementIndicesByViewIndex[viewIdx]; + hostElementInjector = initView.elementInjectors[hostElementIndex]; + context = hostElementInjector.getComponent(); + } + currView.context = context; + currView.locals.parent = parentLocals; + var binders = currProtoView.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var boundElementIndex = binderIdx + currView.elementOffset; + var elementInjector = initView.elementInjectors[boundElementIndex]; + if (isPresent(elementInjector)) { + elementInjector.hydrate(imperativelyCreatedInjector, hostElementInjector, currView.preBuiltObjects[boundElementIndex]); + this._populateViewLocals(currView, elementInjector, boundElementIndex); + this._setUpEventEmitters(currView, elementInjector, boundElementIndex); + this._setUpHostActions(currView, elementInjector, boundElementIndex); + } + } + var pipes = this._getPipes(imperativelyCreatedInjector, hostElementInjector); + currView.changeDetector.hydrate(currView.context, currView.locals, currView, pipes); + viewIdx++; + } + } + }, + _getPipes: function(imperativelyCreatedInjector, hostElementInjector) { + var pipesKey = eli.StaticKeys.instance().pipesKey; + if (isPresent(imperativelyCreatedInjector)) + return imperativelyCreatedInjector.getOptional(pipesKey); + if (isPresent(hostElementInjector)) + return hostElementInjector.getPipes(); + return null; + }, + _populateViewLocals: function(view, elementInjector, boundElementIdx) { + if (isPresent(elementInjector.getDirectiveVariableBindings())) { + MapWrapper.forEach(elementInjector.getDirectiveVariableBindings(), (function(directiveIndex, name) { + if (isBlank(directiveIndex)) { + view.locals.set(name, view.elementRefs[boundElementIdx].nativeElement); + } else { + view.locals.set(name, elementInjector.getDirectiveAtIndex(directiveIndex)); + } + })); + } + }, + _setUpEventEmitters: function(view, elementInjector, boundElementIndex) { + var emitters = elementInjector.getEventEmitterAccessors(); + for (var directiveIndex = 0; directiveIndex < emitters.length; ++directiveIndex) { + var directiveEmitters = emitters[directiveIndex]; + var directive = elementInjector.getDirectiveAtIndex(directiveIndex); + for (var eventIndex = 0; eventIndex < directiveEmitters.length; ++eventIndex) { + var eventEmitterAccessor = directiveEmitters[eventIndex]; + eventEmitterAccessor.subscribe(view, boundElementIndex, directive); + } + } + }, + _setUpHostActions: function(view, elementInjector, boundElementIndex) { + var hostActions = elementInjector.getHostActionAccessors(); + for (var directiveIndex = 0; directiveIndex < hostActions.length; ++directiveIndex) { + var directiveHostActions = hostActions[directiveIndex]; + var directive = elementInjector.getDirectiveAtIndex(directiveIndex); + for (var index = 0; index < directiveHostActions.length; ++index) { + var hostActionAccessor = directiveHostActions[index]; + hostActionAccessor.subscribe(view, boundElementIndex, directive); + } + } + }, + dehydrateView: function(initView) { + var endViewOffset = initView.viewOffset + initView.mainMergeMapping.nestedViewCountByViewIndex[initView.viewOffset]; + for (var viewIdx = initView.viewOffset; viewIdx <= endViewOffset; viewIdx++) { + var currView = initView.views[viewIdx]; + if (currView.hydrated()) { + if (isPresent(currView.locals)) { + currView.locals.clearValues(); + } + currView.context = null; + currView.changeDetector.dehydrate(); + var binders = currView.proto.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var eli = initView.elementInjectors[currView.elementOffset + binderIdx]; + if (isPresent(eli)) { + eli.dehydrate(); + } + } + } + } + } + }, {})); + $__export("AppViewManagerUtils", AppViewManagerUtils); + $__export("AppViewManagerUtils", AppViewManagerUtils = __decorate([Injectable(), __metadata('design:paramtypes', [])], AppViewManagerUtils)); + } + }; +}); + +System.register("angular2/src/core/compiler/view_resolver", ["angular2/di", "angular2/src/core/annotations_impl/view", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/reflection/reflection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view_resolver"; + var __decorate, + __metadata, + Injectable, + View, + stringify, + isBlank, + BaseException, + Map, + reflector, + ViewResolver; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + View = $__m.View; + }, function($__m) { + stringify = $__m.stringify; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + Map = $__m.Map; + }, function($__m) { + reflector = $__m.reflector; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + ViewResolver = (($traceurRuntime.createClass)(function() { + this._cache = new Map(); + }, { + resolve: function(component) { + var view = this._cache.get(component); + if (isBlank(view)) { + view = this._resolve(component); + this._cache.set(component, view); + } + return view; + }, + _resolve: function(component) { + var annotations = reflector.annotations(component); + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + if (annotation instanceof View) { + return annotation; + } + } + throw new BaseException(("No View annotation found on component " + stringify(component))); + } + }, {})); + $__export("ViewResolver", ViewResolver); + $__export("ViewResolver", ViewResolver = __decorate([Injectable(), __metadata('design:paramtypes', [])], ViewResolver)); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/style_inliner", ["angular2/di", "angular2/src/render/xhr", "angular2/src/facade/collection", "angular2/src/services/url_resolver", "angular2/src/render/dom/compiler/style_url_resolver", "angular2/src/facade/lang", "angular2/src/facade/async"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/style_inliner"; + var __decorate, + __metadata, + Injectable, + XHR, + ListWrapper, + UrlResolver, + StyleUrlResolver, + isBlank, + isPresent, + RegExpWrapper, + StringWrapper, + isPromise, + PromiseWrapper, + StyleInliner, + _importRe, + _urlRe, + _mediaQueryRe; + function _extractUrl(importRule) { + var match = RegExpWrapper.firstMatch(_urlRe, importRule); + if (isBlank(match)) + return null; + return isPresent(match[1]) ? match[1] : match[2]; + } + function _extractMediaQuery(importRule) { + var match = RegExpWrapper.firstMatch(_mediaQueryRe, importRule); + if (isBlank(match)) + return null; + var mediaQuery = match[1].trim(); + return (mediaQuery.length > 0) ? mediaQuery : null; + } + function _wrapInMediaRule(css, query) { + return (isBlank(query)) ? css : ("@media " + query + " {\n" + css + "\n}"); + } + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + XHR = $__m.XHR; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + UrlResolver = $__m.UrlResolver; + }, function($__m) { + StyleUrlResolver = $__m.StyleUrlResolver; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + RegExpWrapper = $__m.RegExpWrapper; + StringWrapper = $__m.StringWrapper; + isPromise = $__m.isPromise; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + StyleInliner = (($traceurRuntime.createClass)(function(_xhr, _styleUrlResolver, _urlResolver) { + this._xhr = _xhr; + this._styleUrlResolver = _styleUrlResolver; + this._urlResolver = _urlResolver; + }, { + inlineImports: function(cssText, baseUrl) { + return this._inlineImports(cssText, baseUrl, []); + }, + _inlineImports: function(cssText, baseUrl, inlinedUrls) { + var $__0 = this; + var partIndex = 0; + var parts = StringWrapper.split(cssText, _importRe); + if (parts.length === 1) { + return cssText; + } + var promises = []; + while (partIndex < parts.length - 1) { + var prefix = parts[partIndex]; + var rule = parts[partIndex + 1]; + var url = _extractUrl(rule); + if (isPresent(url)) { + url = this._urlResolver.resolve(baseUrl, url); + } + var mediaQuery = _extractMediaQuery(rule); + var promise = void 0; + if (isBlank(url)) { + promise = PromiseWrapper.resolve(("/* Invalid import rule: \"@import " + rule + ";\" */")); + } else if (ListWrapper.contains(inlinedUrls, url)) { + promise = PromiseWrapper.resolve(prefix); + } else { + inlinedUrls.push(url); + promise = PromiseWrapper.then(this._xhr.get(url), (function(rawCss) { + var inlinedCss = $__0._inlineImports(rawCss, url, inlinedUrls); + if (isPromise(inlinedCss)) { + return inlinedCss.then((function(css) { + return prefix + $__0._transformImportedCss(css, mediaQuery, url) + '\n'; + })); + } else { + return prefix + $__0._transformImportedCss(inlinedCss, mediaQuery, url) + '\n'; + } + }), (function(error) { + return ("/* failed to import " + url + " */\n"); + })); + } + promises.push(promise); + partIndex += 2; + } + return PromiseWrapper.all(promises).then(function(cssParts) { + var cssText = cssParts.join(''); + if (partIndex < parts.length) { + cssText += parts[partIndex]; + } + return cssText; + }); + }, + _transformImportedCss: function(css, mediaQuery, url) { + css = this._styleUrlResolver.resolveUrls(css, url); + return _wrapInMediaRule(css, mediaQuery); + } + }, {})); + $__export("StyleInliner", StyleInliner); + $__export("StyleInliner", StyleInliner = __decorate([Injectable(), __metadata('design:paramtypes', [XHR, StyleUrlResolver, UrlResolver])], StyleInliner)); + _importRe = /@import\s+([^;]+);/g; + _urlRe = RegExpWrapper.create('url\\(\\s*?[\'"]?([^\'")]+)[\'"]?|' + '[\'"]([^\'")]+)[\'"]'); + _mediaQueryRe = /['"][^'"]+['"]\s*\)?\s*(.*)/g; + } + }; +}); + +System.register("angular2/src/render/dom/events/hammer_gestures", ["angular2/src/render/dom/events/hammer_common", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/events/hammer_gestures"; + var HammerGesturesPluginCommon, + isPresent, + BaseException, + HammerGesturesPlugin; + return { + setters: [function($__m) { + HammerGesturesPluginCommon = $__m.HammerGesturesPluginCommon; + }, function($__m) { + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + }], + execute: function() { + HammerGesturesPlugin = (function($__super) { + function HammerGesturesPlugin() { + $traceurRuntime.superConstructor(HammerGesturesPlugin).call(this); + } + return ($traceurRuntime.createClass)(HammerGesturesPlugin, { + supports: function(eventName) { + if (!$traceurRuntime.superGet(this, HammerGesturesPlugin.prototype, "supports").call(this, eventName)) + return false; + if (!isPresent(window['Hammer'])) { + throw new BaseException(("Hammer.js is not loaded, can not bind " + eventName + " event")); + } + return true; + }, + addEventListener: function(element, eventName, handler, shouldSupportBubble) { + if (shouldSupportBubble) + throw new BaseException('Hammer.js plugin does not support bubbling gestures.'); + var zone = this.manager.getZone(); + eventName = eventName.toLowerCase(); + zone.runOutsideAngular(function() { + var mc = new Hammer(element); + mc.get('pinch').set({enable: true}); + mc.get('rotate').set({enable: true}); + mc.on(eventName, function(eventObj) { + zone.run(function() { + handler(eventObj); + }); + }); + }); + } + }, {}, $__super); + }(HammerGesturesPluginCommon)); + $__export("HammerGesturesPlugin", HammerGesturesPlugin); + } + }; +}); + +System.register("angular2/src/core/testability/testability", ["angular2/di", "angular2/src/dom/dom_adapter", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/core/testability/get_testability", "angular2/src/core/zone/ng_zone", "angular2/src/facade/async"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/testability/testability"; + var __decorate, + __metadata, + Injectable, + DOM, + Map, + BaseException, + getTestabilityModule, + NgZone, + PromiseWrapper, + Testability, + TestabilityRegistry; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + Map = $__m.Map; + }, function($__m) { + BaseException = $__m.BaseException; + }, function($__m) { + getTestabilityModule = $__m; + }, function($__m) { + NgZone = $__m.NgZone; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Testability = (($traceurRuntime.createClass)(function(_ngZone) { + this._ngZone = _ngZone; + this._pendingCount = 0; + this._callbacks = []; + this._isAngularEventPending = false; + this._watchAngularEvents(_ngZone); + }, { + _watchAngularEvents: function(_ngZone) { + var $__0 = this; + _ngZone.overrideOnTurnStart((function() { + $__0._isAngularEventPending = true; + })); + _ngZone.overrideOnEventDone((function() { + $__0._isAngularEventPending = false; + $__0._runCallbacksIfReady(); + }), true); + }, + increasePendingRequestCount: function() { + this._pendingCount += 1; + return this._pendingCount; + }, + decreasePendingRequestCount: function() { + this._pendingCount -= 1; + if (this._pendingCount < 0) { + throw new BaseException('pending async requests below zero'); + } + this._runCallbacksIfReady(); + return this._pendingCount; + }, + _runCallbacksIfReady: function() { + var $__0 = this; + if (this._pendingCount != 0 || this._isAngularEventPending) { + return ; + } + PromiseWrapper.resolve(null).then((function(_) { + while ($__0._callbacks.length !== 0) { + ($__0._callbacks.pop())(); + } + })); + }, + whenStable: function(callback) { + this._callbacks.push(callback); + this._runCallbacksIfReady(); + }, + getPendingRequestCount: function() { + return this._pendingCount; + }, + isAngularEventPending: function() { + return this._isAngularEventPending; + }, + findBindings: function(using, binding, exactMatch) { + return []; + } + }, {})); + $__export("Testability", Testability); + $__export("Testability", Testability = __decorate([Injectable(), __metadata('design:paramtypes', [NgZone])], Testability)); + TestabilityRegistry = (($traceurRuntime.createClass)(function() { + this._applications = new Map(); + getTestabilityModule.GetTestability.addToWindow(this); + }, { + registerApplication: function(token, testability) { + this._applications.set(token, testability); + }, + findTestabilityInTree: function(elem) { + if (elem == null) { + return null; + } + if (this._applications.has(elem)) { + return this._applications.get(elem); + } + if (DOM.isShadowRoot(elem)) { + return this.findTestabilityInTree(DOM.getHost(elem)); + } + return this.findTestabilityInTree(DOM.parentElement(elem)); + } + }, {})); + $__export("TestabilityRegistry", TestabilityRegistry); + $__export("TestabilityRegistry", TestabilityRegistry = __decorate([Injectable(), __metadata('design:paramtypes', [])], TestabilityRegistry)); + } + }; +}); + +System.register("angular2/src/render/dom/view/shared_styles_host", ["angular2/src/dom/dom_adapter", "angular2/di", "angular2/src/facade/collection", "angular2/src/render/dom/dom_tokens"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/view/shared_styles_host"; + var __decorate, + __metadata, + __param, + DOM, + Inject, + Injectable, + SetWrapper, + DOCUMENT_TOKEN, + SharedStylesHost, + DomSharedStylesHost; + return { + setters: [function($__m) { + DOM = $__m.DOM; + }, function($__m) { + Inject = $__m.Inject; + Injectable = $__m.Injectable; + }, function($__m) { + SetWrapper = $__m.SetWrapper; + }, function($__m) { + DOCUMENT_TOKEN = $__m.DOCUMENT_TOKEN; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + SharedStylesHost = (($traceurRuntime.createClass)(function() { + this._styles = []; + this._stylesSet = new Set(); + }, { + addStyles: function(styles) { + var $__0 = this; + var additions = []; + styles.forEach((function(style) { + if (!SetWrapper.has($__0._stylesSet, style)) { + $__0._stylesSet.add(style); + $__0._styles.push(style); + additions.push(style); + } + })); + this.onStylesAdded(additions); + }, + onStylesAdded: function(additions) {}, + getAllStyles: function() { + return this._styles; + } + }, {})); + $__export("SharedStylesHost", SharedStylesHost); + $__export("SharedStylesHost", SharedStylesHost = __decorate([Injectable(), __metadata('design:paramtypes', [])], SharedStylesHost)); + DomSharedStylesHost = (function($__super) { + function $__1(doc) { + $traceurRuntime.superConstructor($__1).call(this); + this._hostNodes = new Set(); + this._hostNodes.add(doc.head); + } + return ($traceurRuntime.createClass)($__1, { + _addStylesToHost: function(styles, host) { + for (var i = 0; i < styles.length; i++) { + var style = styles[i]; + DOM.appendChild(host, DOM.createStyleElement(style)); + } + }, + addHost: function(hostNode) { + this._addStylesToHost(this._styles, hostNode); + this._hostNodes.add(hostNode); + }, + removeHost: function(hostNode) { + SetWrapper.delete(this._hostNodes, hostNode); + }, + onStylesAdded: function(additions) { + var $__0 = this; + this._hostNodes.forEach((function(hostNode) { + $__0._addStylesToHost(additions, hostNode); + })); + } + }, {}, $__super); + }(SharedStylesHost)); + $__export("DomSharedStylesHost", DomSharedStylesHost); + $__export("DomSharedStylesHost", DomSharedStylesHost = __decorate([Injectable(), __param(0, Inject(DOCUMENT_TOKEN)), __metadata('design:paramtypes', [Object])], DomSharedStylesHost)); + } + }; +}); + +System.register("angular2/src/render/dom/view/proto_view_builder", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/dom/dom_adapter", "angular2/src/change_detection/change_detection", "angular2/src/render/dom/view/proto_view", "angular2/src/render/dom/view/element_binder", "angular2/src/render/api", "angular2/src/render/dom/util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/view/proto_view_builder"; + var isPresent, + isBlank, + BaseException, + StringWrapper, + ListWrapper, + MapWrapper, + Set, + SetWrapper, + StringMapWrapper, + DOM, + ASTWithSource, + AstTransformer, + AccessMember, + LiteralArray, + ImplicitReceiver, + DomProtoView, + DomProtoViewRef, + DomElementBinder, + Event, + api, + NG_BINDING_CLASS, + EVENT_TARGET_SEPARATOR, + queryBoundTextNodeIndices, + camelCaseToDashCase, + ProtoViewBuilder, + ElementBinderBuilder, + DirectiveBuilder, + EventBuilder, + PROPERTY_PARTS_SEPARATOR, + ATTRIBUTE_PREFIX, + CLASS_PREFIX, + STYLE_PREFIX; + function buildElementPropertyBindings(protoElement, isNgComponent, bindingsInTemplate, directiveTempaltePropertyNames) { + var propertyBindings = []; + MapWrapper.forEach(bindingsInTemplate, (function(ast, propertyNameInTemplate) { + var propertyBinding = createElementPropertyBinding(ast, propertyNameInTemplate); + if (isValidElementPropertyBinding(protoElement, isNgComponent, propertyBinding)) { + propertyBindings.push(propertyBinding); + } else if (!SetWrapper.has(directiveTempaltePropertyNames, propertyNameInTemplate)) { + throw new BaseException(("Can't bind to '" + propertyNameInTemplate + "' since it isn't a known property of the '<" + DOM.tagName(protoElement).toLowerCase() + ">' element and there are no matching directives with a corresponding property")); + } + })); + return propertyBindings; + } + function isValidElementPropertyBinding(protoElement, isNgComponent, binding) { + if (binding.type === api.PropertyBindingType.PROPERTY) { + var tagName = DOM.tagName(protoElement); + var possibleCustomElement = tagName.indexOf('-') !== -1; + if (possibleCustomElement && !isNgComponent) { + return true; + } else { + return DOM.hasProperty(protoElement, binding.property); + } + } + return true; + } + function createElementPropertyBinding(ast, propertyNameInTemplate) { + var parts = StringWrapper.split(propertyNameInTemplate, PROPERTY_PARTS_SEPARATOR); + if (parts.length === 1) { + var propName = parts[0]; + var mappedPropName = StringMapWrapper.get(DOM.attrToPropMap, propName); + propName = isPresent(mappedPropName) ? mappedPropName : propName; + return new api.ElementPropertyBinding(api.PropertyBindingType.PROPERTY, ast, propName); + } else if (parts[0] == ATTRIBUTE_PREFIX) { + return new api.ElementPropertyBinding(api.PropertyBindingType.ATTRIBUTE, ast, parts[1]); + } else if (parts[0] == CLASS_PREFIX) { + return new api.ElementPropertyBinding(api.PropertyBindingType.CLASS, ast, camelCaseToDashCase(parts[1])); + } else if (parts[0] == STYLE_PREFIX) { + var unit = parts.length > 2 ? parts[2] : null; + return new api.ElementPropertyBinding(api.PropertyBindingType.STYLE, ast, parts[1], unit); + } else { + throw new BaseException(("Invalid property name " + propertyNameInTemplate)); + } + } + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + MapWrapper = $__m.MapWrapper; + Set = $__m.Set; + SetWrapper = $__m.SetWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + ASTWithSource = $__m.ASTWithSource; + AstTransformer = $__m.AstTransformer; + AccessMember = $__m.AccessMember; + LiteralArray = $__m.LiteralArray; + ImplicitReceiver = $__m.ImplicitReceiver; + }, function($__m) { + DomProtoView = $__m.DomProtoView; + DomProtoViewRef = $__m.DomProtoViewRef; + }, function($__m) { + DomElementBinder = $__m.DomElementBinder; + Event = $__m.Event; + }, function($__m) { + api = $__m; + }, function($__m) { + NG_BINDING_CLASS = $__m.NG_BINDING_CLASS; + EVENT_TARGET_SEPARATOR = $__m.EVENT_TARGET_SEPARATOR; + queryBoundTextNodeIndices = $__m.queryBoundTextNodeIndices; + camelCaseToDashCase = $__m.camelCaseToDashCase; + }], + execute: function() { + ProtoViewBuilder = (function() { + function ProtoViewBuilder(rootElement, type, viewEncapsulation) { + this.rootElement = rootElement; + this.type = type; + this.viewEncapsulation = viewEncapsulation; + this.variableBindings = new Map(); + this.elements = []; + this.rootTextBindings = new Map(); + this.ngContentCount = 0; + this.hostAttributes = new Map(); + } + return ($traceurRuntime.createClass)(ProtoViewBuilder, { + bindElement: function(element) { + var description = arguments[1] !== (void 0) ? arguments[1] : null; + var builder = new ElementBinderBuilder(this.elements.length, element, description); + this.elements.push(builder); + DOM.addClass(element, NG_BINDING_CLASS); + return builder; + }, + bindVariable: function(name, value) { + this.variableBindings.set(value, name); + }, + bindRootText: function(textNode, expression) { + this.rootTextBindings.set(textNode, expression); + }, + bindNgContent: function() { + this.ngContentCount++; + }, + setHostAttribute: function(name, value) { + this.hostAttributes.set(name, value); + }, + build: function() { + var domElementBinders = []; + var apiElementBinders = []; + var textNodeExpressions = []; + var rootTextNodeIndices = []; + var transitiveNgContentCount = this.ngContentCount; + queryBoundTextNodeIndices(DOM.content(this.rootElement), this.rootTextBindings, (function(node, nodeIndex, expression) { + textNodeExpressions.push(expression); + rootTextNodeIndices.push(nodeIndex); + })); + ListWrapper.forEach(this.elements, (function(ebb) { + var directiveTemplatePropertyNames = new Set(); + var apiDirectiveBinders = ListWrapper.map(ebb.directives, (function(dbb) { + ebb.eventBuilder.merge(dbb.eventBuilder); + ListWrapper.forEach(dbb.templatePropertyNames, (function(name) { + return directiveTemplatePropertyNames.add(name); + })); + return new api.DirectiveBinder({ + directiveIndex: dbb.directiveIndex, + propertyBindings: dbb.propertyBindings, + eventBindings: dbb.eventBindings, + hostPropertyBindings: buildElementPropertyBindings(ebb.element, isPresent(ebb.componentId), dbb.hostPropertyBindings, directiveTemplatePropertyNames) + }); + })); + var nestedProtoView = isPresent(ebb.nestedProtoView) ? ebb.nestedProtoView.build() : null; + if (isPresent(nestedProtoView)) { + transitiveNgContentCount += nestedProtoView.transitiveNgContentCount; + } + var parentIndex = isPresent(ebb.parent) ? ebb.parent.index : -1; + var textNodeIndices = []; + queryBoundTextNodeIndices(ebb.element, ebb.textBindings, (function(node, nodeIndex, expression) { + textNodeExpressions.push(expression); + textNodeIndices.push(nodeIndex); + })); + apiElementBinders.push(new api.ElementBinder({ + index: ebb.index, + parentIndex: parentIndex, + distanceToParent: ebb.distanceToParent, + directives: apiDirectiveBinders, + nestedProtoView: nestedProtoView, + propertyBindings: buildElementPropertyBindings(ebb.element, isPresent(ebb.componentId), ebb.propertyBindings, directiveTemplatePropertyNames), + variableBindings: ebb.variableBindings, + eventBindings: ebb.eventBindings, + readAttributes: ebb.readAttributes + })); + domElementBinders.push(new DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: isPresent(nestedProtoView) || isPresent(ebb.componentId), + hasNativeShadowRoot: false, + eventLocals: new LiteralArray(ebb.eventBuilder.buildEventLocals()), + localEvents: ebb.eventBuilder.buildLocalEvents(), + globalEvents: ebb.eventBuilder.buildGlobalEvents() + })); + })); + var rootNodeCount = DOM.childNodes(DOM.content(this.rootElement)).length; + return new api.ProtoViewDto({ + render: new DomProtoViewRef(DomProtoView.create(this.type, this.rootElement, this.viewEncapsulation, [rootNodeCount], rootTextNodeIndices, domElementBinders, this.hostAttributes)), + type: this.type, + elementBinders: apiElementBinders, + variableBindings: this.variableBindings, + textBindings: textNodeExpressions, + transitiveNgContentCount: transitiveNgContentCount + }); + } + }, {}); + }()); + $__export("ProtoViewBuilder", ProtoViewBuilder); + ElementBinderBuilder = (function() { + function ElementBinderBuilder(index, element, description) { + this.index = index; + this.element = element; + this.parent = null; + this.distanceToParent = 0; + this.directives = []; + this.nestedProtoView = null; + this.propertyBindings = new Map(); + this.variableBindings = new Map(); + this.eventBindings = []; + this.eventBuilder = new EventBuilder(); + this.textBindings = new Map(); + this.readAttributes = new Map(); + this.componentId = null; + } + return ($traceurRuntime.createClass)(ElementBinderBuilder, { + setParent: function(parent, distanceToParent) { + this.parent = parent; + if (isPresent(parent)) { + this.distanceToParent = distanceToParent; + } + return this; + }, + readAttribute: function(attrName) { + if (isBlank(this.readAttributes.get(attrName))) { + this.readAttributes.set(attrName, DOM.getAttribute(this.element, attrName)); + } + }, + bindDirective: function(directiveIndex) { + var directive = new DirectiveBuilder(directiveIndex); + this.directives.push(directive); + return directive; + }, + bindNestedProtoView: function(rootElement) { + if (isPresent(this.nestedProtoView)) { + throw new BaseException('Only one nested view per element is allowed'); + } + this.nestedProtoView = new ProtoViewBuilder(rootElement, api.ViewType.EMBEDDED, api.ViewEncapsulation.NONE); + return this.nestedProtoView; + }, + bindProperty: function(name, expression) { + this.propertyBindings.set(name, expression); + }, + bindVariable: function(name, value) { + if (isPresent(this.nestedProtoView)) { + this.nestedProtoView.bindVariable(name, value); + } else { + this.variableBindings.set(value, name); + } + }, + bindEvent: function(name, expression) { + var target = arguments[2] !== (void 0) ? arguments[2] : null; + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); + }, + bindText: function(textNode, expression) { + this.textBindings.set(textNode, expression); + }, + setComponentId: function(componentId) { + this.componentId = componentId; + } + }, {}); + }()); + $__export("ElementBinderBuilder", ElementBinderBuilder); + DirectiveBuilder = (function() { + function DirectiveBuilder(directiveIndex) { + this.directiveIndex = directiveIndex; + this.propertyBindings = new Map(); + this.templatePropertyNames = []; + this.hostPropertyBindings = new Map(); + this.eventBindings = []; + this.eventBuilder = new EventBuilder(); + } + return ($traceurRuntime.createClass)(DirectiveBuilder, { + bindProperty: function(name, expression, elProp) { + this.propertyBindings.set(name, expression); + if (isPresent(elProp)) { + this.templatePropertyNames.push(elProp); + } + }, + bindHostProperty: function(name, expression) { + this.hostPropertyBindings.set(name, expression); + }, + bindEvent: function(name, expression) { + var target = arguments[2] !== (void 0) ? arguments[2] : null; + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); + } + }, {}); + }()); + $__export("DirectiveBuilder", DirectiveBuilder); + EventBuilder = (function($__super) { + function EventBuilder() { + $traceurRuntime.superConstructor(EventBuilder).call(this); + this.locals = []; + this.localEvents = []; + this.globalEvents = []; + this._implicitReceiver = new ImplicitReceiver(); + } + return ($traceurRuntime.createClass)(EventBuilder, { + add: function(name, source, target) { + var adjustedAst = source.ast; + var fullName = isPresent(target) ? target + EVENT_TARGET_SEPARATOR + name : name; + var result = new api.EventBinding(fullName, new ASTWithSource(adjustedAst, source.source, source.location)); + var event = new Event(name, target, fullName); + if (isBlank(target)) { + this.localEvents.push(event); + } else { + this.globalEvents.push(event); + } + return result; + }, + visitAccessMember: function(ast) { + var isEventAccess = false; + var current = ast; + while (!isEventAccess && (current instanceof AccessMember)) { + var am = current; + if (am.name == '$event') { + isEventAccess = true; + } + current = am.receiver; + } + if (isEventAccess) { + this.locals.push(ast); + var index = this.locals.length - 1; + return new AccessMember(this._implicitReceiver, ("" + index), (function(arr) { + return arr[index]; + }), null); + } else { + return ast; + } + }, + buildEventLocals: function() { + return this.locals; + }, + buildLocalEvents: function() { + return this.localEvents; + }, + buildGlobalEvents: function() { + return this.globalEvents; + }, + merge: function(eventBuilder) { + this._merge(this.localEvents, eventBuilder.localEvents); + this._merge(this.globalEvents, eventBuilder.globalEvents); + ListWrapper.concat(this.locals, eventBuilder.locals); + }, + _merge: function(host, tobeAdded) { + var names = []; + for (var i = 0; i < host.length; i++) { + names.push(host[i].fullName); + } + for (var j = 0; j < tobeAdded.length; j++) { + if (!ListWrapper.contains(names, tobeAdded[j].fullName)) { + host.push(tobeAdded[j]); + } + } + } + }, {}, $__super); + }(AstTransformer)); + $__export("EventBuilder", EventBuilder); + PROPERTY_PARTS_SEPARATOR = new RegExp('\\.'); + ATTRIBUTE_PREFIX = 'attr'; + CLASS_PREFIX = 'class'; + STYLE_PREFIX = 'style'; + } + }; +}); + +System.register("angular2/src/render/dom/compiler/directive_parser", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/dom/dom_adapter", "angular2/src/render/dom/compiler/selector", "angular2/src/render/api", "angular2/src/render/dom/util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/directive_parser"; + var isPresent, + isBlank, + BaseException, + StringWrapper, + MapWrapper, + ListWrapper, + DOM, + SelectorMatcher, + CssSelector, + DirectiveMetadata, + dashCaseToCamelCase, + camelCaseToDashCase, + EVENT_TARGET_SEPARATOR, + DirectiveParser; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + MapWrapper = $__m.MapWrapper; + ListWrapper = $__m.ListWrapper; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + SelectorMatcher = $__m.SelectorMatcher; + CssSelector = $__m.CssSelector; + }, function($__m) { + DirectiveMetadata = $__m.DirectiveMetadata; + }, function($__m) { + dashCaseToCamelCase = $__m.dashCaseToCamelCase; + camelCaseToDashCase = $__m.camelCaseToDashCase; + EVENT_TARGET_SEPARATOR = $__m.EVENT_TARGET_SEPARATOR; + }], + execute: function() { + DirectiveParser = (function() { + function DirectiveParser(_parser, _directives) { + this._parser = _parser; + this._directives = _directives; + this._selectorMatcher = new SelectorMatcher(); + for (var i = 0; i < _directives.length; i++) { + var directive = _directives[i]; + var selector = CssSelector.parse(directive.selector); + this._ensureComponentOnlyHasElementSelector(selector, directive); + this._selectorMatcher.addSelectables(selector, i); + } + } + return ($traceurRuntime.createClass)(DirectiveParser, { + processStyle: function(style) { + return style; + }, + _ensureComponentOnlyHasElementSelector: function(selector, directive) { + var isElementSelector = selector.length === 1 && selector[0].isElementSelector(); + if (!isElementSelector && directive.type === DirectiveMetadata.COMPONENT_TYPE) { + throw new BaseException(("Component '" + directive.id + "' can only have an element selector, but had '" + directive.selector + "'")); + } + }, + processElement: function(parent, current, control) { + var $__0 = this; + var attrs = current.attrs(); + var classList = current.classList(); + var cssSelector = new CssSelector(); + var foundDirectiveIndices = []; + var elementBinder = null; + cssSelector.setElement(DOM.nodeName(current.element)); + for (var i = 0; i < classList.length; i++) { + cssSelector.addClassName(classList[i]); + } + MapWrapper.forEach(attrs, (function(attrValue, attrName) { + cssSelector.addAttribute(attrName, attrValue); + })); + this._selectorMatcher.match(cssSelector, (function(selector, directiveIndex) { + var directive = $__0._directives[directiveIndex]; + elementBinder = current.bindElement(); + if (directive.type === DirectiveMetadata.COMPONENT_TYPE) { + $__0._ensureHasOnlyOneComponent(elementBinder, current.elementDescription); + ListWrapper.insert(foundDirectiveIndices, 0, directiveIndex); + elementBinder.setComponentId(directive.id); + } else { + foundDirectiveIndices.push(directiveIndex); + } + })); + ListWrapper.forEach(foundDirectiveIndices, (function(directiveIndex) { + var dirMetadata = $__0._directives[directiveIndex]; + var directiveBinderBuilder = elementBinder.bindDirective(directiveIndex); + current.compileChildren = current.compileChildren && dirMetadata.compileChildren; + if (isPresent(dirMetadata.properties)) { + ListWrapper.forEach(dirMetadata.properties, (function(bindConfig) { + $__0._bindDirectiveProperty(bindConfig, current, directiveBinderBuilder); + })); + } + if (isPresent(dirMetadata.hostListeners)) { + $__0._sortedKeysForEach(dirMetadata.hostListeners, (function(action, eventName) { + $__0._bindDirectiveEvent(eventName, action, current, directiveBinderBuilder); + })); + } + if (isPresent(dirMetadata.hostProperties)) { + $__0._sortedKeysForEach(dirMetadata.hostProperties, (function(expression, hostPropertyName) { + $__0._bindHostProperty(hostPropertyName, expression, current, directiveBinderBuilder); + })); + } + if (isPresent(dirMetadata.hostAttributes)) { + $__0._sortedKeysForEach(dirMetadata.hostAttributes, (function(hostAttrValue, hostAttrName) { + $__0._addHostAttribute(hostAttrName, hostAttrValue, current); + })); + } + if (isPresent(dirMetadata.readAttributes)) { + ListWrapper.forEach(dirMetadata.readAttributes, (function(attrName) { + elementBinder.readAttribute(attrName); + })); + } + })); + }, + _sortedKeysForEach: function(map, fn) { + var keys = MapWrapper.keys(map); + ListWrapper.sort(keys, (function(a, b) { + var compareVal = StringWrapper.compare(a, b); + return compareVal == 0 ? -1 : compareVal; + })); + ListWrapper.forEach(keys, (function(key) { + fn(MapWrapper.get(map, key), key); + })); + }, + _ensureHasOnlyOneComponent: function(elementBinder, elDescription) { + if (isPresent(elementBinder.componentId)) { + throw new BaseException(("Only one component directive is allowed per element - check " + elDescription)); + } + }, + _bindDirectiveProperty: function(bindConfig, compileElement, directiveBinderBuilder) { + var dirProperty; + var elProp; + var pipes; + var assignIndex = bindConfig.indexOf(':'); + if (assignIndex > -1) { + dirProperty = StringWrapper.substring(bindConfig, 0, assignIndex).trim(); + pipes = this._splitBindConfig(StringWrapper.substring(bindConfig, assignIndex + 1)); + elProp = ListWrapper.removeAt(pipes, 0); + } else { + dirProperty = bindConfig; + elProp = bindConfig; + pipes = []; + } + elProp = dashCaseToCamelCase(elProp); + var bindingAst = compileElement.bindElement().propertyBindings.get(elProp); + if (isBlank(bindingAst)) { + var attributeValue = compileElement.attrs().get(camelCaseToDashCase(elProp)); + if (isPresent(attributeValue)) { + bindingAst = this._parser.wrapLiteralPrimitive(attributeValue, compileElement.elementDescription); + } + } + if (isPresent(bindingAst)) { + directiveBinderBuilder.bindProperty(dirProperty, bindingAst, elProp); + } + }, + _bindDirectiveEvent: function(eventName, action, compileElement, directiveBinderBuilder) { + var ast = this._parser.parseAction(action, compileElement.elementDescription); + if (StringWrapper.contains(eventName, EVENT_TARGET_SEPARATOR)) { + var parts = eventName.split(EVENT_TARGET_SEPARATOR); + directiveBinderBuilder.bindEvent(parts[1], ast, parts[0]); + } else { + directiveBinderBuilder.bindEvent(eventName, ast); + } + }, + _bindHostProperty: function(hostPropertyName, expression, compileElement, directiveBinderBuilder) { + var ast = this._parser.parseSimpleBinding(expression, ("hostProperties of " + compileElement.elementDescription)); + directiveBinderBuilder.bindHostProperty(hostPropertyName, ast); + }, + _addHostAttribute: function(attrName, attrValue, compileElement) { + if (StringWrapper.equals(attrName, 'class')) { + ListWrapper.forEach(attrValue.split(' '), (function(className) { + DOM.addClass(compileElement.element, className); + })); + } else if (!DOM.hasAttribute(compileElement.element, attrName)) { + DOM.setAttribute(compileElement.element, attrName, attrValue); + } + }, + _splitBindConfig: function(bindConfig) { + return ListWrapper.map(bindConfig.split('|'), (function(s) { + return s.trim(); + })); + } + }, {}); + }()); + $__export("DirectiveParser", DirectiveParser); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/style_encapsulator", ["angular2/src/render/api", "angular2/src/render/dom/util", "angular2/src/dom/dom_adapter", "angular2/src/facade/lang", "angular2/src/render/dom/compiler/shadow_css"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/style_encapsulator"; + var ViewEncapsulation, + ViewType, + NG_CONTENT_ELEMENT_NAME, + isElementWithTag, + DOM, + isBlank, + isPresent, + ShadowCss, + StyleEncapsulator; + function getHostAttribute(compId) { + return ("_nghost-" + compId); + } + function getContentAttribute(compId) { + return ("_ngcontent-" + compId); + } + return { + setters: [function($__m) { + ViewEncapsulation = $__m.ViewEncapsulation; + ViewType = $__m.ViewType; + }, function($__m) { + NG_CONTENT_ELEMENT_NAME = $__m.NG_CONTENT_ELEMENT_NAME; + isElementWithTag = $__m.isElementWithTag; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + }, function($__m) { + ShadowCss = $__m.ShadowCss; + }], + execute: function() { + StyleEncapsulator = (function() { + function StyleEncapsulator(_appId, _view, _componentUIDsCache) { + this._appId = _appId; + this._view = _view; + this._componentUIDsCache = _componentUIDsCache; + } + return ($traceurRuntime.createClass)(StyleEncapsulator, { + processElement: function(parent, current, control) { + if (isElementWithTag(current.element, NG_CONTENT_ELEMENT_NAME)) { + current.inheritedProtoView.bindNgContent(); + } else { + if (this._view.encapsulation === ViewEncapsulation.EMULATED) { + this._processEmulatedScopedElement(current, parent); + } + } + }, + processStyle: function(style) { + var encapsulation = this._view.encapsulation; + if (encapsulation === ViewEncapsulation.EMULATED) { + return this._shimCssForComponent(style, this._view.componentId); + } else { + return style; + } + }, + _processEmulatedScopedElement: function(current, parent) { + var element = current.element; + var hostComponentId = this._view.componentId; + var viewType = current.inheritedProtoView.type; + if (viewType !== ViewType.HOST && isPresent(hostComponentId)) { + var contentAttribute = getContentAttribute(this._getComponentId(hostComponentId)); + DOM.setAttribute(element, contentAttribute, ''); + if (isBlank(parent) && viewType == ViewType.COMPONENT) { + var hostAttribute = getHostAttribute(this._getComponentId(hostComponentId)); + current.inheritedProtoView.setHostAttribute(hostAttribute, ''); + } + } + }, + _shimCssForComponent: function(cssText, componentId) { + var id = this._getComponentId(componentId); + var shadowCss = new ShadowCss(); + return shadowCss.shimCssText(cssText, getContentAttribute(id), getHostAttribute(id)); + }, + _getComponentId: function(componentStringId) { + var id = this._componentUIDsCache.get(componentStringId); + if (isBlank(id)) { + id = (this._appId + "-" + this._componentUIDsCache.size); + this._componentUIDsCache.set(componentStringId, id); + } + return id; + } + }, {}); + }()); + $__export("StyleEncapsulator", StyleEncapsulator); + } + }; +}); + +System.register("angular2/src/render/dom/dom_renderer", ["angular2/di", "angular2/src/facade/lang", "angular2/src/dom/dom_adapter", "angular2/src/render/dom/events/event_manager", "angular2/src/render/dom/view/proto_view", "angular2/src/render/dom/view/view", "angular2/src/render/dom/view/fragment", "angular2/src/render/dom/view/shared_styles_host", "angular2/src/render/dom/util", "angular2/src/render/api", "angular2/src/render/dom/dom_tokens"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/dom_renderer"; + var __decorate, + __metadata, + __param, + Inject, + Injectable, + isPresent, + isBlank, + BaseException, + DOM, + EventManager, + resolveInternalDomProtoView, + DomView, + DomViewRef, + resolveInternalDomView, + DomFragmentRef, + resolveInternalDomFragment, + DomSharedStylesHost, + cloneAndQueryProtoView, + camelCaseToDashCase, + Renderer, + RenderViewWithFragments, + DOCUMENT_TOKEN, + DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES, + REFLECT_PREFIX, + DomRenderer; + function moveNodesAfterSibling(sibling, nodes) { + if (nodes.length > 0 && isPresent(DOM.parentElement(sibling))) { + for (var i = 0; i < nodes.length; i++) { + DOM.insertBefore(sibling, nodes[i]); + } + DOM.insertBefore(nodes[nodes.length - 1], sibling); + } + } + function moveChildNodes(source, target) { + var currChild = DOM.firstChild(source); + while (isPresent(currChild)) { + var nextChild = DOM.nextSibling(currChild); + DOM.appendChild(target, currChild); + currChild = nextChild; + } + } + return { + setters: [function($__m) { + Inject = $__m.Inject; + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + EventManager = $__m.EventManager; + }, function($__m) { + resolveInternalDomProtoView = $__m.resolveInternalDomProtoView; + }, function($__m) { + DomView = $__m.DomView; + DomViewRef = $__m.DomViewRef; + resolveInternalDomView = $__m.resolveInternalDomView; + }, function($__m) { + DomFragmentRef = $__m.DomFragmentRef; + resolveInternalDomFragment = $__m.resolveInternalDomFragment; + }, function($__m) { + DomSharedStylesHost = $__m.DomSharedStylesHost; + }, function($__m) { + cloneAndQueryProtoView = $__m.cloneAndQueryProtoView; + camelCaseToDashCase = $__m.camelCaseToDashCase; + }, function($__m) { + Renderer = $__m.Renderer; + RenderViewWithFragments = $__m.RenderViewWithFragments; + }, function($__m) { + DOCUMENT_TOKEN = $__m.DOCUMENT_TOKEN; + DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES = $__m.DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + REFLECT_PREFIX = 'ng-reflect-'; + DomRenderer = (function($__super) { + function $__0(_eventManager, _domSharedStylesHost, document, reflectPropertiesAsAttributes) { + $traceurRuntime.superConstructor($__0).call(this); + this._eventManager = _eventManager; + this._domSharedStylesHost = _domSharedStylesHost; + this._reflectPropertiesAsAttributes = reflectPropertiesAsAttributes; + this._document = document; + } + return ($traceurRuntime.createClass)($__0, { + createRootHostView: function(hostProtoViewRef, fragmentCount, hostElementSelector) { + var hostProtoView = resolveInternalDomProtoView(hostProtoViewRef); + var element = DOM.querySelector(this._document, hostElementSelector); + if (isBlank(element)) { + throw new BaseException(("The selector \"" + hostElementSelector + "\" did not match any elements")); + } + return this._createView(hostProtoView, element); + }, + createView: function(protoViewRef, fragmentCount) { + var protoView = resolveInternalDomProtoView(protoViewRef); + return this._createView(protoView, null); + }, + destroyView: function(viewRef) { + var view = resolveInternalDomView(viewRef); + var elementBinders = view.proto.elementBinders; + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + if (binder.hasNativeShadowRoot) { + this._domSharedStylesHost.removeHost(DOM.getShadowRoot(view.boundElements[i])); + } + } + }, + getNativeElementSync: function(location) { + if (isBlank(location.renderBoundElementIndex)) { + return null; + } + return resolveInternalDomView(location.renderView).boundElements[location.renderBoundElementIndex]; + }, + getRootNodes: function(fragment) { + return resolveInternalDomFragment(fragment); + }, + attachFragmentAfterFragment: function(previousFragmentRef, fragmentRef) { + var previousFragmentNodes = resolveInternalDomFragment(previousFragmentRef); + if (previousFragmentNodes.length > 0) { + var sibling = previousFragmentNodes[previousFragmentNodes.length - 1]; + moveNodesAfterSibling(sibling, resolveInternalDomFragment(fragmentRef)); + } + }, + attachFragmentAfterElement: function(elementRef, fragmentRef) { + if (isBlank(elementRef.renderBoundElementIndex)) { + return ; + } + var parentView = resolveInternalDomView(elementRef.renderView); + var element = parentView.boundElements[elementRef.renderBoundElementIndex]; + moveNodesAfterSibling(element, resolveInternalDomFragment(fragmentRef)); + }, + detachFragment: function(fragmentRef) { + var fragmentNodes = resolveInternalDomFragment(fragmentRef); + for (var i = 0; i < fragmentNodes.length; i++) { + DOM.remove(fragmentNodes[i]); + } + }, + hydrateView: function(viewRef) { + var view = resolveInternalDomView(viewRef); + if (view.hydrated) + throw new BaseException('The view is already hydrated.'); + view.hydrated = true; + view.eventHandlerRemovers = []; + var binders = view.proto.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var binder = binders[binderIdx]; + if (isPresent(binder.globalEvents)) { + for (var i = 0; i < binder.globalEvents.length; i++) { + var globalEvent = binder.globalEvents[i]; + var remover = this._createGlobalEventListener(view, binderIdx, globalEvent.name, globalEvent.target, globalEvent.fullName); + view.eventHandlerRemovers.push(remover); + } + } + } + }, + dehydrateView: function(viewRef) { + var view = resolveInternalDomView(viewRef); + for (var i = 0; i < view.eventHandlerRemovers.length; i++) { + view.eventHandlerRemovers[i](); + } + view.eventHandlerRemovers = null; + view.hydrated = false; + }, + setElementProperty: function(location, propertyName, propertyValue) { + if (isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = resolveInternalDomView(location.renderView); + view.setElementProperty(location.renderBoundElementIndex, propertyName, propertyValue); + if (this._reflectPropertiesAsAttributes) { + this.setElementAttribute(location, ("" + REFLECT_PREFIX + camelCaseToDashCase(propertyName)), ("" + propertyValue)); + } + }, + setElementAttribute: function(location, attributeName, attributeValue) { + if (isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = resolveInternalDomView(location.renderView); + view.setElementAttribute(location.renderBoundElementIndex, attributeName, attributeValue); + }, + setElementClass: function(location, className, isAdd) { + if (isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = resolveInternalDomView(location.renderView); + view.setElementClass(location.renderBoundElementIndex, className, isAdd); + }, + setElementStyle: function(location, styleName, styleValue) { + if (isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = resolveInternalDomView(location.renderView); + view.setElementStyle(location.renderBoundElementIndex, styleName, styleValue); + }, + invokeElementMethod: function(location, methodName, args) { + if (isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = resolveInternalDomView(location.renderView); + view.invokeElementMethod(location.renderBoundElementIndex, methodName, args); + }, + setText: function(viewRef, textNodeIndex, text) { + if (isBlank(textNodeIndex)) { + return ; + } + var view = resolveInternalDomView(viewRef); + DOM.setText(view.boundTextNodes[textNodeIndex], text); + }, + setEventDispatcher: function(viewRef, dispatcher) { + var view = resolveInternalDomView(viewRef); + view.eventDispatcher = dispatcher; + }, + _createView: function(protoView, inplaceElement) { + var clonedProtoView = cloneAndQueryProtoView(protoView, true); + var boundElements = clonedProtoView.boundElements; + if (isPresent(inplaceElement)) { + if (protoView.fragmentsRootNodeCount[0] !== 1) { + throw new BaseException('Root proto views can only contain one element!'); + } + DOM.clearNodes(inplaceElement); + var tempRoot = clonedProtoView.fragments[0][0]; + moveChildNodes(tempRoot, inplaceElement); + if (boundElements.length > 0 && boundElements[0] === tempRoot) { + boundElements[0] = inplaceElement; + } + clonedProtoView.fragments[0][0] = inplaceElement; + } + var view = new DomView(protoView, clonedProtoView.boundTextNodes, boundElements); + var binders = protoView.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var binder = binders[binderIdx]; + var element = boundElements[binderIdx]; + if (binder.hasNativeShadowRoot) { + var shadowRootWrapper = DOM.firstChild(element); + var shadowRoot = DOM.createShadowRoot(element); + this._domSharedStylesHost.addHost(shadowRoot); + moveChildNodes(shadowRootWrapper, shadowRoot); + DOM.remove(shadowRootWrapper); + } + if (isPresent(binder.eventLocals) && isPresent(binder.localEvents)) { + for (var i = 0; i < binder.localEvents.length; i++) { + this._createEventListener(view, element, binderIdx, binder.localEvents[i].name, binder.eventLocals); + } + } + } + return new RenderViewWithFragments(new DomViewRef(view), clonedProtoView.fragments.map((function(nodes) { + return new DomFragmentRef(nodes); + }))); + }, + _createEventListener: function(view, element, elementIndex, eventName, eventLocals) { + this._eventManager.addEventListener(element, eventName, (function(event) { + view.dispatchEvent(elementIndex, eventName, event); + })); + }, + _createGlobalEventListener: function(view, elementIndex, eventName, eventTarget, fullName) { + return this._eventManager.addGlobalEventListener(eventTarget, eventName, (function(event) { + view.dispatchEvent(elementIndex, fullName, event); + })); + } + }, {}, $__super); + }(Renderer)); + $__export("DomRenderer", DomRenderer); + $__export("DomRenderer", DomRenderer = __decorate([Injectable(), __param(2, Inject(DOCUMENT_TOKEN)), __param(3, Inject(DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES)), __metadata('design:paramtypes', [EventManager, DomSharedStylesHost, Object, Boolean])], DomRenderer)); + } + }; +}); + +System.register("angular2/annotations", ["angular2/src/core/annotations/annotations", "angular2/src/core/annotations/view", "angular2/src/core/annotations/di", "angular2/src/util/decorators", "angular2/src/core/annotations/decorators"], function($__export) { + "use strict"; + var __moduleName = "angular2/annotations"; + return { + setters: [function($__m) { + $__export("ComponentAnnotation", $__m.ComponentAnnotation); + $__export("DirectiveAnnotation", $__m.DirectiveAnnotation); + $__export("LifecycleEvent", $__m.LifecycleEvent); + }, function($__m) { + $__export("ViewAnnotation", $__m.ViewAnnotation); + $__export("ViewEncapsulation", $__m.ViewEncapsulation); + }, function($__m) { + $__export("QueryAnnotation", $__m.QueryAnnotation); + $__export("AttributeAnnotation", $__m.AttributeAnnotation); + }, function($__m) { + $__export("Class", $__m.Class); + }, function($__m) { + $__export("Attribute", $__m.Attribute); + $__export("Component", $__m.Component); + $__export("Directive", $__m.Directive); + $__export("View", $__m.View); + $__export("Query", $__m.Query); + $__export("ViewQuery", $__m.ViewQuery); + }], + execute: function() {} + }; +}); + +System.register("angular2/directives", ["angular2/src/facade/lang", "angular2/src/directives/ng_for", "angular2/src/directives/ng_if", "angular2/src/directives/ng_non_bindable", "angular2/src/directives/ng_switch", "angular2/src/directives/class", "angular2/src/directives/ng_style"], function($__export) { + "use strict"; + var __moduleName = "angular2/directives"; + var CONST_EXPR, + NgFor, + NgIf, + NgNonBindable, + NgSwitch, + NgSwitchWhen, + NgSwitchDefault, + coreDirectives; + var $__exportNames = {coreDirectives: true}; + var $__exportNames = {coreDirectives: true}; + var $__exportNames = {coreDirectives: true}; + var $__exportNames = {coreDirectives: true}; + var $__exportNames = {coreDirectives: true}; + var $__exportNames = {coreDirectives: true}; + return { + setters: [function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + NgFor = $__m.NgFor; + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + NgIf = $__m.NgIf; + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + NgNonBindable = $__m.NgNonBindable; + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + NgSwitch = $__m.NgSwitch; + NgSwitchWhen = $__m.NgSwitchWhen; + NgSwitchDefault = $__m.NgSwitchDefault; + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }], + execute: function() { + coreDirectives = CONST_EXPR([NgFor, NgIf, NgNonBindable, NgSwitch, NgSwitchWhen, NgSwitchDefault]); + $__export("coreDirectives", coreDirectives); + } + }; +}); + +System.register("angular2/src/http/static_request", ["angular2/src/http/headers", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/static_request"; + var Headers, + isPresent, + Request; + return { + setters: [function($__m) { + Headers = $__m.Headers; + }, function($__m) { + isPresent = $__m.isPresent; + }], + execute: function() { + Request = (function() { + function Request(requestOptions) { + this.url = requestOptions.url; + this._body = requestOptions.body; + this.method = requestOptions.method; + this.mode = requestOptions.mode; + this.credentials = requestOptions.credentials; + this.headers = new Headers(requestOptions.headers); + this.cache = requestOptions.cache; + } + return ($traceurRuntime.createClass)(Request, {text: function() { + return isPresent(this._body) ? this._body.toString() : ''; + }}, {}); + }()); + $__export("Request", Request); + } + }; +}); + +System.register("angular2/src/http/base_request_options", ["angular2/src/facade/lang", "angular2/src/http/headers", "angular2/src/http/enums", "angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/base_request_options"; + var __decorate, + __metadata, + isPresent, + Headers, + RequestModesOpts, + RequestMethods, + Injectable, + RequestOptions, + BaseRequestOptions; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + Headers = $__m.Headers; + }, function($__m) { + RequestModesOpts = $__m.RequestModesOpts; + RequestMethods = $__m.RequestMethods; + }, function($__m) { + Injectable = $__m.Injectable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + RequestOptions = (function() { + function RequestOptions() { + var $__2 = arguments[0] !== (void 0) ? arguments[0] : {}, + method = $__2.method, + headers = $__2.headers, + body = $__2.body, + mode = $__2.mode, + credentials = $__2.credentials, + cache = $__2.cache, + url = $__2.url; + this.method = isPresent(method) ? method : null; + this.headers = isPresent(headers) ? headers : null; + this.body = isPresent(body) ? body : null; + this.mode = isPresent(mode) ? mode : null; + this.credentials = isPresent(credentials) ? credentials : null; + this.cache = isPresent(cache) ? cache : null; + this.url = isPresent(url) ? url : null; + } + return ($traceurRuntime.createClass)(RequestOptions, {merge: function(options) { + return new RequestOptions({ + method: isPresent(options) && isPresent(options.method) ? options.method : this.method, + headers: isPresent(options) && isPresent(options.headers) ? options.headers : this.headers, + body: isPresent(options) && isPresent(options.body) ? options.body : this.body, + mode: isPresent(options) && isPresent(options.mode) ? options.mode : this.mode, + credentials: isPresent(options) && isPresent(options.credentials) ? options.credentials : this.credentials, + cache: isPresent(options) && isPresent(options.cache) ? options.cache : this.cache, + url: isPresent(options) && isPresent(options.url) ? options.url : this.url + }); + }}, {}); + }()); + $__export("RequestOptions", RequestOptions); + BaseRequestOptions = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).call(this, { + method: RequestMethods.GET, + headers: new Headers(), + mode: RequestModesOpts.Cors + }); + } + return ($traceurRuntime.createClass)($__0, {}, {}, $__super); + }(RequestOptions)); + $__export("BaseRequestOptions", BaseRequestOptions); + $__export("BaseRequestOptions", BaseRequestOptions = __decorate([Injectable(), __metadata('design:paramtypes', [])], BaseRequestOptions)); + } + }; +}); + +System.register("angular2/src/http/static_response", ["angular2/src/facade/lang", "angular2/src/http/http_utils"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/static_response"; + var BaseException, + isString, + Json, + isJsObject, + Response; + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + isString = $__m.isString; + Json = $__m.Json; + }, function($__m) { + isJsObject = $__m.isJsObject; + }], + execute: function() { + Response = (function() { + function Response(responseOptions) { + this._body = responseOptions.body; + this.status = responseOptions.status; + this.statusText = responseOptions.statusText; + this.headers = responseOptions.headers; + this.type = responseOptions.type; + this.url = responseOptions.url; + } + return ($traceurRuntime.createClass)(Response, { + blob: function() { + throw new BaseException('"blob()" method not implemented on Response superclass'); + }, + json: function() { + var jsonResponse; + if (isJsObject(this._body)) { + jsonResponse = this._body; + } else if (isString(this._body)) { + jsonResponse = Json.parse(this._body); + } + return jsonResponse; + }, + text: function() { + return this._body.toString(); + }, + arrayBuffer: function() { + throw new BaseException('"arrayBuffer()" method not implemented on Response superclass'); + } + }, {}); + }()); + $__export("Response", Response); + } + }; +}); + +System.register("angular2/src/http/backends/jsonp_backend", ["angular2/src/http/enums", "angular2/src/http/static_response", "angular2/src/http/base_response_options", "angular2/di", "angular2/src/http/backends/browser_jsonp", "angular2/src/facade/async", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/backends/jsonp_backend"; + var __decorate, + __metadata, + ReadyStates, + RequestMethods, + Response, + ResponseOptions, + Injectable, + BrowserJsonp, + EventEmitter, + ObservableWrapper, + StringWrapper, + isPresent, + makeTypeError, + JSONPConnection, + JSONPBackend; + return { + setters: [function($__m) { + ReadyStates = $__m.ReadyStates; + RequestMethods = $__m.RequestMethods; + }, function($__m) { + Response = $__m.Response; + }, function($__m) { + ResponseOptions = $__m.ResponseOptions; + }, function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + BrowserJsonp = $__m.BrowserJsonp; + }, function($__m) { + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + StringWrapper = $__m.StringWrapper; + isPresent = $__m.isPresent; + makeTypeError = $__m.makeTypeError; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + JSONPConnection = (function() { + function JSONPConnection(req, _dom, baseResponseOptions) { + var $__0 = this; + this._dom = _dom; + this.baseResponseOptions = baseResponseOptions; + this._finished = false; + if (req.method !== RequestMethods.GET) { + throw makeTypeError("JSONP requests must use GET request method."); + } + this.request = req; + this.response = new EventEmitter(); + this.readyState = ReadyStates.LOADING; + this._id = _dom.nextRequestID(); + _dom.exposeConnection(this._id, this); + var callback = _dom.requestCallback(this._id); + var url = req.url; + if (url.indexOf('=JSONP_CALLBACK&') > -1) { + url = StringWrapper.replace(url, '=JSONP_CALLBACK&', ("=" + callback + "&")); + } else if (url.lastIndexOf('=JSONP_CALLBACK') === url.length - '=JSONP_CALLBACK'.length) { + url = StringWrapper.substring(url, 0, url.length - '=JSONP_CALLBACK'.length) + ("=" + callback); + } + var script = this._script = _dom.build(url); + script.addEventListener('load', (function(event) { + if ($__0.readyState === ReadyStates.CANCELLED) + return ; + $__0.readyState = ReadyStates.DONE; + _dom.cleanup(script); + if (!$__0._finished) { + ObservableWrapper.callThrow($__0.response, makeTypeError('JSONP injected script did not invoke callback.')); + return ; + } + var responseOptions = new ResponseOptions({body: $__0._responseData}); + if (isPresent($__0.baseResponseOptions)) { + responseOptions = $__0.baseResponseOptions.merge(responseOptions); + } + ObservableWrapper.callNext($__0.response, new Response(responseOptions)); + })); + script.addEventListener('error', (function(error) { + if ($__0.readyState === ReadyStates.CANCELLED) + return ; + $__0.readyState = ReadyStates.DONE; + _dom.cleanup(script); + ObservableWrapper.callThrow($__0.response, error); + })); + _dom.send(script); + } + return ($traceurRuntime.createClass)(JSONPConnection, { + finished: function(data) { + this._finished = true; + this._dom.removeConnection(this._id); + if (this.readyState === ReadyStates.CANCELLED) + return ; + this._responseData = data; + }, + dispose: function() { + this.readyState = ReadyStates.CANCELLED; + var script = this._script; + this._script = null; + if (isPresent(script)) { + this._dom.cleanup(script); + } + ObservableWrapper.callReturn(this.response); + } + }, {}); + }()); + $__export("JSONPConnection", JSONPConnection); + JSONPBackend = (($traceurRuntime.createClass)(function(_browserJSONP, _baseResponseOptions) { + this._browserJSONP = _browserJSONP; + this._baseResponseOptions = _baseResponseOptions; + }, {createConnection: function(request) { + return new JSONPConnection(request, this._browserJSONP, this._baseResponseOptions); + }}, {})); + $__export("JSONPBackend", JSONPBackend); + $__export("JSONPBackend", JSONPBackend = __decorate([Injectable(), __metadata('design:paramtypes', [BrowserJsonp, ResponseOptions])], JSONPBackend)); + } + }; +}); + +System.register("angular2/src/forms/model", ["angular2/src/facade/lang", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/forms/validators"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/model"; + var StringWrapper, + isPresent, + isBlank, + EventEmitter, + ObservableWrapper, + StringMapWrapper, + ListWrapper, + List, + Validators, + VALID, + INVALID, + AbstractControl, + Control, + ControlGroup, + ControlArray; + function isControl(c) { + return c instanceof AbstractControl; + } + function _find(c, path) { + if (isBlank(path)) + return null; + if (!(path instanceof List)) { + path = StringWrapper.split(path, new RegExp("/")); + } + if (path instanceof List && ListWrapper.isEmpty(path)) + return null; + return ListWrapper.reduce(path, (function(v, name) { + if (v instanceof ControlGroup) { + return isPresent(v.controls[name]) ? v.controls[name] : null; + } else if (v instanceof ControlArray) { + var index = name; + return isPresent(v.at(index)) ? v.at(index) : null; + } else { + return null; + } + }), c); + } + $__export("isControl", isControl); + return { + setters: [function($__m) { + StringWrapper = $__m.StringWrapper; + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + }, function($__m) { + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + ListWrapper = $__m.ListWrapper; + List = $__m.List; + }, function($__m) { + Validators = $__m.Validators; + }], + execute: function() { + VALID = "VALID"; + $__export("VALID", VALID); + INVALID = "INVALID"; + $__export("INVALID", INVALID); + AbstractControl = (function() { + function AbstractControl(validator) { + this.validator = validator; + this._pristine = true; + this._touched = false; + } + return ($traceurRuntime.createClass)(AbstractControl, { + get value() { + return this._value; + }, + get status() { + return this._status; + }, + get valid() { + return this._status === VALID; + }, + get errors() { + return this._errors; + }, + get pristine() { + return this._pristine; + }, + get dirty() { + return !this.pristine; + }, + get touched() { + return this._touched; + }, + get untouched() { + return !this._touched; + }, + get valueChanges() { + return this._valueChanges; + }, + markAsTouched: function() { + this._touched = true; + }, + markAsDirty: function() { + var onlySelf = (arguments[0] !== (void 0) ? arguments[0] : {}).onlySelf; + onlySelf = isPresent(onlySelf) ? onlySelf : false; + this._pristine = false; + if (isPresent(this._parent) && !onlySelf) { + this._parent.markAsDirty({onlySelf: onlySelf}); + } + }, + setParent: function(parent) { + this._parent = parent; + }, + updateValidity: function() { + var onlySelf = (arguments[0] !== (void 0) ? arguments[0] : {}).onlySelf; + onlySelf = isPresent(onlySelf) ? onlySelf : false; + this._errors = this.validator(this); + this._status = isPresent(this._errors) ? INVALID : VALID; + if (isPresent(this._parent) && !onlySelf) { + this._parent.updateValidity({onlySelf: onlySelf}); + } + }, + updateValueAndValidity: function() { + var $__2 = arguments[0] !== (void 0) ? arguments[0] : {}, + onlySelf = $__2.onlySelf, + emitEvent = $__2.emitEvent; + onlySelf = isPresent(onlySelf) ? onlySelf : false; + emitEvent = isPresent(emitEvent) ? emitEvent : true; + this._updateValue(); + if (emitEvent) { + ObservableWrapper.callNext(this._valueChanges, this._value); + } + this._errors = this.validator(this); + this._status = isPresent(this._errors) ? INVALID : VALID; + if (isPresent(this._parent) && !onlySelf) { + this._parent.updateValueAndValidity({ + onlySelf: onlySelf, + emitEvent: emitEvent + }); + } + }, + find: function(path) { + return _find(this, path); + }, + getError: function(errorCode) { + var path = arguments[1] !== (void 0) ? arguments[1] : null; + var c = isPresent(path) && !ListWrapper.isEmpty(path) ? this.find(path) : this; + if (isPresent(c) && isPresent(c._errors)) { + return StringMapWrapper.get(c._errors, errorCode); + } else { + return null; + } + }, + hasError: function(errorCode) { + var path = arguments[1] !== (void 0) ? arguments[1] : null; + return isPresent(this.getError(errorCode, path)); + }, + _updateValue: function() {} + }, {}); + }()); + $__export("AbstractControl", AbstractControl); + Control = (function($__super) { + function Control() { + var value = arguments[0] !== (void 0) ? arguments[0] : null; + var validator = arguments[1] !== (void 0) ? arguments[1] : Validators.nullValidator; + $traceurRuntime.superConstructor(Control).call(this, validator); + this._value = value; + this.updateValidity({onlySelf: true}); + this._valueChanges = new EventEmitter(); + } + return ($traceurRuntime.createClass)(Control, { + updateValue: function(value) { + var $__2 = arguments[1] !== (void 0) ? arguments[1] : {}, + onlySelf = $__2.onlySelf, + emitEvent = $__2.emitEvent, + emitModelToViewChange = $__2.emitModelToViewChange; + emitModelToViewChange = isPresent(emitModelToViewChange) ? emitModelToViewChange : true; + this._value = value; + if (isPresent(this._onChange) && emitModelToViewChange) + this._onChange(this._value); + this.updateValueAndValidity({ + onlySelf: onlySelf, + emitEvent: emitEvent + }); + }, + registerOnChange: function(fn) { + this._onChange = fn; + } + }, {}, $__super); + }(AbstractControl)); + $__export("Control", Control); + ControlGroup = (function($__super) { + function ControlGroup(controls) { + var optionals = arguments[1] !== (void 0) ? arguments[1] : null; + var validator = arguments[2] !== (void 0) ? arguments[2] : Validators.group; + $traceurRuntime.superConstructor(ControlGroup).call(this, validator); + this.controls = controls; + this._optionals = isPresent(optionals) ? optionals : {}; + this._valueChanges = new EventEmitter(); + this._setParentForControls(); + this._value = this._reduceValue(); + this.updateValidity({onlySelf: true}); + } + return ($traceurRuntime.createClass)(ControlGroup, { + addControl: function(name, c) { + this.controls[name] = c; + c.setParent(this); + }, + removeControl: function(name) { + StringMapWrapper.delete(this.controls, name); + }, + include: function(controlName) { + StringMapWrapper.set(this._optionals, controlName, true); + this.updateValueAndValidity(); + }, + exclude: function(controlName) { + StringMapWrapper.set(this._optionals, controlName, false); + this.updateValueAndValidity(); + }, + contains: function(controlName) { + var c = StringMapWrapper.contains(this.controls, controlName); + return c && this._included(controlName); + }, + _setParentForControls: function() { + var $__0 = this; + StringMapWrapper.forEach(this.controls, (function(control, name) { + control.setParent($__0); + })); + }, + _updateValue: function() { + this._value = this._reduceValue(); + }, + _reduceValue: function() { + return this._reduceChildren({}, (function(acc, control, name) { + acc[name] = control.value; + return acc; + })); + }, + _reduceChildren: function(initValue, fn) { + var $__0 = this; + var res = initValue; + StringMapWrapper.forEach(this.controls, (function(control, name) { + if ($__0._included(name)) { + res = fn(res, control, name); + } + })); + return res; + }, + _included: function(controlName) { + var isOptional = StringMapWrapper.contains(this._optionals, controlName); + return !isOptional || StringMapWrapper.get(this._optionals, controlName); + } + }, {}, $__super); + }(AbstractControl)); + $__export("ControlGroup", ControlGroup); + ControlArray = (function($__super) { + function ControlArray(controls) { + var validator = arguments[1] !== (void 0) ? arguments[1] : Validators.array; + $traceurRuntime.superConstructor(ControlArray).call(this, validator); + this.controls = controls; + this._valueChanges = new EventEmitter(); + this._setParentForControls(); + this._updateValue(); + this.updateValidity({onlySelf: true}); + } + return ($traceurRuntime.createClass)(ControlArray, { + at: function(index) { + return this.controls[index]; + }, + push: function(control) { + this.controls.push(control); + control.setParent(this); + this.updateValueAndValidity(); + }, + insert: function(index, control) { + ListWrapper.insert(this.controls, index, control); + control.setParent(this); + this.updateValueAndValidity(); + }, + removeAt: function(index) { + ListWrapper.removeAt(this.controls, index); + this.updateValueAndValidity(); + }, + get length() { + return this.controls.length; + }, + _updateValue: function() { + this._value = ListWrapper.map(this.controls, (function(c) { + return c.value; + })); + }, + _setParentForControls: function() { + var $__0 = this; + ListWrapper.forEach(this.controls, (function(control) { + control.setParent($__0); + })); + } + }, {}, $__super); + }(AbstractControl)); + $__export("ControlArray", ControlArray); + } + }; +}); + +System.register("angular2/src/forms/directives/ng_control_name", ["angular2/src/facade/lang", "angular2/src/facade/async", "angular2/core", "angular2/annotations", "angular2/di", "angular2/src/forms/directives/control_container", "angular2/src/forms/directives/ng_control", "angular2/src/forms/directives/validators", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/ng_control_name"; + var __decorate, + __metadata, + __param, + CONST_EXPR, + EventEmitter, + ObservableWrapper, + QueryList, + Query, + Directive, + LifecycleEvent, + forwardRef, + Ancestor, + Binding, + ControlContainer, + NgControl, + NgValidator, + controlPath, + composeNgValidator, + isPropertyUpdated, + controlNameBinding, + NgControlName; + return { + setters: [function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + QueryList = $__m.QueryList; + }, function($__m) { + Query = $__m.Query; + Directive = $__m.Directive; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + forwardRef = $__m.forwardRef; + Ancestor = $__m.Ancestor; + Binding = $__m.Binding; + }, function($__m) { + ControlContainer = $__m.ControlContainer; + }, function($__m) { + NgControl = $__m.NgControl; + }, function($__m) { + NgValidator = $__m.NgValidator; + }, function($__m) { + controlPath = $__m.controlPath; + composeNgValidator = $__m.composeNgValidator; + isPropertyUpdated = $__m.isPropertyUpdated; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + controlNameBinding = CONST_EXPR(new Binding(NgControl, {toAlias: forwardRef((function() { + return NgControlName; + }))})); + NgControlName = (function($__super) { + function $__0(parent, ngValidators) { + $traceurRuntime.superConstructor($__0).call(this); + this.update = new EventEmitter(); + this._added = false; + this._parent = parent; + this.ngValidators = ngValidators; + } + return ($traceurRuntime.createClass)($__0, { + onChange: function(c) { + if (!this._added) { + this.formDirective.addControl(this); + this._added = true; + } + if (isPropertyUpdated(c, this.viewModel)) { + this.viewModel = this.model; + this.formDirective.updateModel(this, this.model); + } + }, + onDestroy: function() { + this.formDirective.removeControl(this); + }, + viewToModelUpdate: function(newValue) { + this.viewModel = newValue; + ObservableWrapper.callNext(this.update, newValue); + }, + get path() { + return controlPath(this.name, this._parent); + }, + get formDirective() { + return this._parent.formDirective; + }, + get control() { + return this.formDirective.getControl(this); + }, + get validator() { + return composeNgValidator(this.ngValidators); + } + }, {}, $__super); + }(NgControl)); + $__export("NgControlName", NgControlName); + $__export("NgControlName", NgControlName = __decorate([Directive({ + selector: '[ng-control]', + hostInjector: [controlNameBinding], + properties: ['name: ngControl', 'model: ngModel'], + events: ['update: ngModel'], + lifecycle: [LifecycleEvent.onDestroy, LifecycleEvent.onChange], + exportAs: 'form' + }), __param(0, Ancestor()), __param(1, Query(NgValidator)), __metadata('design:paramtypes', [ControlContainer, QueryList])], NgControlName)); + } + }; +}); + +System.register("angular2/src/forms/directives/default_value_accessor", ["angular2/render", "angular2/annotations", "angular2/core", "angular2/di", "angular2/src/forms/directives/ng_control", "angular2/src/facade/lang", "angular2/src/forms/directives/shared"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/forms/directives/default_value_accessor"; + var __decorate, + __metadata, + __param, + Renderer, + Directive, + ElementRef, + Self, + NgControl, + isBlank, + isPresent, + setProperty, + DefaultValueAccessor; + return { + setters: [function($__m) { + Renderer = $__m.Renderer; + }, function($__m) { + Directive = $__m.Directive; + }, function($__m) { + ElementRef = $__m.ElementRef; + }, function($__m) { + Self = $__m.Self; + }, function($__m) { + NgControl = $__m.NgControl; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + }, function($__m) { + setProperty = $__m.setProperty; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + DefaultValueAccessor = (($traceurRuntime.createClass)(function(cd, renderer, elementRef) { + this.renderer = renderer; + this.elementRef = elementRef; + this.onChange = (function(_) {}); + this.onTouched = (function() {}); + this.cd = cd; + cd.valueAccessor = this; + }, { + writeValue: function(value) { + var normalizedValue = isBlank(value) ? '' : value; + setProperty(this.renderer, this.elementRef, 'value', normalizedValue); + }, + get ngClassUntouched() { + return isPresent(this.cd.control) ? this.cd.control.untouched : false; + }, + get ngClassTouched() { + return isPresent(this.cd.control) ? this.cd.control.touched : false; + }, + get ngClassPristine() { + return isPresent(this.cd.control) ? this.cd.control.pristine : false; + }, + get ngClassDirty() { + return isPresent(this.cd.control) ? this.cd.control.dirty : false; + }, + get ngClassValid() { + return isPresent(this.cd.control) ? this.cd.control.valid : false; + }, + get ngClassInvalid() { + return isPresent(this.cd.control) ? !this.cd.control.valid : false; + }, + registerOnChange: function(fn) { + this.onChange = fn; + }, + registerOnTouched: function(fn) { + this.onTouched = fn; + } + }, {})); + $__export("DefaultValueAccessor", DefaultValueAccessor); + $__export("DefaultValueAccessor", DefaultValueAccessor = __decorate([Directive({ + selector: 'input:not([type=checkbox])[ng-control],textarea[ng-control],input:not([type=checkbox])[ng-form-control],textarea[ng-form-control],input:not([type=checkbox])[ng-model],textarea[ng-model]', + host: { + '(change)': 'onChange($event.target.value)', + '(input)': 'onChange($event.target.value)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, Self()), __metadata('design:paramtypes', [NgControl, Renderer, ElementRef])], DefaultValueAccessor)); + } + }; +}); + +System.register("angular2/src/router/route_lifecycle_reflector", ["angular2/src/facade/lang", "angular2/src/router/lifecycle_annotations_impl", "angular2/src/reflection/reflection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/route_lifecycle_reflector"; + var Type, + CanActivate, + reflector; + function hasLifecycleHook(e, type) { + if (!(type instanceof Type)) + return false; + return e.name in type.prototype; + } + function getCanActivateHook(type) { + var annotations = reflector.annotations(type); + for (var i = 0; i < annotations.length; i += 1) { + var annotation = annotations[i]; + if (annotation instanceof CanActivate) { + return annotation.fn; + } + } + return null; + } + $__export("hasLifecycleHook", hasLifecycleHook); + $__export("getCanActivateHook", getCanActivateHook); + return { + setters: [function($__m) { + Type = $__m.Type; + }, function($__m) { + CanActivate = $__m.CanActivate; + }, function($__m) { + reflector = $__m.reflector; + }], + execute: function() { + } + }; +}); + +System.register("angular2/src/router/router_outlet", ["angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/core/annotations/decorators", "angular2/core", "angular2/di", "angular2/src/router/router", "angular2/src/router/instruction", "angular2/src/router/lifecycle_annotations", "angular2/src/router/route_lifecycle_reflector"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/router_outlet"; + var __decorate, + __metadata, + __param, + PromiseWrapper, + StringMapWrapper, + isBlank, + isPresent, + Directive, + Attribute, + DynamicComponentLoader, + ElementRef, + Injector, + bind, + routerMod, + RouteParams, + hookMod, + hasLifecycleHook, + RouterOutlet; + return { + setters: [function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + }, function($__m) { + Directive = $__m.Directive; + Attribute = $__m.Attribute; + }, function($__m) { + DynamicComponentLoader = $__m.DynamicComponentLoader; + ElementRef = $__m.ElementRef; + }, function($__m) { + Injector = $__m.Injector; + bind = $__m.bind; + }, function($__m) { + routerMod = $__m; + }, function($__m) { + RouteParams = $__m.RouteParams; + }, function($__m) { + hookMod = $__m; + }, function($__m) { + hasLifecycleHook = $__m.hasLifecycleHook; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + RouterOutlet = (($traceurRuntime.createClass)(function(_elementRef, _loader, _parentRouter, nameAttr) { + this._elementRef = _elementRef; + this._loader = _loader; + this._parentRouter = _parentRouter; + this.childRouter = null; + this._componentRef = null; + this._currentInstruction = null; + this._parentRouter.registerOutlet(this); + }, { + commit: function(instruction) { + var $__0 = this; + var next; + if (instruction.reuse) { + next = this._reuse(instruction); + } else { + next = this.deactivate(instruction).then((function(_) { + return $__0._activate(instruction); + })); + } + return next.then((function(_) { + return $__0._commitChild(instruction); + })); + }, + _commitChild: function(instruction) { + if (isPresent(this.childRouter)) { + return this.childRouter.commit(instruction.child); + } else { + return PromiseWrapper.resolve(true); + } + }, + _activate: function(instruction) { + var $__0 = this; + var previousInstruction = this._currentInstruction; + this._currentInstruction = instruction; + this.childRouter = this._parentRouter.childRouter(instruction.component); + var bindings = Injector.resolve([bind(RouteParams).toValue(new RouteParams(instruction.params())), bind(routerMod.Router).toValue(this.childRouter)]); + return this._loader.loadNextToLocation(instruction.component, this._elementRef, bindings).then((function(componentRef) { + $__0._componentRef = componentRef; + if (hasLifecycleHook(hookMod.onActivate, instruction.component)) { + return $__0._componentRef.instance.onActivate(instruction, previousInstruction); + } + })); + }, + canDeactivate: function(nextInstruction) { + if (isBlank(this._currentInstruction)) { + return PromiseWrapper.resolve(true); + } + if (hasLifecycleHook(hookMod.canDeactivate, this._currentInstruction.component)) { + return PromiseWrapper.resolve(this._componentRef.instance.canDeactivate(nextInstruction, this._currentInstruction)); + } + return PromiseWrapper.resolve(true); + }, + canReuse: function(nextInstruction) { + var result; + if (isBlank(this._currentInstruction) || this._currentInstruction.component != nextInstruction.component) { + result = false; + } else if (hasLifecycleHook(hookMod.canReuse, this._currentInstruction.component)) { + result = this._componentRef.instance.canReuse(nextInstruction, this._currentInstruction); + } else { + result = nextInstruction == this._currentInstruction || StringMapWrapper.equals(nextInstruction.params(), this._currentInstruction.params()); + } + return PromiseWrapper.resolve(result); + }, + _reuse: function(instruction) { + var previousInstruction = this._currentInstruction; + this._currentInstruction = instruction; + return PromiseWrapper.resolve(hasLifecycleHook(hookMod.onReuse, this._currentInstruction.component) ? this._componentRef.instance.onReuse(instruction, previousInstruction) : true); + }, + deactivate: function(nextInstruction) { + var $__0 = this; + return (isPresent(this.childRouter) ? this.childRouter.deactivate(isPresent(nextInstruction) ? nextInstruction.child : null) : PromiseWrapper.resolve(true)).then((function(_) { + if (isPresent($__0._componentRef) && isPresent($__0._currentInstruction) && hasLifecycleHook(hookMod.onDeactivate, $__0._currentInstruction.component)) { + return $__0._componentRef.instance.onDeactivate(nextInstruction, $__0._currentInstruction); + } + })).then((function(_) { + if (isPresent($__0._componentRef)) { + $__0._componentRef.dispose(); + $__0._componentRef = null; + } + })); + } + }, {})); + $__export("RouterOutlet", RouterOutlet); + $__export("RouterOutlet", RouterOutlet = __decorate([Directive({selector: 'router-outlet'}), __param(3, Attribute('name')), __metadata('design:paramtypes', [ElementRef, DynamicComponentLoader, routerMod.Router, String])], RouterOutlet)); + } + }; +}); + +System.register("angular2/src/router/location", ["angular2/src/router/location_strategy", "angular2/src/facade/lang", "angular2/src/facade/async", "angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/location"; + var __decorate, + __metadata, + __param, + LocationStrategy, + isPresent, + CONST_EXPR, + EventEmitter, + ObservableWrapper, + BaseException, + isBlank, + OpaqueToken, + Injectable, + Optional, + Inject, + appBaseHrefToken, + Location; + function stripIndexHtml(url) { + if (/\/index.html$/g.test(url)) { + return url.substring(0, url.length - 11); + } + return url; + } + function stripTrailingSlash(url) { + if (/\/$/g.test(url)) { + url = url.substring(0, url.length - 1); + } + return url; + } + return { + setters: [function($__m) { + LocationStrategy = $__m.LocationStrategy; + }, function($__m) { + isPresent = $__m.isPresent; + CONST_EXPR = $__m.CONST_EXPR; + BaseException = $__m.BaseException; + isBlank = $__m.isBlank; + }, function($__m) { + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + OpaqueToken = $__m.OpaqueToken; + Injectable = $__m.Injectable; + Optional = $__m.Optional; + Inject = $__m.Inject; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + appBaseHrefToken = CONST_EXPR(new OpaqueToken('locationHrefToken')); + $__export("appBaseHrefToken", appBaseHrefToken); + Location = (($traceurRuntime.createClass)(function(_platformStrategy, href) { + var $__0 = this; + this._platformStrategy = _platformStrategy; + this._subject = new EventEmitter(); + var browserBaseHref = isPresent(href) ? href : this._platformStrategy.getBaseHref(); + if (isBlank(browserBaseHref)) { + throw new BaseException("No base href set. Either provide a binding to \"appBaseHrefToken\" or add a base element."); + } + this._baseHref = stripTrailingSlash(stripIndexHtml(browserBaseHref)); + this._platformStrategy.onPopState((function(_) { + return $__0._onPopState(_); + })); + }, { + _onPopState: function(_) { + ObservableWrapper.callNext(this._subject, {'url': this.path()}); + }, + path: function() { + return this.normalize(this._platformStrategy.path()); + }, + normalize: function(url) { + return stripTrailingSlash(this._stripBaseHref(stripIndexHtml(url))); + }, + normalizeAbsolutely: function(url) { + if (!url.startsWith('/')) { + url = '/' + url; + } + return stripTrailingSlash(this._addBaseHref(url)); + }, + _stripBaseHref: function(url) { + if (this._baseHref.length > 0 && url.startsWith(this._baseHref)) { + return url.substring(this._baseHref.length); + } + return url; + }, + _addBaseHref: function(url) { + if (!url.startsWith(this._baseHref)) { + return this._baseHref + url; + } + return url; + }, + go: function(url) { + var finalUrl = this.normalizeAbsolutely(url); + this._platformStrategy.pushState(null, '', finalUrl); + }, + forward: function() { + this._platformStrategy.forward(); + }, + back: function() { + this._platformStrategy.back(); + }, + subscribe: function(onNext) { + var onThrow = arguments[1] !== (void 0) ? arguments[1] : null; + var onReturn = arguments[2] !== (void 0) ? arguments[2] : null; + ObservableWrapper.subscribe(this._subject, onNext, onThrow, onReturn); + } + }, {})); + $__export("Location", Location); + $__export("Location", Location = __decorate([Injectable(), __param(1, Optional()), __param(1, Inject(appBaseHrefToken)), __metadata('design:paramtypes', [LocationStrategy, String])], Location)); + } + }; +}); + +System.register("angular2/src/router/path_recognizer", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/router/helpers", "angular2/src/router/url"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/path_recognizer"; + var __decorate, + __metadata, + RegExpWrapper, + StringWrapper, + isPresent, + isBlank, + BaseException, + StringMapWrapper, + ListWrapper, + IMPLEMENTS, + parseAndAssignParamString, + escapeRegex, + Segment, + TouchMap, + ContinuationSegment, + StaticSegment, + DynamicSegment, + StarSegment, + paramMatcher, + wildcardMatcher, + RESERVED_CHARS, + PathRecognizer; + function normalizeString(obj) { + if (isBlank(obj)) { + return null; + } else { + return obj.toString(); + } + } + function parsePathString(route) { + if (StringWrapper.startsWith(route, "/")) { + route = StringWrapper.substring(route, 1); + } + var segments = splitBySlash(route); + var results = []; + var specificity = 0; + if (segments.length > 98) { + throw new BaseException(("'" + route + "' has more than the maximum supported number of segments.")); + } + var limit = segments.length - 1; + for (var i = 0; i <= limit; i++) { + var segment = segments[i], + match = void 0; + if (isPresent(match = RegExpWrapper.firstMatch(paramMatcher, segment))) { + results.push(new DynamicSegment(match[1])); + specificity += (100 - i); + } else if (isPresent(match = RegExpWrapper.firstMatch(wildcardMatcher, segment))) { + results.push(new StarSegment(match[1])); + } else if (segment == '...') { + if (i < limit) { + throw new BaseException(("Unexpected \"...\" before the end of the path for \"" + route + "\".")); + } + results.push(new ContinuationSegment()); + } else if (segment.length > 0) { + results.push(new StaticSegment(segment)); + specificity += 100 * (100 - i); + } + } + var result = StringMapWrapper.create(); + StringMapWrapper.set(result, 'segments', results); + StringMapWrapper.set(result, 'specificity', specificity); + return result; + } + function splitBySlash(url) { + return url.split('/'); + } + function assertPath(path) { + if (StringWrapper.contains(path, '#')) { + throw new BaseException(("Path \"" + path + "\" should not include \"#\". Use \"HashLocationStrategy\" instead.")); + } + var illegalCharacter = RegExpWrapper.firstMatch(RESERVED_CHARS, path); + if (isPresent(illegalCharacter)) { + throw new BaseException(("Path \"" + path + "\" contains \"" + illegalCharacter[0] + "\" which is not allowed in a route config.")); + } + } + return { + setters: [function($__m) { + RegExpWrapper = $__m.RegExpWrapper; + StringWrapper = $__m.StringWrapper; + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + IMPLEMENTS = $__m.IMPLEMENTS; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + ListWrapper = $__m.ListWrapper; + }, function($__m) { + parseAndAssignParamString = $__m.parseAndAssignParamString; + }, function($__m) { + escapeRegex = $__m.escapeRegex; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Segment = (function() { + function Segment() {} + return ($traceurRuntime.createClass)(Segment, {generate: function(params) { + return ''; + }}, {}); + }()); + $__export("Segment", Segment); + TouchMap = (function() { + function TouchMap(map) { + var $__0 = this; + this.map = StringMapWrapper.create(); + this.keys = StringMapWrapper.create(); + if (isPresent(map)) { + StringMapWrapper.forEach(map, (function(value, key) { + $__0.map[key] = isPresent(value) ? value.toString() : null; + $__0.keys[key] = true; + })); + } + } + return ($traceurRuntime.createClass)(TouchMap, { + get: function(key) { + StringMapWrapper.delete(this.keys, key); + return this.map[key]; + }, + getUnused: function() { + var $__0 = this; + var unused = StringMapWrapper.create(); + var keys = StringMapWrapper.keys(this.keys); + ListWrapper.forEach(keys, (function(key) { + unused[key] = StringMapWrapper.get($__0.map, key); + })); + return unused; + } + }, {}); + }()); + ContinuationSegment = (function($__super) { + function ContinuationSegment() { + $traceurRuntime.superConstructor(ContinuationSegment).apply(this, arguments); + } + return ($traceurRuntime.createClass)(ContinuationSegment, {}, {}, $__super); + }(Segment)); + StaticSegment = (function($__super) { + function StaticSegment(string) { + $traceurRuntime.superConstructor(StaticSegment).call(this); + this.string = string; + this.name = ''; + this.regex = escapeRegex(string); + this.regex += '(;[^\/]+)?'; + } + return ($traceurRuntime.createClass)(StaticSegment, {generate: function(params) { + return this.string; + }}, {}, $__super); + }(Segment)); + DynamicSegment = (($traceurRuntime.createClass)(function(name) { + this.name = name; + this.regex = "([^/]+)"; + }, {generate: function(params) { + if (!StringMapWrapper.contains(params.map, this.name)) { + throw new BaseException(("Route generator for '" + this.name + "' was not included in parameters passed.")); + } + return normalizeString(params.get(this.name)); + }}, {})); + DynamicSegment = __decorate([IMPLEMENTS(Segment), __metadata('design:paramtypes', [String])], DynamicSegment); + StarSegment = (function() { + function StarSegment(name) { + this.name = name; + this.regex = "(.+)"; + } + return ($traceurRuntime.createClass)(StarSegment, {generate: function(params) { + return normalizeString(params.get(this.name)); + }}, {}); + }()); + paramMatcher = /^:([^\/]+)$/g; + wildcardMatcher = /^\*([^\/]+)$/g; + RESERVED_CHARS = RegExpWrapper.create('//|\\(|\\)|;|\\?|='); + PathRecognizer = (function() { + function PathRecognizer(path, handler) { + var isRoot = arguments[2] !== (void 0) ? arguments[2] : false; + var $__0 = this; + this.path = path; + this.handler = handler; + this.isRoot = isRoot; + this.terminal = true; + assertPath(path); + var parsed = parsePathString(path); + var specificity = parsed['specificity']; + var segments = parsed['segments']; + var regexString = '^'; + ListWrapper.forEach(segments, (function(segment) { + if (segment instanceof ContinuationSegment) { + $__0.terminal = false; + } else { + regexString += '/' + segment.regex; + } + })); + if (this.terminal) { + regexString += '$'; + } + this.regex = RegExpWrapper.create(regexString); + this.segments = segments; + this.specificity = specificity; + } + return ($traceurRuntime.createClass)(PathRecognizer, { + parseParams: function(url) { + var segmentsLimit = this.segments.length - 1; + var containsStarSegment = segmentsLimit >= 0 && this.segments[segmentsLimit] instanceof StarSegment; + var paramsString, + useQueryString = this.isRoot && this.terminal; + if (!containsStarSegment) { + var matches = RegExpWrapper.firstMatch(useQueryString ? PathRecognizer.queryRegex : PathRecognizer.matrixRegex, url); + if (isPresent(matches)) { + url = matches[1]; + paramsString = matches[2]; + } + url = StringWrapper.replaceAll(url, /(;[^\/]+)(?=(\/|$))/g, ''); + } + var params = StringMapWrapper.create(); + var urlPart = url; + for (var i = 0; i <= segmentsLimit; i++) { + var segment = this.segments[i]; + if (segment instanceof ContinuationSegment) { + continue; + } + var match = RegExpWrapper.firstMatch(RegExpWrapper.create('/' + segment.regex), urlPart); + urlPart = StringWrapper.substring(urlPart, match[0].length); + if (segment.name.length > 0) { + params[segment.name] = match[1]; + } + } + if (isPresent(paramsString) && paramsString.length > 0) { + var expectedStartingValue = useQueryString ? '?' : ';'; + if (paramsString[0] == expectedStartingValue) { + parseAndAssignParamString(expectedStartingValue, paramsString, params); + } + } + return params; + }, + generate: function(params) { + var paramTokens = new TouchMap(params); + var applyLeadingSlash = false; + var useQueryString = this.isRoot && this.terminal; + var url = ''; + for (var i = 0; i < this.segments.length; i++) { + var segment = this.segments[i]; + var s = segment.generate(paramTokens); + applyLeadingSlash = applyLeadingSlash || (segment instanceof ContinuationSegment); + if (s.length > 0) { + url += (i > 0 ? '/' : '') + s; + } + } + var unusedParams = paramTokens.getUnused(); + if (!StringMapWrapper.isEmpty(unusedParams)) { + url += useQueryString ? '?' : ';'; + var paramToken = useQueryString ? '&' : ';'; + var i = 0; + StringMapWrapper.forEach(unusedParams, (function(value, key) { + if (i++ > 0) { + url += paramToken; + } + url += key; + if (!isPresent(value) && useQueryString) { + value = 'true'; + } + if (isPresent(value)) { + url += '=' + value; + } + })); + } + if (applyLeadingSlash) { + url += '/'; + } + return url; + }, + resolveComponentType: function() { + return this.handler.resolveComponentType(); + } + }, {}); + }()); + $__export("PathRecognizer", PathRecognizer); + PathRecognizer.matrixRegex = RegExpWrapper.create('^(.*\/[^\/]+?)(;[^\/]+)?\/?$'); + PathRecognizer.queryRegex = RegExpWrapper.create('^(.*\/[^\/]+?)(\\?[^\/]+)?$'); + } + }; +}); + +System.register("angular2/src/router/route_config_nomalizer", ["angular2/src/router/route_config_decorator", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/route_config_nomalizer"; + var AsyncRoute, + Route, + Redirect, + BaseException; + function normalizeRouteConfig(config) { + if (config instanceof Route || config instanceof Redirect || config instanceof AsyncRoute) { + return config; + } + if ((!config.component) == (!config.redirectTo)) { + throw new BaseException("Route config should contain exactly one 'component', or 'redirectTo' property"); + } + if (config.component) { + if (typeof config.component == 'object') { + var componentDefinitionObject = config.component; + if (componentDefinitionObject.type == 'constructor') { + return new Route({ + path: config.path, + component: componentDefinitionObject.constructor, + as: config.as + }); + } else if (componentDefinitionObject.type == 'loader') { + return new AsyncRoute({ + path: config.path, + loader: componentDefinitionObject.loader, + as: config.as + }); + } else { + throw new BaseException(("Invalid component type '" + componentDefinitionObject.type + "'. Valid types are \"constructor\" and \"loader\".")); + } + } + return new Route(config); + } + if (config.redirectTo) { + return new Redirect({ + path: config.path, + redirectTo: config.redirectTo + }); + } + return config; + } + $__export("normalizeRouteConfig", normalizeRouteConfig); + return { + setters: [function($__m) { + AsyncRoute = $__m.AsyncRoute; + Route = $__m.Route; + Redirect = $__m.Redirect; + }, function($__m) { + BaseException = $__m.BaseException; + }], + execute: function() { + } + }; +}); + +System.register("angular2/src/di/binding", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/reflection/reflection", "angular2/src/di/key", "angular2/src/di/metadata", "angular2/src/di/exceptions", "angular2/src/di/forward_ref"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/binding"; + var __decorate, + __metadata, + Type, + isBlank, + isPresent, + CONST, + CONST_EXPR, + BaseException, + stringify, + isArray, + ListWrapper, + reflector, + Key, + InjectMetadata, + VisibilityMetadata, + OptionalMetadata, + DEFAULT_VISIBILITY, + DependencyMetadata, + NoAnnotationError, + resolveForwardRef, + Dependency, + _EMPTY_LIST, + Binding, + ResolvedBinding, + BindingBuilder; + function bind(token) { + return new BindingBuilder(token); + } + function _constructDependencies(factoryFunction, dependencies) { + if (isBlank(dependencies)) { + return _dependenciesFor(factoryFunction); + } else { + var params = ListWrapper.map(dependencies, (function(t) { + return [t]; + })); + return ListWrapper.map(dependencies, (function(t) { + return _extractToken(factoryFunction, t, params); + })); + } + } + function _dependenciesFor(typeOrFunc) { + var params = reflector.parameters(typeOrFunc); + if (isBlank(params)) + return []; + if (ListWrapper.any(params, (function(p) { + return isBlank(p); + }))) { + throw new NoAnnotationError(typeOrFunc, params); + } + return ListWrapper.map(params, (function(p) { + return _extractToken(typeOrFunc, p, params); + })); + } + function _extractToken(typeOrFunc, annotations, params) { + var depProps = []; + var token = null; + var optional = false; + if (!isArray(annotations)) { + return _createDependency(annotations, optional, DEFAULT_VISIBILITY, depProps); + } + var visibility = DEFAULT_VISIBILITY; + for (var i = 0; i < annotations.length; ++i) { + var paramAnnotation = annotations[i]; + if (paramAnnotation instanceof Type) { + token = paramAnnotation; + } else if (paramAnnotation instanceof InjectMetadata) { + token = paramAnnotation.token; + } else if (paramAnnotation instanceof OptionalMetadata) { + optional = true; + } else if (paramAnnotation instanceof VisibilityMetadata) { + visibility = paramAnnotation; + } else if (paramAnnotation instanceof DependencyMetadata) { + if (isPresent(paramAnnotation.token)) { + token = paramAnnotation.token; + } + depProps.push(paramAnnotation); + } + } + token = resolveForwardRef(token); + if (isPresent(token)) { + return _createDependency(token, optional, visibility, depProps); + } else { + throw new NoAnnotationError(typeOrFunc, params); + } + } + function _createDependency(token, optional, visibility, depProps) { + return new Dependency(Key.get(token), optional, visibility, depProps); + } + $__export("bind", bind); + return { + setters: [function($__m) { + Type = $__m.Type; + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + CONST = $__m.CONST; + CONST_EXPR = $__m.CONST_EXPR; + BaseException = $__m.BaseException; + stringify = $__m.stringify; + isArray = $__m.isArray; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + reflector = $__m.reflector; + }, function($__m) { + Key = $__m.Key; + }, function($__m) { + InjectMetadata = $__m.InjectMetadata; + VisibilityMetadata = $__m.VisibilityMetadata; + OptionalMetadata = $__m.OptionalMetadata; + DEFAULT_VISIBILITY = $__m.DEFAULT_VISIBILITY; + DependencyMetadata = $__m.DependencyMetadata; + }, function($__m) { + NoAnnotationError = $__m.NoAnnotationError; + }, function($__m) { + resolveForwardRef = $__m.resolveForwardRef; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Dependency = (function() { + function Dependency(key, optional, visibility, properties) { + this.key = key; + this.optional = optional; + this.visibility = visibility; + this.properties = properties; + } + return ($traceurRuntime.createClass)(Dependency, {}, {fromKey: function(key) { + return new Dependency(key, false, DEFAULT_VISIBILITY, []); + }}); + }()); + $__export("Dependency", Dependency); + _EMPTY_LIST = CONST_EXPR([]); + Binding = (($traceurRuntime.createClass)(function(token, $__3) { + var $__4 = $__3, + toClass = $__4.toClass, + toValue = $__4.toValue, + toAlias = $__4.toAlias, + toFactory = $__4.toFactory, + deps = $__4.deps; + this.token = token; + this.toClass = toClass; + this.toValue = toValue; + this.toAlias = toAlias; + this.toFactory = toFactory; + this.dependencies = deps; + }, {resolve: function() { + var $__0 = this; + var factoryFn; + var resolvedDeps; + if (isPresent(this.toClass)) { + var toClass = resolveForwardRef(this.toClass); + factoryFn = reflector.factory(toClass); + resolvedDeps = _dependenciesFor(toClass); + } else if (isPresent(this.toAlias)) { + factoryFn = (function(aliasInstance) { + return aliasInstance; + }); + resolvedDeps = [Dependency.fromKey(Key.get(this.toAlias))]; + } else if (isPresent(this.toFactory)) { + factoryFn = this.toFactory; + resolvedDeps = _constructDependencies(this.toFactory, this.dependencies); + } else { + factoryFn = (function() { + return $__0.toValue; + }); + resolvedDeps = _EMPTY_LIST; + } + return new ResolvedBinding(Key.get(this.token), factoryFn, resolvedDeps); + }}, {})); + $__export("Binding", Binding); + $__export("Binding", Binding = __decorate([CONST(), __metadata('design:paramtypes', [Object, Object])], Binding)); + ResolvedBinding = (function() { + function ResolvedBinding(key, factory, dependencies) { + this.key = key; + this.factory = factory; + this.dependencies = dependencies; + } + return ($traceurRuntime.createClass)(ResolvedBinding, {}, {}); + }()); + $__export("ResolvedBinding", ResolvedBinding); + BindingBuilder = (function() { + function BindingBuilder(token) { + this.token = token; + } + return ($traceurRuntime.createClass)(BindingBuilder, { + toClass: function(type) { + return new Binding(this.token, {toClass: type}); + }, + toValue: function(value) { + return new Binding(this.token, {toValue: value}); + }, + toAlias: function(aliasToken) { + if (isBlank(aliasToken)) { + throw new BaseException(("Can not alias " + stringify(this.token) + " to a blank value!")); + } + return new Binding(this.token, {toAlias: aliasToken}); + }, + toFactory: function(factoryFunction, dependencies) { + return new Binding(this.token, { + toFactory: factoryFunction, + deps: dependencies + }); + } + }, {}); + }()); + $__export("BindingBuilder", BindingBuilder); + } + }; +}); + +System.register("angular2/src/change_detection/abstract_change_detector", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/change_detector_ref", "angular2/src/change_detection/exceptions", "angular2/src/change_detection/constants"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/abstract_change_detector"; + var isPresent, + BaseException, + ListWrapper, + ChangeDetectorRef, + ChangeDetectionError, + CHECK_ONCE, + CHECKED, + DETACHED, + _Context, + AbstractChangeDetector; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + ChangeDetectorRef = $__m.ChangeDetectorRef; + }, function($__m) { + ChangeDetectionError = $__m.ChangeDetectionError; + }, function($__m) { + CHECK_ONCE = $__m.CHECK_ONCE; + CHECKED = $__m.CHECKED; + DETACHED = $__m.DETACHED; + }], + execute: function() { + _Context = (function() { + function _Context(element, componentElement, instance, context, locals, injector, expression) { + this.element = element; + this.componentElement = componentElement; + this.instance = instance; + this.context = context; + this.locals = locals; + this.injector = injector; + this.expression = expression; + } + return ($traceurRuntime.createClass)(_Context, {}, {}); + }()); + AbstractChangeDetector = (function() { + function AbstractChangeDetector(id, dispatcher) { + this.id = id; + this.dispatcher = dispatcher; + this.lightDomChildren = []; + this.shadowDomChildren = []; + this.mode = null; + this.ref = new ChangeDetectorRef(this); + } + return ($traceurRuntime.createClass)(AbstractChangeDetector, { + addChild: function(cd) { + this.lightDomChildren.push(cd); + cd.parent = this; + }, + removeChild: function(cd) { + ListWrapper.remove(this.lightDomChildren, cd); + }, + addShadowDomChild: function(cd) { + this.shadowDomChildren.push(cd); + cd.parent = this; + }, + removeShadowDomChild: function(cd) { + ListWrapper.remove(this.shadowDomChildren, cd); + }, + remove: function() { + this.parent.removeChild(this); + }, + detectChanges: function() { + this.runDetectChanges(false); + }, + checkNoChanges: function() { + throw new BaseException("Not implemented"); + }, + runDetectChanges: function(throwOnChange) { + if (this.mode === DETACHED || this.mode === CHECKED) + return ; + this.detectChangesInRecords(throwOnChange); + this._detectChangesInLightDomChildren(throwOnChange); + if (throwOnChange === false) + this.callOnAllChangesDone(); + this._detectChangesInShadowDomChildren(throwOnChange); + if (this.mode === CHECK_ONCE) + this.mode = CHECKED; + }, + detectChangesInRecords: function(throwOnChange) {}, + hydrate: function(context, locals, directives, pipes) {}, + hydrateDirectives: function(directives) {}, + dehydrate: function() {}, + dehydrateDirectives: function(destroyPipes) {}, + callOnAllChangesDone: function() {}, + _detectChangesInLightDomChildren: function(throwOnChange) { + var c = this.lightDomChildren; + for (var i = 0; i < c.length; ++i) { + c[i].runDetectChanges(throwOnChange); + } + }, + _detectChangesInShadowDomChildren: function(throwOnChange) { + var c = this.shadowDomChildren; + for (var i = 0; i < c.length; ++i) { + c[i].runDetectChanges(throwOnChange); + } + }, + markAsCheckOnce: function() { + this.mode = CHECK_ONCE; + }, + markPathToRootAsCheckOnce: function() { + var c = this; + while (isPresent(c) && c.mode != DETACHED) { + if (c.mode === CHECKED) + c.mode = CHECK_ONCE; + c = c.parent; + } + }, + throwError: function(proto, exception, stack) { + var c = this.dispatcher.getDebugContext(proto.bindingRecord.elementIndex, proto.directiveIndex); + var context = isPresent(c) ? new _Context(c.element, c.componentElement, c.directive, c.context, c.locals, c.injector, proto.expressionAsString) : null; + throw new ChangeDetectionError(proto, exception, stack, context); + } + }, {}); + }()); + $__export("AbstractChangeDetector", AbstractChangeDetector); + } + }; +}); + +System.register("angular2/src/core/compiler/view_manager", ["angular2/di", "angular2/src/facade/lang", "angular2/src/core/compiler/view_ref", "angular2/src/render/api", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_listener"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/view_manager"; + var __decorate, + __metadata, + Injectable, + isPresent, + isBlank, + BaseException, + internalView, + internalProtoView, + Renderer, + ViewType, + AppViewManagerUtils, + AppViewPool, + AppViewListener, + AppViewManager; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + }, function($__m) { + internalView = $__m.internalView; + internalProtoView = $__m.internalProtoView; + }, function($__m) { + Renderer = $__m.Renderer; + ViewType = $__m.ViewType; + }, function($__m) { + AppViewManagerUtils = $__m.AppViewManagerUtils; + }, function($__m) { + AppViewPool = $__m.AppViewPool; + }, function($__m) { + AppViewListener = $__m.AppViewListener; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + AppViewManager = (($traceurRuntime.createClass)(function(_viewPool, _viewListener, _utils, _renderer) { + this._viewPool = _viewPool; + this._viewListener = _viewListener; + this._utils = _utils; + this._renderer = _renderer; + }, { + getViewContainer: function(location) { + var hostView = internalView(location.parentView); + return hostView.elementInjectors[location.boundElementIndex].getViewContainerRef(); + }, + getHostElement: function(hostViewRef) { + var hostView = internalView(hostViewRef); + if (hostView.proto.type !== ViewType.HOST) { + throw new BaseException('This operation is only allowed on host views'); + } + return hostView.elementRefs[hostView.elementOffset]; + }, + getNamedElementInComponentView: function(hostLocation, variableName) { + var hostView = internalView(hostLocation.parentView); + var boundElementIndex = hostLocation.boundElementIndex; + var componentView = hostView.getNestedView(boundElementIndex); + if (isBlank(componentView)) { + throw new BaseException(("There is no component directive at element " + boundElementIndex)); + } + var binderIdx = componentView.proto.variableLocations.get(variableName); + if (isBlank(binderIdx)) { + throw new BaseException(("Could not find variable " + variableName)); + } + return componentView.elementRefs[componentView.elementOffset + binderIdx]; + }, + getComponent: function(hostLocation) { + var hostView = internalView(hostLocation.parentView); + var boundElementIndex = hostLocation.boundElementIndex; + return this._utils.getComponentInstance(hostView, boundElementIndex); + }, + createRootHostView: function(hostProtoViewRef, overrideSelector, injector) { + var hostProtoView = internalProtoView(hostProtoViewRef); + var hostElementSelector = overrideSelector; + if (isBlank(hostElementSelector)) { + hostElementSelector = hostProtoView.elementBinders[0].componentDirective.metadata.selector; + } + var renderViewWithFragments = this._renderer.createRootHostView(hostProtoView.mergeMapping.renderProtoViewRef, hostProtoView.mergeMapping.renderFragmentCount, hostElementSelector); + var hostView = this._createMainView(hostProtoView, renderViewWithFragments); + this._renderer.hydrateView(hostView.render); + this._utils.hydrateRootHostView(hostView, injector); + return hostView.ref; + }, + destroyRootHostView: function(hostViewRef) { + var hostView = internalView(hostViewRef); + this._renderer.detachFragment(hostView.renderFragment); + this._renderer.dehydrateView(hostView.render); + this._viewDehydrateRecurse(hostView); + this._viewListener.viewDestroyed(hostView); + this._renderer.destroyView(hostView.render); + }, + createEmbeddedViewInContainer: function(viewContainerLocation, atIndex, templateRef) { + var protoView = internalProtoView(templateRef.protoViewRef); + if (protoView.type !== ViewType.EMBEDDED) { + throw new BaseException('This method can only be called with embedded ProtoViews!'); + } + return this._createViewInContainer(viewContainerLocation, atIndex, protoView, templateRef.elementRef, null); + }, + createHostViewInContainer: function(viewContainerLocation, atIndex, protoViewRef, imperativelyCreatedInjector) { + var protoView = internalProtoView(protoViewRef); + if (protoView.type !== ViewType.HOST) { + throw new BaseException('This method can only be called with host ProtoViews!'); + } + return this._createViewInContainer(viewContainerLocation, atIndex, protoView, viewContainerLocation, imperativelyCreatedInjector); + }, + _createViewInContainer: function(viewContainerLocation, atIndex, protoView, context, imperativelyCreatedInjector) { + var parentView = internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + var contextView = internalView(context.parentView); + var contextBoundElementIndex = context.boundElementIndex; + var embeddedFragmentView = contextView.getNestedView(contextBoundElementIndex); + var view; + if (protoView.type === ViewType.EMBEDDED && isPresent(embeddedFragmentView) && !embeddedFragmentView.hydrated()) { + view = embeddedFragmentView; + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + } else { + view = this._createPooledView(protoView); + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + this._renderer.hydrateView(view.render); + } + this._utils.attachViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view); + this._utils.hydrateViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, imperativelyCreatedInjector); + return view.ref; + }, + _attachRenderView: function(parentView, boundElementIndex, atIndex, view) { + var elementRef = parentView.elementRefs[boundElementIndex]; + if (atIndex === 0) { + this._renderer.attachFragmentAfterElement(elementRef, view.renderFragment); + } else { + var prevView = parentView.viewContainers[boundElementIndex].views[atIndex - 1]; + this._renderer.attachFragmentAfterFragment(prevView.renderFragment, view.renderFragment); + } + }, + destroyViewInContainer: function(viewContainerLocation, atIndex) { + var parentView = internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + this._destroyViewInContainer(parentView, boundElementIndex, atIndex); + }, + attachViewInContainer: function(viewContainerLocation, atIndex, viewRef) { + var view = internalView(viewRef); + var parentView = internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + this._utils.attachViewInContainer(parentView, boundElementIndex, null, null, atIndex, view); + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + return viewRef; + }, + detachViewInContainer: function(viewContainerLocation, atIndex) { + var parentView = internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex); + this._renderer.detachFragment(view.renderFragment); + return view.ref; + }, + _createMainView: function(protoView, renderViewWithFragments) { + var mergedParentView = this._utils.createView(protoView, renderViewWithFragments, this, this._renderer); + this._renderer.setEventDispatcher(mergedParentView.render, mergedParentView); + this._viewListener.viewCreated(mergedParentView); + return mergedParentView; + }, + _createPooledView: function(protoView) { + var view = this._viewPool.getView(protoView); + if (isBlank(view)) { + view = this._createMainView(protoView, this._renderer.createView(protoView.mergeMapping.renderProtoViewRef, protoView.mergeMapping.renderFragmentCount)); + } + return view; + }, + _destroyPooledView: function(view) { + var wasReturned = this._viewPool.returnView(view); + if (!wasReturned) { + this._viewListener.viewDestroyed(view); + this._renderer.destroyView(view.render); + } + }, + _destroyViewInContainer: function(parentView, boundElementIndex, atIndex) { + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + this._viewDehydrateRecurse(view); + this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex); + if (view.viewOffset > 0) { + this._renderer.detachFragment(view.renderFragment); + } else { + this._renderer.dehydrateView(view.render); + this._renderer.detachFragment(view.renderFragment); + this._destroyPooledView(view); + } + }, + _viewDehydrateRecurse: function(view) { + if (view.hydrated()) { + this._utils.dehydrateView(view); + } + var viewContainers = view.viewContainers; + var startViewOffset = view.viewOffset; + var endViewOffset = view.viewOffset + view.mainMergeMapping.nestedViewCountByViewIndex[view.viewOffset]; + var elementOffset = view.elementOffset; + for (var viewIdx = startViewOffset; viewIdx <= endViewOffset; viewIdx++) { + var currView = view.views[viewIdx]; + for (var binderIdx = 0; binderIdx < currView.proto.elementBinders.length; binderIdx++, elementOffset++) { + var vc = viewContainers[elementOffset]; + if (isPresent(vc)) { + for (var j = vc.views.length - 1; j >= 0; j--) { + this._destroyViewInContainer(currView, elementOffset, j); + } + } + } + } + } + }, {})); + $__export("AppViewManager", AppViewManager); + $__export("AppViewManager", AppViewManager = __decorate([Injectable(), __metadata('design:paramtypes', [AppViewPool, AppViewListener, AppViewManagerUtils, Renderer])], AppViewManager)); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/view_loader", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/facade/async", "angular2/src/dom/dom_adapter", "angular2/src/render/xhr", "angular2/src/render/dom/compiler/style_inliner", "angular2/src/render/dom/compiler/style_url_resolver"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/view_loader"; + var __decorate, + __metadata, + Injectable, + isBlank, + isPresent, + BaseException, + isPromise, + StringWrapper, + Map, + MapWrapper, + ListWrapper, + PromiseWrapper, + DOM, + XHR, + StyleInliner, + StyleUrlResolver, + TemplateAndStyles, + ViewLoader; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + isPromise = $__m.isPromise; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + Map = $__m.Map; + MapWrapper = $__m.MapWrapper; + ListWrapper = $__m.ListWrapper; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + XHR = $__m.XHR; + }, function($__m) { + StyleInliner = $__m.StyleInliner; + }, function($__m) { + StyleUrlResolver = $__m.StyleUrlResolver; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + TemplateAndStyles = (function() { + function TemplateAndStyles(template, styles) { + this.template = template; + this.styles = styles; + } + return ($traceurRuntime.createClass)(TemplateAndStyles, {}, {}); + }()); + $__export("TemplateAndStyles", TemplateAndStyles); + ViewLoader = (($traceurRuntime.createClass)(function(_xhr, _styleInliner, _styleUrlResolver) { + this._xhr = _xhr; + this._styleInliner = _styleInliner; + this._styleUrlResolver = _styleUrlResolver; + this._cache = new Map(); + }, { + load: function(viewDef) { + var $__0 = this; + var tplAndStyles = [this._loadHtml(viewDef.template, viewDef.templateAbsUrl)]; + if (isPresent(viewDef.styles)) { + viewDef.styles.forEach((function(cssText) { + var textOrPromise = $__0._resolveAndInlineCssText(cssText, viewDef.templateAbsUrl); + tplAndStyles.push(textOrPromise); + })); + } + if (isPresent(viewDef.styleAbsUrls)) { + viewDef.styleAbsUrls.forEach((function(url) { + var promise = $__0._loadText(url).then((function(cssText) { + return $__0._resolveAndInlineCssText(cssText, viewDef.templateAbsUrl); + })); + tplAndStyles.push(promise); + })); + } + return PromiseWrapper.all(tplAndStyles).then((function(res) { + var loadedTplAndStyles = res[0]; + var styles = ListWrapper.slice(res, 1); + return new TemplateAndStyles(loadedTplAndStyles.template, loadedTplAndStyles.styles.concat(styles)); + })); + }, + _loadText: function(url) { + var response = this._cache.get(url); + if (isBlank(response)) { + response = PromiseWrapper.catchError(this._xhr.get(url), (function(_) { + return PromiseWrapper.reject(new BaseException(("Failed to fetch url \"" + url + "\"")), null); + })); + this._cache.set(url, response); + } + return response; + }, + _loadHtml: function(template, templateAbsUrl) { + var $__0 = this; + var html; + if (isPresent(template)) { + html = PromiseWrapper.resolve(template); + } else if (isPresent(templateAbsUrl)) { + html = this._loadText(templateAbsUrl); + } else { + throw new BaseException('View should have either the templateUrl or template property set'); + } + return html.then((function(html) { + var tplEl = DOM.createTemplate(html); + if (isPresent(templateAbsUrl) && templateAbsUrl.indexOf("/") >= 0) { + var baseUrl = templateAbsUrl.substring(0, templateAbsUrl.lastIndexOf("/")); + $__0._substituteBaseUrl(DOM.content(tplEl), baseUrl); + } + var styleEls = DOM.querySelectorAll(DOM.content(tplEl), 'STYLE'); + var unresolvedStyles = []; + for (var i = 0; i < styleEls.length; i++) { + var styleEl = styleEls[i]; + unresolvedStyles.push(DOM.getText(styleEl)); + DOM.remove(styleEl); + } + var syncStyles = []; + var asyncStyles = []; + for (var i$__3 = 0; i$__3 < styleEls.length; i$__3++) { + var styleEl = styleEls[i$__3]; + var resolvedStyled = $__0._resolveAndInlineCssText(DOM.getText(styleEl), templateAbsUrl); + if (isPromise(resolvedStyled)) { + asyncStyles.push(resolvedStyled); + } else { + syncStyles.push(resolvedStyled); + } + } + if (asyncStyles.length === 0) { + return PromiseWrapper.resolve(new TemplateAndStyles(DOM.getInnerHTML(tplEl), syncStyles)); + } else { + return PromiseWrapper.all(asyncStyles).then((function(loadedStyles) { + return new TemplateAndStyles(DOM.getInnerHTML(tplEl), syncStyles.concat(loadedStyles)); + })); + } + })); + }, + _substituteBaseUrl: function(element, baseUrl) { + if (DOM.isElementNode(element)) { + var attrs = DOM.attributeMap(element); + MapWrapper.forEach(attrs, (function(v, k) { + if (isPresent(v) && v.indexOf('$baseUrl') >= 0) { + DOM.setAttribute(element, k, StringWrapper.replaceAll(v, /\$baseUrl/g, baseUrl)); + } + })); + } + var children = DOM.childNodes(element); + for (var i = 0; i < children.length; i++) { + if (DOM.isElementNode(children[i])) { + this._substituteBaseUrl(children[i], baseUrl); + } + } + }, + _resolveAndInlineCssText: function(cssText, baseUrl) { + cssText = this._styleUrlResolver.resolveUrls(cssText, baseUrl); + return this._styleInliner.inlineImports(cssText, baseUrl); + } + }, {})); + $__export("ViewLoader", ViewLoader); + $__export("ViewLoader", ViewLoader = __decorate([Injectable(), __metadata('design:paramtypes', [XHR, StyleInliner, StyleUrlResolver])], ViewLoader)); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/compile_pipeline", ["angular2/src/facade/lang", "angular2/src/dom/dom_adapter", "angular2/src/render/dom/compiler/compile_element", "angular2/src/render/dom/compiler/compile_control", "angular2/src/render/dom/view/proto_view_builder"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/compile_pipeline"; + var isPresent, + DOM, + CompileElement, + CompileControl, + ProtoViewBuilder, + CompilePipeline; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + CompileElement = $__m.CompileElement; + }, function($__m) { + CompileControl = $__m.CompileControl; + }, function($__m) { + ProtoViewBuilder = $__m.ProtoViewBuilder; + }], + execute: function() { + CompilePipeline = (function() { + function CompilePipeline(steps) { + this.steps = steps; + this._control = new CompileControl(steps); + } + return ($traceurRuntime.createClass)(CompilePipeline, { + processStyles: function(styles) { + var $__0 = this; + return styles.map((function(style) { + $__0.steps.forEach((function(step) { + style = step.processStyle(style); + })); + return style; + })); + }, + processElements: function(rootElement, protoViewType, viewDef) { + var results = []; + var compilationCtxtDescription = viewDef.componentId; + var rootCompileElement = new CompileElement(rootElement, compilationCtxtDescription); + rootCompileElement.inheritedProtoView = new ProtoViewBuilder(rootElement, protoViewType, viewDef.encapsulation); + rootCompileElement.isViewRoot = true; + this._processElement(results, null, rootCompileElement, compilationCtxtDescription); + return results; + }, + _processElement: function(results, parent, current) { + var compilationCtxtDescription = arguments[3] !== (void 0) ? arguments[3] : ''; + var additionalChildren = this._control.internalProcess(results, 0, parent, current); + if (current.compileChildren) { + var node = DOM.firstChild(DOM.templateAwareRoot(current.element)); + while (isPresent(node)) { + var nextNode = DOM.nextSibling(node); + if (DOM.isElementNode(node)) { + var childCompileElement = new CompileElement(node, compilationCtxtDescription); + childCompileElement.inheritedProtoView = current.inheritedProtoView; + childCompileElement.inheritedElementBinder = current.inheritedElementBinder; + childCompileElement.distanceToInheritedBinder = current.distanceToInheritedBinder + 1; + this._processElement(results, current, childCompileElement); + } + node = nextNode; + } + } + if (isPresent(additionalChildren)) { + for (var i = 0; i < additionalChildren.length; i++) { + this._processElement(results, current, additionalChildren[i]); + } + } + } + }, {}); + }()); + $__export("CompilePipeline", CompilePipeline); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/compile_step_factory", ["angular2/src/render/dom/compiler/property_binding_parser", "angular2/src/render/dom/compiler/text_interpolation_parser", "angular2/src/render/dom/compiler/directive_parser", "angular2/src/render/dom/compiler/view_splitter", "angular2/src/render/dom/compiler/style_encapsulator"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/compile_step_factory"; + var PropertyBindingParser, + TextInterpolationParser, + DirectiveParser, + ViewSplitter, + StyleEncapsulator, + CompileStepFactory, + DefaultStepFactory; + return { + setters: [function($__m) { + PropertyBindingParser = $__m.PropertyBindingParser; + }, function($__m) { + TextInterpolationParser = $__m.TextInterpolationParser; + }, function($__m) { + DirectiveParser = $__m.DirectiveParser; + }, function($__m) { + ViewSplitter = $__m.ViewSplitter; + }, function($__m) { + StyleEncapsulator = $__m.StyleEncapsulator; + }], + execute: function() { + CompileStepFactory = (function() { + function CompileStepFactory() {} + return ($traceurRuntime.createClass)(CompileStepFactory, {createSteps: function(view) { + return null; + }}, {}); + }()); + $__export("CompileStepFactory", CompileStepFactory); + DefaultStepFactory = (function($__super) { + function DefaultStepFactory(_parser, _appId) { + $traceurRuntime.superConstructor(DefaultStepFactory).call(this); + this._parser = _parser; + this._appId = _appId; + this._componentUIDsCache = new Map(); + } + return ($traceurRuntime.createClass)(DefaultStepFactory, {createSteps: function(view) { + return [new ViewSplitter(this._parser), new PropertyBindingParser(this._parser), new DirectiveParser(this._parser, view.directives), new TextInterpolationParser(this._parser), new StyleEncapsulator(this._appId, view, this._componentUIDsCache)]; + }}, {}, $__super); + }(CompileStepFactory)); + $__export("DefaultStepFactory", DefaultStepFactory); + } + }; +}); + +System.register("angular2/src/http/http", ["angular2/src/facade/lang", "angular2/src/di/decorators", "angular2/src/http/interfaces", "angular2/src/http/static_request", "angular2/src/http/base_request_options", "angular2/src/http/enums"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/http"; + var __decorate, + __metadata, + isString, + isPresent, + makeTypeError, + Injectable, + ConnectionBackend, + Request, + RequestOptions, + RequestMethods, + Http, + Jsonp; + function httpRequest(backend, request) { + return backend.createConnection(request).response; + } + function mergeOptions(defaultOpts, providedOpts, method, url) { + var newOptions = defaultOpts; + if (isPresent(providedOpts)) { + newOptions = newOptions.merge(new RequestOptions({ + method: providedOpts.method, + url: providedOpts.url, + headers: providedOpts.headers, + body: providedOpts.body, + mode: providedOpts.mode, + credentials: providedOpts.credentials, + cache: providedOpts.cache + })); + } + if (isPresent(method)) { + return newOptions.merge(new RequestOptions({ + method: method, + url: url + })); + } else { + return newOptions.merge(new RequestOptions({url: url})); + } + } + return { + setters: [function($__m) { + isString = $__m.isString; + isPresent = $__m.isPresent; + makeTypeError = $__m.makeTypeError; + }, function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + ConnectionBackend = $__m.ConnectionBackend; + }, function($__m) { + Request = $__m.Request; + }, function($__m) { + RequestOptions = $__m.RequestOptions; + }, function($__m) { + RequestMethods = $__m.RequestMethods; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Http = (($traceurRuntime.createClass)(function(_backend, _defaultOptions) { + this._backend = _backend; + this._defaultOptions = _defaultOptions; + }, { + request: function(url, options) { + var responseObservable; + if (isString(url)) { + responseObservable = httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions, options, RequestMethods.GET, url))); + } else if (url instanceof Request) { + responseObservable = httpRequest(this._backend, url); + } + return responseObservable; + }, + get: function(url, options) { + return httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions, options, RequestMethods.GET, url))); + }, + post: function(url, body, options) { + return httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions.merge(new RequestOptions({body: body})), options, RequestMethods.POST, url))); + }, + put: function(url, body, options) { + return httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions.merge(new RequestOptions({body: body})), options, RequestMethods.PUT, url))); + }, + delete: function(url, options) { + return httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions, options, RequestMethods.DELETE, url))); + }, + patch: function(url, body, options) { + return httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions.merge(new RequestOptions({body: body})), options, RequestMethods.PATCH, url))); + }, + head: function(url, options) { + return httpRequest(this._backend, new Request(mergeOptions(this._defaultOptions, options, RequestMethods.HEAD, url))); + } + }, {})); + $__export("Http", Http); + $__export("Http", Http = __decorate([Injectable(), __metadata('design:paramtypes', [ConnectionBackend, RequestOptions])], Http)); + Jsonp = (function($__super) { + function $__0(backend, defaultOptions) { + $traceurRuntime.superConstructor($__0).call(this, backend, defaultOptions); + } + return ($traceurRuntime.createClass)($__0, {request: function(url, options) { + var responseObservable; + if (isString(url)) { + url = new Request(mergeOptions(this._defaultOptions, options, RequestMethods.GET, url)); + } + if (url instanceof Request) { + if (url.method !== RequestMethods.GET) { + makeTypeError('JSONP requests must use GET request method.'); + } + responseObservable = httpRequest(this._backend, url); + } + return responseObservable; + }}, {}, $__super); + }(Http)); + $__export("Jsonp", Jsonp); + $__export("Jsonp", Jsonp = __decorate([Injectable(), __metadata('design:paramtypes', [ConnectionBackend, RequestOptions])], Jsonp)); + } + }; +}); + +System.register("angular2/src/http/backends/xhr_backend", ["angular2/src/http/enums", "angular2/src/http/static_response", "angular2/src/http/base_response_options", "angular2/di", "angular2/src/http/backends/browser_xhr", "angular2/src/facade/async", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/http/backends/xhr_backend"; + var __decorate, + __metadata, + RequestMethodsMap, + Response, + ResponseOptions, + Injectable, + BrowserXhr, + EventEmitter, + ObservableWrapper, + isPresent, + ENUM_INDEX, + XHRConnection, + XHRBackend; + return { + setters: [function($__m) { + RequestMethodsMap = $__m.RequestMethodsMap; + }, function($__m) { + Response = $__m.Response; + }, function($__m) { + ResponseOptions = $__m.ResponseOptions; + }, function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + BrowserXhr = $__m.BrowserXhr; + }, function($__m) { + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + ENUM_INDEX = $__m.ENUM_INDEX; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + XHRConnection = (function() { + function XHRConnection(req, browserXHR, baseResponseOptions) { + var $__0 = this; + var requestMethodsMap = new RequestMethodsMap(); + this.request = req; + this.response = new EventEmitter(); + this._xhr = browserXHR.build(); + this._xhr.open(requestMethodsMap.getMethod(ENUM_INDEX(req.method)), req.url); + this._xhr.addEventListener('load', (function(_) { + var responseOptions = new ResponseOptions({body: isPresent($__0._xhr.response) ? $__0._xhr.response : $__0._xhr.responseText}); + if (isPresent(baseResponseOptions)) { + responseOptions = baseResponseOptions.merge(responseOptions); + } + ObservableWrapper.callNext($__0.response, new Response(responseOptions)); + ObservableWrapper.callReturn($__0.response); + })); + if (isPresent(req.headers)) { + req.headers.forEach((function(value, name) { + $__0._xhr.setRequestHeader(name, value); + })); + } + this._xhr.send(this.request.text()); + } + return ($traceurRuntime.createClass)(XHRConnection, {dispose: function() { + this._xhr.abort(); + }}, {}); + }()); + $__export("XHRConnection", XHRConnection); + XHRBackend = (($traceurRuntime.createClass)(function(_browserXHR, _baseResponseOptions) { + this._browserXHR = _browserXHR; + this._baseResponseOptions = _baseResponseOptions; + }, {createConnection: function(request) { + return new XHRConnection(request, this._browserXHR, this._baseResponseOptions); + }}, {})); + $__export("XHRBackend", XHRBackend); + $__export("XHRBackend", XHRBackend = __decorate([Injectable(), __metadata('design:paramtypes', [BrowserXhr, ResponseOptions])], XHRBackend)); + } + }; +}); + +System.register("angular2/forms", ["angular2/src/forms/model", "angular2/src/forms/directives/abstract_control_directive", "angular2/src/forms/directives/control_container", "angular2/src/forms/directives/ng_control_name", "angular2/src/forms/directives/ng_form_control", "angular2/src/forms/directives/ng_model", "angular2/src/forms/directives/ng_control", "angular2/src/forms/directives/ng_control_group", "angular2/src/forms/directives/ng_form_model", "angular2/src/forms/directives/ng_form", "angular2/src/forms/directives/default_value_accessor", "angular2/src/forms/directives/checkbox_value_accessor", "angular2/src/forms/directives/select_control_value_accessor", "angular2/src/forms/directives", "angular2/src/forms/validators", "angular2/src/forms/directives/validators", "angular2/src/forms/form_builder", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/forms"; + var FormBuilder, + CONST_EXPR, + formInjectables; + return { + setters: [function($__m) { + $__export("AbstractControl", $__m.AbstractControl); + $__export("Control", $__m.Control); + $__export("ControlGroup", $__m.ControlGroup); + $__export("ControlArray", $__m.ControlArray); + }, function($__m) { + $__export("AbstractControlDirective", $__m.AbstractControlDirective); + }, function($__m) { + $__export("ControlContainer", $__m.ControlContainer); + }, function($__m) { + $__export("NgControlName", $__m.NgControlName); + }, function($__m) { + $__export("NgFormControl", $__m.NgFormControl); + }, function($__m) { + $__export("NgModel", $__m.NgModel); + }, function($__m) { + $__export("NgControl", $__m.NgControl); + }, function($__m) { + $__export("NgControlGroup", $__m.NgControlGroup); + }, function($__m) { + $__export("NgFormModel", $__m.NgFormModel); + }, function($__m) { + $__export("NgForm", $__m.NgForm); + }, function($__m) { + $__export("DefaultValueAccessor", $__m.DefaultValueAccessor); + }, function($__m) { + $__export("CheckboxControlValueAccessor", $__m.CheckboxControlValueAccessor); + }, function($__m) { + $__export("NgSelectOption", $__m.NgSelectOption); + $__export("SelectControlValueAccessor", $__m.SelectControlValueAccessor); + }, function($__m) { + $__export("formDirectives", $__m.formDirectives); + }, function($__m) { + $__export("Validators", $__m.Validators); + }, function($__m) { + $__export("NgValidator", $__m.NgValidator); + $__export("NgRequiredValidator", $__m.NgRequiredValidator); + }, function($__m) { + FormBuilder = $__m.FormBuilder; + $__export("FormBuilder", $__m.FormBuilder); + }, function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }], + execute: function() { + formInjectables = CONST_EXPR([FormBuilder]); + $__export("formInjectables", formInjectables); + } + }; +}); + +System.register("angular2/src/router/router", ["angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/router/route_lifecycle_reflector"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/router"; + var PromiseWrapper, + EventEmitter, + ObservableWrapper, + ListWrapper, + isBlank, + isString, + StringWrapper, + isPresent, + BaseException, + getCanActivateHook, + _resolveToTrue, + _resolveToFalse, + Router, + RootRouter, + ChildRouter, + SLASH; + function splitAndFlattenLinkParams(linkParams) { + return ListWrapper.reduce(linkParams, (function(accumulation, item) { + if (isString(item)) { + return ListWrapper.concat(accumulation, StringWrapper.split(item, SLASH)); + } + accumulation.push(item); + return accumulation; + }), []); + } + function canActivateOne(nextInstruction, currentInstruction) { + var next = _resolveToTrue; + if (isPresent(nextInstruction.child)) { + next = canActivateOne(nextInstruction.child, isPresent(currentInstruction) ? currentInstruction.child : null); + } + return next.then((function(res) { + if (res == false) { + return false; + } + if (nextInstruction.reuse) { + return true; + } + var hook = getCanActivateHook(nextInstruction.component); + if (isPresent(hook)) { + return hook(nextInstruction, currentInstruction); + } + return true; + })); + } + return { + setters: [function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + isBlank = $__m.isBlank; + isString = $__m.isString; + StringWrapper = $__m.StringWrapper; + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + }, function($__m) { + getCanActivateHook = $__m.getCanActivateHook; + }], + execute: function() { + _resolveToTrue = PromiseWrapper.resolve(true); + _resolveToFalse = PromiseWrapper.resolve(false); + Router = (function() { + function Router(registry, _pipeline, parent, hostComponent) { + this.registry = registry; + this._pipeline = _pipeline; + this.parent = parent; + this.hostComponent = hostComponent; + this.navigating = false; + this._currentInstruction = null; + this._currentNavigation = _resolveToTrue; + this._outlet = null; + this._subject = new EventEmitter(); + } + return ($traceurRuntime.createClass)(Router, { + childRouter: function(hostComponent) { + return new ChildRouter(this, hostComponent); + }, + registerOutlet: function(outlet) { + this._outlet = outlet; + if (isPresent(this._currentInstruction)) { + return outlet.commit(this._currentInstruction); + } + return _resolveToTrue; + }, + config: function(definitions) { + var $__0 = this; + definitions.forEach((function(routeDefinition) { + $__0.registry.config($__0.hostComponent, routeDefinition, $__0 instanceof RootRouter); + })); + return this.renavigate(); + }, + navigate: function(url) { + var $__0 = this; + return this._currentNavigation = this._currentNavigation.then((function(_) { + $__0.lastNavigationAttempt = url; + $__0._startNavigating(); + return $__0._afterPromiseFinishNavigating($__0.recognize(url).then((function(matchedInstruction) { + if (isBlank(matchedInstruction)) { + return false; + } + return $__0._reuse(matchedInstruction).then((function(_) { + return $__0._canActivate(matchedInstruction); + })).then((function(result) { + if (!result) { + return false; + } + return $__0._canDeactivate(matchedInstruction).then((function(result) { + if (result) { + return $__0.commit(matchedInstruction).then((function(_) { + $__0._emitNavigationFinish(matchedInstruction.accumulatedUrl); + return true; + })); + } + })); + })); + }))); + })); + }, + _emitNavigationFinish: function(url) { + ObservableWrapper.callNext(this._subject, url); + }, + _afterPromiseFinishNavigating: function(promise) { + var $__0 = this; + return PromiseWrapper.catchError(promise.then((function(_) { + return $__0._finishNavigating(); + })), (function(err) { + $__0._finishNavigating(); + throw err; + })); + }, + _reuse: function(instruction) { + var $__0 = this; + if (isBlank(this._outlet)) { + return _resolveToFalse; + } + return this._outlet.canReuse(instruction).then((function(result) { + instruction.reuse = result; + if (isPresent($__0._outlet.childRouter) && isPresent(instruction.child)) { + return $__0._outlet.childRouter._reuse(instruction.child); + } + })); + }, + _canActivate: function(instruction) { + return canActivateOne(instruction, this._currentInstruction); + }, + _canDeactivate: function(instruction) { + var $__0 = this; + if (isBlank(this._outlet)) { + return _resolveToTrue; + } + var next; + if (isPresent(instruction) && instruction.reuse) { + next = _resolveToTrue; + } else { + next = this._outlet.canDeactivate(instruction); + } + return next.then((function(result) { + if (result == false) { + return false; + } + if (isPresent($__0._outlet.childRouter)) { + return $__0._outlet.childRouter._canDeactivate(isPresent(instruction) ? instruction.child : null); + } + return true; + })); + }, + commit: function(instruction) { + this._currentInstruction = instruction; + if (isPresent(this._outlet)) { + return this._outlet.commit(instruction); + } + return _resolveToTrue; + }, + _startNavigating: function() { + this.navigating = true; + }, + _finishNavigating: function() { + this.navigating = false; + }, + subscribe: function(onNext) { + ObservableWrapper.subscribe(this._subject, onNext); + }, + deactivate: function(instruction) { + if (isPresent(this._outlet)) { + return this._outlet.deactivate(instruction); + } + return _resolveToTrue; + }, + recognize: function(url) { + return this.registry.recognize(url, this.hostComponent); + }, + renavigate: function() { + if (isBlank(this.lastNavigationAttempt)) { + return this._currentNavigation; + } + return this.navigate(this.lastNavigationAttempt); + }, + generate: function(linkParams) { + var normalizedLinkParams = splitAndFlattenLinkParams(linkParams); + var first = ListWrapper.first(normalizedLinkParams); + var rest = ListWrapper.slice(normalizedLinkParams, 1); + var router = this; + if (first == '') { + while (isPresent(router.parent)) { + router = router.parent; + } + } else if (first == '..') { + router = router.parent; + while (ListWrapper.first(rest) == '..') { + rest = ListWrapper.slice(rest, 1); + router = router.parent; + if (isBlank(router)) { + throw new BaseException(("Link \"" + ListWrapper.toJSON(linkParams) + "\" has too many \"../\" segments.")); + } + } + } else if (first != '.') { + throw new BaseException(("Link \"" + ListWrapper.toJSON(linkParams) + "\" must start with \"/\", \"./\", or \"../\"")); + } + if (rest[rest.length - 1] == '') { + ListWrapper.removeLast(rest); + } + if (rest.length < 1) { + var msg = ("Link \"" + ListWrapper.toJSON(linkParams) + "\" must include a route name."); + throw new BaseException(msg); + } + var url = ''; + if (isPresent(router.parent) && isPresent(router.parent._currentInstruction)) { + url = router.parent._currentInstruction.capturedUrl; + } + return url + '/' + this.registry.generate(rest, router.hostComponent); + } + }, {}); + }()); + $__export("Router", Router); + RootRouter = (function($__super) { + function RootRouter(registry, pipeline, location, hostComponent) { + var $__0; + $traceurRuntime.superConstructor(RootRouter).call(this, registry, pipeline, null, hostComponent); + this._location = location; + this._location.subscribe(($__0 = this, function(change) { + return $__0.navigate(change['url']); + })); + this.registry.configFromComponent(hostComponent, true); + this.navigate(location.path()); + } + return ($traceurRuntime.createClass)(RootRouter, {commit: function(instruction) { + var $__0 = this; + return $traceurRuntime.superGet(this, RootRouter.prototype, "commit").call(this, instruction).then((function(_) { + $__0._location.go(instruction.accumulatedUrl); + })); + }}, {}, $__super); + }(Router)); + $__export("RootRouter", RootRouter); + ChildRouter = (function($__super) { + function ChildRouter(parent, hostComponent) { + $traceurRuntime.superConstructor(ChildRouter).call(this, parent.registry, parent._pipeline, parent, hostComponent); + this.parent = parent; + } + return ($traceurRuntime.createClass)(ChildRouter, {navigate: function(url) { + return this.parent.navigate(url); + }}, {}, $__super); + }(Router)); + SLASH = new RegExp('/'); + } + }; +}); + +System.register("angular2/src/router/router_link", ["angular2/src/core/annotations/decorators", "angular2/src/router/router", "angular2/src/router/location"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/router_link"; + var __decorate, + __metadata, + Directive, + Router, + Location, + RouterLink; + return { + setters: [function($__m) { + Directive = $__m.Directive; + }, function($__m) { + Router = $__m.Router; + }, function($__m) { + Location = $__m.Location; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + RouterLink = (($traceurRuntime.createClass)(function(_router, _location) { + this._router = _router; + this._location = _location; + }, { + set routeParams(changes) { + this._routeParams = changes; + this._navigationHref = this._router.generate(this._routeParams); + this.visibleHref = this._location.normalizeAbsolutely(this._navigationHref); + }, + onClick: function() { + this._router.navigate(this._navigationHref); + return false; + } + }, {})); + $__export("RouterLink", RouterLink); + $__export("RouterLink", RouterLink = __decorate([Directive({ + selector: '[router-link]', + properties: ['routeParams: routerLink'], + host: { + '(^click)': 'onClick()', + '[attr.href]': 'visibleHref' + } + }), __metadata('design:paramtypes', [Router, Location])], RouterLink)); + } + }; +}); + +System.register("angular2/src/router/route_recognizer", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/router/path_recognizer", "angular2/src/router/route_config_impl", "angular2/src/router/async_route_handler", "angular2/src/router/sync_route_handler", "angular2/src/router/helpers"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/route_recognizer"; + var RegExpWrapper, + isBlank, + isPresent, + isType, + isStringMap, + BaseException, + Map, + MapWrapper, + StringMapWrapper, + PathRecognizer, + Route, + AsyncRoute, + Redirect, + AsyncRouteHandler, + SyncRouteHandler, + parseAndAssignParamString, + RouteRecognizer, + RouteMatch; + function configObjToHandler(config) { + if (isType(config)) { + return new SyncRouteHandler(config); + } else if (isStringMap(config)) { + if (isBlank(config['type'])) { + throw new BaseException("Component declaration when provided as a map should include a 'type' property"); + } + var componentType = config['type']; + if (componentType == 'constructor') { + return new SyncRouteHandler(config['constructor']); + } else if (componentType == 'loader') { + return new AsyncRouteHandler(config['loader']); + } else { + throw new BaseException("oops"); + } + } + throw new BaseException(("Unexpected component \"" + config + "\".")); + } + return { + setters: [function($__m) { + RegExpWrapper = $__m.RegExpWrapper; + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + isType = $__m.isType; + isStringMap = $__m.isStringMap; + BaseException = $__m.BaseException; + }, function($__m) { + Map = $__m.Map; + MapWrapper = $__m.MapWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + PathRecognizer = $__m.PathRecognizer; + }, function($__m) { + Route = $__m.Route; + AsyncRoute = $__m.AsyncRoute; + Redirect = $__m.Redirect; + }, function($__m) { + AsyncRouteHandler = $__m.AsyncRouteHandler; + }, function($__m) { + SyncRouteHandler = $__m.SyncRouteHandler; + }, function($__m) { + parseAndAssignParamString = $__m.parseAndAssignParamString; + }], + execute: function() { + RouteRecognizer = (function() { + function RouteRecognizer() { + var isRoot = arguments[0] !== (void 0) ? arguments[0] : false; + this.isRoot = isRoot; + this.names = new Map(); + this.redirects = new Map(); + this.matchers = new Map(); + } + return ($traceurRuntime.createClass)(RouteRecognizer, { + config: function(config) { + var handler; + if (config instanceof Redirect) { + var path = config.path == '/' ? '' : config.path; + this.redirects.set(path, config.redirectTo); + return true; + } else if (config instanceof Route) { + handler = new SyncRouteHandler(config.component); + } else if (config instanceof AsyncRoute) { + handler = new AsyncRouteHandler(config.loader); + } + var recognizer = new PathRecognizer(config.path, handler, this.isRoot); + MapWrapper.forEach(this.matchers, (function(matcher, _) { + if (recognizer.regex.toString() == matcher.regex.toString()) { + throw new BaseException(("Configuration '" + config.path + "' conflicts with existing route '" + matcher.path + "'")); + } + })); + this.matchers.set(recognizer.regex, recognizer); + if (isPresent(config.as)) { + this.names.set(config.as, recognizer); + } + return recognizer.terminal; + }, + recognize: function(url) { + var solutions = []; + if (url.length > 0 && url[url.length - 1] == '/') { + url = url.substring(0, url.length - 1); + } + MapWrapper.forEach(this.redirects, (function(target, path) { + if (path == '/' || path == '') { + if (path == url) { + url = target; + } + } else if (url.startsWith(path)) { + url = target + url.substring(path.length); + } + })); + var queryParams = StringMapWrapper.create(); + var queryString = ''; + var queryIndex = url.indexOf('?'); + if (queryIndex >= 0) { + queryString = url.substring(queryIndex + 1); + url = url.substring(0, queryIndex); + } + if (this.isRoot && queryString.length > 0) { + parseAndAssignParamString('&', queryString, queryParams); + } + MapWrapper.forEach(this.matchers, (function(pathRecognizer, regex) { + var match; + if (isPresent(match = RegExpWrapper.firstMatch(regex, url))) { + var matchedUrl = '/'; + var unmatchedUrl = ''; + if (url != '/') { + matchedUrl = match[0]; + unmatchedUrl = url.substring(match[0].length); + } + var params = null; + if (pathRecognizer.terminal && !StringMapWrapper.isEmpty(queryParams)) { + params = queryParams; + matchedUrl += '?' + queryString; + } + solutions.push(new RouteMatch(pathRecognizer, matchedUrl, unmatchedUrl, params)); + } + })); + return solutions; + }, + hasRoute: function(name) { + return this.names.has(name); + }, + generate: function(name, params) { + var pathRecognizer = this.names.get(name); + if (isBlank(pathRecognizer)) { + return null; + } + var url = pathRecognizer.generate(params); + return { + url: url, + 'nextComponent': pathRecognizer.handler.componentType + }; + } + }, {}); + }()); + $__export("RouteRecognizer", RouteRecognizer); + RouteMatch = (function() { + function RouteMatch(recognizer, matchedUrl, unmatchedUrl) { + var p = arguments[3] !== (void 0) ? arguments[3] : null; + this.recognizer = recognizer; + this.matchedUrl = matchedUrl; + this.unmatchedUrl = unmatchedUrl; + this._paramsParsed = false; + this._params = isPresent(p) ? p : StringMapWrapper.create(); + } + return ($traceurRuntime.createClass)(RouteMatch, {params: function() { + var $__0 = this; + if (!this._paramsParsed) { + this._paramsParsed = true; + StringMapWrapper.forEach(this.recognizer.parseParams(this.matchedUrl), (function(value, key) { + StringMapWrapper.set($__0._params, key, value); + })); + } + return this._params; + }}, {}); + }()); + $__export("RouteMatch", RouteMatch); + } + }; +}); + +System.register("angular2/src/di/injector", ["angular2/src/facade/collection", "angular2/src/di/binding", "angular2/src/di/exceptions", "angular2/src/facade/lang", "angular2/src/di/key", "angular2/src/di/forward_ref", "angular2/src/di/metadata"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/di/injector"; + var Map, + List, + MapWrapper, + ListWrapper, + ResolvedBinding, + Binding, + BindingBuilder, + bind, + AbstractBindingError, + NoBindingError, + CyclicDependencyError, + InstantiationError, + InvalidBindingError, + OutOfBoundsError, + Type, + isPresent, + CONST_EXPR, + Key, + resolveForwardRef, + DEFAULT_VISIBILITY, + SelfMetadata, + AncestorMetadata, + _constructing, + _notFound, + _MAX_CONSTRUCTION_COUNTER, + undefinedValue, + PUBLIC, + PRIVATE, + PUBLIC_AND_PRIVATE, + ProtoInjectorInlineStrategy, + ProtoInjectorDynamicStrategy, + ProtoInjector, + InjectorInlineStrategy, + InjectorDynamicStrategy, + BindingWithVisibility, + Injector, + INJECTOR_KEY; + function _resolveBindings(bindings) { + var resolvedList = ListWrapper.createFixedSize(bindings.length); + for (var i = 0; i < bindings.length; i++) { + var unresolved = resolveForwardRef(bindings[i]); + var resolved = void 0; + if (unresolved instanceof ResolvedBinding) { + resolved = unresolved; + } else if (unresolved instanceof Type) { + resolved = bind(unresolved).toClass(unresolved).resolve(); + } else if (unresolved instanceof Binding) { + resolved = unresolved.resolve(); + } else if (unresolved instanceof List) { + resolved = _resolveBindings(unresolved); + } else if (unresolved instanceof BindingBuilder) { + throw new InvalidBindingError(unresolved.token); + } else { + throw new InvalidBindingError(unresolved); + } + resolvedList[i] = resolved; + } + return resolvedList; + } + function _createListOfBindings(flattenedBindings) { + return MapWrapper.values(flattenedBindings); + } + function _flattenBindings(bindings, res) { + ListWrapper.forEach(bindings, function(b) { + if (b instanceof ResolvedBinding) { + res.set(b.key.id, b); + } else if (b instanceof List) { + _flattenBindings(b, res); + } + }); + return res; + } + function _mapBindings(injector, fn) { + var res = []; + for (var i = 0; i < injector._proto.numberOfBindings; ++i) { + res.push(fn(injector._proto.getBindingAtIndex(i))); + } + return res; + } + return { + setters: [function($__m) { + Map = $__m.Map; + List = $__m.List; + MapWrapper = $__m.MapWrapper; + ListWrapper = $__m.ListWrapper; + }, function($__m) { + ResolvedBinding = $__m.ResolvedBinding; + Binding = $__m.Binding; + BindingBuilder = $__m.BindingBuilder; + bind = $__m.bind; + }, function($__m) { + AbstractBindingError = $__m.AbstractBindingError; + NoBindingError = $__m.NoBindingError; + CyclicDependencyError = $__m.CyclicDependencyError; + InstantiationError = $__m.InstantiationError; + InvalidBindingError = $__m.InvalidBindingError; + OutOfBoundsError = $__m.OutOfBoundsError; + }, function($__m) { + Type = $__m.Type; + isPresent = $__m.isPresent; + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + Key = $__m.Key; + }, function($__m) { + resolveForwardRef = $__m.resolveForwardRef; + }, function($__m) { + DEFAULT_VISIBILITY = $__m.DEFAULT_VISIBILITY; + SelfMetadata = $__m.SelfMetadata; + AncestorMetadata = $__m.AncestorMetadata; + }], + execute: function() { + _constructing = CONST_EXPR(new Object()); + _notFound = CONST_EXPR(new Object()); + _MAX_CONSTRUCTION_COUNTER = 10; + undefinedValue = CONST_EXPR(new Object()); + $__export("undefinedValue", undefinedValue); + PUBLIC = 1; + $__export("PUBLIC", PUBLIC); + PRIVATE = 2; + $__export("PRIVATE", PRIVATE); + PUBLIC_AND_PRIVATE = 3; + $__export("PUBLIC_AND_PRIVATE", PUBLIC_AND_PRIVATE); + ProtoInjectorInlineStrategy = (function() { + function ProtoInjectorInlineStrategy(protoEI, bwv) { + this.binding0 = null; + this.binding1 = null; + this.binding2 = null; + this.binding3 = null; + this.binding4 = null; + this.binding5 = null; + this.binding6 = null; + this.binding7 = null; + this.binding8 = null; + this.binding9 = null; + this.keyId0 = null; + this.keyId1 = null; + this.keyId2 = null; + this.keyId3 = null; + this.keyId4 = null; + this.keyId5 = null; + this.keyId6 = null; + this.keyId7 = null; + this.keyId8 = null; + this.keyId9 = null; + this.visibility0 = null; + this.visibility1 = null; + this.visibility2 = null; + this.visibility3 = null; + this.visibility4 = null; + this.visibility5 = null; + this.visibility6 = null; + this.visibility7 = null; + this.visibility8 = null; + this.visibility9 = null; + var length = bwv.length; + if (length > 0) { + this.binding0 = bwv[0].binding; + this.keyId0 = bwv[0].getKeyId(); + this.visibility0 = bwv[0].visibility; + } + if (length > 1) { + this.binding1 = bwv[1].binding; + this.keyId1 = bwv[1].getKeyId(); + this.visibility1 = bwv[1].visibility; + } + if (length > 2) { + this.binding2 = bwv[2].binding; + this.keyId2 = bwv[2].getKeyId(); + this.visibility2 = bwv[2].visibility; + } + if (length > 3) { + this.binding3 = bwv[3].binding; + this.keyId3 = bwv[3].getKeyId(); + this.visibility3 = bwv[3].visibility; + } + if (length > 4) { + this.binding4 = bwv[4].binding; + this.keyId4 = bwv[4].getKeyId(); + this.visibility4 = bwv[4].visibility; + } + if (length > 5) { + this.binding5 = bwv[5].binding; + this.keyId5 = bwv[5].getKeyId(); + this.visibility5 = bwv[5].visibility; + } + if (length > 6) { + this.binding6 = bwv[6].binding; + this.keyId6 = bwv[6].getKeyId(); + this.visibility6 = bwv[6].visibility; + } + if (length > 7) { + this.binding7 = bwv[7].binding; + this.keyId7 = bwv[7].getKeyId(); + this.visibility7 = bwv[7].visibility; + } + if (length > 8) { + this.binding8 = bwv[8].binding; + this.keyId8 = bwv[8].getKeyId(); + this.visibility8 = bwv[8].visibility; + } + if (length > 9) { + this.binding9 = bwv[9].binding; + this.keyId9 = bwv[9].getKeyId(); + this.visibility9 = bwv[9].visibility; + } + } + return ($traceurRuntime.createClass)(ProtoInjectorInlineStrategy, { + getBindingAtIndex: function(index) { + if (index == 0) + return this.binding0; + if (index == 1) + return this.binding1; + if (index == 2) + return this.binding2; + if (index == 3) + return this.binding3; + if (index == 4) + return this.binding4; + if (index == 5) + return this.binding5; + if (index == 6) + return this.binding6; + if (index == 7) + return this.binding7; + if (index == 8) + return this.binding8; + if (index == 9) + return this.binding9; + throw new OutOfBoundsError(index); + }, + createInjectorStrategy: function(injector) { + return new InjectorInlineStrategy(injector, this); + } + }, {}); + }()); + $__export("ProtoInjectorInlineStrategy", ProtoInjectorInlineStrategy); + ProtoInjectorDynamicStrategy = (function() { + function ProtoInjectorDynamicStrategy(protoInj, bwv) { + var len = bwv.length; + this.bindings = ListWrapper.createFixedSize(len); + this.keyIds = ListWrapper.createFixedSize(len); + this.visibilities = ListWrapper.createFixedSize(len); + for (var i = 0; i < len; i++) { + this.bindings[i] = bwv[i].binding; + this.keyIds[i] = bwv[i].getKeyId(); + this.visibilities[i] = bwv[i].visibility; + } + } + return ($traceurRuntime.createClass)(ProtoInjectorDynamicStrategy, { + getBindingAtIndex: function(index) { + if (index < 0 || index >= this.bindings.length) { + throw new OutOfBoundsError(index); + } + return this.bindings[index]; + }, + createInjectorStrategy: function(ei) { + return new InjectorDynamicStrategy(this, ei); + } + }, {}); + }()); + $__export("ProtoInjectorDynamicStrategy", ProtoInjectorDynamicStrategy); + ProtoInjector = (function() { + function ProtoInjector(bwv) { + this.numberOfBindings = bwv.length; + this._strategy = bwv.length > _MAX_CONSTRUCTION_COUNTER ? new ProtoInjectorDynamicStrategy(this, bwv) : new ProtoInjectorInlineStrategy(this, bwv); + } + return ($traceurRuntime.createClass)(ProtoInjector, {getBindingAtIndex: function(index) { + return this._strategy.getBindingAtIndex(index); + }}, {}); + }()); + $__export("ProtoInjector", ProtoInjector); + InjectorInlineStrategy = (function() { + function InjectorInlineStrategy(injector, protoStrategy) { + this.injector = injector; + this.protoStrategy = protoStrategy; + this.obj0 = undefinedValue; + this.obj1 = undefinedValue; + this.obj2 = undefinedValue; + this.obj3 = undefinedValue; + this.obj4 = undefinedValue; + this.obj5 = undefinedValue; + this.obj6 = undefinedValue; + this.obj7 = undefinedValue; + this.obj8 = undefinedValue; + this.obj9 = undefinedValue; + } + return ($traceurRuntime.createClass)(InjectorInlineStrategy, { + resetConstructionCounter: function() { + this.injector._constructionCounter = 0; + }, + instantiateBinding: function(binding, visibility) { + return this.injector._new(binding, visibility); + }, + attach: function(parent, isBoundary) { + var inj = this.injector; + inj._parent = parent; + inj._isBoundary = isBoundary; + }, + getObjByKeyId: function(keyId, visibility) { + var p = this.protoStrategy; + var inj = this.injector; + if (p.keyId0 === keyId && (p.visibility0 & visibility) > 0) { + if (this.obj0 === undefinedValue) { + this.obj0 = inj._new(p.binding0, p.visibility0); + } + return this.obj0; + } + if (p.keyId1 === keyId && (p.visibility1 & visibility) > 0) { + if (this.obj1 === undefinedValue) { + this.obj1 = inj._new(p.binding1, p.visibility1); + } + return this.obj1; + } + if (p.keyId2 === keyId && (p.visibility2 & visibility) > 0) { + if (this.obj2 === undefinedValue) { + this.obj2 = inj._new(p.binding2, p.visibility2); + } + return this.obj2; + } + if (p.keyId3 === keyId && (p.visibility3 & visibility) > 0) { + if (this.obj3 === undefinedValue) { + this.obj3 = inj._new(p.binding3, p.visibility3); + } + return this.obj3; + } + if (p.keyId4 === keyId && (p.visibility4 & visibility) > 0) { + if (this.obj4 === undefinedValue) { + this.obj4 = inj._new(p.binding4, p.visibility4); + } + return this.obj4; + } + if (p.keyId5 === keyId && (p.visibility5 & visibility) > 0) { + if (this.obj5 === undefinedValue) { + this.obj5 = inj._new(p.binding5, p.visibility5); + } + return this.obj5; + } + if (p.keyId6 === keyId && (p.visibility6 & visibility) > 0) { + if (this.obj6 === undefinedValue) { + this.obj6 = inj._new(p.binding6, p.visibility6); + } + return this.obj6; + } + if (p.keyId7 === keyId && (p.visibility7 & visibility) > 0) { + if (this.obj7 === undefinedValue) { + this.obj7 = inj._new(p.binding7, p.visibility7); + } + return this.obj7; + } + if (p.keyId8 === keyId && (p.visibility8 & visibility) > 0) { + if (this.obj8 === undefinedValue) { + this.obj8 = inj._new(p.binding8, p.visibility8); + } + return this.obj8; + } + if (p.keyId9 === keyId && (p.visibility9 & visibility) > 0) { + if (this.obj9 === undefinedValue) { + this.obj9 = inj._new(p.binding9, p.visibility9); + } + return this.obj9; + } + return undefinedValue; + }, + getObjAtIndex: function(index) { + if (index == 0) + return this.obj0; + if (index == 1) + return this.obj1; + if (index == 2) + return this.obj2; + if (index == 3) + return this.obj3; + if (index == 4) + return this.obj4; + if (index == 5) + return this.obj5; + if (index == 6) + return this.obj6; + if (index == 7) + return this.obj7; + if (index == 8) + return this.obj8; + if (index == 9) + return this.obj9; + throw new OutOfBoundsError(index); + }, + getMaxNumberOfObjects: function() { + return _MAX_CONSTRUCTION_COUNTER; + } + }, {}); + }()); + $__export("InjectorInlineStrategy", InjectorInlineStrategy); + InjectorDynamicStrategy = (function() { + function InjectorDynamicStrategy(protoStrategy, injector) { + this.protoStrategy = protoStrategy; + this.injector = injector; + this.objs = ListWrapper.createFixedSize(protoStrategy.bindings.length); + ListWrapper.fill(this.objs, undefinedValue); + } + return ($traceurRuntime.createClass)(InjectorDynamicStrategy, { + resetConstructionCounter: function() { + this.injector._constructionCounter = 0; + }, + instantiateBinding: function(binding, visibility) { + return this.injector._new(binding, visibility); + }, + attach: function(parent, isBoundary) { + var inj = this.injector; + inj._parent = parent; + inj._isBoundary = isBoundary; + }, + getObjByKeyId: function(keyId, visibility) { + var p = this.protoStrategy; + for (var i = 0; i < p.keyIds.length; i++) { + if (p.keyIds[i] === keyId && (p.visibilities[i] & visibility) > 0) { + if (this.objs[i] === undefinedValue) { + this.objs[i] = this.injector._new(p.bindings[i], p.visibilities[i]); + } + return this.objs[i]; + } + } + return undefinedValue; + }, + getObjAtIndex: function(index) { + if (index < 0 || index >= this.objs.length) { + throw new OutOfBoundsError(index); + } + return this.objs[index]; + }, + getMaxNumberOfObjects: function() { + return this.objs.length; + } + }, {}); + }()); + $__export("InjectorDynamicStrategy", InjectorDynamicStrategy); + BindingWithVisibility = (function() { + function BindingWithVisibility(binding, visibility) { + this.binding = binding; + this.visibility = visibility; + } + return ($traceurRuntime.createClass)(BindingWithVisibility, {getKeyId: function() { + return this.binding.key.id; + }}, {}); + }()); + $__export("BindingWithVisibility", BindingWithVisibility); + Injector = (function() { + function Injector(_proto) { + var _parent = arguments[1] !== (void 0) ? arguments[1] : null; + var _depProvider = arguments[2] !== (void 0) ? arguments[2] : null; + var _debugContext = arguments[3] !== (void 0) ? arguments[3] : null; + this._proto = _proto; + this._parent = _parent; + this._depProvider = _depProvider; + this._debugContext = _debugContext; + this._isBoundary = false; + this._constructionCounter = 0; + this._strategy = _proto._strategy.createInjectorStrategy(this); + } + return ($traceurRuntime.createClass)(Injector, { + debugContext: function() { + return this._debugContext(); + }, + get: function(token) { + return this._getByKey(Key.get(token), DEFAULT_VISIBILITY, false, PUBLIC_AND_PRIVATE); + }, + getOptional: function(token) { + return this._getByKey(Key.get(token), DEFAULT_VISIBILITY, true, PUBLIC_AND_PRIVATE); + }, + getAt: function(index) { + return this._strategy.getObjAtIndex(index); + }, + get parent() { + return this._parent; + }, + get internalStrategy() { + return this._strategy; + }, + resolveAndCreateChild: function(bindings) { + var depProvider = arguments[1] !== (void 0) ? arguments[1] : null; + var resovledBindings = Injector.resolve(bindings); + return this.createChildFromResolved(resovledBindings, depProvider); + }, + createChildFromResolved: function(bindings) { + var depProvider = arguments[1] !== (void 0) ? arguments[1] : null; + var bd = bindings.map((function(b) { + return new BindingWithVisibility(b, PUBLIC); + })); + var proto = new ProtoInjector(bd); + var inj = new Injector(proto, null, depProvider); + inj._parent = this; + return inj; + }, + _new: function(binding, visibility) { + if (this._constructionCounter++ > this._strategy.getMaxNumberOfObjects()) { + throw new CyclicDependencyError(this, binding.key); + } + var factory = binding.factory; + var deps = binding.dependencies; + var length = deps.length; + var d0, + d1, + d2, + d3, + d4, + d5, + d6, + d7, + d8, + d9, + d10, + d11, + d12, + d13, + d14, + d15, + d16, + d17, + d18, + d19; + try { + d0 = length > 0 ? this._getByDependency(binding, deps[0], visibility) : null; + d1 = length > 1 ? this._getByDependency(binding, deps[1], visibility) : null; + d2 = length > 2 ? this._getByDependency(binding, deps[2], visibility) : null; + d3 = length > 3 ? this._getByDependency(binding, deps[3], visibility) : null; + d4 = length > 4 ? this._getByDependency(binding, deps[4], visibility) : null; + d5 = length > 5 ? this._getByDependency(binding, deps[5], visibility) : null; + d6 = length > 6 ? this._getByDependency(binding, deps[6], visibility) : null; + d7 = length > 7 ? this._getByDependency(binding, deps[7], visibility) : null; + d8 = length > 8 ? this._getByDependency(binding, deps[8], visibility) : null; + d9 = length > 9 ? this._getByDependency(binding, deps[9], visibility) : null; + d10 = length > 10 ? this._getByDependency(binding, deps[10], visibility) : null; + d11 = length > 11 ? this._getByDependency(binding, deps[11], visibility) : null; + d12 = length > 12 ? this._getByDependency(binding, deps[12], visibility) : null; + d13 = length > 13 ? this._getByDependency(binding, deps[13], visibility) : null; + d14 = length > 14 ? this._getByDependency(binding, deps[14], visibility) : null; + d15 = length > 15 ? this._getByDependency(binding, deps[15], visibility) : null; + d16 = length > 16 ? this._getByDependency(binding, deps[16], visibility) : null; + d17 = length > 17 ? this._getByDependency(binding, deps[17], visibility) : null; + d18 = length > 18 ? this._getByDependency(binding, deps[18], visibility) : null; + d19 = length > 19 ? this._getByDependency(binding, deps[19], visibility) : null; + } catch (e) { + if (e instanceof AbstractBindingError) { + e.addKey(this, binding.key); + } + throw e; + } + var obj; + try { + switch (length) { + case 0: + obj = factory(); + break; + case 1: + obj = factory(d0); + break; + case 2: + obj = factory(d0, d1); + break; + case 3: + obj = factory(d0, d1, d2); + break; + case 4: + obj = factory(d0, d1, d2, d3); + break; + case 5: + obj = factory(d0, d1, d2, d3, d4); + break; + case 6: + obj = factory(d0, d1, d2, d3, d4, d5); + break; + case 7: + obj = factory(d0, d1, d2, d3, d4, d5, d6); + break; + case 8: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7); + break; + case 9: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8); + break; + case 10: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9); + break; + case 11: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10); + break; + case 12: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11); + break; + case 13: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12); + break; + case 14: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13); + break; + case 15: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14); + break; + case 16: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15); + break; + case 17: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16); + break; + case 18: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17); + break; + case 19: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18); + break; + case 20: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18, d19); + break; + } + } catch (e) { + throw new InstantiationError(this, e, e.stack, binding.key); + } + return obj; + }, + _getByDependency: function(binding, dep, bindingVisibility) { + var special = isPresent(this._depProvider) ? this._depProvider.getDependency(this, binding, dep) : undefinedValue; + if (special !== undefinedValue) { + return special; + } else { + return this._getByKey(dep.key, dep.visibility, dep.optional, bindingVisibility); + } + }, + _getByKey: function(key, depVisibility, optional, bindingVisibility) { + if (key === INJECTOR_KEY) { + return this; + } + if (depVisibility instanceof SelfMetadata) { + return this._getByKeySelf(key, optional, bindingVisibility); + } else if (depVisibility instanceof AncestorMetadata) { + return this._getByKeyAncestor(key, optional, bindingVisibility, depVisibility.includeSelf); + } else { + return this._getByKeyUnbounded(key, optional, bindingVisibility, depVisibility.includeSelf); + } + }, + _throwOrNull: function(key, optional) { + if (optional) { + return null; + } else { + throw new NoBindingError(this, key); + } + }, + _getByKeySelf: function(key, optional, bindingVisibility) { + var obj = this._strategy.getObjByKeyId(key.id, bindingVisibility); + return (obj !== undefinedValue) ? obj : this._throwOrNull(key, optional); + }, + _getByKeyAncestor: function(key, optional, bindingVisibility, includeSelf) { + var inj = this; + if (!includeSelf) { + if (inj._isBoundary) { + return this._getPrivateDependency(key, optional, inj); + } else { + inj = inj._parent; + } + } + while (inj != null) { + var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility); + if (obj !== undefinedValue) + return obj; + if (isPresent(inj._parent) && inj._isBoundary) { + return this._getPrivateDependency(key, optional, inj); + } else { + inj = inj._parent; + } + } + return this._throwOrNull(key, optional); + }, + _getPrivateDependency: function(key, optional, inj) { + var obj = inj._parent._strategy.getObjByKeyId(key.id, PRIVATE); + return (obj !== undefinedValue) ? obj : this._throwOrNull(key, optional); + }, + _getByKeyUnbounded: function(key, optional, bindingVisibility, includeSelf) { + var inj = this; + if (!includeSelf) { + bindingVisibility = inj._isBoundary ? PUBLIC_AND_PRIVATE : PUBLIC; + inj = inj._parent; + } + while (inj != null) { + var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility); + if (obj !== undefinedValue) + return obj; + bindingVisibility = inj._isBoundary ? PUBLIC_AND_PRIVATE : PUBLIC; + inj = inj._parent; + } + return this._throwOrNull(key, optional); + }, + get displayName() { + return ("Injector(bindings: [" + _mapBindings(this, (function(b) { + return (" \"" + b.key.displayName + "\" "); + })).join(", ") + "])"); + }, + toString: function() { + return this.displayName; + } + }, { + resolve: function(bindings) { + var resolvedBindings = _resolveBindings(bindings); + var flatten = _flattenBindings(resolvedBindings, new Map()); + return _createListOfBindings(flatten); + }, + resolveAndCreate: function(bindings) { + var depProvider = arguments[1] !== (void 0) ? arguments[1] : null; + var resolvedBindings = Injector.resolve(bindings); + return Injector.fromResolvedBindings(resolvedBindings, depProvider); + }, + fromResolvedBindings: function(bindings) { + var depProvider = arguments[1] !== (void 0) ? arguments[1] : null; + var bd = bindings.map((function(b) { + return new BindingWithVisibility(b, PUBLIC); + })); + var proto = new ProtoInjector(bd); + var inj = new Injector(proto, null, depProvider); + return inj; + } + }); + }()); + $__export("Injector", Injector); + INJECTOR_KEY = Key.get(Injector); + } + }; +}); + +System.register("angular2/src/change_detection/change_detection_jit_generator", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/change_detection/abstract_change_detector", "angular2/src/change_detection/change_detection_util", "angular2/src/change_detection/proto_record", "angular2/src/change_detection/codegen_name_util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/change_detection_jit_generator"; + var BaseException, + ListWrapper, + AbstractChangeDetector, + ChangeDetectionUtil, + RecordType, + CodegenNameUtil, + sanitizeName, + ABSTRACT_CHANGE_DETECTOR, + UTIL, + DISPATCHER_ACCESSOR, + PIPES_ACCESSOR, + PROTOS_ACCESSOR, + DIRECTIVES_ACCESSOR, + IS_CHANGED_LOCAL, + CHANGES_LOCAL, + LOCALS_ACCESSOR, + MODE_ACCESSOR, + CURRENT_PROTO, + ALREADY_CHECKED_ACCESSOR, + ChangeDetectorJITGenerator; + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + AbstractChangeDetector = $__m.AbstractChangeDetector; + }, function($__m) { + ChangeDetectionUtil = $__m.ChangeDetectionUtil; + }, function($__m) { + RecordType = $__m.RecordType; + }, function($__m) { + CodegenNameUtil = $__m.CodegenNameUtil; + sanitizeName = $__m.sanitizeName; + }], + execute: function() { + ABSTRACT_CHANGE_DETECTOR = "AbstractChangeDetector"; + UTIL = "ChangeDetectionUtil"; + DISPATCHER_ACCESSOR = "this.dispatcher"; + PIPES_ACCESSOR = "this.pipes"; + PROTOS_ACCESSOR = "this.protos"; + DIRECTIVES_ACCESSOR = "this.directiveRecords"; + IS_CHANGED_LOCAL = "isChanged"; + CHANGES_LOCAL = "changes"; + LOCALS_ACCESSOR = "this.locals"; + MODE_ACCESSOR = "this.mode"; + CURRENT_PROTO = "this.currentProto"; + ALREADY_CHECKED_ACCESSOR = "this.alreadyChecked"; + ChangeDetectorJITGenerator = (function() { + function ChangeDetectorJITGenerator(id, changeDetectionStrategy, records, directiveRecords, generateCheckNoChanges) { + this.id = id; + this.changeDetectionStrategy = changeDetectionStrategy; + this.records = records; + this.directiveRecords = directiveRecords; + this.generateCheckNoChanges = generateCheckNoChanges; + this._names = new CodegenNameUtil(this.records, this.directiveRecords, 'this._', UTIL); + this._typeName = sanitizeName(("ChangeDetector_" + this.id)); + } + return ($traceurRuntime.createClass)(ChangeDetectorJITGenerator, { + generate: function() { + var $__0 = this; + var classDefinition = ("\n var " + this._typeName + " = function " + this._typeName + "(dispatcher, protos, directiveRecords) {\n " + ABSTRACT_CHANGE_DETECTOR + ".call(this, " + JSON.stringify(this.id) + ", dispatcher);\n " + PROTOS_ACCESSOR + " = protos;\n " + DIRECTIVES_ACCESSOR + " = directiveRecords;\n " + LOCALS_ACCESSOR + " = null;\n " + CURRENT_PROTO + " = null;\n " + PIPES_ACCESSOR + " = null;\n " + ALREADY_CHECKED_ACCESSOR + " = false;\n this.dehydrateDirectives(false);\n }\n\n " + this._typeName + ".prototype = Object.create(" + ABSTRACT_CHANGE_DETECTOR + ".prototype);\n\n " + this._typeName + ".prototype.detectChangesInRecords = function(throwOnChange) {\n if (!this.hydrated()) {\n " + UTIL + ".throwDehydrated();\n }\n try {\n this.__detectChangesInRecords(throwOnChange);\n } catch (e) {\n this.throwError(" + CURRENT_PROTO + ", e, e.stack);\n }\n }\n\n " + this._typeName + ".prototype.__detectChangesInRecords = function(throwOnChange) {\n " + CURRENT_PROTO + " = null;\n\n " + this._names.genInitLocals() + "\n var " + IS_CHANGED_LOCAL + " = false;\n var " + CHANGES_LOCAL + " = null;\n\n context = " + this._names.getContextName() + ";\n\n " + this.records.map((function(r) { + return $__0._genRecord(r); + })).join("\n") + "\n\n " + ALREADY_CHECKED_ACCESSOR + " = true;\n }\n\n " + this._genCheckNoChanges() + "\n\n " + this._typeName + ".prototype.callOnAllChangesDone = function() {\n " + this._genCallOnAllChangesDoneBody() + "\n }\n\n " + this._typeName + ".prototype.hydrate = function(context, locals, directives, pipes) {\n " + MODE_ACCESSOR + " = \"" + ChangeDetectionUtil.changeDetectionMode(this.changeDetectionStrategy) + "\";\n " + this._names.getContextName() + " = context;\n " + LOCALS_ACCESSOR + " = locals;\n this.hydrateDirectives(directives);\n " + PIPES_ACCESSOR + " = pipes;\n " + ALREADY_CHECKED_ACCESSOR + " = false;\n }\n\n " + this._maybeGenHydrateDirectives() + "\n\n " + this._typeName + ".prototype.dehydrate = function() {\n this.dehydrateDirectives(true);\n " + LOCALS_ACCESSOR + " = null;\n " + PIPES_ACCESSOR + " = null;\n }\n\n " + this._maybeGenDehydrateDirectives() + "\n\n " + this._typeName + ".prototype.hydrated = function() {\n return " + this._names.getContextName() + " !== null;\n }\n\n return function(dispatcher) {\n return new " + this._typeName + "(dispatcher, protos, directiveRecords);\n }\n "); + return new Function('AbstractChangeDetector', 'ChangeDetectionUtil', 'protos', 'directiveRecords', classDefinition)(AbstractChangeDetector, ChangeDetectionUtil, this.records, this.directiveRecords); + }, + _maybeGenDehydrateDirectives: function() { + var destroyPipesCode = this._names.genPipeOnDestroy(); + if (destroyPipesCode) { + destroyPipesCode = ("if (destroyPipes) { " + destroyPipesCode + " }"); + } + var dehydrateFieldsCode = this._names.genDehydrateFields(); + if (!destroyPipesCode && !dehydrateFieldsCode) + return ''; + return (this._typeName + ".prototype.dehydrateDirectives = function(destroyPipes) {\n " + destroyPipesCode + "\n " + dehydrateFieldsCode + "\n }"); + }, + _maybeGenHydrateDirectives: function() { + var hydrateDirectivesCode = this._genHydrateDirectives(); + var hydrateDetectorsCode = this._genHydrateDetectors(); + if (!hydrateDirectivesCode && !hydrateDetectorsCode) + return ''; + return (this._typeName + ".prototype.hydrateDirectives = function(directives) {\n " + hydrateDirectivesCode + "\n " + hydrateDetectorsCode + "\n }"); + }, + _genHydrateDirectives: function() { + var directiveFieldNames = this._names.getAllDirectiveNames(); + var lines = ListWrapper.createFixedSize(directiveFieldNames.length); + for (var i = 0, + iLen = directiveFieldNames.length; i < iLen; ++i) { + lines[i] = (directiveFieldNames[i] + " = directives.getDirectiveFor(" + DIRECTIVES_ACCESSOR + "[" + i + "].directiveIndex);"); + } + return lines.join('\n'); + }, + _genHydrateDetectors: function() { + var detectorFieldNames = this._names.getAllDetectorNames(); + var lines = ListWrapper.createFixedSize(detectorFieldNames.length); + for (var i = 0, + iLen = detectorFieldNames.length; i < iLen; ++i) { + lines[i] = (detectorFieldNames[i] + " =\n directives.getDetectorFor(" + DIRECTIVES_ACCESSOR + "[" + i + "].directiveIndex);"); + } + return lines.join('\n'); + }, + _genCallOnAllChangesDoneBody: function() { + var notifications = []; + var dirs = this.directiveRecords; + for (var i = dirs.length - 1; i >= 0; --i) { + var dir = dirs[i]; + if (dir.callOnAllChangesDone) { + notifications.push((this._names.getDirectiveName(dir.directiveIndex) + ".onAllChangesDone();")); + } + } + var directiveNotifications = notifications.join("\n"); + return ("\n this.dispatcher.notifyOnAllChangesDone();\n " + directiveNotifications + "\n "); + }, + _genRecord: function(r) { + var rec; + if (r.isLifeCycleRecord()) { + rec = this._genDirectiveLifecycle(r); + } else if (r.isPipeRecord()) { + rec = this._genPipeCheck(r); + } else { + rec = this._genReferenceCheck(r); + } + return ("" + rec + this._maybeGenLastInDirective(r)); + }, + _genDirectiveLifecycle: function(r) { + if (r.name === "onCheck") { + return this._genOnCheck(r); + } else if (r.name === "onInit") { + return this._genOnInit(r); + } else if (r.name === "onChange") { + return this._genOnChange(r); + } else { + throw new BaseException(("Unknown lifecycle event '" + r.name + "'")); + } + }, + _genPipeCheck: function(r) { + var $__0 = this; + var context = this._names.getLocalName(r.contextIndex); + var argString = r.args.map((function(arg) { + return $__0._names.getLocalName(arg); + })).join(", "); + var oldValue = this._names.getFieldName(r.selfIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var change = this._names.getChangeName(r.selfIndex); + var pipe = this._names.getPipeName(r.selfIndex); + var cdRef = "this.ref"; + var protoIndex = r.selfIndex - 1; + var pipeType = r.name; + return ("\n " + CURRENT_PROTO + " = " + PROTOS_ACCESSOR + "[" + protoIndex + "];\n if (" + pipe + " === " + UTIL + ".uninitialized) {\n " + pipe + " = " + PIPES_ACCESSOR + ".get('" + pipeType + "', " + context + ", " + cdRef + ");\n } else if (!" + pipe + ".supports(" + context + ")) {\n " + pipe + ".onDestroy();\n " + pipe + " = " + PIPES_ACCESSOR + ".get('" + pipeType + "', " + context + ", " + cdRef + ");\n }\n\n " + newValue + " = " + pipe + ".transform(" + context + ", [" + argString + "]);\n if (" + oldValue + " !== " + newValue + ") {\n " + newValue + " = " + UTIL + ".unwrapValue(" + newValue + ");\n " + change + " = true;\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n "); + }, + _genReferenceCheck: function(r) { + var $__0 = this; + var oldValue = this._names.getFieldName(r.selfIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var protoIndex = r.selfIndex - 1; + var check = ("\n " + CURRENT_PROTO + " = " + PROTOS_ACCESSOR + "[" + protoIndex + "];\n " + this._genUpdateCurrentValue(r) + "\n if (" + newValue + " !== " + oldValue + ") {\n " + this._names.getChangeName(r.selfIndex) + " = true;\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n "); + if (r.isPureFunction()) { + var condition = r.args.map((function(a) { + return $__0._names.getChangeName(a); + })).join(" || "); + return ("if (" + condition + ") { " + check + " } else { " + newValue + " = " + oldValue + "; }"); + } else { + return check; + } + }, + _genUpdateCurrentValue: function(r) { + var $__0 = this; + var context = (r.contextIndex == -1) ? this._names.getDirectiveName(r.directiveIndex) : this._names.getLocalName(r.contextIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var argString = r.args.map((function(arg) { + return $__0._names.getLocalName(arg); + })).join(", "); + var rhs; + switch (r.mode) { + case RecordType.SELF: + rhs = context; + break; + case RecordType.CONST: + rhs = JSON.stringify(r.funcOrValue); + break; + case RecordType.PROPERTY: + rhs = (context + "." + r.name); + break; + case RecordType.SAFE_PROPERTY: + rhs = (UTIL + ".isValueBlank(" + context + ") ? null : " + context + "." + r.name); + break; + case RecordType.LOCAL: + rhs = (LOCALS_ACCESSOR + ".get('" + r.name + "')"); + break; + case RecordType.INVOKE_METHOD: + rhs = (context + "." + r.name + "(" + argString + ")"); + break; + case RecordType.SAFE_INVOKE_METHOD: + rhs = (UTIL + ".isValueBlank(" + context + ") ? null : " + context + "." + r.name + "(" + argString + ")"); + break; + case RecordType.INVOKE_CLOSURE: + rhs = (context + "(" + argString + ")"); + break; + case RecordType.PRIMITIVE_OP: + rhs = (UTIL + "." + r.name + "(" + argString + ")"); + break; + case RecordType.INTERPOLATE: + rhs = this._genInterpolation(r); + break; + case RecordType.KEYED_ACCESS: + rhs = (context + "[" + this._names.getLocalName(r.args[0]) + "]"); + break; + default: + throw new BaseException(("Unknown operation " + r.mode)); + } + return (newValue + " = " + rhs); + }, + _genInterpolation: function(r) { + var res = ""; + for (var i = 0; i < r.args.length; ++i) { + res += JSON.stringify(r.fixedArgs[i]); + res += " + "; + res += (UTIL + ".s(" + this._names.getLocalName(r.args[i]) + ")"); + res += " + "; + } + res += JSON.stringify(r.fixedArgs[r.args.length]); + return res; + }, + _genUpdateDirectiveOrElement: function(r) { + if (!r.lastInBinding) + return ""; + var newValue = this._names.getLocalName(r.selfIndex); + var oldValue = this._names.getFieldName(r.selfIndex); + var br = r.bindingRecord; + if (br.isDirective()) { + var directiveProperty = (this._names.getDirectiveName(br.directiveRecord.directiveIndex) + "." + br.propertyName); + return ("\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n " + directiveProperty + " = " + newValue + ";\n " + IS_CHANGED_LOCAL + " = true;\n "); + } else { + return ("\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n " + DISPATCHER_ACCESSOR + ".notifyOnBinding(" + CURRENT_PROTO + ".bindingRecord, " + newValue + ");\n "); + } + }, + _genThrowOnChangeCheck: function(oldValue, newValue) { + if (this.generateCheckNoChanges) { + return ("\n if(throwOnChange) {\n " + UTIL + ".throwOnChange(" + CURRENT_PROTO + ", " + UTIL + ".simpleChange(" + oldValue + ", " + newValue + "));\n }\n "); + } else { + return ''; + } + }, + _genCheckNoChanges: function() { + if (this.generateCheckNoChanges) { + return (this._typeName + ".prototype.checkNoChanges = function() { this.runDetectChanges(true); }"); + } else { + return ''; + } + }, + _genAddToChanges: function(r) { + var newValue = this._names.getLocalName(r.selfIndex); + var oldValue = this._names.getFieldName(r.selfIndex); + if (!r.bindingRecord.callOnChange()) + return ""; + return ("\n " + CHANGES_LOCAL + " = " + UTIL + ".addChange(\n " + CHANGES_LOCAL + ", " + CURRENT_PROTO + ".bindingRecord.propertyName,\n " + UTIL + ".simpleChange(" + oldValue + ", " + newValue + "));\n "); + }, + _maybeGenLastInDirective: function(r) { + if (!r.lastInDirective) + return ""; + return ("\n " + CHANGES_LOCAL + " = null;\n " + this._genNotifyOnPushDetectors(r) + "\n " + IS_CHANGED_LOCAL + " = false;\n "); + }, + _genOnCheck: function(r) { + var br = r.bindingRecord; + return ("if (!throwOnChange) " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onCheck();"); + }, + _genOnInit: function(r) { + var br = r.bindingRecord; + return ("if (!throwOnChange && !" + ALREADY_CHECKED_ACCESSOR + ") " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onInit();"); + }, + _genOnChange: function(r) { + var br = r.bindingRecord; + return ("if (!throwOnChange && " + CHANGES_LOCAL + ") " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onChange(" + CHANGES_LOCAL + ");"); + }, + _genNotifyOnPushDetectors: function(r) { + var br = r.bindingRecord; + if (!r.lastInDirective || !br.isOnPushChangeDetection()) + return ""; + var retVal = ("\n if(" + IS_CHANGED_LOCAL + ") {\n " + this._names.getDetectorName(br.directiveRecord.directiveIndex) + ".markAsCheckOnce();\n }\n "); + return retVal; + } + }, {}); + }()); + $__export("ChangeDetectorJITGenerator", ChangeDetectorJITGenerator); + } + }; +}); + +System.register("angular2/src/core/compiler/element_injector", ["angular2/src/facade/lang", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/di", "angular2/src/di/injector", "angular2/src/core/annotations_impl/di", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/annotations_impl/annotations", "angular2/src/core/compiler/directive_lifecycle_reflector", "angular2/src/change_detection/change_detection", "angular2/src/core/compiler/query_list", "angular2/src/reflection/reflection", "angular2/src/render/api"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/element_injector"; + var isPresent, + isBlank, + BaseException, + stringify, + StringWrapper, + ObservableWrapper, + ListWrapper, + MapWrapper, + Injector, + ProtoInjector, + PUBLIC_AND_PRIVATE, + PUBLIC, + PRIVATE, + undefinedValue, + Key, + Dependency, + Binding, + ResolvedBinding, + NoBindingError, + InjectorInlineStrategy, + BindingWithVisibility, + Attribute, + Query, + avmModule, + ViewContainerRef, + ElementRef, + TemplateRef, + Directive, + Component, + LifecycleEvent, + hasLifecycleHook, + ChangeDetectorRef, + Pipes, + QueryList, + reflector, + DirectiveMetadata, + _staticKeys, + StaticKeys, + TreeNode, + DirectiveDependency, + DirectiveBinding, + PreBuiltObjects, + EventEmitterAccessor, + HostActionAccessor, + ProtoElementInjector, + _Context, + ElementInjector, + ElementInjectorInlineStrategy, + ElementInjectorDynamicStrategy, + QueryError, + QueryRef; + function _createEventEmitterAccessors(bwv) { + var binding = bwv.binding; + if (!(binding instanceof DirectiveBinding)) + return []; + var db = binding; + return ListWrapper.map(db.eventEmitters, (function(eventConfig) { + var fieldName; + var eventName; + var colonIdx = eventConfig.indexOf(':'); + if (colonIdx > -1) { + fieldName = StringWrapper.substring(eventConfig, 0, colonIdx).trim(); + eventName = StringWrapper.substring(eventConfig, colonIdx + 1).trim(); + } else { + fieldName = eventName = eventConfig; + } + return new EventEmitterAccessor(eventName, reflector.getter(fieldName)); + })); + } + function _createHostActionAccessors(bwv) { + var binding = bwv.binding; + if (!(binding instanceof DirectiveBinding)) + return []; + var res = []; + var db = binding; + MapWrapper.forEach(db.hostActions, (function(actionExpression, actionName) { + res.push(new HostActionAccessor(actionExpression, reflector.getter(actionName))); + })); + return res; + } + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + stringify = $__m.stringify; + StringWrapper = $__m.StringWrapper; + }, function($__m) { + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + MapWrapper = $__m.MapWrapper; + }, function($__m) { + Injector = $__m.Injector; + ProtoInjector = $__m.ProtoInjector; + PUBLIC_AND_PRIVATE = $__m.PUBLIC_AND_PRIVATE; + PUBLIC = $__m.PUBLIC; + PRIVATE = $__m.PRIVATE; + undefinedValue = $__m.undefinedValue; + Key = $__m.Key; + Dependency = $__m.Dependency; + Binding = $__m.Binding; + ResolvedBinding = $__m.ResolvedBinding; + NoBindingError = $__m.NoBindingError; + }, function($__m) { + InjectorInlineStrategy = $__m.InjectorInlineStrategy; + BindingWithVisibility = $__m.BindingWithVisibility; + }, function($__m) { + Attribute = $__m.Attribute; + Query = $__m.Query; + }, function($__m) { + avmModule = $__m; + }, function($__m) { + ViewContainerRef = $__m.ViewContainerRef; + }, function($__m) { + ElementRef = $__m.ElementRef; + }, function($__m) { + TemplateRef = $__m.TemplateRef; + }, function($__m) { + Directive = $__m.Directive; + Component = $__m.Component; + LifecycleEvent = $__m.LifecycleEvent; + }, function($__m) { + hasLifecycleHook = $__m.hasLifecycleHook; + }, function($__m) { + ChangeDetectorRef = $__m.ChangeDetectorRef; + Pipes = $__m.Pipes; + }, function($__m) { + QueryList = $__m.QueryList; + }, function($__m) { + reflector = $__m.reflector; + }, function($__m) { + DirectiveMetadata = $__m.DirectiveMetadata; + }], + execute: function() { + StaticKeys = (function() { + function StaticKeys() { + this.viewManagerId = Key.get(avmModule.AppViewManager).id; + this.templateRefId = Key.get(TemplateRef).id; + this.viewContainerId = Key.get(ViewContainerRef).id; + this.changeDetectorRefId = Key.get(ChangeDetectorRef).id; + this.elementRefId = Key.get(ElementRef).id; + this.pipesKey = Key.get(Pipes); + } + return ($traceurRuntime.createClass)(StaticKeys, {}, {instance: function() { + if (isBlank(_staticKeys)) + _staticKeys = new StaticKeys(); + return _staticKeys; + }}); + }()); + $__export("StaticKeys", StaticKeys); + TreeNode = (function() { + function TreeNode(parent) { + this._head = null; + this._tail = null; + this._next = null; + if (isPresent(parent)) + parent.addChild(this); + } + return ($traceurRuntime.createClass)(TreeNode, { + addChild: function(child) { + if (isPresent(this._tail)) { + this._tail._next = child; + this._tail = child; + } else { + this._tail = this._head = child; + } + child._next = null; + child._parent = this; + }, + addChildAfter: function(child, prevSibling) { + if (isBlank(prevSibling)) { + var prevHead = this._head; + this._head = child; + child._next = prevHead; + if (isBlank(this._tail)) + this._tail = child; + } else if (isBlank(prevSibling._next)) { + this.addChild(child); + return ; + } else { + child._next = prevSibling._next; + prevSibling._next = child; + } + child._parent = this; + }, + remove: function() { + if (isBlank(this.parent)) + return ; + var nextSibling = this._next; + var prevSibling = this._findPrev(); + if (isBlank(prevSibling)) { + this.parent._head = this._next; + } else { + prevSibling._next = this._next; + } + if (isBlank(nextSibling)) { + this._parent._tail = prevSibling; + } + this._parent = null; + this._next = null; + }, + _findPrev: function() { + var node = this.parent._head; + if (node == this) + return null; + while (node._next !== this) + node = node._next; + return node; + }, + get parent() { + return this._parent; + }, + get children() { + var res = []; + var child = this._head; + while (child != null) { + res.push(child); + child = child._next; + } + return res; + } + }, {}); + }()); + $__export("TreeNode", TreeNode); + DirectiveDependency = (function($__super) { + function DirectiveDependency(key, optional, visibility, properties, attributeName, queryDecorator) { + $traceurRuntime.superConstructor(DirectiveDependency).call(this, key, optional, visibility, properties); + this.attributeName = attributeName; + this.queryDecorator = queryDecorator; + this._verify(); + } + return ($traceurRuntime.createClass)(DirectiveDependency, {_verify: function() { + var count = 0; + if (isPresent(this.queryDecorator)) + count++; + if (isPresent(this.attributeName)) + count++; + if (count > 1) + throw new BaseException('A directive injectable can contain only one of the following @Attribute or @Query.'); + }}, { + createFrom: function(d) { + return new DirectiveDependency(d.key, d.optional, d.visibility, d.properties, DirectiveDependency._attributeName(d.properties), DirectiveDependency._query(d.properties)); + }, + _attributeName: function(properties) { + var p = ListWrapper.find(properties, (function(p) { + return p instanceof Attribute; + })); + return isPresent(p) ? p.attributeName : null; + }, + _query: function(properties) { + return ListWrapper.find(properties, (function(p) { + return p instanceof Query; + })); + } + }, $__super); + }(Dependency)); + $__export("DirectiveDependency", DirectiveDependency); + DirectiveBinding = (function($__super) { + function DirectiveBinding(key, factory, dependencies, resolvedHostInjectables, resolvedViewInjectables, metadata) { + $traceurRuntime.superConstructor(DirectiveBinding).call(this, key, factory, dependencies); + this.resolvedHostInjectables = resolvedHostInjectables; + this.resolvedViewInjectables = resolvedViewInjectables; + this.metadata = metadata; + } + return ($traceurRuntime.createClass)(DirectiveBinding, { + get callOnDestroy() { + return this.metadata.callOnDestroy; + }, + get callOnChange() { + return this.metadata.callOnChange; + }, + get callOnAllChangesDone() { + return this.metadata.callOnAllChangesDone; + }, + get displayName() { + return this.key.displayName; + }, + get eventEmitters() { + return isPresent(this.metadata) && isPresent(this.metadata.events) ? this.metadata.events : []; + }, + get hostActions() { + return isPresent(this.metadata) && isPresent(this.metadata.hostActions) ? this.metadata.hostActions : new Map(); + }, + get changeDetection() { + return this.metadata.changeDetection; + } + }, { + createFromBinding: function(binding, ann) { + if (isBlank(ann)) { + ann = new Directive(); + } + var rb = binding.resolve(); + var deps = ListWrapper.map(rb.dependencies, DirectiveDependency.createFrom); + var resolvedHostInjectables = isPresent(ann.hostInjector) ? Injector.resolve(ann.hostInjector) : []; + var resolvedViewInjectables = ann instanceof Component && isPresent(ann.viewInjector) ? Injector.resolve(ann.viewInjector) : []; + var metadata = DirectiveMetadata.create({ + id: stringify(rb.key.token), + type: ann instanceof Component ? DirectiveMetadata.COMPONENT_TYPE : DirectiveMetadata.DIRECTIVE_TYPE, + selector: ann.selector, + compileChildren: ann.compileChildren, + events: ann.events, + host: isPresent(ann.host) ? MapWrapper.createFromStringMap(ann.host) : null, + properties: ann.properties, + readAttributes: DirectiveBinding._readAttributes(deps), + callOnDestroy: hasLifecycleHook(LifecycleEvent.onDestroy, rb.key.token, ann), + callOnChange: hasLifecycleHook(LifecycleEvent.onChange, rb.key.token, ann), + callOnCheck: hasLifecycleHook(LifecycleEvent.onCheck, rb.key.token, ann), + callOnInit: hasLifecycleHook(LifecycleEvent.onInit, rb.key.token, ann), + callOnAllChangesDone: hasLifecycleHook(LifecycleEvent.onAllChangesDone, rb.key.token, ann), + changeDetection: ann instanceof Component ? ann.changeDetection : null, + exportAs: ann.exportAs + }); + return new DirectiveBinding(rb.key, rb.factory, deps, resolvedHostInjectables, resolvedViewInjectables, metadata); + }, + _readAttributes: function(deps) { + var readAttributes = []; + ListWrapper.forEach(deps, (function(dep) { + if (isPresent(dep.attributeName)) { + readAttributes.push(dep.attributeName); + } + })); + return readAttributes; + }, + createFromType: function(type, annotation) { + var binding = new Binding(type, {toClass: type}); + return DirectiveBinding.createFromBinding(binding, annotation); + } + }, $__super); + }(ResolvedBinding)); + $__export("DirectiveBinding", DirectiveBinding); + PreBuiltObjects = (function() { + function PreBuiltObjects(viewManager, view, elementRef, templateRef) { + this.viewManager = viewManager; + this.view = view; + this.elementRef = elementRef; + this.templateRef = templateRef; + } + return ($traceurRuntime.createClass)(PreBuiltObjects, {}, {}); + }()); + $__export("PreBuiltObjects", PreBuiltObjects); + EventEmitterAccessor = (function() { + function EventEmitterAccessor(eventName, getter) { + this.eventName = eventName; + this.getter = getter; + } + return ($traceurRuntime.createClass)(EventEmitterAccessor, {subscribe: function(view, boundElementIndex, directive) { + var $__0 = this; + var eventEmitter = this.getter(directive); + return ObservableWrapper.subscribe(eventEmitter, (function(eventObj) { + return view.triggerEventHandlers($__0.eventName, eventObj, boundElementIndex); + })); + }}, {}); + }()); + $__export("EventEmitterAccessor", EventEmitterAccessor); + HostActionAccessor = (function() { + function HostActionAccessor(methodName, getter) { + this.methodName = methodName; + this.getter = getter; + } + return ($traceurRuntime.createClass)(HostActionAccessor, {subscribe: function(view, boundElementIndex, directive) { + var $__0 = this; + var eventEmitter = this.getter(directive); + return ObservableWrapper.subscribe(eventEmitter, (function(actionArgs) { + return view.invokeElementMethod(boundElementIndex, $__0.methodName, actionArgs); + })); + }}, {}); + }()); + $__export("HostActionAccessor", HostActionAccessor); + ProtoElementInjector = (function() { + function ProtoElementInjector(parent, index, bwv, distanceToParent, _firstBindingIsComponent, directiveVariableBindings) { + this.parent = parent; + this.index = index; + this.distanceToParent = distanceToParent; + this._firstBindingIsComponent = _firstBindingIsComponent; + this.directiveVariableBindings = directiveVariableBindings; + var length = bwv.length; + this.protoInjector = new ProtoInjector(bwv); + this.eventEmitterAccessors = ListWrapper.createFixedSize(length); + this.hostActionAccessors = ListWrapper.createFixedSize(length); + for (var i = 0; i < length; ++i) { + this.eventEmitterAccessors[i] = _createEventEmitterAccessors(bwv[i]); + this.hostActionAccessors[i] = _createHostActionAccessors(bwv[i]); + } + } + return ($traceurRuntime.createClass)(ProtoElementInjector, { + instantiate: function(parent) { + return new ElementInjector(this, parent); + }, + directParent: function() { + return this.distanceToParent < 2 ? this.parent : null; + }, + get hasBindings() { + return this.eventEmitterAccessors.length > 0; + }, + getBindingAtIndex: function(index) { + return this.protoInjector.getBindingAtIndex(index); + } + }, { + create: function(parent, index, bindings, firstBindingIsComponent, distanceToParent, directiveVariableBindings) { + var bd = []; + ProtoElementInjector._createDirectiveBindingWithVisibility(bindings, bd, firstBindingIsComponent); + if (firstBindingIsComponent) { + ProtoElementInjector._createViewInjectorBindingWithVisibility(bindings, bd); + } + ProtoElementInjector._createHostInjectorBindingWithVisibility(bindings, bd, firstBindingIsComponent); + return new ProtoElementInjector(parent, index, bd, distanceToParent, firstBindingIsComponent, directiveVariableBindings); + }, + _createDirectiveBindingWithVisibility: function(dirBindings, bd, firstBindingIsComponent) { + ListWrapper.forEach(dirBindings, (function(dirBinding) { + bd.push(ProtoElementInjector._createBindingWithVisibility(firstBindingIsComponent, dirBinding, dirBindings, dirBinding)); + })); + }, + _createHostInjectorBindingWithVisibility: function(dirBindings, bd, firstBindingIsComponent) { + ListWrapper.forEach(dirBindings, (function(dirBinding) { + ListWrapper.forEach(dirBinding.resolvedHostInjectables, (function(b) { + bd.push(ProtoElementInjector._createBindingWithVisibility(firstBindingIsComponent, dirBinding, dirBindings, b)); + })); + })); + }, + _createBindingWithVisibility: function(firstBindingIsComponent, dirBinding, dirBindings, binding) { + var isComponent = firstBindingIsComponent && dirBindings[0] === dirBinding; + return new BindingWithVisibility(binding, isComponent ? PUBLIC_AND_PRIVATE : PUBLIC); + }, + _createViewInjectorBindingWithVisibility: function(bindings, bd) { + var db = bindings[0]; + ListWrapper.forEach(db.resolvedViewInjectables, (function(b) { + return bd.push(new BindingWithVisibility(b, PRIVATE)); + })); + } + }); + }()); + $__export("ProtoElementInjector", ProtoElementInjector); + _Context = (function() { + function _Context(element, componentElement, injector) { + this.element = element; + this.componentElement = componentElement; + this.injector = injector; + } + return ($traceurRuntime.createClass)(_Context, {}, {}); + }()); + ElementInjector = (function($__super) { + function ElementInjector(_proto, parent) { + var $__0; + $traceurRuntime.superConstructor(ElementInjector).call(this, parent); + this._proto = _proto; + this._preBuiltObjects = null; + this._injector = new Injector(this._proto.protoInjector, null, this, ($__0 = this, function() { + return $__0._debugContext(); + })); + var injectorStrategy = this._injector.internalStrategy; + this._strategy = injectorStrategy instanceof InjectorInlineStrategy ? new ElementInjectorInlineStrategy(injectorStrategy, this) : new ElementInjectorDynamicStrategy(injectorStrategy, this); + this.hydrated = false; + this._buildQueries(); + this._addParentQueries(); + } + return ($traceurRuntime.createClass)(ElementInjector, { + dehydrate: function() { + this.hydrated = false; + this._host = null; + this._preBuiltObjects = null; + this._strategy.callOnDestroy(); + this._strategy.dehydrate(); + }, + onAllChangesDone: function() { + if (isPresent(this._query0) && this._query0.originator === this) { + this._query0.list.fireCallbacks(); + } + if (isPresent(this._query1) && this._query1.originator === this) { + this._query1.list.fireCallbacks(); + } + if (isPresent(this._query2) && this._query2.originator === this) { + this._query2.list.fireCallbacks(); + } + }, + hydrate: function(imperativelyCreatedInjector, host, preBuiltObjects) { + this._host = host; + this._preBuiltObjects = preBuiltObjects; + this._reattachInjectors(imperativelyCreatedInjector); + this._strategy.hydrate(); + if (isPresent(host)) { + this._addViewQueries(host); + } + this._addDirectivesToQueries(); + this._addVarBindingsToQueries(); + this.hydrated = true; + }, + _debugContext: function() { + var p = this._preBuiltObjects; + var index = p.elementRef.boundElementIndex - p.view.elementOffset; + var c = this._preBuiltObjects.view.getDebugContext(index, null); + return isPresent(c) ? new _Context(c.element, c.componentElement, c.injector) : null; + }, + _reattachInjectors: function(imperativelyCreatedInjector) { + if (isPresent(this._parent)) { + if (isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, false); + this._reattachInjector(imperativelyCreatedInjector, this._parent._injector, false); + } else { + this._reattachInjector(this._injector, this._parent._injector, false); + } + } else if (isPresent(this._host)) { + if (isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, false); + this._reattachInjector(imperativelyCreatedInjector, this._host._injector, true); + } else { + this._reattachInjector(this._injector, this._host._injector, true); + } + } else { + if (isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, true); + } + } + }, + _reattachInjector: function(injector, parentInjector, isBoundary) { + injector.internalStrategy.attach(parentInjector, isBoundary); + }, + getPipes: function() { + var pipesKey = StaticKeys.instance().pipesKey; + return this._injector.getOptional(pipesKey); + }, + hasVariableBinding: function(name) { + var vb = this._proto.directiveVariableBindings; + return isPresent(vb) && vb.has(name); + }, + getVariableBinding: function(name) { + var index = this._proto.directiveVariableBindings.get(name); + return isPresent(index) ? this.getDirectiveAtIndex(index) : this.getElementRef(); + }, + get: function(token) { + return this._injector.get(token); + }, + hasDirective: function(type) { + return isPresent(this._injector.getOptional(type)); + }, + getEventEmitterAccessors: function() { + return this._proto.eventEmitterAccessors; + }, + getHostActionAccessors: function() { + return this._proto.hostActionAccessors; + }, + getDirectiveVariableBindings: function() { + return this._proto.directiveVariableBindings; + }, + getComponent: function() { + return this._strategy.getComponent(); + }, + getInjector: function() { + return this._injector; + }, + getElementRef: function() { + return this._preBuiltObjects.elementRef; + }, + getViewContainerRef: function() { + return new ViewContainerRef(this._preBuiltObjects.viewManager, this.getElementRef()); + }, + directParent: function() { + return this._proto.distanceToParent < 2 ? this.parent : null; + }, + isComponentKey: function(key) { + return this._strategy.isComponentKey(key); + }, + getDependency: function(injector, binding, dep) { + var key = dep.key; + if (!(dep instanceof DirectiveDependency)) + return undefinedValue; + if (!(binding instanceof DirectiveBinding)) + return undefinedValue; + var dirDep = dep; + var dirBin = binding; + var staticKeys = StaticKeys.instance(); + if (key.id === staticKeys.viewManagerId) + return this._preBuiltObjects.viewManager; + if (isPresent(dirDep.attributeName)) + return this._buildAttribute(dirDep); + if (isPresent(dirDep.queryDecorator)) + return this._findQuery(dirDep.queryDecorator).list; + if (dirDep.key.id === StaticKeys.instance().changeDetectorRefId) { + if (dirBin.metadata.type === DirectiveMetadata.COMPONENT_TYPE) { + var componentView = this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex); + return componentView.changeDetector.ref; + } else { + return this._preBuiltObjects.view.changeDetector.ref; + } + } + if (dirDep.key.id === StaticKeys.instance().elementRefId) { + return this.getElementRef(); + } + if (dirDep.key.id === StaticKeys.instance().viewContainerId) { + return this.getViewContainerRef(); + } + if (dirDep.key.id === StaticKeys.instance().templateRefId) { + if (isBlank(this._preBuiltObjects.templateRef)) { + if (dirDep.optional) { + return null; + } + throw new NoBindingError(null, dirDep.key); + } + return this._preBuiltObjects.templateRef; + } + return undefinedValue; + }, + _buildAttribute: function(dep) { + var attributes = this._proto.attributes; + if (isPresent(attributes) && attributes.has(dep.attributeName)) { + return attributes.get(dep.attributeName); + } else { + return null; + } + }, + _buildQueriesForDeps: function(deps) { + for (var i = 0; i < deps.length; i++) { + var dep = deps[i]; + if (isPresent(dep.queryDecorator)) { + this._createQueryRef(dep.queryDecorator); + } + } + }, + _addViewQueries: function(host) { + if (isPresent(host._query0) && host._query0.originator == host && host._query0.query.isViewQuery) + this._addViewQuery(host._query0); + if (isPresent(host._query1) && host._query1.originator == host && host._query1.query.isViewQuery) + this._addViewQuery(host._query1); + if (isPresent(host._query2) && host._query2.originator == host && host._query2.query.isViewQuery) + this._addViewQuery(host._query2); + }, + _addViewQuery: function(queryRef) { + if (!queryRef.query.descendants && isPresent(this.parent)) + return ; + this._assignQueryRef(queryRef); + }, + _addVarBindingsToQueries: function() { + this._addVarBindingsToQuery(this._query0); + this._addVarBindingsToQuery(this._query1); + this._addVarBindingsToQuery(this._query2); + }, + _addDirectivesToQueries: function() { + this._addDirectivesToQuery(this._query0); + this._addDirectivesToQuery(this._query1); + this._addDirectivesToQuery(this._query2); + }, + _addVarBindingsToQuery: function(queryRef) { + if (isBlank(queryRef) || !queryRef.query.isVarBindingQuery) + return ; + var vb = queryRef.query.varBindings; + for (var i = 0; i < vb.length; ++i) { + if (this.hasVariableBinding(vb[i])) { + queryRef.list.add(this.getVariableBinding(vb[i])); + } + } + }, + _addDirectivesToQuery: function(queryRef) { + if (isBlank(queryRef) || queryRef.query.isVarBindingQuery) + return ; + var matched = []; + this.addDirectivesMatchingQuery(queryRef.query, matched); + matched.forEach((function(s) { + return queryRef.list.add(s); + })); + }, + _createQueryRef: function(query) { + var queryList = new QueryList(); + if (isBlank(this._query0)) { + this._query0 = new QueryRef(query, queryList, this); + } else if (isBlank(this._query1)) { + this._query1 = new QueryRef(query, queryList, this); + } else if (isBlank(this._query2)) { + this._query2 = new QueryRef(query, queryList, this); + } else { + throw new QueryError(); + } + }, + addDirectivesMatchingQuery: function(query, list) { + this._strategy.addDirectivesMatchingQuery(query, list); + }, + _buildQueries: function() { + if (isPresent(this._proto)) { + this._strategy.buildQueries(); + } + }, + _findQuery: function(query) { + if (isPresent(this._query0) && this._query0.query === query) { + return this._query0; + } + if (isPresent(this._query1) && this._query1.query === query) { + return this._query1; + } + if (isPresent(this._query2) && this._query2.query === query) { + return this._query2; + } + throw new BaseException(("Cannot find query for directive " + query + ".")); + }, + _hasQuery: function(query) { + return this._query0 == query || this._query1 == query || this._query2 == query; + }, + link: function(parent) { + parent.addChild(this); + this._addParentQueries(); + }, + linkAfter: function(parent, prevSibling) { + parent.addChildAfter(this, prevSibling); + this._addParentQueries(); + }, + _addParentQueries: function() { + if (isBlank(this.parent)) + return ; + if (isPresent(this.parent._query0) && !this.parent._query0.query.isViewQuery) { + this._addQueryToTree(this.parent._query0); + if (this.hydrated) + this.parent._query0.update(); + } + if (isPresent(this.parent._query1) && !this.parent._query1.query.isViewQuery) { + this._addQueryToTree(this.parent._query1); + if (this.hydrated) + this.parent._query1.update(); + } + if (isPresent(this.parent._query2) && !this.parent._query2.query.isViewQuery) { + this._addQueryToTree(this.parent._query2); + if (this.hydrated) + this.parent._query2.update(); + } + }, + unlink: function() { + var queriesToUpdate = []; + if (isPresent(this.parent._query0)) { + this._pruneQueryFromTree(this.parent._query0); + queriesToUpdate.push(this.parent._query0); + } + if (isPresent(this.parent._query1)) { + this._pruneQueryFromTree(this.parent._query1); + queriesToUpdate.push(this.parent._query1); + } + if (isPresent(this.parent._query2)) { + this._pruneQueryFromTree(this.parent._query2); + queriesToUpdate.push(this.parent._query2); + } + this.remove(); + ListWrapper.forEach(queriesToUpdate, (function(q) { + return q.update(); + })); + }, + _pruneQueryFromTree: function(query) { + this._removeQueryRef(query); + var child = this._head; + while (isPresent(child)) { + child._pruneQueryFromTree(query); + child = child._next; + } + }, + _addQueryToTree: function(queryRef) { + if (queryRef.query.descendants == false) { + if (this == queryRef.originator) { + this._addQueryToTreeSelfAndRecurse(queryRef); + } else if (this.parent == queryRef.originator) { + this._assignQueryRef(queryRef); + } + } else { + this._addQueryToTreeSelfAndRecurse(queryRef); + } + }, + _addQueryToTreeSelfAndRecurse: function(queryRef) { + this._assignQueryRef(queryRef); + var child = this._head; + while (isPresent(child)) { + child._addQueryToTree(queryRef); + child = child._next; + } + }, + _assignQueryRef: function(query) { + if (isBlank(this._query0)) { + this._query0 = query; + return ; + } else if (isBlank(this._query1)) { + this._query1 = query; + return ; + } else if (isBlank(this._query2)) { + this._query2 = query; + return ; + } + throw new QueryError(); + }, + _removeQueryRef: function(query) { + if (this._query0 == query) + this._query0 = null; + if (this._query1 == query) + this._query1 = null; + if (this._query2 == query) + this._query2 = null; + }, + getDirectiveAtIndex: function(index) { + return this._injector.getAt(index); + }, + hasInstances: function() { + return this._proto.hasBindings && this.hydrated; + }, + getHost: function() { + return this._host; + }, + getBoundElementIndex: function() { + return this._proto.index; + } + }, {}, $__super); + }(TreeNode)); + $__export("ElementInjector", ElementInjector); + ElementInjectorInlineStrategy = (function() { + function ElementInjectorInlineStrategy(injectorStrategy, _ei) { + this.injectorStrategy = injectorStrategy; + this._ei = _ei; + } + return ($traceurRuntime.createClass)(ElementInjectorInlineStrategy, { + hydrate: function() { + var i = this.injectorStrategy; + var p = i.protoStrategy; + i.resetConstructionCounter(); + if (p.binding0 instanceof DirectiveBinding && isPresent(p.keyId0) && i.obj0 === undefinedValue) + i.obj0 = i.instantiateBinding(p.binding0, p.visibility0); + if (p.binding1 instanceof DirectiveBinding && isPresent(p.keyId1) && i.obj1 === undefinedValue) + i.obj1 = i.instantiateBinding(p.binding1, p.visibility1); + if (p.binding2 instanceof DirectiveBinding && isPresent(p.keyId2) && i.obj2 === undefinedValue) + i.obj2 = i.instantiateBinding(p.binding2, p.visibility2); + if (p.binding3 instanceof DirectiveBinding && isPresent(p.keyId3) && i.obj3 === undefinedValue) + i.obj3 = i.instantiateBinding(p.binding3, p.visibility3); + if (p.binding4 instanceof DirectiveBinding && isPresent(p.keyId4) && i.obj4 === undefinedValue) + i.obj4 = i.instantiateBinding(p.binding4, p.visibility4); + if (p.binding5 instanceof DirectiveBinding && isPresent(p.keyId5) && i.obj5 === undefinedValue) + i.obj5 = i.instantiateBinding(p.binding5, p.visibility5); + if (p.binding6 instanceof DirectiveBinding && isPresent(p.keyId6) && i.obj6 === undefinedValue) + i.obj6 = i.instantiateBinding(p.binding6, p.visibility6); + if (p.binding7 instanceof DirectiveBinding && isPresent(p.keyId7) && i.obj7 === undefinedValue) + i.obj7 = i.instantiateBinding(p.binding7, p.visibility7); + if (p.binding8 instanceof DirectiveBinding && isPresent(p.keyId8) && i.obj8 === undefinedValue) + i.obj8 = i.instantiateBinding(p.binding8, p.visibility8); + if (p.binding9 instanceof DirectiveBinding && isPresent(p.keyId9) && i.obj9 === undefinedValue) + i.obj9 = i.instantiateBinding(p.binding9, p.visibility9); + }, + dehydrate: function() { + var i = this.injectorStrategy; + i.obj0 = undefinedValue; + i.obj1 = undefinedValue; + i.obj2 = undefinedValue; + i.obj3 = undefinedValue; + i.obj4 = undefinedValue; + i.obj5 = undefinedValue; + i.obj6 = undefinedValue; + i.obj7 = undefinedValue; + i.obj8 = undefinedValue; + i.obj9 = undefinedValue; + }, + callOnDestroy: function() { + var i = this.injectorStrategy; + var p = i.protoStrategy; + if (p.binding0 instanceof DirectiveBinding && p.binding0.callOnDestroy) { + i.obj0.onDestroy(); + } + if (p.binding1 instanceof DirectiveBinding && p.binding1.callOnDestroy) { + i.obj1.onDestroy(); + } + if (p.binding2 instanceof DirectiveBinding && p.binding2.callOnDestroy) { + i.obj2.onDestroy(); + } + if (p.binding3 instanceof DirectiveBinding && p.binding3.callOnDestroy) { + i.obj3.onDestroy(); + } + if (p.binding4 instanceof DirectiveBinding && p.binding4.callOnDestroy) { + i.obj4.onDestroy(); + } + if (p.binding5 instanceof DirectiveBinding && p.binding5.callOnDestroy) { + i.obj5.onDestroy(); + } + if (p.binding6 instanceof DirectiveBinding && p.binding6.callOnDestroy) { + i.obj6.onDestroy(); + } + if (p.binding7 instanceof DirectiveBinding && p.binding7.callOnDestroy) { + i.obj7.onDestroy(); + } + if (p.binding8 instanceof DirectiveBinding && p.binding8.callOnDestroy) { + i.obj8.onDestroy(); + } + if (p.binding9 instanceof DirectiveBinding && p.binding9.callOnDestroy) { + i.obj9.onDestroy(); + } + }, + getComponent: function() { + return this.injectorStrategy.obj0; + }, + isComponentKey: function(key) { + return this._ei._proto._firstBindingIsComponent && isPresent(key) && key.id === this.injectorStrategy.protoStrategy.keyId0; + }, + buildQueries: function() { + var p = this.injectorStrategy.protoStrategy; + if (p.binding0 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding0.dependencies); + } + if (p.binding1 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding1.dependencies); + } + if (p.binding2 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding2.dependencies); + } + if (p.binding3 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding3.dependencies); + } + if (p.binding4 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding4.dependencies); + } + if (p.binding5 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding5.dependencies); + } + if (p.binding6 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding6.dependencies); + } + if (p.binding7 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding7.dependencies); + } + if (p.binding8 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding8.dependencies); + } + if (p.binding9 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding9.dependencies); + } + }, + addDirectivesMatchingQuery: function(query, list) { + var i = this.injectorStrategy; + var p = i.protoStrategy; + if (isPresent(p.binding0) && p.binding0.key.token === query.selector) { + if (i.obj0 === undefinedValue) + i.obj0 = i.instantiateBinding(p.binding0, p.visibility0); + list.push(i.obj0); + } + if (isPresent(p.binding1) && p.binding1.key.token === query.selector) { + if (i.obj1 === undefinedValue) + i.obj1 = i.instantiateBinding(p.binding1, p.visibility1); + list.push(i.obj1); + } + if (isPresent(p.binding2) && p.binding2.key.token === query.selector) { + if (i.obj2 === undefinedValue) + i.obj2 = i.instantiateBinding(p.binding2, p.visibility2); + list.push(i.obj2); + } + if (isPresent(p.binding3) && p.binding3.key.token === query.selector) { + if (i.obj3 === undefinedValue) + i.obj3 = i.instantiateBinding(p.binding3, p.visibility3); + list.push(i.obj3); + } + if (isPresent(p.binding4) && p.binding4.key.token === query.selector) { + if (i.obj4 === undefinedValue) + i.obj4 = i.instantiateBinding(p.binding4, p.visibility4); + list.push(i.obj4); + } + if (isPresent(p.binding5) && p.binding5.key.token === query.selector) { + if (i.obj5 === undefinedValue) + i.obj5 = i.instantiateBinding(p.binding5, p.visibility5); + list.push(i.obj5); + } + if (isPresent(p.binding6) && p.binding6.key.token === query.selector) { + if (i.obj6 === undefinedValue) + i.obj6 = i.instantiateBinding(p.binding6, p.visibility6); + list.push(i.obj6); + } + if (isPresent(p.binding7) && p.binding7.key.token === query.selector) { + if (i.obj7 === undefinedValue) + i.obj7 = i.instantiateBinding(p.binding7, p.visibility7); + list.push(i.obj7); + } + if (isPresent(p.binding8) && p.binding8.key.token === query.selector) { + if (i.obj8 === undefinedValue) + i.obj8 = i.instantiateBinding(p.binding8, p.visibility8); + list.push(i.obj8); + } + if (isPresent(p.binding9) && p.binding9.key.token === query.selector) { + if (i.obj9 === undefinedValue) + i.obj9 = i.instantiateBinding(p.binding9, p.visibility9); + list.push(i.obj9); + } + }, + getComponentBinding: function() { + var p = this.injectorStrategy.protoStrategy; + return p.binding0; + } + }, {}); + }()); + ElementInjectorDynamicStrategy = (function() { + function ElementInjectorDynamicStrategy(injectorStrategy, _ei) { + this.injectorStrategy = injectorStrategy; + this._ei = _ei; + } + return ($traceurRuntime.createClass)(ElementInjectorDynamicStrategy, { + hydrate: function() { + var inj = this.injectorStrategy; + var p = inj.protoStrategy; + for (var i = 0; i < p.keyIds.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding && isPresent(p.keyIds[i]) && inj.objs[i] === undefinedValue) { + inj.objs[i] = inj.instantiateBinding(p.bindings[i], p.visibilities[i]); + } + } + }, + dehydrate: function() { + var inj = this.injectorStrategy; + ListWrapper.fill(inj.objs, undefinedValue); + }, + callOnDestroy: function() { + var ist = this.injectorStrategy; + var p = ist.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding && p.bindings[i].callOnDestroy) { + ist.objs[i].onDestroy(); + } + } + }, + getComponent: function() { + return this.injectorStrategy.objs[0]; + }, + isComponentKey: function(key) { + var p = this.injectorStrategy.protoStrategy; + return this._ei._proto._firstBindingIsComponent && isPresent(key) && key.id === p.keyIds[0]; + }, + buildQueries: function() { + var inj = this.injectorStrategy; + var p = inj.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.bindings[i].dependencies); + } + } + }, + addDirectivesMatchingQuery: function(query, list) { + var ist = this.injectorStrategy; + var p = ist.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i].key.token === query.selector) { + if (ist.objs[i] === undefinedValue) { + ist.objs[i] = ist.instantiateBinding(p.bindings[i], p.visibilities[i]); + } + list.push(ist.objs[i]); + } + } + }, + getComponentBinding: function() { + var p = this.injectorStrategy.protoStrategy; + return p.bindings[0]; + } + }, {}); + }()); + QueryError = (function($__super) { + function QueryError() { + $traceurRuntime.superConstructor(QueryError).call(this); + this.message = 'Only 3 queries can be concurrently active in a template.'; + } + return ($traceurRuntime.createClass)(QueryError, {toString: function() { + return this.message; + }}, {}, $__super); + }(BaseException)); + $__export("QueryError", QueryError); + QueryRef = (function() { + function QueryRef(query, list, originator) { + this.query = query; + this.list = list; + this.originator = originator; + } + return ($traceurRuntime.createClass)(QueryRef, { + update: function() { + var aggregator = []; + this.visit(this.originator, aggregator); + this.list.reset(aggregator); + }, + visit: function(inj, aggregator) { + if (isBlank(inj) || !inj._hasQuery(this)) + return ; + if (this.query.isVarBindingQuery) { + this._aggregateVariableBindings(inj, aggregator); + } else { + this._aggregateDirective(inj, aggregator); + } + var child = inj._head; + while (isPresent(child)) { + this.visit(child, aggregator); + child = child._next; + } + }, + _aggregateVariableBindings: function(inj, aggregator) { + var vb = this.query.varBindings; + for (var i = 0; i < vb.length; ++i) { + if (inj.hasVariableBinding(vb[i])) { + aggregator.push(inj.getVariableBinding(vb[i])); + } + } + }, + _aggregateDirective: function(inj, aggregator) { + inj.addDirectivesMatchingQuery(this.query, aggregator); + } + }, {}); + }()); + $__export("QueryRef", QueryRef); + } + }; +}); + +System.register("angular2/src/render/dom/compiler/compiler", ["angular2/di", "angular2/src/facade/async", "angular2/src/facade/lang", "angular2/src/dom/dom_adapter", "angular2/src/render/api", "angular2/src/render/dom/compiler/compile_pipeline", "angular2/src/render/dom/compiler/view_loader", "angular2/src/render/dom/compiler/compile_step_factory", "angular2/src/change_detection/change_detection", "angular2/src/render/dom/view/proto_view_merger", "angular2/src/render/dom/dom_tokens", "angular2/src/render/dom/view/shared_styles_host", "angular2/src/render/dom/util"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/dom/compiler/compiler"; + var __decorate, + __metadata, + __param, + Injectable, + PromiseWrapper, + BaseException, + DOM, + ViewDefinition, + ViewType, + RenderCompiler, + ViewEncapsulation, + CompilePipeline, + ViewLoader, + TemplateAndStyles, + DefaultStepFactory, + Parser, + pvm, + APP_ID_TOKEN, + Inject, + SharedStylesHost, + prependAll, + DomCompiler, + DefaultDomCompiler; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + Inject = $__m.Inject; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }, function($__m) { + BaseException = $__m.BaseException; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + ViewDefinition = $__m.ViewDefinition; + ViewType = $__m.ViewType; + RenderCompiler = $__m.RenderCompiler; + ViewEncapsulation = $__m.ViewEncapsulation; + }, function($__m) { + CompilePipeline = $__m.CompilePipeline; + }, function($__m) { + ViewLoader = $__m.ViewLoader; + TemplateAndStyles = $__m.TemplateAndStyles; + }, function($__m) { + DefaultStepFactory = $__m.DefaultStepFactory; + }, function($__m) { + Parser = $__m.Parser; + }, function($__m) { + pvm = $__m; + }, function($__m) { + APP_ID_TOKEN = $__m.APP_ID_TOKEN; + }, function($__m) { + SharedStylesHost = $__m.SharedStylesHost; + }, function($__m) { + prependAll = $__m.prependAll; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + DomCompiler = (function($__super) { + function DomCompiler(_stepFactory, _viewLoader, _sharedStylesHost) { + $traceurRuntime.superConstructor(DomCompiler).call(this); + this._stepFactory = _stepFactory; + this._viewLoader = _viewLoader; + this._sharedStylesHost = _sharedStylesHost; + } + return ($traceurRuntime.createClass)(DomCompiler, { + compile: function(view) { + var $__0 = this; + var tplPromise = this._viewLoader.load(view); + return PromiseWrapper.then(tplPromise, (function(tplAndStyles) { + return $__0._compileView(view, tplAndStyles, ViewType.COMPONENT); + }), (function(e) { + throw new BaseException(("Failed to load the template for \"" + view.componentId + "\" : " + e)); + return null; + })); + }, + compileHost: function(directiveMetadata) { + var hostViewDef = new ViewDefinition({ + componentId: directiveMetadata.id, + templateAbsUrl: null, + template: null, + styles: null, + styleAbsUrls: null, + directives: [directiveMetadata], + encapsulation: ViewEncapsulation.NONE + }); + return this._compileView(hostViewDef, new TemplateAndStyles(("<" + directiveMetadata.selector + ">"), []), ViewType.HOST); + }, + mergeProtoViewsRecursively: function(protoViewRefs) { + return PromiseWrapper.resolve(pvm.mergeProtoViewsRecursively(protoViewRefs)); + }, + _compileView: function(viewDef, templateAndStyles, protoViewType) { + if (viewDef.encapsulation === ViewEncapsulation.EMULATED && templateAndStyles.styles.length === 0) { + viewDef = this._normalizeViewEncapsulationIfThereAreNoStyles(viewDef); + } + var pipeline = new CompilePipeline(this._stepFactory.createSteps(viewDef)); + var compiledStyles = pipeline.processStyles(templateAndStyles.styles); + var compileElements = pipeline.processElements(DOM.createTemplate(templateAndStyles.template), protoViewType, viewDef); + if (viewDef.encapsulation === ViewEncapsulation.NATIVE) { + prependAll(DOM.content(compileElements[0].element), compiledStyles.map((function(style) { + return DOM.createStyleElement(style); + }))); + } else { + this._sharedStylesHost.addStyles(compiledStyles); + } + return PromiseWrapper.resolve(compileElements[0].inheritedProtoView.build()); + }, + _normalizeViewEncapsulationIfThereAreNoStyles: function(viewDef) { + if (viewDef.encapsulation === ViewEncapsulation.EMULATED) { + return new ViewDefinition({ + componentId: viewDef.componentId, + templateAbsUrl: viewDef.templateAbsUrl, + template: viewDef.template, + styleAbsUrls: viewDef.styleAbsUrls, + styles: viewDef.styles, + directives: viewDef.directives, + encapsulation: ViewEncapsulation.NONE + }); + } else { + return viewDef; + } + } + }, {}, $__super); + }(RenderCompiler)); + $__export("DomCompiler", DomCompiler); + DefaultDomCompiler = (function($__super) { + function $__1(parser, viewLoader, sharedStylesHost, appId) { + $traceurRuntime.superConstructor($__1).call(this, new DefaultStepFactory(parser, appId), viewLoader, sharedStylesHost); + } + return ($traceurRuntime.createClass)($__1, {}, {}, $__super); + }(DomCompiler)); + $__export("DefaultDomCompiler", DefaultDomCompiler); + $__export("DefaultDomCompiler", DefaultDomCompiler = __decorate([Injectable(), __param(3, Inject(APP_ID_TOKEN)), __metadata('design:paramtypes', [Parser, ViewLoader, SharedStylesHost, Object])], DefaultDomCompiler)); + } + }; +}); + +System.register("angular2/http", ["angular2/di", "angular2/src/http/http", "angular2/src/http/backends/xhr_backend", "angular2/src/http/backends/jsonp_backend", "angular2/src/http/backends/browser_xhr", "angular2/src/http/backends/browser_jsonp", "angular2/src/http/base_request_options", "angular2/src/http/interfaces", "angular2/src/http/base_response_options", "angular2/src/http/backends/mock_backend", "angular2/src/http/static_request", "angular2/src/http/static_response", "angular2/src/http/headers", "angular2/src/http/enums", "angular2/src/http/url_search_params"], function($__export) { + "use strict"; + var __moduleName = "angular2/http"; + var bind, + Http, + Jsonp, + XHRBackend, + JSONPBackend, + BrowserXhr, + BrowserJsonp, + BaseRequestOptions, + RequestOptions, + ConnectionBackend, + BaseResponseOptions, + ResponseOptions, + httpInjectables, + jsonpInjectables; + return { + setters: [function($__m) { + bind = $__m.bind; + }, function($__m) { + Http = $__m.Http; + Jsonp = $__m.Jsonp; + $__export("Http", $__m.Http); + $__export("Jsonp", $__m.Jsonp); + }, function($__m) { + XHRBackend = $__m.XHRBackend; + $__export("XHRBackend", $__m.XHRBackend); + $__export("XHRConnection", $__m.XHRConnection); + }, function($__m) { + JSONPBackend = $__m.JSONPBackend; + $__export("JSONPBackend", $__m.JSONPBackend); + $__export("JSONPConnection", $__m.JSONPConnection); + }, function($__m) { + BrowserXhr = $__m.BrowserXhr; + $__export("BrowserXhr", $__m.BrowserXhr); + }, function($__m) { + BrowserJsonp = $__m.BrowserJsonp; + }, function($__m) { + BaseRequestOptions = $__m.BaseRequestOptions; + RequestOptions = $__m.RequestOptions; + $__export("BaseRequestOptions", $__m.BaseRequestOptions); + $__export("RequestOptions", $__m.RequestOptions); + }, function($__m) { + ConnectionBackend = $__m.ConnectionBackend; + $__export("Connection", $__m.Connection); + $__export("ConnectionBackend", $__m.ConnectionBackend); + }, function($__m) { + BaseResponseOptions = $__m.BaseResponseOptions; + ResponseOptions = $__m.ResponseOptions; + $__export("BaseResponseOptions", $__m.BaseResponseOptions); + $__export("ResponseOptions", $__m.ResponseOptions); + }, function($__m) { + $__export("MockConnection", $__m.MockConnection); + $__export("MockBackend", $__m.MockBackend); + }, function($__m) { + $__export("Request", $__m.Request); + }, function($__m) { + $__export("Response", $__m.Response); + }, function($__m) { + $__export("Headers", $__m.Headers); + }, function($__m) { + $__export("ResponseTypes", $__m.ResponseTypes); + $__export("ReadyStates", $__m.ReadyStates); + $__export("RequestMethods", $__m.RequestMethods); + $__export("RequestCredentialsOpts", $__m.RequestCredentialsOpts); + $__export("RequestCacheOpts", $__m.RequestCacheOpts); + $__export("RequestModesOpts", $__m.RequestModesOpts); + }, function($__m) { + $__export("URLSearchParams", $__m.URLSearchParams); + }], + execute: function() { + httpInjectables = [bind(ConnectionBackend).toClass(XHRBackend), BrowserXhr, bind(RequestOptions).toClass(BaseRequestOptions), bind(ResponseOptions).toClass(BaseResponseOptions), Http]; + $__export("httpInjectables", httpInjectables); + jsonpInjectables = [bind(ConnectionBackend).toClass(JSONPBackend), BrowserJsonp, bind(RequestOptions).toClass(BaseRequestOptions), bind(ResponseOptions).toClass(BaseResponseOptions), Jsonp]; + $__export("jsonpInjectables", jsonpInjectables); + } + }; +}); + +System.register("angular2/src/router/route_registry", ["angular2/src/router/route_recognizer", "angular2/src/router/instruction", "angular2/src/facade/collection", "angular2/src/facade/async", "angular2/src/facade/lang", "angular2/src/router/route_config_impl", "angular2/src/reflection/reflection", "angular2/di", "angular2/src/router/route_config_nomalizer"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/route_registry"; + var __decorate, + __metadata, + RouteRecognizer, + Instruction, + ListWrapper, + Map, + PromiseWrapper, + isPresent, + isBlank, + isType, + isString, + isStringMap, + BaseException, + getTypeNameForDebugging, + RouteConfig, + Route, + reflector, + Injectable, + normalizeRouteConfig, + RouteRegistry; + function mostSpecific(instructions) { + var mostSpecificSolution = instructions[0]; + for (var solutionIndex = 1; solutionIndex < instructions.length; solutionIndex++) { + var solution = instructions[solutionIndex]; + if (solution.specificity > mostSpecificSolution.specificity) { + mostSpecificSolution = solution; + } + } + return mostSpecificSolution; + } + function assertTerminalComponent(component, path) { + if (!isType(component)) { + return ; + } + var annotations = reflector.annotations(component); + if (isPresent(annotations)) { + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + if (annotation instanceof RouteConfig) { + throw new BaseException(("Child routes are not allowed for \"" + path + "\". Use \"...\" on the parent's route path.")); + } + } + } + } + return { + setters: [function($__m) { + RouteRecognizer = $__m.RouteRecognizer; + }, function($__m) { + Instruction = $__m.Instruction; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + Map = $__m.Map; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + isType = $__m.isType; + isString = $__m.isString; + isStringMap = $__m.isStringMap; + BaseException = $__m.BaseException; + getTypeNameForDebugging = $__m.getTypeNameForDebugging; + }, function($__m) { + RouteConfig = $__m.RouteConfig; + Route = $__m.Route; + }, function($__m) { + reflector = $__m.reflector; + }, function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + normalizeRouteConfig = $__m.normalizeRouteConfig; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + RouteRegistry = (($traceurRuntime.createClass)(function() { + this._rules = new Map(); + }, { + config: function(parentComponent, config) { + var isRootLevelRoute = arguments[2] !== (void 0) ? arguments[2] : false; + config = normalizeRouteConfig(config); + var recognizer = this._rules.get(parentComponent); + if (isBlank(recognizer)) { + recognizer = new RouteRecognizer(isRootLevelRoute); + this._rules.set(parentComponent, recognizer); + } + var terminal = recognizer.config(config); + if (config instanceof Route) { + if (terminal) { + assertTerminalComponent(config.component, config.path); + } else { + this.configFromComponent(config.component); + } + } + }, + configFromComponent: function(component) { + var isRootComponent = arguments[1] !== (void 0) ? arguments[1] : false; + var $__0 = this; + if (!isType(component)) { + return ; + } + if (this._rules.has(component)) { + return ; + } + var annotations = reflector.annotations(component); + if (isPresent(annotations)) { + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + if (annotation instanceof RouteConfig) { + ListWrapper.forEach(annotation.configs, (function(config) { + return $__0.config(component, config, isRootComponent); + })); + } + } + } + }, + recognize: function(url, parentComponent) { + var $__0 = this; + var componentRecognizer = this._rules.get(parentComponent); + if (isBlank(componentRecognizer)) { + return PromiseWrapper.resolve(null); + } + var possibleMatches = componentRecognizer.recognize(url); + var matchPromises = ListWrapper.map(possibleMatches, (function(candidate) { + return $__0._completeRouteMatch(candidate); + })); + return PromiseWrapper.all(matchPromises).then((function(solutions) { + var fullSolutions = ListWrapper.filter(solutions, (function(solution) { + return isPresent(solution); + })); + if (fullSolutions.length > 0) { + return mostSpecific(fullSolutions); + } + return null; + })); + }, + _completeRouteMatch: function(partialMatch) { + var $__0 = this; + var recognizer = partialMatch.recognizer; + var handler = recognizer.handler; + return handler.resolveComponentType().then((function(componentType) { + $__0.configFromComponent(componentType); + if (partialMatch.unmatchedUrl.length == 0) { + if (recognizer.terminal) { + return new Instruction(componentType, partialMatch.matchedUrl, recognizer, null, partialMatch.params()); + } else { + return null; + } + } + return $__0.recognize(partialMatch.unmatchedUrl, componentType).then((function(childInstruction) { + if (isBlank(childInstruction)) { + return null; + } else { + return new Instruction(componentType, partialMatch.matchedUrl, recognizer, childInstruction); + } + })); + })); + }, + generate: function(linkParams, parentComponent) { + var url = ''; + var componentCursor = parentComponent; + for (var i = 0; i < linkParams.length; i += 1) { + var segment = linkParams[i]; + if (isBlank(componentCursor)) { + throw new BaseException(("Could not find route named \"" + segment + "\".")); + } + if (!isString(segment)) { + throw new BaseException(("Unexpected segment \"" + segment + "\" in link DSL. Expected a string.")); + } else if (segment == '' || segment == '.' || segment == '..') { + throw new BaseException(("\"" + segment + "/\" is only allowed at the beginning of a link DSL.")); + } + var params = null; + if (i + 1 < linkParams.length) { + var nextSegment = linkParams[i + 1]; + if (isStringMap(nextSegment)) { + params = nextSegment; + i += 1; + } + } + var componentRecognizer = this._rules.get(componentCursor); + if (isBlank(componentRecognizer)) { + throw new BaseException(("Component \"" + getTypeNameForDebugging(componentCursor) + "\" has no route config.")); + } + var response = componentRecognizer.generate(segment, params); + if (isBlank(response)) { + throw new BaseException(("Component \"" + getTypeNameForDebugging(componentCursor) + "\" has no route named \"" + segment + "\".")); + } + url += response['url']; + componentCursor = response['nextComponent']; + } + return url; + } + }, {})); + $__export("RouteRegistry", RouteRegistry); + $__export("RouteRegistry", RouteRegistry = __decorate([Injectable(), __metadata('design:paramtypes', [])], RouteRegistry)); + } + }; +}); + +System.register("angular2/di", ["angular2/src/di/metadata", "angular2/src/di/decorators", "angular2/src/di/forward_ref", "angular2/src/di/injector", "angular2/src/di/binding", "angular2/src/di/key", "angular2/src/di/exceptions", "angular2/src/di/opaque_token"], function($__export) { + "use strict"; + var __moduleName = "angular2/di"; + var $__exportNames = {undefined: true}; + return { + setters: [function($__m) { + $__export("InjectMetadata", $__m.InjectMetadata); + $__export("OptionalMetadata", $__m.OptionalMetadata); + $__export("InjectableMetadata", $__m.InjectableMetadata); + $__export("VisibilityMetadata", $__m.VisibilityMetadata); + $__export("SelfMetadata", $__m.SelfMetadata); + $__export("AncestorMetadata", $__m.AncestorMetadata); + $__export("UnboundedMetadata", $__m.UnboundedMetadata); + $__export("DependencyMetadata", $__m.DependencyMetadata); + $__export("DEFAULT_VISIBILITY", $__m.DEFAULT_VISIBILITY); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + $__export("forwardRef", $__m.forwardRef); + $__export("resolveForwardRef", $__m.resolveForwardRef); + }, function($__m) { + $__export("Injector", $__m.Injector); + $__export("ProtoInjector", $__m.ProtoInjector); + $__export("BindingWithVisibility", $__m.BindingWithVisibility); + $__export("PUBLIC_AND_PRIVATE", $__m.PUBLIC_AND_PRIVATE); + $__export("PUBLIC", $__m.PUBLIC); + $__export("PRIVATE", $__m.PRIVATE); + $__export("undefinedValue", $__m.undefinedValue); + }, function($__m) { + $__export("Binding", $__m.Binding); + $__export("BindingBuilder", $__m.BindingBuilder); + $__export("ResolvedBinding", $__m.ResolvedBinding); + $__export("Dependency", $__m.Dependency); + $__export("bind", $__m.bind); + }, function($__m) { + $__export("Key", $__m.Key); + $__export("KeyRegistry", $__m.KeyRegistry); + $__export("TypeLiteral", $__m.TypeLiteral); + }, function($__m) { + $__export("NoBindingError", $__m.NoBindingError); + $__export("AbstractBindingError", $__m.AbstractBindingError); + $__export("CyclicDependencyError", $__m.CyclicDependencyError); + $__export("InstantiationError", $__m.InstantiationError); + $__export("InvalidBindingError", $__m.InvalidBindingError); + $__export("NoAnnotationError", $__m.NoAnnotationError); + $__export("OutOfBoundsError", $__m.OutOfBoundsError); + }, function($__m) { + $__export("OpaqueToken", $__m.OpaqueToken); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/change_detection/jit_proto_change_detector", ["angular2/src/facade/collection", "angular2/src/change_detection/change_detection_jit_generator", "angular2/src/change_detection/coalesce", "angular2/src/change_detection/proto_change_detector"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/jit_proto_change_detector"; + var ListWrapper, + ChangeDetectorJITGenerator, + coalesce, + ProtoRecordBuilder, + JitProtoChangeDetector; + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + ChangeDetectorJITGenerator = $__m.ChangeDetectorJITGenerator; + }, function($__m) { + coalesce = $__m.coalesce; + }, function($__m) { + ProtoRecordBuilder = $__m.ProtoRecordBuilder; + }], + execute: function() { + JitProtoChangeDetector = (function() { + function JitProtoChangeDetector(definition) { + this.definition = definition; + this._factory = this._createFactory(definition); + } + return ($traceurRuntime.createClass)(JitProtoChangeDetector, { + instantiate: function(dispatcher) { + return this._factory(dispatcher); + }, + _createFactory: function(definition) { + var recordBuilder = new ProtoRecordBuilder(); + ListWrapper.forEach(definition.bindingRecords, (function(b) { + recordBuilder.add(b, definition.variableNames); + })); + var records = coalesce(recordBuilder.records); + return new ChangeDetectorJITGenerator(definition.id, definition.strategy, records, this.definition.directiveRecords, this.definition.generateCheckNoChanges).generate(); + } + }, {isSupported: function() { + return true; + }}); + }()); + $__export("JitProtoChangeDetector", JitProtoChangeDetector); + } + }; +}); + +System.register("angular2/src/render/render", ["angular2/src/render/dom/compiler/view_loader", "angular2/src/render/dom/view/shared_styles_host", "angular2/src/render/dom/compiler/compiler", "angular2/src/render/dom/dom_renderer", "angular2/src/render/dom/dom_tokens", "angular2/src/render/api"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/render"; + var $__exportNames = {}; + var $__exportNames = {}; + var $__exportNames = {}; + var $__exportNames = {}; + var $__exportNames = {}; + var $__exportNames = {}; + return { + setters: [function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }], + execute: function() {} + }; +}); + +System.register("angular2/router", ["angular2/src/router/router", "angular2/src/router/router_outlet", "angular2/src/router/router_link", "angular2/src/router/instruction", "angular2/src/router/route_registry", "angular2/src/router/location_strategy", "angular2/src/router/hash_location_strategy", "angular2/src/router/html5_location_strategy", "angular2/src/router/location", "angular2/src/router/pipeline", "angular2/src/router/route_config_decorator", "angular2/src/router/lifecycle_annotations", "angular2/src/core/application_tokens", "angular2/di", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/router"; + var LocationStrategy, + HTML5LocationStrategy, + Router, + RootRouter, + RouterOutlet, + RouterLink, + RouteRegistry, + Pipeline, + Location, + appComponentTypeToken, + bind, + CONST_EXPR, + routerDirectives, + routerInjectables; + var $__exportNames = { + routerDirectives: true, + routerInjectables: true, + undefined: true + }; + return { + setters: [function($__m) { + Router = $__m.Router; + RootRouter = $__m.RootRouter; + $__export("Router", $__m.Router); + $__export("RootRouter", $__m.RootRouter); + }, function($__m) { + RouterOutlet = $__m.RouterOutlet; + $__export("RouterOutlet", $__m.RouterOutlet); + }, function($__m) { + RouterLink = $__m.RouterLink; + $__export("RouterLink", $__m.RouterLink); + }, function($__m) { + $__export("RouteParams", $__m.RouteParams); + }, function($__m) { + RouteRegistry = $__m.RouteRegistry; + $__export("RouteRegistry", $__m.RouteRegistry); + }, function($__m) { + LocationStrategy = $__m.LocationStrategy; + $__export("LocationStrategy", $__m.LocationStrategy); + }, function($__m) { + $__export("HashLocationStrategy", $__m.HashLocationStrategy); + }, function($__m) { + HTML5LocationStrategy = $__m.HTML5LocationStrategy; + $__export("HTML5LocationStrategy", $__m.HTML5LocationStrategy); + }, function($__m) { + Location = $__m.Location; + $__export("Location", $__m.Location); + $__export("appBaseHrefToken", $__m.appBaseHrefToken); + }, function($__m) { + Pipeline = $__m.Pipeline; + $__export("Pipeline", $__m.Pipeline); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + $__export("CanActivate", $__m.CanActivate); + }, function($__m) { + appComponentTypeToken = $__m.appComponentTypeToken; + }, function($__m) { + bind = $__m.bind; + }, function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }], + execute: function() { + routerDirectives = CONST_EXPR([RouterOutlet, RouterLink]); + $__export("routerDirectives", routerDirectives); + routerInjectables = [RouteRegistry, Pipeline, bind(LocationStrategy).toClass(HTML5LocationStrategy), Location, bind(Router).toFactory((function(registry, pipeline, location, appRoot) { + return new RootRouter(registry, pipeline, location, appRoot); + }), [RouteRegistry, Pipeline, Location, appComponentTypeToken])]; + $__export("routerInjectables", routerInjectables); + } + }; +}); + +System.register("angular2/src/change_detection/change_detection", ["angular2/src/change_detection/jit_proto_change_detector", "angular2/src/change_detection/pregen_proto_change_detector", "angular2/src/change_detection/proto_change_detector", "angular2/src/change_detection/pipes/pipes", "angular2/src/change_detection/pipes/iterable_changes", "angular2/src/change_detection/pipes/keyvalue_changes", "angular2/src/change_detection/pipes/observable_pipe", "angular2/src/change_detection/pipes/promise_pipe", "angular2/src/change_detection/pipes/uppercase_pipe", "angular2/src/change_detection/pipes/lowercase_pipe", "angular2/src/change_detection/pipes/json_pipe", "angular2/src/change_detection/pipes/limit_to_pipe", "angular2/src/change_detection/pipes/date_pipe", "angular2/src/change_detection/pipes/number_pipe", "angular2/src/change_detection/pipes/null_pipe", "angular2/src/change_detection/interfaces", "angular2/di", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/change_detection/parser/ast", "angular2/src/change_detection/parser/lexer", "angular2/src/change_detection/parser/parser", "angular2/src/change_detection/parser/locals", "angular2/src/change_detection/exceptions", "angular2/src/change_detection/constants", "angular2/src/change_detection/binding_record", "angular2/src/change_detection/directive_record", "angular2/src/change_detection/dynamic_change_detector", "angular2/src/change_detection/change_detector_ref", "angular2/src/change_detection/pipes/pipe"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/change_detection/change_detection"; + var __decorate, + __metadata, + __param, + JitProtoChangeDetector, + PregenProtoChangeDetector, + DynamicProtoChangeDetector, + Pipes, + IterableChangesFactory, + KeyValueChangesFactory, + ObservablePipeFactory, + PromisePipeFactory, + UpperCasePipe, + LowerCasePipe, + JsonPipe, + LimitToPipeFactory, + DatePipe, + DecimalPipe, + PercentPipe, + CurrencyPipe, + NullPipeFactory, + ChangeDetection, + Inject, + Injectable, + OpaqueToken, + Optional, + StringMapWrapper, + CONST, + CONST_EXPR, + isPresent, + keyValDiff, + iterableDiff, + async, + uppercase, + lowercase, + json, + limitTo, + decimal, + percent, + currency, + date, + defaultPipes, + preGeneratedProtoDetectors, + PROTO_CHANGE_DETECTOR_KEY, + PreGeneratedChangeDetection, + DynamicChangeDetection, + JitChangeDetection; + return { + setters: [function($__m) { + JitProtoChangeDetector = $__m.JitProtoChangeDetector; + }, function($__m) { + PregenProtoChangeDetector = $__m.PregenProtoChangeDetector; + }, function($__m) { + DynamicProtoChangeDetector = $__m.DynamicProtoChangeDetector; + $__export("DynamicProtoChangeDetector", $__m.DynamicProtoChangeDetector); + }, function($__m) { + Pipes = $__m.Pipes; + $__export("Pipes", $__m.Pipes); + }, function($__m) { + IterableChangesFactory = $__m.IterableChangesFactory; + }, function($__m) { + KeyValueChangesFactory = $__m.KeyValueChangesFactory; + }, function($__m) { + ObservablePipeFactory = $__m.ObservablePipeFactory; + }, function($__m) { + PromisePipeFactory = $__m.PromisePipeFactory; + }, function($__m) { + UpperCasePipe = $__m.UpperCasePipe; + }, function($__m) { + LowerCasePipe = $__m.LowerCasePipe; + }, function($__m) { + JsonPipe = $__m.JsonPipe; + }, function($__m) { + LimitToPipeFactory = $__m.LimitToPipeFactory; + }, function($__m) { + DatePipe = $__m.DatePipe; + }, function($__m) { + DecimalPipe = $__m.DecimalPipe; + PercentPipe = $__m.PercentPipe; + CurrencyPipe = $__m.CurrencyPipe; + }, function($__m) { + NullPipeFactory = $__m.NullPipeFactory; + $__export("NullPipe", $__m.NullPipe); + $__export("NullPipeFactory", $__m.NullPipeFactory); + }, function($__m) { + ChangeDetection = $__m.ChangeDetection; + $__export("ChangeDetection", $__m.ChangeDetection); + $__export("ChangeDetectorDefinition", $__m.ChangeDetectorDefinition); + }, function($__m) { + Inject = $__m.Inject; + Injectable = $__m.Injectable; + OpaqueToken = $__m.OpaqueToken; + Optional = $__m.Optional; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + CONST = $__m.CONST; + CONST_EXPR = $__m.CONST_EXPR; + isPresent = $__m.isPresent; + }, function($__m) { + $__export("ASTWithSource", $__m.ASTWithSource); + $__export("AST", $__m.AST); + $__export("AstTransformer", $__m.AstTransformer); + $__export("AccessMember", $__m.AccessMember); + $__export("LiteralArray", $__m.LiteralArray); + $__export("ImplicitReceiver", $__m.ImplicitReceiver); + }, function($__m) { + $__export("Lexer", $__m.Lexer); + }, function($__m) { + $__export("Parser", $__m.Parser); + }, function($__m) { + $__export("Locals", $__m.Locals); + }, function($__m) { + $__export("DehydratedException", $__m.DehydratedException); + $__export("ExpressionChangedAfterItHasBeenCheckedException", $__m.ExpressionChangedAfterItHasBeenCheckedException); + $__export("ChangeDetectionError", $__m.ChangeDetectionError); + }, function($__m) { + $__export("CHECK_ONCE", $__m.CHECK_ONCE); + $__export("CHECK_ALWAYS", $__m.CHECK_ALWAYS); + $__export("DETACHED", $__m.DETACHED); + $__export("CHECKED", $__m.CHECKED); + $__export("ON_PUSH", $__m.ON_PUSH); + $__export("DEFAULT", $__m.DEFAULT); + }, function($__m) { + $__export("BindingRecord", $__m.BindingRecord); + }, function($__m) { + $__export("DirectiveIndex", $__m.DirectiveIndex); + $__export("DirectiveRecord", $__m.DirectiveRecord); + }, function($__m) { + $__export("DynamicChangeDetector", $__m.DynamicChangeDetector); + }, function($__m) { + $__export("ChangeDetectorRef", $__m.ChangeDetectorRef); + }, function($__m) { + $__export("WrappedValue", $__m.WrappedValue); + $__export("BasePipe", $__m.BasePipe); + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + keyValDiff = CONST_EXPR([CONST_EXPR(new KeyValueChangesFactory()), CONST_EXPR(new NullPipeFactory())]); + $__export("keyValDiff", keyValDiff); + iterableDiff = CONST_EXPR([CONST_EXPR(new IterableChangesFactory()), CONST_EXPR(new NullPipeFactory())]); + $__export("iterableDiff", iterableDiff); + async = CONST_EXPR([CONST_EXPR(new ObservablePipeFactory()), CONST_EXPR(new PromisePipeFactory()), CONST_EXPR(new NullPipeFactory())]); + $__export("async", async); + uppercase = CONST_EXPR([CONST_EXPR(new UpperCasePipe()), CONST_EXPR(new NullPipeFactory())]); + $__export("uppercase", uppercase); + lowercase = CONST_EXPR([CONST_EXPR(new LowerCasePipe()), CONST_EXPR(new NullPipeFactory())]); + $__export("lowercase", lowercase); + json = CONST_EXPR([CONST_EXPR(new JsonPipe()), CONST_EXPR(new NullPipeFactory())]); + $__export("json", json); + limitTo = CONST_EXPR([CONST_EXPR(new LimitToPipeFactory()), CONST_EXPR(new NullPipeFactory())]); + $__export("limitTo", limitTo); + decimal = CONST_EXPR([CONST_EXPR(new DecimalPipe()), CONST_EXPR(new NullPipeFactory())]); + $__export("decimal", decimal); + percent = CONST_EXPR([CONST_EXPR(new PercentPipe()), CONST_EXPR(new NullPipeFactory())]); + $__export("percent", percent); + currency = CONST_EXPR([CONST_EXPR(new CurrencyPipe()), CONST_EXPR(new NullPipeFactory())]); + $__export("currency", currency); + date = CONST_EXPR([CONST_EXPR(new DatePipe()), CONST_EXPR(new NullPipeFactory())]); + $__export("date", date); + defaultPipes = CONST_EXPR(new Pipes({ + "iterableDiff": iterableDiff, + "keyValDiff": keyValDiff, + "async": async, + "uppercase": uppercase, + "lowercase": lowercase, + "json": json, + "limitTo": limitTo, + "number": decimal, + "percent": percent, + "currency": currency, + "date": date + })); + $__export("defaultPipes", defaultPipes); + preGeneratedProtoDetectors = {}; + $__export("preGeneratedProtoDetectors", preGeneratedProtoDetectors); + PROTO_CHANGE_DETECTOR_KEY = CONST_EXPR(new OpaqueToken('ProtoChangeDetectors')); + $__export("PROTO_CHANGE_DETECTOR_KEY", PROTO_CHANGE_DETECTOR_KEY); + PreGeneratedChangeDetection = (function($__super) { + function $__0(protoChangeDetectorsForTest) { + $traceurRuntime.superConstructor($__0).call(this); + this._dynamicChangeDetection = new DynamicChangeDetection(); + this._protoChangeDetectorFactories = isPresent(protoChangeDetectorsForTest) ? protoChangeDetectorsForTest : preGeneratedProtoDetectors; + } + return ($traceurRuntime.createClass)($__0, {createProtoChangeDetector: function(definition) { + var id = definition.id; + if (StringMapWrapper.contains(this._protoChangeDetectorFactories, id)) { + return StringMapWrapper.get(this._protoChangeDetectorFactories, id)(definition); + } + return this._dynamicChangeDetection.createProtoChangeDetector(definition); + }}, {isSupported: function() { + return PregenProtoChangeDetector.isSupported(); + }}, $__super); + }(ChangeDetection)); + $__export("PreGeneratedChangeDetection", PreGeneratedChangeDetection); + $__export("PreGeneratedChangeDetection", PreGeneratedChangeDetection = __decorate([Injectable(), __param(0, Inject(PROTO_CHANGE_DETECTOR_KEY)), __param(0, Optional()), __metadata('design:paramtypes', [Object])], PreGeneratedChangeDetection)); + DynamicChangeDetection = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, {createProtoChangeDetector: function(definition) { + return new DynamicProtoChangeDetector(definition); + }}, {}, $__super); + }(ChangeDetection)); + $__export("DynamicChangeDetection", DynamicChangeDetection); + $__export("DynamicChangeDetection", DynamicChangeDetection = __decorate([Injectable(), __metadata('design:paramtypes', [])], DynamicChangeDetection)); + JitChangeDetection = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).apply(this, arguments); + } + return ($traceurRuntime.createClass)($__0, {createProtoChangeDetector: function(definition) { + return new JitProtoChangeDetector(definition); + }}, {isSupported: function() { + return JitProtoChangeDetector.isSupported(); + }}, $__super); + }(ChangeDetection)); + $__export("JitChangeDetection", JitChangeDetection); + $__export("JitChangeDetection", JitChangeDetection = __decorate([Injectable(), CONST(), __metadata('design:paramtypes', [])], JitChangeDetection)); + } + }; +}); + +System.register("angular2/change_detection", ["angular2/src/change_detection/change_detection"], function($__export) { + "use strict"; + var __moduleName = "angular2/change_detection"; + return { + setters: [function($__m) { + $__export("CHECK_ONCE", $__m.CHECK_ONCE); + $__export("CHECK_ALWAYS", $__m.CHECK_ALWAYS); + $__export("DETACHED", $__m.DETACHED); + $__export("CHECKED", $__m.CHECKED); + $__export("ON_PUSH", $__m.ON_PUSH); + $__export("DEFAULT", $__m.DEFAULT); + $__export("ExpressionChangedAfterItHasBeenCheckedException", $__m.ExpressionChangedAfterItHasBeenCheckedException); + $__export("ChangeDetectionError", $__m.ChangeDetectionError); + $__export("ChangeDetectorRef", $__m.ChangeDetectorRef); + $__export("WrappedValue", $__m.WrappedValue); + $__export("Pipes", $__m.Pipes); + $__export("BasePipe", $__m.BasePipe); + $__export("NullPipe", $__m.NullPipe); + $__export("NullPipeFactory", $__m.NullPipeFactory); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/core/annotations_impl/annotations", ["angular2/src/facade/lang", "angular2/src/di/metadata", "angular2/change_detection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/annotations_impl/annotations"; + var __decorate, + __metadata, + CONST, + InjectableMetadata, + DEFAULT, + Directive, + Component, + LifecycleEvent; + return { + setters: [function($__m) { + CONST = $__m.CONST; + }, function($__m) { + InjectableMetadata = $__m.InjectableMetadata; + }, function($__m) { + DEFAULT = $__m.DEFAULT; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Directive = (function($__super) { + function $__0() { + var $__3; + var $__2 = arguments[0] !== (void 0) ? arguments[0] : {}, + selector = $__2.selector, + properties = $__2.properties, + events = $__2.events, + host = $__2.host, + lifecycle = $__2.lifecycle, + hostInjector = $__2.hostInjector, + exportAs = $__2.exportAs, + compileChildren = ($__3 = $__2.compileChildren) === void 0 ? true : $__3; + $traceurRuntime.superConstructor($__0).call(this); + this.selector = selector; + this.properties = properties; + this.events = events; + this.host = host; + this.exportAs = exportAs; + this.lifecycle = lifecycle; + this.compileChildren = compileChildren; + this.hostInjector = hostInjector; + } + return ($traceurRuntime.createClass)($__0, {}, {}, $__super); + }(InjectableMetadata)); + $__export("Directive", Directive); + $__export("Directive", Directive = __decorate([CONST(), __metadata('design:paramtypes', [Object])], Directive)); + Component = (function($__super) { + function $__0() { + var $__3, + $__4; + var $__2 = arguments[0] !== (void 0) ? arguments[0] : {}, + selector = $__2.selector, + properties = $__2.properties, + events = $__2.events, + host = $__2.host, + exportAs = $__2.exportAs, + lifecycle = $__2.lifecycle, + hostInjector = $__2.hostInjector, + viewInjector = $__2.viewInjector, + changeDetection = ($__3 = $__2.changeDetection) === void 0 ? DEFAULT : $__3, + compileChildren = ($__4 = $__2.compileChildren) === void 0 ? true : $__4; + $traceurRuntime.superConstructor($__0).call(this, { + selector: selector, + properties: properties, + events: events, + host: host, + exportAs: exportAs, + hostInjector: hostInjector, + lifecycle: lifecycle, + compileChildren: compileChildren + }); + this.changeDetection = changeDetection; + this.viewInjector = viewInjector; + } + return ($traceurRuntime.createClass)($__0, {}, {}, $__super); + }(Directive)); + $__export("Component", Component); + $__export("Component", Component = __decorate([CONST(), __metadata('design:paramtypes', [Object])], Component)); + $__export("LifecycleEvent", LifecycleEvent); + (function(LifecycleEvent) { + LifecycleEvent[LifecycleEvent["onDestroy"] = 0] = "onDestroy"; + LifecycleEvent[LifecycleEvent["onChange"] = 1] = "onChange"; + LifecycleEvent[LifecycleEvent["onCheck"] = 2] = "onCheck"; + LifecycleEvent[LifecycleEvent["onInit"] = 3] = "onInit"; + LifecycleEvent[LifecycleEvent["onAllChangesDone"] = 4] = "onAllChangesDone"; + })(LifecycleEvent || ($__export("LifecycleEvent", LifecycleEvent = {}))); + } + }; +}); + +System.register("angular2/src/core/compiler/directive_resolver", ["angular2/di", "angular2/src/facade/lang", "angular2/src/core/annotations_impl/annotations", "angular2/src/reflection/reflection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/directive_resolver"; + var __decorate, + __metadata, + resolveForwardRef, + Injectable, + isPresent, + BaseException, + stringify, + Directive, + reflector, + DirectiveResolver; + return { + setters: [function($__m) { + resolveForwardRef = $__m.resolveForwardRef; + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + stringify = $__m.stringify; + }, function($__m) { + Directive = $__m.Directive; + }, function($__m) { + reflector = $__m.reflector; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + DirectiveResolver = (($traceurRuntime.createClass)(function() {}, {resolve: function(type) { + var annotations = reflector.annotations(resolveForwardRef(type)); + if (isPresent(annotations)) { + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + if (annotation instanceof Directive) { + return annotation; + } + } + } + throw new BaseException(("No Directive annotation found on " + stringify(type))); + }}, {})); + $__export("DirectiveResolver", DirectiveResolver); + $__export("DirectiveResolver", DirectiveResolver = __decorate([Injectable(), __metadata('design:paramtypes', [])], DirectiveResolver)); + } + }; +}); + +System.register("angular2/src/core/compiler/compiler", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/view", "angular2/src/core/compiler/element_injector", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/proto_view_factory", "angular2/src/services/url_resolver", "angular2/src/services/app_root_url", "angular2/src/render/api"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/compiler/compiler"; + var __decorate, + __metadata, + Binding, + resolveForwardRef, + Injectable, + Type, + isBlank, + isType, + isPresent, + BaseException, + normalizeBlank, + stringify, + isArray, + isPromise, + PromiseWrapper, + ListWrapper, + Map, + MapWrapper, + DirectiveResolver, + AppProtoViewMergeMapping, + DirectiveBinding, + ViewResolver, + ComponentUrlMapper, + ProtoViewFactory, + UrlResolver, + AppRootUrl, + renderApi, + CompilerCache, + Compiler; + return { + setters: [function($__m) { + Binding = $__m.Binding; + resolveForwardRef = $__m.resolveForwardRef; + Injectable = $__m.Injectable; + }, function($__m) { + Type = $__m.Type; + isBlank = $__m.isBlank; + isType = $__m.isType; + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + normalizeBlank = $__m.normalizeBlank; + stringify = $__m.stringify; + isArray = $__m.isArray; + isPromise = $__m.isPromise; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + Map = $__m.Map; + MapWrapper = $__m.MapWrapper; + }, function($__m) { + DirectiveResolver = $__m.DirectiveResolver; + }, function($__m) { + AppProtoViewMergeMapping = $__m.AppProtoViewMergeMapping; + }, function($__m) { + DirectiveBinding = $__m.DirectiveBinding; + }, function($__m) { + ViewResolver = $__m.ViewResolver; + }, function($__m) { + ComponentUrlMapper = $__m.ComponentUrlMapper; + }, function($__m) { + ProtoViewFactory = $__m.ProtoViewFactory; + }, function($__m) { + UrlResolver = $__m.UrlResolver; + }, function($__m) { + AppRootUrl = $__m.AppRootUrl; + }, function($__m) { + renderApi = $__m; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + CompilerCache = (($traceurRuntime.createClass)(function() { + this._cache = new Map(); + this._hostCache = new Map(); + }, { + set: function(component, protoView) { + this._cache.set(component, protoView); + }, + get: function(component) { + var result = this._cache.get(component); + return normalizeBlank(result); + }, + setHost: function(component, protoView) { + this._hostCache.set(component, protoView); + }, + getHost: function(component) { + var result = this._hostCache.get(component); + return normalizeBlank(result); + }, + clear: function() { + this._cache.clear(); + this._hostCache.clear(); + } + }, {})); + $__export("CompilerCache", CompilerCache); + $__export("CompilerCache", CompilerCache = __decorate([Injectable(), __metadata('design:paramtypes', [])], CompilerCache)); + Compiler = (($traceurRuntime.createClass)(function(reader, cache, viewResolver, componentUrlMapper, urlResolver, render, protoViewFactory, appUrl) { + this._reader = reader; + this._compilerCache = cache; + this._compiling = new Map(); + this._viewResolver = viewResolver; + this._componentUrlMapper = componentUrlMapper; + this._urlResolver = urlResolver; + this._appUrl = appUrl.value; + this._render = render; + this._protoViewFactory = protoViewFactory; + }, { + _bindDirective: function(directiveTypeOrBinding) { + if (directiveTypeOrBinding instanceof DirectiveBinding) { + return directiveTypeOrBinding; + } else if (directiveTypeOrBinding instanceof Binding) { + var annotation = this._reader.resolve(directiveTypeOrBinding.token); + return DirectiveBinding.createFromBinding(directiveTypeOrBinding, annotation); + } else { + var annotation$__3 = this._reader.resolve(directiveTypeOrBinding); + return DirectiveBinding.createFromType(directiveTypeOrBinding, annotation$__3); + } + }, + compileInHost: function(componentTypeOrBinding) { + var $__0 = this; + var componentType = isType(componentTypeOrBinding) ? componentTypeOrBinding : componentTypeOrBinding.token; + var hostAppProtoView = this._compilerCache.getHost(componentType); + var hostPvPromise; + if (isPresent(hostAppProtoView)) { + hostPvPromise = PromiseWrapper.resolve(hostAppProtoView); + } else { + var componentBinding = this._bindDirective(componentTypeOrBinding); + Compiler._assertTypeIsComponent(componentBinding); + var directiveMetadata = componentBinding.metadata; + hostPvPromise = this._render.compileHost(directiveMetadata).then((function(hostRenderPv) { + var protoViews = $__0._protoViewFactory.createAppProtoViews(componentBinding, hostRenderPv, [componentBinding]); + return $__0._compileNestedProtoViews(protoViews, componentType, new Map()); + })).then((function(appProtoView) { + $__0._compilerCache.setHost(componentType, appProtoView); + return appProtoView; + })); + } + return hostPvPromise.then((function(hostAppProtoView) { + return hostAppProtoView.ref; + })); + }, + _compile: function(componentBinding, componentPath) { + var $__0 = this; + var component = componentBinding.key.token; + var protoView = this._compilerCache.get(component); + if (isPresent(protoView)) { + return protoView; + } + var resultPromise = this._compiling.get(component); + if (isPresent(resultPromise)) { + return resultPromise; + } + var view = this._viewResolver.resolve(component); + var directives = this._flattenDirectives(view); + for (var i = 0; i < directives.length; i++) { + if (!Compiler._isValidDirective(directives[i])) { + throw new BaseException(("Unexpected directive value '" + stringify(directives[i]) + "' on the View of component '" + stringify(component) + "'")); + } + } + var boundDirectives = this._removeDuplicatedDirectives(ListWrapper.map(directives, (function(directive) { + return $__0._bindDirective(directive); + }))); + var renderTemplate = this._buildRenderTemplate(component, view, boundDirectives); + resultPromise = this._render.compile(renderTemplate).then((function(renderPv) { + var protoViews = $__0._protoViewFactory.createAppProtoViews(componentBinding, renderPv, boundDirectives); + return $__0._compileNestedProtoViews(protoViews, component, componentPath); + })).then((function(appProtoView) { + $__0._compilerCache.set(component, appProtoView); + MapWrapper.delete($__0._compiling, component); + return appProtoView; + })); + this._compiling.set(component, resultPromise); + return resultPromise; + }, + _removeDuplicatedDirectives: function(directives) { + var directivesMap = new Map(); + directives.forEach((function(dirBinding) { + directivesMap.set(dirBinding.key.id, dirBinding); + })); + return MapWrapper.values(directivesMap); + }, + _compileNestedProtoViews: function(appProtoViews, componentType, componentPath) { + var $__0 = this; + var nestedPVPromises = []; + componentPath = MapWrapper.clone(componentPath); + if (appProtoViews[0].type === renderApi.ViewType.COMPONENT) { + componentPath.set(componentType, appProtoViews[0]); + } + appProtoViews.forEach((function(appProtoView) { + $__0._collectComponentElementBinders(appProtoView).forEach((function(elementBinder) { + var nestedComponent = elementBinder.componentDirective; + var nestedComponentType = nestedComponent.key.token; + var elementBinderDone = (function(nestedPv) { + elementBinder.nestedProtoView = nestedPv; + }); + if (componentPath.has(nestedComponentType)) { + if (appProtoView.isEmbeddedFragment) { + throw new BaseException((" is used within the recursive path of " + stringify(nestedComponentType))); + } else if (appProtoView.type === renderApi.ViewType.COMPONENT) { + throw new BaseException(("Unconditional component cycle in " + stringify(nestedComponentType))); + } else { + elementBinderDone(componentPath.get(nestedComponentType)); + } + } else { + var nestedCall = $__0._compile(nestedComponent, componentPath); + if (isPromise(nestedCall)) { + nestedPVPromises.push(nestedCall.then(elementBinderDone)); + } else { + elementBinderDone(nestedCall); + } + } + })); + })); + return PromiseWrapper.all(nestedPVPromises).then((function(_) { + return PromiseWrapper.all(appProtoViews.map((function(appProtoView) { + return $__0._mergeProtoView(appProtoView); + }))); + })).then((function(_) { + return appProtoViews[0]; + })); + }, + _mergeProtoView: function(appProtoView) { + if (appProtoView.type !== renderApi.ViewType.HOST && appProtoView.type !== renderApi.ViewType.EMBEDDED) { + return null; + } + return this._render.mergeProtoViewsRecursively(this._collectMergeRenderProtoViews(appProtoView)).then((function(mergeResult) { + appProtoView.mergeMapping = new AppProtoViewMergeMapping(mergeResult); + })); + }, + _collectMergeRenderProtoViews: function(appProtoView) { + var result = [appProtoView.render]; + for (var i = 0; i < appProtoView.elementBinders.length; i++) { + var binder = appProtoView.elementBinders[i]; + if (isPresent(binder.nestedProtoView)) { + if (binder.hasStaticComponent() || (binder.hasEmbeddedProtoView() && binder.nestedProtoView.isEmbeddedFragment)) { + result.push(this._collectMergeRenderProtoViews(binder.nestedProtoView)); + } else { + result.push(null); + } + } + } + return result; + }, + _collectComponentElementBinders: function(appProtoView) { + var componentElementBinders = []; + appProtoView.elementBinders.forEach((function(elementBinder) { + if (isPresent(elementBinder.componentDirective)) { + componentElementBinders.push(elementBinder); + } + })); + return componentElementBinders; + }, + _buildRenderTemplate: function(component, view, directives) { + var $__0 = this; + var componentUrl = this._urlResolver.resolve(this._appUrl, this._componentUrlMapper.getUrl(component)); + var templateAbsUrl = null; + var styleAbsUrls = null; + if (isPresent(view.templateUrl)) { + templateAbsUrl = this._urlResolver.resolve(componentUrl, view.templateUrl); + } else if (isPresent(view.template)) { + templateAbsUrl = componentUrl; + } + if (isPresent(view.styleUrls)) { + styleAbsUrls = ListWrapper.map(view.styleUrls, (function(url) { + return $__0._urlResolver.resolve(componentUrl, url); + })); + } + return new renderApi.ViewDefinition({ + componentId: stringify(component), + templateAbsUrl: templateAbsUrl, + template: view.template, + styleAbsUrls: styleAbsUrls, + styles: view.styles, + directives: ListWrapper.map(directives, (function(directiveBinding) { + return directiveBinding.metadata; + })), + encapsulation: view.encapsulation + }); + }, + _flattenDirectives: function(template) { + if (isBlank(template.directives)) + return []; + var directives = []; + this._flattenList(template.directives, directives); + return directives; + }, + _flattenList: function(tree, out) { + for (var i = 0; i < tree.length; i++) { + var item = resolveForwardRef(tree[i]); + if (isArray(item)) { + this._flattenList(item, out); + } else { + out.push(item); + } + } + } + }, { + _isValidDirective: function(value) { + return isPresent(value) && (value instanceof Type || value instanceof Binding); + }, + _assertTypeIsComponent: function(directiveBinding) { + if (directiveBinding.metadata.type !== renderApi.DirectiveMetadata.COMPONENT_TYPE) { + throw new BaseException(("Could not load '" + stringify(directiveBinding.key.token) + "' because it is not a component.")); + } + } + })); + $__export("Compiler", Compiler); + $__export("Compiler", Compiler = __decorate([Injectable(), __metadata('design:paramtypes', [DirectiveResolver, CompilerCache, ViewResolver, ComponentUrlMapper, UrlResolver, renderApi.RenderCompiler, ProtoViewFactory, AppRootUrl])], Compiler)); + } + }; +}); + +System.register("angular2/src/core/application_common", ["angular2/di", "angular2/src/facade/lang", "angular2/src/dom/browser_adapter", "angular2/src/dom/dom_adapter", "angular2/src/core/compiler/compiler", "angular2/src/reflection/reflection", "angular2/src/change_detection/change_detection", "angular2/src/core/exception_handler", "angular2/src/render/dom/compiler/view_loader", "angular2/src/render/dom/compiler/style_url_resolver", "angular2/src/render/dom/compiler/style_inliner", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/directive_resolver", "angular2/src/facade/collection", "angular2/src/facade/async", "angular2/src/core/zone/ng_zone", "angular2/src/core/life_cycle/life_cycle", "angular2/src/render/xhr", "angular2/src/render/xhr_impl", "angular2/src/render/dom/events/event_manager", "angular2/src/render/dom/events/key_events", "angular2/src/render/dom/events/hammer_gestures", "angular2/src/core/compiler/component_url_mapper", "angular2/src/services/url_resolver", "angular2/src/services/app_root_url", "angular2/src/services/anchor_based_app_root_url", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/testability/testability", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_listener", "angular2/src/core/compiler/proto_view_factory", "angular2/src/render/api", "angular2/src/render/render", "angular2/src/render/dom/view/shared_styles_host", "angular2/src/core/compiler/view_ref", "angular2/src/core/application_tokens"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/core/application_common"; + var Injector, + bind, + isBlank, + isPresent, + assertionsEnabled, + isDart, + BrowserDomAdapter, + DOM, + Compiler, + CompilerCache, + Reflector, + reflector, + Parser, + Lexer, + ChangeDetection, + DynamicChangeDetection, + JitChangeDetection, + PreGeneratedChangeDetection, + Pipes, + defaultPipes, + ExceptionHandler, + ViewLoader, + StyleUrlResolver, + StyleInliner, + ViewResolver, + DirectiveResolver, + ListWrapper, + PromiseWrapper, + NgZone, + LifeCycle, + XHR, + XHRImpl, + EventManager, + DomEventsPlugin, + KeyEventsPlugin, + HammerGesturesPlugin, + ComponentUrlMapper, + UrlResolver, + AppRootUrl, + AnchorBasedAppRootUrl, + DynamicComponentLoader, + TestabilityRegistry, + Testability, + AppViewPool, + APP_VIEW_POOL_CAPACITY, + AppViewManager, + AppViewManagerUtils, + AppViewListener, + ProtoViewFactory, + Renderer, + RenderCompiler, + DomRenderer, + DOCUMENT_TOKEN, + DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES, + DefaultDomCompiler, + APP_ID_RANDOM_BINDING, + SharedStylesHost, + DomSharedStylesHost, + internalView, + appComponentRefPromiseToken, + appComponentTypeToken, + _rootInjector, + _rootBindings, + ApplicationRef; + function _injectorBindings(appComponentType) { + var bestChangeDetection = DynamicChangeDetection; + if (PreGeneratedChangeDetection.isSupported()) { + bestChangeDetection = PreGeneratedChangeDetection; + } else if (JitChangeDetection.isSupported()) { + bestChangeDetection = JitChangeDetection; + } + return [bind(DOCUMENT_TOKEN).toValue(DOM.defaultDoc()), bind(DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES).toValue(false), bind(appComponentTypeToken).toValue(appComponentType), bind(appComponentRefPromiseToken).toFactory((function(dynamicComponentLoader, injector, testability, registry) { + return dynamicComponentLoader.loadAsRoot(appComponentType, null, injector).then((function(componentRef) { + registry.registerApplication(componentRef.location.nativeElement, testability); + return componentRef; + })); + }), [DynamicComponentLoader, Injector, Testability, TestabilityRegistry]), bind(appComponentType).toFactory((function(p) { + return p.then((function(ref) { + return ref.instance; + })); + }), [appComponentRefPromiseToken]), bind(LifeCycle).toFactory((function(exceptionHandler) { + return new LifeCycle(null, assertionsEnabled()); + }), [ExceptionHandler]), bind(EventManager).toFactory((function(ngZone) { + var plugins = [new HammerGesturesPlugin(), new KeyEventsPlugin(), new DomEventsPlugin()]; + return new EventManager(plugins, ngZone); + }), [NgZone]), DomRenderer, bind(Renderer).toAlias(DomRenderer), APP_ID_RANDOM_BINDING, DefaultDomCompiler, bind(RenderCompiler).toAlias(DefaultDomCompiler), DomSharedStylesHost, bind(SharedStylesHost).toAlias(DomSharedStylesHost), ProtoViewFactory, AppViewPool, bind(APP_VIEW_POOL_CAPACITY).toValue(10000), AppViewManager, AppViewManagerUtils, AppViewListener, Compiler, CompilerCache, ViewResolver, bind(Pipes).toValue(defaultPipes), bind(ChangeDetection).toClass(bestChangeDetection), ViewLoader, DirectiveResolver, Parser, Lexer, bind(ExceptionHandler).toFactory((function() { + return new ExceptionHandler(DOM, isDart ? false : true); + }), []), bind(XHR).toValue(new XHRImpl()), ComponentUrlMapper, UrlResolver, StyleUrlResolver, StyleInliner, DynamicComponentLoader, Testability, AnchorBasedAppRootUrl, bind(AppRootUrl).toAlias(AnchorBasedAppRootUrl)]; + } + function createNgZone(handler) { + var bootstrapErrorReporter = (function(exception, stackTrace) { + return handler.call(exception, stackTrace); + }); + var zone = new NgZone({enableLongStackTrace: assertionsEnabled()}); + zone.overrideOnErrorHandler(bootstrapErrorReporter); + return zone; + } + function commonBootstrap(appComponentType) { + var componentInjectableBindings = arguments[1] !== (void 0) ? arguments[1] : null; + BrowserDomAdapter.makeCurrent(); + var bootstrapProcess = PromiseWrapper.completer(); + var zone = createNgZone(new ExceptionHandler(DOM, isDart ? false : true)); + zone.run((function() { + var appInjector = _createAppInjector(appComponentType, componentInjectableBindings, zone); + var exceptionHandler = appInjector.get(ExceptionHandler); + zone.overrideOnErrorHandler((function(e, s) { + return exceptionHandler.call(e, s); + })); + try { + var compRefToken = appInjector.get(appComponentRefPromiseToken); + var tick = (function(componentRef) { + var appChangeDetector = internalView(componentRef.hostView).changeDetector; + var lc = appInjector.get(LifeCycle); + lc.registerWith(zone, appChangeDetector); + lc.tick(); + bootstrapProcess.resolve(new ApplicationRef(componentRef, appComponentType, appInjector)); + }); + var tickResult = PromiseWrapper.then(compRefToken, tick); + PromiseWrapper.then(tickResult, (function(_) {})); + PromiseWrapper.then(tickResult, null, (function(err, stackTrace) { + bootstrapProcess.reject(err, stackTrace); + })); + } catch (e) { + bootstrapProcess.reject(e, e.stack); + } + })); + return bootstrapProcess.promise; + } + function _createAppInjector(appComponentType, bindings, zone) { + if (isBlank(_rootInjector)) + _rootInjector = Injector.resolveAndCreate(_rootBindings); + var mergedBindings = isPresent(bindings) ? ListWrapper.concat(_injectorBindings(appComponentType), bindings) : _injectorBindings(appComponentType); + mergedBindings.push(bind(NgZone).toValue(zone)); + return _rootInjector.resolveAndCreateChild(mergedBindings); + } + $__export("createNgZone", createNgZone); + $__export("commonBootstrap", commonBootstrap); + return { + setters: [function($__m) { + Injector = $__m.Injector; + bind = $__m.bind; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + assertionsEnabled = $__m.assertionsEnabled; + isDart = $__m.isDart; + }, function($__m) { + BrowserDomAdapter = $__m.BrowserDomAdapter; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + Compiler = $__m.Compiler; + CompilerCache = $__m.CompilerCache; + }, function($__m) { + Reflector = $__m.Reflector; + reflector = $__m.reflector; + }, function($__m) { + Parser = $__m.Parser; + Lexer = $__m.Lexer; + ChangeDetection = $__m.ChangeDetection; + DynamicChangeDetection = $__m.DynamicChangeDetection; + JitChangeDetection = $__m.JitChangeDetection; + PreGeneratedChangeDetection = $__m.PreGeneratedChangeDetection; + Pipes = $__m.Pipes; + defaultPipes = $__m.defaultPipes; + }, function($__m) { + ExceptionHandler = $__m.ExceptionHandler; + }, function($__m) { + ViewLoader = $__m.ViewLoader; + }, function($__m) { + StyleUrlResolver = $__m.StyleUrlResolver; + }, function($__m) { + StyleInliner = $__m.StyleInliner; + }, function($__m) { + ViewResolver = $__m.ViewResolver; + }, function($__m) { + DirectiveResolver = $__m.DirectiveResolver; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }, function($__m) { + NgZone = $__m.NgZone; + }, function($__m) { + LifeCycle = $__m.LifeCycle; + }, function($__m) { + XHR = $__m.XHR; + }, function($__m) { + XHRImpl = $__m.XHRImpl; + }, function($__m) { + EventManager = $__m.EventManager; + DomEventsPlugin = $__m.DomEventsPlugin; + }, function($__m) { + KeyEventsPlugin = $__m.KeyEventsPlugin; + }, function($__m) { + HammerGesturesPlugin = $__m.HammerGesturesPlugin; + }, function($__m) { + ComponentUrlMapper = $__m.ComponentUrlMapper; + }, function($__m) { + UrlResolver = $__m.UrlResolver; + }, function($__m) { + AppRootUrl = $__m.AppRootUrl; + }, function($__m) { + AnchorBasedAppRootUrl = $__m.AnchorBasedAppRootUrl; + }, function($__m) { + DynamicComponentLoader = $__m.DynamicComponentLoader; + }, function($__m) { + TestabilityRegistry = $__m.TestabilityRegistry; + Testability = $__m.Testability; + }, function($__m) { + AppViewPool = $__m.AppViewPool; + APP_VIEW_POOL_CAPACITY = $__m.APP_VIEW_POOL_CAPACITY; + }, function($__m) { + AppViewManager = $__m.AppViewManager; + }, function($__m) { + AppViewManagerUtils = $__m.AppViewManagerUtils; + }, function($__m) { + AppViewListener = $__m.AppViewListener; + }, function($__m) { + ProtoViewFactory = $__m.ProtoViewFactory; + }, function($__m) { + Renderer = $__m.Renderer; + RenderCompiler = $__m.RenderCompiler; + }, function($__m) { + DomRenderer = $__m.DomRenderer; + DOCUMENT_TOKEN = $__m.DOCUMENT_TOKEN; + DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES = $__m.DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES; + DefaultDomCompiler = $__m.DefaultDomCompiler; + APP_ID_RANDOM_BINDING = $__m.APP_ID_RANDOM_BINDING; + }, function($__m) { + SharedStylesHost = $__m.SharedStylesHost; + DomSharedStylesHost = $__m.DomSharedStylesHost; + }, function($__m) { + internalView = $__m.internalView; + }, function($__m) { + appComponentRefPromiseToken = $__m.appComponentRefPromiseToken; + appComponentTypeToken = $__m.appComponentTypeToken; + }], + execute: function() { + _rootBindings = [bind(Reflector).toValue(reflector), TestabilityRegistry]; + ApplicationRef = (function() { + function ApplicationRef(hostComponent, hostComponentType, injector) { + this._hostComponent = hostComponent; + this._injector = injector; + this._hostComponentType = hostComponentType; + } + return ($traceurRuntime.createClass)(ApplicationRef, { + get hostComponentType() { + return this._hostComponentType; + }, + get hostComponent() { + return this._hostComponent.instance; + }, + dispose: function() { + this._hostComponent.dispose(); + }, + get injector() { + return this._injector; + } + }, {}); + }()); + $__export("ApplicationRef", ApplicationRef); + } + }; +}); + +System.register("angular2/angular2", ["angular2/src/core/application_common", "angular2/annotations", "angular2/change_detection", "angular2/core", "angular2/di", "angular2/directives", "angular2/http", "angular2/forms", "angular2/render"], function($__export) { + "use strict"; + var __moduleName = "angular2/angular2"; + var $__exportNames = {undefined: true}; + var $__exportNames = {undefined: true}; + var $__exportNames = {undefined: true}; + var $__exportNames = {undefined: true}; + var $__exportNames = {undefined: true}; + var $__exportNames = {undefined: true}; + var $__exportNames = {undefined: true}; + var $__exportNames = {undefined: true}; + return { + setters: [function($__m) { + $__export("bootstrap", $__m.commonBootstrap); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }], + execute: function() {} + }; +}); + +System.register("angular2/angular2_sfx", ["angular2/angular2", "angular2/router"], function($__export) { + "use strict"; + var __moduleName = "angular2/angular2_sfx"; + var ng, + router, + _prevNg; + return { + setters: [function($__m) { + ng = $__m; + }, function($__m) { + router = $__m; + }], + execute: function() { + _prevNg = window.ng; + window.ng = ng; + ng.router = router; + ng.noConflict = function() { + window.ng = _prevNg; + return ng; + }; + } + }; +}); + +}); +//# sourceMappingURLDisabled=angular2.sfx.dev.js.map \ No newline at end of file diff --git a/2.0.0-alpha.33/router.dev.js b/2.0.0-alpha.33/router.dev.js new file mode 100644 index 0000000000..399e0ebc50 --- /dev/null +++ b/2.0.0-alpha.33/router.dev.js @@ -0,0 +1,2131 @@ +"format register"; +System.register("angular2/src/router/lifecycle_annotations_impl", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/lifecycle_annotations_impl"; + var __decorate, + __metadata, + CONST, + CONST_EXPR, + RouteLifecycleHook, + CanActivate, + canReuse, + canDeactivate, + onActivate, + onReuse, + onDeactivate; + return { + setters: [function($__m) { + CONST = $__m.CONST; + CONST_EXPR = $__m.CONST_EXPR; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + RouteLifecycleHook = (($traceurRuntime.createClass)(function(name) { + this.name = name; + }, {}, {})); + $__export("RouteLifecycleHook", RouteLifecycleHook); + $__export("RouteLifecycleHook", RouteLifecycleHook = __decorate([CONST(), __metadata('design:paramtypes', [String])], RouteLifecycleHook)); + CanActivate = (($traceurRuntime.createClass)(function(fn) { + this.fn = fn; + }, {}, {})); + $__export("CanActivate", CanActivate); + $__export("CanActivate", CanActivate = __decorate([CONST(), __metadata('design:paramtypes', [Function])], CanActivate)); + canReuse = CONST_EXPR(new RouteLifecycleHook("canReuse")); + $__export("canReuse", canReuse); + canDeactivate = CONST_EXPR(new RouteLifecycleHook("canDeactivate")); + $__export("canDeactivate", canDeactivate); + onActivate = CONST_EXPR(new RouteLifecycleHook("onActivate")); + $__export("onActivate", onActivate); + onReuse = CONST_EXPR(new RouteLifecycleHook("onReuse")); + $__export("onReuse", onReuse); + onDeactivate = CONST_EXPR(new RouteLifecycleHook("onDeactivate")); + $__export("onDeactivate", onDeactivate); + } + }; +}); + +System.register("angular2/src/router/instruction", ["angular2/src/facade/collection", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/instruction"; + var StringMapWrapper, + isPresent, + isBlank, + normalizeBlank, + RouteParams, + Instruction; + return { + setters: [function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + normalizeBlank = $__m.normalizeBlank; + }], + execute: function() { + RouteParams = (function() { + function RouteParams(params) { + this.params = params; + } + return ($traceurRuntime.createClass)(RouteParams, {get: function(param) { + return normalizeBlank(StringMapWrapper.get(this.params, param)); + }}, {}); + }()); + $__export("RouteParams", RouteParams); + Instruction = (function() { + function Instruction(component, capturedUrl, _recognizer) { + var child = arguments[3] !== (void 0) ? arguments[3] : null; + var _params = arguments[4] !== (void 0) ? arguments[4] : null; + this.component = component; + this.capturedUrl = capturedUrl; + this._recognizer = _recognizer; + this.child = child; + this._params = _params; + this.reuse = false; + this.accumulatedUrl = capturedUrl; + this.specificity = _recognizer.specificity; + if (isPresent(child)) { + this.child = child; + this.specificity += child.specificity; + var childUrl = child.accumulatedUrl; + if (isPresent(childUrl)) { + this.accumulatedUrl += childUrl; + } + } + } + return ($traceurRuntime.createClass)(Instruction, {params: function() { + if (isBlank(this._params)) { + this._params = this._recognizer.parseParams(this.capturedUrl); + } + return this._params; + }}, {}); + }()); + $__export("Instruction", Instruction); + } + }; +}); + +System.register("angular2/src/router/lifecycle_annotations", ["angular2/src/util/decorators", "angular2/src/router/lifecycle_annotations_impl"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/lifecycle_annotations"; + var makeDecorator, + CanActivateAnnotation, + CanActivate; + return { + setters: [function($__m) { + makeDecorator = $__m.makeDecorator; + }, function($__m) { + CanActivateAnnotation = $__m.CanActivate; + $__export("canReuse", $__m.canReuse); + $__export("canDeactivate", $__m.canDeactivate); + $__export("onActivate", $__m.onActivate); + $__export("onReuse", $__m.onReuse); + $__export("onDeactivate", $__m.onDeactivate); + }], + execute: function() { + CanActivate = makeDecorator(CanActivateAnnotation); + $__export("CanActivate", CanActivate); + } + }; +}); + +System.register("angular2/src/router/location_strategy", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/location_strategy"; + var BaseException, + LocationStrategy; + function _abstract() { + return new BaseException('This method is abstract'); + } + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + }], + execute: function() { + LocationStrategy = (function() { + function LocationStrategy() {} + return ($traceurRuntime.createClass)(LocationStrategy, { + path: function() { + throw _abstract(); + }, + pushState: function(ctx, title, url) { + throw _abstract(); + }, + forward: function() { + throw _abstract(); + }, + back: function() { + throw _abstract(); + }, + onPopState: function(fn) { + throw _abstract(); + }, + getBaseHref: function() { + throw _abstract(); + } + }, {}); + }()); + $__export("LocationStrategy", LocationStrategy); + } + }; +}); + +System.register("angular2/src/router/helpers", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/helpers"; + var isPresent; + function parseAndAssignParamString(splitToken, paramString, keyValueMap) { + var first = paramString[0]; + if (first == '?' || first == ';') { + paramString = paramString.substring(1); + } + paramString.split(splitToken).forEach((function(entry) { + var tuple = entry.split('='); + var key = tuple[0]; + if (!isPresent(keyValueMap[key])) { + var value = tuple.length > 1 ? tuple[1] : true; + keyValueMap[key] = value; + } + })); + } + $__export("parseAndAssignParamString", parseAndAssignParamString); + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }], + execute: function() { + } + }; +}); + +System.register("angular2/src/router/url", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/url"; + var RegExpWrapper, + StringWrapper, + specialCharacters, + escapeRe; + function escapeRegex(string) { + return StringWrapper.replaceAllMapped(string, escapeRe, (function(match) { + return "\\" + match; + })); + } + $__export("escapeRegex", escapeRegex); + return { + setters: [function($__m) { + RegExpWrapper = $__m.RegExpWrapper; + StringWrapper = $__m.StringWrapper; + }], + execute: function() { + specialCharacters = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\']; + escapeRe = RegExpWrapper.create('(\\' + specialCharacters.join('|\\') + ')', 'g'); + } + }; +}); + +System.register("angular2/src/router/route_config_impl", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/route_config_impl"; + var __decorate, + __metadata, + CONST, + RouteConfig, + Route, + AsyncRoute, + Redirect; + return { + setters: [function($__m) { + CONST = $__m.CONST; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + RouteConfig = (($traceurRuntime.createClass)(function(configs) { + this.configs = configs; + }, {}, {})); + $__export("RouteConfig", RouteConfig); + $__export("RouteConfig", RouteConfig = __decorate([CONST(), __metadata('design:paramtypes', [Object])], RouteConfig)); + Route = (($traceurRuntime.createClass)(function($__2) { + var $__3 = $__2, + path = $__3.path, + component = $__3.component, + as = $__3.as; + this.path = path; + this.component = component; + this.as = as; + }, {}, {})); + $__export("Route", Route); + $__export("Route", Route = __decorate([CONST(), __metadata('design:paramtypes', [Object])], Route)); + AsyncRoute = (($traceurRuntime.createClass)(function($__2) { + var $__3 = $__2, + path = $__3.path, + loader = $__3.loader, + as = $__3.as; + this.path = path; + this.loader = loader; + this.as = as; + }, {}, {})); + $__export("AsyncRoute", AsyncRoute); + $__export("AsyncRoute", AsyncRoute = __decorate([CONST(), __metadata('design:paramtypes', [Object])], AsyncRoute)); + Redirect = (($traceurRuntime.createClass)(function($__2) { + var $__3 = $__2, + path = $__3.path, + redirectTo = $__3.redirectTo; + this.as = null; + this.path = path; + this.redirectTo = redirectTo; + }, {}, {})); + $__export("Redirect", Redirect); + $__export("Redirect", Redirect = __decorate([CONST(), __metadata('design:paramtypes', [Object])], Redirect)); + } + }; +}); + +System.register("angular2/src/router/async_route_handler", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/async_route_handler"; + var isPresent, + AsyncRouteHandler; + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }], + execute: function() { + AsyncRouteHandler = (function() { + function AsyncRouteHandler(_loader) { + this._loader = _loader; + this._resolvedComponent = null; + } + return ($traceurRuntime.createClass)(AsyncRouteHandler, {resolveComponentType: function() { + var $__0 = this; + if (isPresent(this._resolvedComponent)) { + return this._resolvedComponent; + } + return this._resolvedComponent = this._loader().then((function(componentType) { + $__0.componentType = componentType; + return componentType; + })); + }}, {}); + }()); + $__export("AsyncRouteHandler", AsyncRouteHandler); + } + }; +}); + +System.register("angular2/src/router/sync_route_handler", ["angular2/src/facade/async"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/sync_route_handler"; + var PromiseWrapper, + SyncRouteHandler; + return { + setters: [function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }], + execute: function() { + SyncRouteHandler = (function() { + function SyncRouteHandler(componentType) { + this.componentType = componentType; + this._resolvedComponent = null; + this._resolvedComponent = PromiseWrapper.resolve(componentType); + } + return ($traceurRuntime.createClass)(SyncRouteHandler, {resolveComponentType: function() { + return this._resolvedComponent; + }}, {}); + }()); + $__export("SyncRouteHandler", SyncRouteHandler); + } + }; +}); + +System.register("angular2/src/router/route_config_decorator", ["angular2/src/router/route_config_impl", "angular2/src/util/decorators"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/route_config_decorator"; + var RouteConfigAnnotation, + makeDecorator, + RouteConfig; + return { + setters: [function($__m) { + RouteConfigAnnotation = $__m.RouteConfig; + $__export("Route", $__m.Route); + $__export("Redirect", $__m.Redirect); + $__export("AsyncRoute", $__m.AsyncRoute); + }, function($__m) { + makeDecorator = $__m.makeDecorator; + }], + execute: function() { + RouteConfig = makeDecorator(RouteConfigAnnotation); + $__export("RouteConfig", RouteConfig); + } + }; +}); + +System.register("angular2/src/router/hash_location_strategy", ["angular2/src/dom/dom_adapter", "angular2/di", "angular2/src/router/location_strategy"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/hash_location_strategy"; + var __decorate, + __metadata, + DOM, + Injectable, + LocationStrategy, + HashLocationStrategy; + return { + setters: [function($__m) { + DOM = $__m.DOM; + }, function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + LocationStrategy = $__m.LocationStrategy; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + HashLocationStrategy = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).call(this); + this._location = DOM.getLocation(); + this._history = DOM.getHistory(); + } + return ($traceurRuntime.createClass)($__0, { + onPopState: function(fn) { + DOM.getGlobalEventTarget('window').addEventListener('popstate', fn, false); + }, + getBaseHref: function() { + return ''; + }, + path: function() { + var path = this._location.hash; + return path.length > 0 ? path.substring(1) : path; + }, + pushState: function(state, title, url) { + this._history.pushState(state, title, '#' + url); + }, + forward: function() { + this._history.forward(); + }, + back: function() { + this._history.back(); + } + }, {}, $__super); + }(LocationStrategy)); + $__export("HashLocationStrategy", HashLocationStrategy); + $__export("HashLocationStrategy", HashLocationStrategy = __decorate([Injectable(), __metadata('design:paramtypes', [])], HashLocationStrategy)); + } + }; +}); + +System.register("angular2/src/router/html5_location_strategy", ["angular2/src/dom/dom_adapter", "angular2/di", "angular2/src/router/location_strategy"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/html5_location_strategy"; + var __decorate, + __metadata, + DOM, + Injectable, + LocationStrategy, + HTML5LocationStrategy; + return { + setters: [function($__m) { + DOM = $__m.DOM; + }, function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + LocationStrategy = $__m.LocationStrategy; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + HTML5LocationStrategy = (function($__super) { + function $__0() { + $traceurRuntime.superConstructor($__0).call(this); + this._location = DOM.getLocation(); + this._history = DOM.getHistory(); + this._baseHref = DOM.getBaseHref(); + } + return ($traceurRuntime.createClass)($__0, { + onPopState: function(fn) { + DOM.getGlobalEventTarget('window').addEventListener('popstate', fn, false); + }, + getBaseHref: function() { + return this._baseHref; + }, + path: function() { + return this._location.pathname; + }, + pushState: function(state, title, url) { + this._history.pushState(state, title, url); + }, + forward: function() { + this._history.forward(); + }, + back: function() { + this._history.back(); + } + }, {}, $__super); + }(LocationStrategy)); + $__export("HTML5LocationStrategy", HTML5LocationStrategy); + $__export("HTML5LocationStrategy", HTML5LocationStrategy = __decorate([Injectable(), __metadata('design:paramtypes', [])], HTML5LocationStrategy)); + } + }; +}); + +System.register("angular2/src/router/pipeline", ["angular2/src/facade/async", "angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/pipeline"; + var __decorate, + __metadata, + PromiseWrapper, + Injectable, + Pipeline; + return { + setters: [function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }, function($__m) { + Injectable = $__m.Injectable; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Pipeline = (($traceurRuntime.createClass)(function() { + this.steps = [(function(instruction) { + return instruction.router.activateOutlets(instruction); + })]; + }, {process: function(instruction) { + var steps = this.steps, + currentStep = 0; + function processOne() { + var result = arguments[0] !== (void 0) ? arguments[0] : true; + if (currentStep >= steps.length) { + return PromiseWrapper.resolve(result); + } + var step = steps[currentStep]; + currentStep += 1; + return PromiseWrapper.resolve(step(instruction)).then(processOne); + } + return processOne(); + }}, {})); + $__export("Pipeline", Pipeline); + $__export("Pipeline", Pipeline = __decorate([Injectable(), __metadata('design:paramtypes', [])], Pipeline)); + } + }; +}); + +System.register("angular2/src/router/location", ["angular2/src/router/location_strategy", "angular2/src/facade/lang", "angular2/src/facade/async", "angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/location"; + var __decorate, + __metadata, + __param, + LocationStrategy, + isPresent, + CONST_EXPR, + EventEmitter, + ObservableWrapper, + BaseException, + isBlank, + OpaqueToken, + Injectable, + Optional, + Inject, + appBaseHrefToken, + Location; + function stripIndexHtml(url) { + if (/\/index.html$/g.test(url)) { + return url.substring(0, url.length - 11); + } + return url; + } + function stripTrailingSlash(url) { + if (/\/$/g.test(url)) { + url = url.substring(0, url.length - 1); + } + return url; + } + return { + setters: [function($__m) { + LocationStrategy = $__m.LocationStrategy; + }, function($__m) { + isPresent = $__m.isPresent; + CONST_EXPR = $__m.CONST_EXPR; + BaseException = $__m.BaseException; + isBlank = $__m.isBlank; + }, function($__m) { + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + OpaqueToken = $__m.OpaqueToken; + Injectable = $__m.Injectable; + Optional = $__m.Optional; + Inject = $__m.Inject; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + appBaseHrefToken = CONST_EXPR(new OpaqueToken('locationHrefToken')); + $__export("appBaseHrefToken", appBaseHrefToken); + Location = (($traceurRuntime.createClass)(function(_platformStrategy, href) { + var $__0 = this; + this._platformStrategy = _platformStrategy; + this._subject = new EventEmitter(); + var browserBaseHref = isPresent(href) ? href : this._platformStrategy.getBaseHref(); + if (isBlank(browserBaseHref)) { + throw new BaseException("No base href set. Either provide a binding to \"appBaseHrefToken\" or add a base element."); + } + this._baseHref = stripTrailingSlash(stripIndexHtml(browserBaseHref)); + this._platformStrategy.onPopState((function(_) { + return $__0._onPopState(_); + })); + }, { + _onPopState: function(_) { + ObservableWrapper.callNext(this._subject, {'url': this.path()}); + }, + path: function() { + return this.normalize(this._platformStrategy.path()); + }, + normalize: function(url) { + return stripTrailingSlash(this._stripBaseHref(stripIndexHtml(url))); + }, + normalizeAbsolutely: function(url) { + if (!url.startsWith('/')) { + url = '/' + url; + } + return stripTrailingSlash(this._addBaseHref(url)); + }, + _stripBaseHref: function(url) { + if (this._baseHref.length > 0 && url.startsWith(this._baseHref)) { + return url.substring(this._baseHref.length); + } + return url; + }, + _addBaseHref: function(url) { + if (!url.startsWith(this._baseHref)) { + return this._baseHref + url; + } + return url; + }, + go: function(url) { + var finalUrl = this.normalizeAbsolutely(url); + this._platformStrategy.pushState(null, '', finalUrl); + }, + forward: function() { + this._platformStrategy.forward(); + }, + back: function() { + this._platformStrategy.back(); + }, + subscribe: function(onNext) { + var onThrow = arguments[1] !== (void 0) ? arguments[1] : null; + var onReturn = arguments[2] !== (void 0) ? arguments[2] : null; + ObservableWrapper.subscribe(this._subject, onNext, onThrow, onReturn); + } + }, {})); + $__export("Location", Location); + $__export("Location", Location = __decorate([Injectable(), __param(1, Optional()), __param(1, Inject(appBaseHrefToken)), __metadata('design:paramtypes', [LocationStrategy, String])], Location)); + } + }; +}); + +System.register("angular2/src/router/path_recognizer", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/router/helpers", "angular2/src/router/url"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/path_recognizer"; + var __decorate, + __metadata, + RegExpWrapper, + StringWrapper, + isPresent, + isBlank, + BaseException, + StringMapWrapper, + ListWrapper, + IMPLEMENTS, + parseAndAssignParamString, + escapeRegex, + Segment, + TouchMap, + ContinuationSegment, + StaticSegment, + DynamicSegment, + StarSegment, + paramMatcher, + wildcardMatcher, + RESERVED_CHARS, + PathRecognizer; + function normalizeString(obj) { + if (isBlank(obj)) { + return null; + } else { + return obj.toString(); + } + } + function parsePathString(route) { + if (StringWrapper.startsWith(route, "/")) { + route = StringWrapper.substring(route, 1); + } + var segments = splitBySlash(route); + var results = []; + var specificity = 0; + if (segments.length > 98) { + throw new BaseException(("'" + route + "' has more than the maximum supported number of segments.")); + } + var limit = segments.length - 1; + for (var i = 0; i <= limit; i++) { + var segment = segments[i], + match = void 0; + if (isPresent(match = RegExpWrapper.firstMatch(paramMatcher, segment))) { + results.push(new DynamicSegment(match[1])); + specificity += (100 - i); + } else if (isPresent(match = RegExpWrapper.firstMatch(wildcardMatcher, segment))) { + results.push(new StarSegment(match[1])); + } else if (segment == '...') { + if (i < limit) { + throw new BaseException(("Unexpected \"...\" before the end of the path for \"" + route + "\".")); + } + results.push(new ContinuationSegment()); + } else if (segment.length > 0) { + results.push(new StaticSegment(segment)); + specificity += 100 * (100 - i); + } + } + var result = StringMapWrapper.create(); + StringMapWrapper.set(result, 'segments', results); + StringMapWrapper.set(result, 'specificity', specificity); + return result; + } + function splitBySlash(url) { + return url.split('/'); + } + function assertPath(path) { + if (StringWrapper.contains(path, '#')) { + throw new BaseException(("Path \"" + path + "\" should not include \"#\". Use \"HashLocationStrategy\" instead.")); + } + var illegalCharacter = RegExpWrapper.firstMatch(RESERVED_CHARS, path); + if (isPresent(illegalCharacter)) { + throw new BaseException(("Path \"" + path + "\" contains \"" + illegalCharacter[0] + "\" which is not allowed in a route config.")); + } + } + return { + setters: [function($__m) { + RegExpWrapper = $__m.RegExpWrapper; + StringWrapper = $__m.StringWrapper; + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + BaseException = $__m.BaseException; + IMPLEMENTS = $__m.IMPLEMENTS; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + ListWrapper = $__m.ListWrapper; + }, function($__m) { + parseAndAssignParamString = $__m.parseAndAssignParamString; + }, function($__m) { + escapeRegex = $__m.escapeRegex; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Segment = (function() { + function Segment() {} + return ($traceurRuntime.createClass)(Segment, {generate: function(params) { + return ''; + }}, {}); + }()); + $__export("Segment", Segment); + TouchMap = (function() { + function TouchMap(map) { + var $__0 = this; + this.map = StringMapWrapper.create(); + this.keys = StringMapWrapper.create(); + if (isPresent(map)) { + StringMapWrapper.forEach(map, (function(value, key) { + $__0.map[key] = isPresent(value) ? value.toString() : null; + $__0.keys[key] = true; + })); + } + } + return ($traceurRuntime.createClass)(TouchMap, { + get: function(key) { + StringMapWrapper.delete(this.keys, key); + return this.map[key]; + }, + getUnused: function() { + var $__0 = this; + var unused = StringMapWrapper.create(); + var keys = StringMapWrapper.keys(this.keys); + ListWrapper.forEach(keys, (function(key) { + unused[key] = StringMapWrapper.get($__0.map, key); + })); + return unused; + } + }, {}); + }()); + ContinuationSegment = (function($__super) { + function ContinuationSegment() { + $traceurRuntime.superConstructor(ContinuationSegment).apply(this, arguments); + } + return ($traceurRuntime.createClass)(ContinuationSegment, {}, {}, $__super); + }(Segment)); + StaticSegment = (function($__super) { + function StaticSegment(string) { + $traceurRuntime.superConstructor(StaticSegment).call(this); + this.string = string; + this.name = ''; + this.regex = escapeRegex(string); + this.regex += '(;[^\/]+)?'; + } + return ($traceurRuntime.createClass)(StaticSegment, {generate: function(params) { + return this.string; + }}, {}, $__super); + }(Segment)); + DynamicSegment = (($traceurRuntime.createClass)(function(name) { + this.name = name; + this.regex = "([^/]+)"; + }, {generate: function(params) { + if (!StringMapWrapper.contains(params.map, this.name)) { + throw new BaseException(("Route generator for '" + this.name + "' was not included in parameters passed.")); + } + return normalizeString(params.get(this.name)); + }}, {})); + DynamicSegment = __decorate([IMPLEMENTS(Segment), __metadata('design:paramtypes', [String])], DynamicSegment); + StarSegment = (function() { + function StarSegment(name) { + this.name = name; + this.regex = "(.+)"; + } + return ($traceurRuntime.createClass)(StarSegment, {generate: function(params) { + return normalizeString(params.get(this.name)); + }}, {}); + }()); + paramMatcher = /^:([^\/]+)$/g; + wildcardMatcher = /^\*([^\/]+)$/g; + RESERVED_CHARS = RegExpWrapper.create('//|\\(|\\)|;|\\?|='); + PathRecognizer = (function() { + function PathRecognizer(path, handler) { + var isRoot = arguments[2] !== (void 0) ? arguments[2] : false; + var $__0 = this; + this.path = path; + this.handler = handler; + this.isRoot = isRoot; + this.terminal = true; + assertPath(path); + var parsed = parsePathString(path); + var specificity = parsed['specificity']; + var segments = parsed['segments']; + var regexString = '^'; + ListWrapper.forEach(segments, (function(segment) { + if (segment instanceof ContinuationSegment) { + $__0.terminal = false; + } else { + regexString += '/' + segment.regex; + } + })); + if (this.terminal) { + regexString += '$'; + } + this.regex = RegExpWrapper.create(regexString); + this.segments = segments; + this.specificity = specificity; + } + return ($traceurRuntime.createClass)(PathRecognizer, { + parseParams: function(url) { + var segmentsLimit = this.segments.length - 1; + var containsStarSegment = segmentsLimit >= 0 && this.segments[segmentsLimit] instanceof StarSegment; + var paramsString, + useQueryString = this.isRoot && this.terminal; + if (!containsStarSegment) { + var matches = RegExpWrapper.firstMatch(useQueryString ? PathRecognizer.queryRegex : PathRecognizer.matrixRegex, url); + if (isPresent(matches)) { + url = matches[1]; + paramsString = matches[2]; + } + url = StringWrapper.replaceAll(url, /(;[^\/]+)(?=(\/|$))/g, ''); + } + var params = StringMapWrapper.create(); + var urlPart = url; + for (var i = 0; i <= segmentsLimit; i++) { + var segment = this.segments[i]; + if (segment instanceof ContinuationSegment) { + continue; + } + var match = RegExpWrapper.firstMatch(RegExpWrapper.create('/' + segment.regex), urlPart); + urlPart = StringWrapper.substring(urlPart, match[0].length); + if (segment.name.length > 0) { + params[segment.name] = match[1]; + } + } + if (isPresent(paramsString) && paramsString.length > 0) { + var expectedStartingValue = useQueryString ? '?' : ';'; + if (paramsString[0] == expectedStartingValue) { + parseAndAssignParamString(expectedStartingValue, paramsString, params); + } + } + return params; + }, + generate: function(params) { + var paramTokens = new TouchMap(params); + var applyLeadingSlash = false; + var useQueryString = this.isRoot && this.terminal; + var url = ''; + for (var i = 0; i < this.segments.length; i++) { + var segment = this.segments[i]; + var s = segment.generate(paramTokens); + applyLeadingSlash = applyLeadingSlash || (segment instanceof ContinuationSegment); + if (s.length > 0) { + url += (i > 0 ? '/' : '') + s; + } + } + var unusedParams = paramTokens.getUnused(); + if (!StringMapWrapper.isEmpty(unusedParams)) { + url += useQueryString ? '?' : ';'; + var paramToken = useQueryString ? '&' : ';'; + var i = 0; + StringMapWrapper.forEach(unusedParams, (function(value, key) { + if (i++ > 0) { + url += paramToken; + } + url += key; + if (!isPresent(value) && useQueryString) { + value = 'true'; + } + if (isPresent(value)) { + url += '=' + value; + } + })); + } + if (applyLeadingSlash) { + url += '/'; + } + return url; + }, + resolveComponentType: function() { + return this.handler.resolveComponentType(); + } + }, {}); + }()); + $__export("PathRecognizer", PathRecognizer); + PathRecognizer.matrixRegex = RegExpWrapper.create('^(.*\/[^\/]+?)(;[^\/]+)?\/?$'); + PathRecognizer.queryRegex = RegExpWrapper.create('^(.*\/[^\/]+?)(\\?[^\/]+)?$'); + } + }; +}); + +System.register("angular2/src/router/route_config_nomalizer", ["angular2/src/router/route_config_decorator", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/route_config_nomalizer"; + var AsyncRoute, + Route, + Redirect, + BaseException; + function normalizeRouteConfig(config) { + if (config instanceof Route || config instanceof Redirect || config instanceof AsyncRoute) { + return config; + } + if ((!config.component) == (!config.redirectTo)) { + throw new BaseException("Route config should contain exactly one 'component', or 'redirectTo' property"); + } + if (config.component) { + if (typeof config.component == 'object') { + var componentDefinitionObject = config.component; + if (componentDefinitionObject.type == 'constructor') { + return new Route({ + path: config.path, + component: componentDefinitionObject.constructor, + as: config.as + }); + } else if (componentDefinitionObject.type == 'loader') { + return new AsyncRoute({ + path: config.path, + loader: componentDefinitionObject.loader, + as: config.as + }); + } else { + throw new BaseException(("Invalid component type '" + componentDefinitionObject.type + "'. Valid types are \"constructor\" and \"loader\".")); + } + } + return new Route(config); + } + if (config.redirectTo) { + return new Redirect({ + path: config.path, + redirectTo: config.redirectTo + }); + } + return config; + } + $__export("normalizeRouteConfig", normalizeRouteConfig); + return { + setters: [function($__m) { + AsyncRoute = $__m.AsyncRoute; + Route = $__m.Route; + Redirect = $__m.Redirect; + }, function($__m) { + BaseException = $__m.BaseException; + }], + execute: function() { + } + }; +}); + +System.register("angular2/src/router/route_lifecycle_reflector", ["angular2/src/facade/lang", "angular2/src/router/lifecycle_annotations_impl", "angular2/src/reflection/reflection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/route_lifecycle_reflector"; + var Type, + CanActivate, + reflector; + function hasLifecycleHook(e, type) { + if (!(type instanceof Type)) + return false; + return e.name in type.prototype; + } + function getCanActivateHook(type) { + var annotations = reflector.annotations(type); + for (var i = 0; i < annotations.length; i += 1) { + var annotation = annotations[i]; + if (annotation instanceof CanActivate) { + return annotation.fn; + } + } + return null; + } + $__export("hasLifecycleHook", hasLifecycleHook); + $__export("getCanActivateHook", getCanActivateHook); + return { + setters: [function($__m) { + Type = $__m.Type; + }, function($__m) { + CanActivate = $__m.CanActivate; + }, function($__m) { + reflector = $__m.reflector; + }], + execute: function() { + } + }; +}); + +System.register("angular2/src/router/router_link", ["angular2/src/core/annotations/decorators", "angular2/src/router/router", "angular2/src/router/location"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/router_link"; + var __decorate, + __metadata, + Directive, + Router, + Location, + RouterLink; + return { + setters: [function($__m) { + Directive = $__m.Directive; + }, function($__m) { + Router = $__m.Router; + }, function($__m) { + Location = $__m.Location; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + RouterLink = (($traceurRuntime.createClass)(function(_router, _location) { + this._router = _router; + this._location = _location; + }, { + set routeParams(changes) { + this._routeParams = changes; + this._navigationHref = this._router.generate(this._routeParams); + this.visibleHref = this._location.normalizeAbsolutely(this._navigationHref); + }, + onClick: function() { + this._router.navigate(this._navigationHref); + return false; + } + }, {})); + $__export("RouterLink", RouterLink); + $__export("RouterLink", RouterLink = __decorate([Directive({ + selector: '[router-link]', + properties: ['routeParams: routerLink'], + host: { + '(^click)': 'onClick()', + '[attr.href]': 'visibleHref' + } + }), __metadata('design:paramtypes', [Router, Location])], RouterLink)); + } + }; +}); + +System.register("angular2/src/router/route_recognizer", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/router/path_recognizer", "angular2/src/router/route_config_impl", "angular2/src/router/async_route_handler", "angular2/src/router/sync_route_handler", "angular2/src/router/helpers"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/route_recognizer"; + var RegExpWrapper, + isBlank, + isPresent, + isType, + isStringMap, + BaseException, + Map, + MapWrapper, + StringMapWrapper, + PathRecognizer, + Route, + AsyncRoute, + Redirect, + AsyncRouteHandler, + SyncRouteHandler, + parseAndAssignParamString, + RouteRecognizer, + RouteMatch; + function configObjToHandler(config) { + if (isType(config)) { + return new SyncRouteHandler(config); + } else if (isStringMap(config)) { + if (isBlank(config['type'])) { + throw new BaseException("Component declaration when provided as a map should include a 'type' property"); + } + var componentType = config['type']; + if (componentType == 'constructor') { + return new SyncRouteHandler(config['constructor']); + } else if (componentType == 'loader') { + return new AsyncRouteHandler(config['loader']); + } else { + throw new BaseException("oops"); + } + } + throw new BaseException(("Unexpected component \"" + config + "\".")); + } + return { + setters: [function($__m) { + RegExpWrapper = $__m.RegExpWrapper; + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + isType = $__m.isType; + isStringMap = $__m.isStringMap; + BaseException = $__m.BaseException; + }, function($__m) { + Map = $__m.Map; + MapWrapper = $__m.MapWrapper; + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + PathRecognizer = $__m.PathRecognizer; + }, function($__m) { + Route = $__m.Route; + AsyncRoute = $__m.AsyncRoute; + Redirect = $__m.Redirect; + }, function($__m) { + AsyncRouteHandler = $__m.AsyncRouteHandler; + }, function($__m) { + SyncRouteHandler = $__m.SyncRouteHandler; + }, function($__m) { + parseAndAssignParamString = $__m.parseAndAssignParamString; + }], + execute: function() { + RouteRecognizer = (function() { + function RouteRecognizer() { + var isRoot = arguments[0] !== (void 0) ? arguments[0] : false; + this.isRoot = isRoot; + this.names = new Map(); + this.redirects = new Map(); + this.matchers = new Map(); + } + return ($traceurRuntime.createClass)(RouteRecognizer, { + config: function(config) { + var handler; + if (config instanceof Redirect) { + var path = config.path == '/' ? '' : config.path; + this.redirects.set(path, config.redirectTo); + return true; + } else if (config instanceof Route) { + handler = new SyncRouteHandler(config.component); + } else if (config instanceof AsyncRoute) { + handler = new AsyncRouteHandler(config.loader); + } + var recognizer = new PathRecognizer(config.path, handler, this.isRoot); + MapWrapper.forEach(this.matchers, (function(matcher, _) { + if (recognizer.regex.toString() == matcher.regex.toString()) { + throw new BaseException(("Configuration '" + config.path + "' conflicts with existing route '" + matcher.path + "'")); + } + })); + this.matchers.set(recognizer.regex, recognizer); + if (isPresent(config.as)) { + this.names.set(config.as, recognizer); + } + return recognizer.terminal; + }, + recognize: function(url) { + var solutions = []; + if (url.length > 0 && url[url.length - 1] == '/') { + url = url.substring(0, url.length - 1); + } + MapWrapper.forEach(this.redirects, (function(target, path) { + if (path == '/' || path == '') { + if (path == url) { + url = target; + } + } else if (url.startsWith(path)) { + url = target + url.substring(path.length); + } + })); + var queryParams = StringMapWrapper.create(); + var queryString = ''; + var queryIndex = url.indexOf('?'); + if (queryIndex >= 0) { + queryString = url.substring(queryIndex + 1); + url = url.substring(0, queryIndex); + } + if (this.isRoot && queryString.length > 0) { + parseAndAssignParamString('&', queryString, queryParams); + } + MapWrapper.forEach(this.matchers, (function(pathRecognizer, regex) { + var match; + if (isPresent(match = RegExpWrapper.firstMatch(regex, url))) { + var matchedUrl = '/'; + var unmatchedUrl = ''; + if (url != '/') { + matchedUrl = match[0]; + unmatchedUrl = url.substring(match[0].length); + } + var params = null; + if (pathRecognizer.terminal && !StringMapWrapper.isEmpty(queryParams)) { + params = queryParams; + matchedUrl += '?' + queryString; + } + solutions.push(new RouteMatch(pathRecognizer, matchedUrl, unmatchedUrl, params)); + } + })); + return solutions; + }, + hasRoute: function(name) { + return this.names.has(name); + }, + generate: function(name, params) { + var pathRecognizer = this.names.get(name); + if (isBlank(pathRecognizer)) { + return null; + } + var url = pathRecognizer.generate(params); + return { + url: url, + 'nextComponent': pathRecognizer.handler.componentType + }; + } + }, {}); + }()); + $__export("RouteRecognizer", RouteRecognizer); + RouteMatch = (function() { + function RouteMatch(recognizer, matchedUrl, unmatchedUrl) { + var p = arguments[3] !== (void 0) ? arguments[3] : null; + this.recognizer = recognizer; + this.matchedUrl = matchedUrl; + this.unmatchedUrl = unmatchedUrl; + this._paramsParsed = false; + this._params = isPresent(p) ? p : StringMapWrapper.create(); + } + return ($traceurRuntime.createClass)(RouteMatch, {params: function() { + var $__0 = this; + if (!this._paramsParsed) { + this._paramsParsed = true; + StringMapWrapper.forEach(this.recognizer.parseParams(this.matchedUrl), (function(value, key) { + StringMapWrapper.set($__0._params, key, value); + })); + } + return this._params; + }}, {}); + }()); + $__export("RouteMatch", RouteMatch); + } + }; +}); + +System.register("angular2/src/router/router", ["angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/router/route_lifecycle_reflector"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/router"; + var PromiseWrapper, + EventEmitter, + ObservableWrapper, + ListWrapper, + isBlank, + isString, + StringWrapper, + isPresent, + BaseException, + getCanActivateHook, + _resolveToTrue, + _resolveToFalse, + Router, + RootRouter, + ChildRouter, + SLASH; + function splitAndFlattenLinkParams(linkParams) { + return ListWrapper.reduce(linkParams, (function(accumulation, item) { + if (isString(item)) { + return ListWrapper.concat(accumulation, StringWrapper.split(item, SLASH)); + } + accumulation.push(item); + return accumulation; + }), []); + } + function canActivateOne(nextInstruction, currentInstruction) { + var next = _resolveToTrue; + if (isPresent(nextInstruction.child)) { + next = canActivateOne(nextInstruction.child, isPresent(currentInstruction) ? currentInstruction.child : null); + } + return next.then((function(res) { + if (res == false) { + return false; + } + if (nextInstruction.reuse) { + return true; + } + var hook = getCanActivateHook(nextInstruction.component); + if (isPresent(hook)) { + return hook(nextInstruction, currentInstruction); + } + return true; + })); + } + return { + setters: [function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + isBlank = $__m.isBlank; + isString = $__m.isString; + StringWrapper = $__m.StringWrapper; + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + }, function($__m) { + getCanActivateHook = $__m.getCanActivateHook; + }], + execute: function() { + _resolveToTrue = PromiseWrapper.resolve(true); + _resolveToFalse = PromiseWrapper.resolve(false); + Router = (function() { + function Router(registry, _pipeline, parent, hostComponent) { + this.registry = registry; + this._pipeline = _pipeline; + this.parent = parent; + this.hostComponent = hostComponent; + this.navigating = false; + this._currentInstruction = null; + this._currentNavigation = _resolveToTrue; + this._outlet = null; + this._subject = new EventEmitter(); + } + return ($traceurRuntime.createClass)(Router, { + childRouter: function(hostComponent) { + return new ChildRouter(this, hostComponent); + }, + registerOutlet: function(outlet) { + this._outlet = outlet; + if (isPresent(this._currentInstruction)) { + return outlet.commit(this._currentInstruction); + } + return _resolveToTrue; + }, + config: function(definitions) { + var $__0 = this; + definitions.forEach((function(routeDefinition) { + $__0.registry.config($__0.hostComponent, routeDefinition, $__0 instanceof RootRouter); + })); + return this.renavigate(); + }, + navigate: function(url) { + var $__0 = this; + return this._currentNavigation = this._currentNavigation.then((function(_) { + $__0.lastNavigationAttempt = url; + $__0._startNavigating(); + return $__0._afterPromiseFinishNavigating($__0.recognize(url).then((function(matchedInstruction) { + if (isBlank(matchedInstruction)) { + return false; + } + return $__0._reuse(matchedInstruction).then((function(_) { + return $__0._canActivate(matchedInstruction); + })).then((function(result) { + if (!result) { + return false; + } + return $__0._canDeactivate(matchedInstruction).then((function(result) { + if (result) { + return $__0.commit(matchedInstruction).then((function(_) { + $__0._emitNavigationFinish(matchedInstruction.accumulatedUrl); + return true; + })); + } + })); + })); + }))); + })); + }, + _emitNavigationFinish: function(url) { + ObservableWrapper.callNext(this._subject, url); + }, + _afterPromiseFinishNavigating: function(promise) { + var $__0 = this; + return PromiseWrapper.catchError(promise.then((function(_) { + return $__0._finishNavigating(); + })), (function(err) { + $__0._finishNavigating(); + throw err; + })); + }, + _reuse: function(instruction) { + var $__0 = this; + if (isBlank(this._outlet)) { + return _resolveToFalse; + } + return this._outlet.canReuse(instruction).then((function(result) { + instruction.reuse = result; + if (isPresent($__0._outlet.childRouter) && isPresent(instruction.child)) { + return $__0._outlet.childRouter._reuse(instruction.child); + } + })); + }, + _canActivate: function(instruction) { + return canActivateOne(instruction, this._currentInstruction); + }, + _canDeactivate: function(instruction) { + var $__0 = this; + if (isBlank(this._outlet)) { + return _resolveToTrue; + } + var next; + if (isPresent(instruction) && instruction.reuse) { + next = _resolveToTrue; + } else { + next = this._outlet.canDeactivate(instruction); + } + return next.then((function(result) { + if (result == false) { + return false; + } + if (isPresent($__0._outlet.childRouter)) { + return $__0._outlet.childRouter._canDeactivate(isPresent(instruction) ? instruction.child : null); + } + return true; + })); + }, + commit: function(instruction) { + this._currentInstruction = instruction; + if (isPresent(this._outlet)) { + return this._outlet.commit(instruction); + } + return _resolveToTrue; + }, + _startNavigating: function() { + this.navigating = true; + }, + _finishNavigating: function() { + this.navigating = false; + }, + subscribe: function(onNext) { + ObservableWrapper.subscribe(this._subject, onNext); + }, + deactivate: function(instruction) { + if (isPresent(this._outlet)) { + return this._outlet.deactivate(instruction); + } + return _resolveToTrue; + }, + recognize: function(url) { + return this.registry.recognize(url, this.hostComponent); + }, + renavigate: function() { + if (isBlank(this.lastNavigationAttempt)) { + return this._currentNavigation; + } + return this.navigate(this.lastNavigationAttempt); + }, + generate: function(linkParams) { + var normalizedLinkParams = splitAndFlattenLinkParams(linkParams); + var first = ListWrapper.first(normalizedLinkParams); + var rest = ListWrapper.slice(normalizedLinkParams, 1); + var router = this; + if (first == '') { + while (isPresent(router.parent)) { + router = router.parent; + } + } else if (first == '..') { + router = router.parent; + while (ListWrapper.first(rest) == '..') { + rest = ListWrapper.slice(rest, 1); + router = router.parent; + if (isBlank(router)) { + throw new BaseException(("Link \"" + ListWrapper.toJSON(linkParams) + "\" has too many \"../\" segments.")); + } + } + } else if (first != '.') { + throw new BaseException(("Link \"" + ListWrapper.toJSON(linkParams) + "\" must start with \"/\", \"./\", or \"../\"")); + } + if (rest[rest.length - 1] == '') { + ListWrapper.removeLast(rest); + } + if (rest.length < 1) { + var msg = ("Link \"" + ListWrapper.toJSON(linkParams) + "\" must include a route name."); + throw new BaseException(msg); + } + var url = ''; + if (isPresent(router.parent) && isPresent(router.parent._currentInstruction)) { + url = router.parent._currentInstruction.capturedUrl; + } + return url + '/' + this.registry.generate(rest, router.hostComponent); + } + }, {}); + }()); + $__export("Router", Router); + RootRouter = (function($__super) { + function RootRouter(registry, pipeline, location, hostComponent) { + var $__0; + $traceurRuntime.superConstructor(RootRouter).call(this, registry, pipeline, null, hostComponent); + this._location = location; + this._location.subscribe(($__0 = this, function(change) { + return $__0.navigate(change['url']); + })); + this.registry.configFromComponent(hostComponent, true); + this.navigate(location.path()); + } + return ($traceurRuntime.createClass)(RootRouter, {commit: function(instruction) { + var $__0 = this; + return $traceurRuntime.superGet(this, RootRouter.prototype, "commit").call(this, instruction).then((function(_) { + $__0._location.go(instruction.accumulatedUrl); + })); + }}, {}, $__super); + }(Router)); + $__export("RootRouter", RootRouter); + ChildRouter = (function($__super) { + function ChildRouter(parent, hostComponent) { + $traceurRuntime.superConstructor(ChildRouter).call(this, parent.registry, parent._pipeline, parent, hostComponent); + this.parent = parent; + } + return ($traceurRuntime.createClass)(ChildRouter, {navigate: function(url) { + return this.parent.navigate(url); + }}, {}, $__super); + }(Router)); + SLASH = new RegExp('/'); + } + }; +}); + +System.register("angular2/src/router/route_registry", ["angular2/src/router/route_recognizer", "angular2/src/router/instruction", "angular2/src/facade/collection", "angular2/src/facade/async", "angular2/src/facade/lang", "angular2/src/router/route_config_impl", "angular2/src/reflection/reflection", "angular2/di", "angular2/src/router/route_config_nomalizer"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/route_registry"; + var __decorate, + __metadata, + RouteRecognizer, + Instruction, + ListWrapper, + Map, + PromiseWrapper, + isPresent, + isBlank, + isType, + isString, + isStringMap, + BaseException, + getTypeNameForDebugging, + RouteConfig, + Route, + reflector, + Injectable, + normalizeRouteConfig, + RouteRegistry; + function mostSpecific(instructions) { + var mostSpecificSolution = instructions[0]; + for (var solutionIndex = 1; solutionIndex < instructions.length; solutionIndex++) { + var solution = instructions[solutionIndex]; + if (solution.specificity > mostSpecificSolution.specificity) { + mostSpecificSolution = solution; + } + } + return mostSpecificSolution; + } + function assertTerminalComponent(component, path) { + if (!isType(component)) { + return ; + } + var annotations = reflector.annotations(component); + if (isPresent(annotations)) { + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + if (annotation instanceof RouteConfig) { + throw new BaseException(("Child routes are not allowed for \"" + path + "\". Use \"...\" on the parent's route path.")); + } + } + } + } + return { + setters: [function($__m) { + RouteRecognizer = $__m.RouteRecognizer; + }, function($__m) { + Instruction = $__m.Instruction; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + Map = $__m.Map; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + isBlank = $__m.isBlank; + isType = $__m.isType; + isString = $__m.isString; + isStringMap = $__m.isStringMap; + BaseException = $__m.BaseException; + getTypeNameForDebugging = $__m.getTypeNameForDebugging; + }, function($__m) { + RouteConfig = $__m.RouteConfig; + Route = $__m.Route; + }, function($__m) { + reflector = $__m.reflector; + }, function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + normalizeRouteConfig = $__m.normalizeRouteConfig; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + RouteRegistry = (($traceurRuntime.createClass)(function() { + this._rules = new Map(); + }, { + config: function(parentComponent, config) { + var isRootLevelRoute = arguments[2] !== (void 0) ? arguments[2] : false; + config = normalizeRouteConfig(config); + var recognizer = this._rules.get(parentComponent); + if (isBlank(recognizer)) { + recognizer = new RouteRecognizer(isRootLevelRoute); + this._rules.set(parentComponent, recognizer); + } + var terminal = recognizer.config(config); + if (config instanceof Route) { + if (terminal) { + assertTerminalComponent(config.component, config.path); + } else { + this.configFromComponent(config.component); + } + } + }, + configFromComponent: function(component) { + var isRootComponent = arguments[1] !== (void 0) ? arguments[1] : false; + var $__0 = this; + if (!isType(component)) { + return ; + } + if (this._rules.has(component)) { + return ; + } + var annotations = reflector.annotations(component); + if (isPresent(annotations)) { + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + if (annotation instanceof RouteConfig) { + ListWrapper.forEach(annotation.configs, (function(config) { + return $__0.config(component, config, isRootComponent); + })); + } + } + } + }, + recognize: function(url, parentComponent) { + var $__0 = this; + var componentRecognizer = this._rules.get(parentComponent); + if (isBlank(componentRecognizer)) { + return PromiseWrapper.resolve(null); + } + var possibleMatches = componentRecognizer.recognize(url); + var matchPromises = ListWrapper.map(possibleMatches, (function(candidate) { + return $__0._completeRouteMatch(candidate); + })); + return PromiseWrapper.all(matchPromises).then((function(solutions) { + var fullSolutions = ListWrapper.filter(solutions, (function(solution) { + return isPresent(solution); + })); + if (fullSolutions.length > 0) { + return mostSpecific(fullSolutions); + } + return null; + })); + }, + _completeRouteMatch: function(partialMatch) { + var $__0 = this; + var recognizer = partialMatch.recognizer; + var handler = recognizer.handler; + return handler.resolveComponentType().then((function(componentType) { + $__0.configFromComponent(componentType); + if (partialMatch.unmatchedUrl.length == 0) { + if (recognizer.terminal) { + return new Instruction(componentType, partialMatch.matchedUrl, recognizer, null, partialMatch.params()); + } else { + return null; + } + } + return $__0.recognize(partialMatch.unmatchedUrl, componentType).then((function(childInstruction) { + if (isBlank(childInstruction)) { + return null; + } else { + return new Instruction(componentType, partialMatch.matchedUrl, recognizer, childInstruction); + } + })); + })); + }, + generate: function(linkParams, parentComponent) { + var url = ''; + var componentCursor = parentComponent; + for (var i = 0; i < linkParams.length; i += 1) { + var segment = linkParams[i]; + if (isBlank(componentCursor)) { + throw new BaseException(("Could not find route named \"" + segment + "\".")); + } + if (!isString(segment)) { + throw new BaseException(("Unexpected segment \"" + segment + "\" in link DSL. Expected a string.")); + } else if (segment == '' || segment == '.' || segment == '..') { + throw new BaseException(("\"" + segment + "/\" is only allowed at the beginning of a link DSL.")); + } + var params = null; + if (i + 1 < linkParams.length) { + var nextSegment = linkParams[i + 1]; + if (isStringMap(nextSegment)) { + params = nextSegment; + i += 1; + } + } + var componentRecognizer = this._rules.get(componentCursor); + if (isBlank(componentRecognizer)) { + throw new BaseException(("Component \"" + getTypeNameForDebugging(componentCursor) + "\" has no route config.")); + } + var response = componentRecognizer.generate(segment, params); + if (isBlank(response)) { + throw new BaseException(("Component \"" + getTypeNameForDebugging(componentCursor) + "\" has no route named \"" + segment + "\".")); + } + url += response['url']; + componentCursor = response['nextComponent']; + } + return url; + } + }, {})); + $__export("RouteRegistry", RouteRegistry); + $__export("RouteRegistry", RouteRegistry = __decorate([Injectable(), __metadata('design:paramtypes', [])], RouteRegistry)); + } + }; +}); + +System.register("angular2/src/router/router_outlet", ["angular2/src/facade/async", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/core/annotations/decorators", "angular2/core", "angular2/di", "angular2/src/router/router", "angular2/src/router/instruction", "angular2/src/router/lifecycle_annotations", "angular2/src/router/route_lifecycle_reflector"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/router_outlet"; + var __decorate, + __metadata, + __param, + PromiseWrapper, + StringMapWrapper, + isBlank, + isPresent, + Directive, + Attribute, + DynamicComponentLoader, + ElementRef, + Injector, + bind, + routerMod, + RouteParams, + hookMod, + hasLifecycleHook, + RouterOutlet; + return { + setters: [function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + isBlank = $__m.isBlank; + isPresent = $__m.isPresent; + }, function($__m) { + Directive = $__m.Directive; + Attribute = $__m.Attribute; + }, function($__m) { + DynamicComponentLoader = $__m.DynamicComponentLoader; + ElementRef = $__m.ElementRef; + }, function($__m) { + Injector = $__m.Injector; + bind = $__m.bind; + }, function($__m) { + routerMod = $__m; + }, function($__m) { + RouteParams = $__m.RouteParams; + }, function($__m) { + hookMod = $__m; + }, function($__m) { + hasLifecycleHook = $__m.hasLifecycleHook; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + RouterOutlet = (($traceurRuntime.createClass)(function(_elementRef, _loader, _parentRouter, nameAttr) { + this._elementRef = _elementRef; + this._loader = _loader; + this._parentRouter = _parentRouter; + this.childRouter = null; + this._componentRef = null; + this._currentInstruction = null; + this._parentRouter.registerOutlet(this); + }, { + commit: function(instruction) { + var $__0 = this; + var next; + if (instruction.reuse) { + next = this._reuse(instruction); + } else { + next = this.deactivate(instruction).then((function(_) { + return $__0._activate(instruction); + })); + } + return next.then((function(_) { + return $__0._commitChild(instruction); + })); + }, + _commitChild: function(instruction) { + if (isPresent(this.childRouter)) { + return this.childRouter.commit(instruction.child); + } else { + return PromiseWrapper.resolve(true); + } + }, + _activate: function(instruction) { + var $__0 = this; + var previousInstruction = this._currentInstruction; + this._currentInstruction = instruction; + this.childRouter = this._parentRouter.childRouter(instruction.component); + var bindings = Injector.resolve([bind(RouteParams).toValue(new RouteParams(instruction.params())), bind(routerMod.Router).toValue(this.childRouter)]); + return this._loader.loadNextToLocation(instruction.component, this._elementRef, bindings).then((function(componentRef) { + $__0._componentRef = componentRef; + if (hasLifecycleHook(hookMod.onActivate, instruction.component)) { + return $__0._componentRef.instance.onActivate(instruction, previousInstruction); + } + })); + }, + canDeactivate: function(nextInstruction) { + if (isBlank(this._currentInstruction)) { + return PromiseWrapper.resolve(true); + } + if (hasLifecycleHook(hookMod.canDeactivate, this._currentInstruction.component)) { + return PromiseWrapper.resolve(this._componentRef.instance.canDeactivate(nextInstruction, this._currentInstruction)); + } + return PromiseWrapper.resolve(true); + }, + canReuse: function(nextInstruction) { + var result; + if (isBlank(this._currentInstruction) || this._currentInstruction.component != nextInstruction.component) { + result = false; + } else if (hasLifecycleHook(hookMod.canReuse, this._currentInstruction.component)) { + result = this._componentRef.instance.canReuse(nextInstruction, this._currentInstruction); + } else { + result = nextInstruction == this._currentInstruction || StringMapWrapper.equals(nextInstruction.params(), this._currentInstruction.params()); + } + return PromiseWrapper.resolve(result); + }, + _reuse: function(instruction) { + var previousInstruction = this._currentInstruction; + this._currentInstruction = instruction; + return PromiseWrapper.resolve(hasLifecycleHook(hookMod.onReuse, this._currentInstruction.component) ? this._componentRef.instance.onReuse(instruction, previousInstruction) : true); + }, + deactivate: function(nextInstruction) { + var $__0 = this; + return (isPresent(this.childRouter) ? this.childRouter.deactivate(isPresent(nextInstruction) ? nextInstruction.child : null) : PromiseWrapper.resolve(true)).then((function(_) { + if (isPresent($__0._componentRef) && isPresent($__0._currentInstruction) && hasLifecycleHook(hookMod.onDeactivate, $__0._currentInstruction.component)) { + return $__0._componentRef.instance.onDeactivate(nextInstruction, $__0._currentInstruction); + } + })).then((function(_) { + if (isPresent($__0._componentRef)) { + $__0._componentRef.dispose(); + $__0._componentRef = null; + } + })); + } + }, {})); + $__export("RouterOutlet", RouterOutlet); + $__export("RouterOutlet", RouterOutlet = __decorate([Directive({selector: 'router-outlet'}), __param(3, Attribute('name')), __metadata('design:paramtypes', [ElementRef, DynamicComponentLoader, routerMod.Router, String])], RouterOutlet)); + } + }; +}); + +System.register("angular2/router", ["angular2/src/router/router", "angular2/src/router/router_outlet", "angular2/src/router/router_link", "angular2/src/router/instruction", "angular2/src/router/route_registry", "angular2/src/router/location_strategy", "angular2/src/router/hash_location_strategy", "angular2/src/router/html5_location_strategy", "angular2/src/router/location", "angular2/src/router/pipeline", "angular2/src/router/route_config_decorator", "angular2/src/router/lifecycle_annotations", "angular2/src/core/application_tokens", "angular2/di", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/router"; + var LocationStrategy, + HTML5LocationStrategy, + Router, + RootRouter, + RouterOutlet, + RouterLink, + RouteRegistry, + Pipeline, + Location, + appComponentTypeToken, + bind, + CONST_EXPR, + routerDirectives, + routerInjectables; + var $__exportNames = { + routerDirectives: true, + routerInjectables: true, + undefined: true + }; + return { + setters: [function($__m) { + Router = $__m.Router; + RootRouter = $__m.RootRouter; + $__export("Router", $__m.Router); + $__export("RootRouter", $__m.RootRouter); + }, function($__m) { + RouterOutlet = $__m.RouterOutlet; + $__export("RouterOutlet", $__m.RouterOutlet); + }, function($__m) { + RouterLink = $__m.RouterLink; + $__export("RouterLink", $__m.RouterLink); + }, function($__m) { + $__export("RouteParams", $__m.RouteParams); + }, function($__m) { + RouteRegistry = $__m.RouteRegistry; + $__export("RouteRegistry", $__m.RouteRegistry); + }, function($__m) { + LocationStrategy = $__m.LocationStrategy; + $__export("LocationStrategy", $__m.LocationStrategy); + }, function($__m) { + $__export("HashLocationStrategy", $__m.HashLocationStrategy); + }, function($__m) { + HTML5LocationStrategy = $__m.HTML5LocationStrategy; + $__export("HTML5LocationStrategy", $__m.HTML5LocationStrategy); + }, function($__m) { + Location = $__m.Location; + $__export("Location", $__m.Location); + $__export("appBaseHrefToken", $__m.appBaseHrefToken); + }, function($__m) { + Pipeline = $__m.Pipeline; + $__export("Pipeline", $__m.Pipeline); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + $__export("CanActivate", $__m.CanActivate); + }, function($__m) { + appComponentTypeToken = $__m.appComponentTypeToken; + }, function($__m) { + bind = $__m.bind; + }, function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }], + execute: function() { + routerDirectives = CONST_EXPR([RouterOutlet, RouterLink]); + $__export("routerDirectives", routerDirectives); + routerInjectables = [RouteRegistry, Pipeline, bind(LocationStrategy).toClass(HTML5LocationStrategy), Location, bind(Router).toFactory((function(registry, pipeline, location, appRoot) { + return new RootRouter(registry, pipeline, location, appRoot); + }), [RouteRegistry, Pipeline, Location, appComponentTypeToken])]; + $__export("routerInjectables", routerInjectables); + } + }; +}); + +//# sourceMappingURL=router.dev.js.map \ No newline at end of file diff --git a/2.0.0-alpha.33/router.dev.js.map b/2.0.0-alpha.33/router.dev.js.map new file mode 100644 index 0000000000..c1e288d9bd --- /dev/null +++ b/2.0.0-alpha.33/router.dev.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../dev/es6/angular2/src/router/lifecycle_annotations_impl.js","../dev/es6/angular2/src/router/instruction.js","../dev/es6/angular2/src/router/lifecycle_annotations.js","../dev/es6/angular2/src/router/location_strategy.js","../dev/es6/angular2/src/router/helpers.js","../dev/es6/angular2/src/router/url.js","../dev/es6/angular2/src/router/route_config_impl.js","../dev/es6/angular2/src/router/async_route_handler.js","../dev/es6/angular2/src/router/sync_route_handler.js","../dev/es6/angular2/src/router/route_config_decorator.js","../dev/es6/angular2/src/router/hash_location_strategy.js","../dev/es6/angular2/src/router/html5_location_strategy.js","../dev/es6/angular2/src/router/pipeline.js","../dev/es6/angular2/src/router/location.js","../dev/es6/angular2/src/router/path_recognizer.js","../dev/es6/angular2/src/router/route_config_nomalizer.js","../dev/es6/angular2/src/router/route_lifecycle_reflector.js","../dev/es6/angular2/src/router/router_link.js","../dev/es6/angular2/src/router/route_recognizer.js","../dev/es6/angular2/src/router/router.js","../dev/es6/angular2/src/router/route_registry.js","../dev/es6/angular2/src/router/router_outlet.js","../dev/es6/angular2/router.js"],"names":[],"mappings":";AAAA,KAAK,SAAS,AAAC,gFACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,mDAAoB,CAAC;;;;;;;;;;;;AAApC,OAAO;AACD,UAAM,GADZ,SAAS,IAAG;AAAZ,YAAoB,KAAG,MAAkB,CAAC;AAA1C,iBAAoB,KAAG,WAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;iBAFK,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,eAAQ,SAAQ,OAAO;AACnB,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;YAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,KAAG,CAAC,CAAC;AAAA,QACzG;MACJ;iBACiB,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,MAC5G;2BAVA,CAAC,eAAc,YAAY,CAAC,AAAC,CAYG,SAChB,IAAG,CAAG;AACd,WAAG,KAAK,EAAI,KAAG,CAAC;MACpB,AACJ,SAhBqF;AAArF,cAAQ,AAAC,0CAAqC,CAAA;AAA9C,AAiBA,cAjBQ,AAAC,sBAiBT,CAAA,kBAAiB,EAAI,CAAA,UAAS,AAAC,CAAC,CAC5B,KAAI,AAAC,EAAC,CACN,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,MAAK,CAAC,CAAC,CAC5C,CAAG,mBAAiB,CAAC,CApByB,CAoBxB;oBApBtB,CAAC,eAAc,YAAY,CAAC,AAAC,CAqBJ,SACT,EAAC,CAAG;AACZ,WAAG,GAAG,EAAI,GAAC,CAAC;MAChB,AACJ,SAzBqF;AAArF,cAAQ,AAAC,4BAAqC,CAAA;AAA9C,AA0BA,cA1BQ,AAAC,eA0BT,CAAA,WAAU,EAAI,CAAA,UAAS,AAAC,CAAC,CACrB,KAAI,AAAC,EAAC,CACN,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,QAAO,CAAC,CAAC,CAC9C,CAAG,YAAU,CAAC,CA7BgC,CA6B/B;eACS,CAAA,UAAS,AAAC,CAAC,GAAI,mBAAiB,AAAC,CAAC,UAAS,CAAC,CAAC;AA9BrE,cAAQ,AAAC,sBAAqC,CAAA;oBA+BjB,CAAA,UAAS,AAAC,CAAC,GAAI,mBAAiB,AAAC,CAAC,eAAc,CAAC,CAAC;AA/B/E,cAAQ,AAAC,gCAAqC,CAAA;iBAgCpB,CAAA,UAAS,AAAC,CAAC,GAAI,mBAAiB,AAAC,CAAC,YAAW,CAAC,CAAC;AAhCzE,cAAQ,AAAC,0BAAqC,CAAA;cAiCvB,CAAA,UAAS,AAAC,CAAC,GAAI,mBAAiB,AAAC,CAAC,SAAQ,CAAC,CAAC;AAjCnE,cAAQ,AAAC,oBAAqC,CAAA;mBAkClB,CAAA,UAAS,AAAC,CAAC,GAAI,mBAAiB,AAAC,CAAC,cAAa,CAAC,CAAC;AAlC7E,cAAQ,AAAC,8BAAqC,CAAA;IAEf;EAC3B,CAAA;AAAM,CAAC,CAAC;AAgCyC;ACnCrD,KAAK,SAAS,AAAC,mGACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,oCAAoB,CAAC;;;;;;;AAApC,OAAO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AAAf,uBAAoB,KAAG,iBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,gBAAoB,KAAG,UAAkB,CAAC;AAA1C,cAAoB,KAAG,QAAkB,CAAC;AAA1C,qBAAoB,KAAG,eAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;AAFZ,oBAAA,SAAQ,AAAC;AAEF,eAAM,YAAU,CACP,MAAK,CAAG;AAChB,aAAG,OAAO,EAAI,OAAK,CAAC;QACxB;AAHM,AAKV,aALiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC,eAI1C,GAAE,CAAF,UAAI,KAAI,CAAG;AAAE,iBAAO,CAAA,cAAa,AAAC,CAAC,gBAAe,IAAI,AAAC,CAAC,IAAG,OAAO,CAAG,MAAI,CAAC,CAAC,CAAC;UAAE,MAHlB,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;AAApC,cAAQ,AAAC,4BAAqC,CAAA;AAA9C,oBAAA,SAAQ,AAAC;AAWF,eAAM,YAAU,CACP,SAAQ,CAAG,CAAA,WAAU,CAAG,CAAA,WAAU,AAA8B,CAAG;YAA9B,MAAI,6CAAI,KAAG;YAAG,QAAM,6CAAI,KAAG;AACxE,aAAG,UAAU,EAAI,UAAQ,CAAC;AAC1B,aAAG,YAAY,EAAI,YAAU,CAAC;AAC9B,aAAG,YAAY,EAAI,YAAU,CAAC;AAC9B,aAAG,MAAM,EAAI,MAAI,CAAC;AAClB,aAAG,QAAQ,EAAI,QAAM,CAAC;AACtB,aAAG,MAAM,EAAI,MAAI,CAAC;AAClB,aAAG,eAAe,EAAI,YAAU,CAAC;AACjC,aAAG,YAAY,EAAI,CAAA,WAAU,YAAY,CAAC;AAC1C,aAAI,SAAQ,AAAC,CAAC,KAAI,CAAC,CAAG;AAClB,eAAG,MAAM,EAAI,MAAI,CAAC;AAClB,eAAG,YAAY,GAAK,CAAA,KAAI,YAAY,CAAC;AACrC,AAAI,cAAA,CAAA,QAAO,EAAI,CAAA,KAAI,eAAe,CAAC;AACnC,eAAI,SAAQ,AAAC,CAAC,QAAO,CAAC,CAAG;AACrB,iBAAG,eAAe,GAAK,SAAO,CAAC;YACnC;AAAA,UACJ;AAAA,QACJ;AA3BM,AAkCV,aAlCiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC,eA4B1C,MAAK,CAAL,UAAM,AAAC,CAAE;AACL,eAAI,OAAM,AAAC,CAAC,IAAG,QAAQ,CAAC,CAAG;AACvB,iBAAG,QAAQ,EAAI,CAAA,IAAG,YAAY,YAAY,AAAC,CAAC,IAAG,YAAY,CAAC,CAAC;YACjE;AAAA,AACA,iBAAO,CAAA,IAAG,QAAQ,CAAC;UACvB,MAhC4D,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;AAApC,cAAQ,AAAC,4BAAqC,CAAA;IAEf;EAC3B,CAAA;AAAM,CAAC,CAAC;AAkC0B;ACrCtC,KAAK,SAAS,AAAC,iIACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,8CAAoB,CAAC;;;;AAApC,OAAO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AAAf,oBAAoB,KAAG,cAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,4BAAoB,KAAG,YAAkB,CAAC;AAA1C,cAAQ,AAAC,YAAoB,KAAG,UAAmB,CAAC;AAApD,cAAQ,AAAC,iBAAoB,KAAG,eAAmB,CAAC;AAApD,cAAQ,AAAC,cAAoB,KAAG,YAAmB,CAAC;AAApD,cAAQ,AAAC,WAAoB,KAAG,SAAmB,CAAC;AAApD,cAAQ,AAAC,gBAAoB,KAAG,cAAmB,CAAC;IAE5C,CADuB;AACzB,UAAM;kBAKa,CAAA,aAAY,AAAC,CAAC,qBAAoB,CAAC;AAP5D,cAAQ,AAAC,4BAAqC,CAAA;IAEf;EAC3B,CAAA;AAAM,CAAC,CAAC;AAKoC;ACRhD,KAAK,SAAS,AAAC,uEACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,0CAAoB,CAAC;;;AACpC,SAAS,UAAQ,CAAC,AAAC,CAAE;AACjB,SAAO,IAAI,cAAY,AAAC,CAAC,yBAAwB,CAAC,CAAC;EACvD;AAHA,AAGA,OAHO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AAAf,oBAAoB,KAAG,cAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;AAFZ,yBAAA,SAAQ,AAAC;AAIF,eAAM,iBAAe,KAO5B;AATU,aAAO,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC;AAG1C,aAAG,CAAH,UAAI,AAAC,CAAE;AAAE,gBAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;UAAE;AAC5B,kBAAQ,CAAR,UAAU,GAAE,CAAG,CAAA,KAAI,CAAG,CAAA,GAAE,CAAG;AAAE,gBAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;UAAE;AAChD,gBAAM,CAAN,UAAO,AAAC,CAAE;AAAE,gBAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;UAAE;AAC/B,aAAG,CAAH,UAAI,AAAC,CAAE;AAAE,gBAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;UAAE;AAC5B,mBAAS,CAAT,UAAW,EAAC,CAAG;AAAE,gBAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;UAAE;AACpC,oBAAU,CAAV,UAAW,AAAC,CAAE;AAAE,gBAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;UAAE;AAAA,aAPyB,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;AAApC,cAAQ,AAAC,sCAAqC,CAAA;IAEf;EAC3B,CAAA;AAAM,CAAC,CAAC;AASgC;ACZ5C,KAAK,SAAS,AAAC,6DACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,gCAAoB,CAAC;;AAC7B,SAAS,0BAAwB,CAAE,UAAS,CAAG,CAAA,WAAU,CAAG,CAAA,WAAU;AACzE,AAAI,MAAA,CAAA,KAAI,EAAI,CAAA,WAAU,CAAE,CAAA,CAAC,CAAC;AAC1B,OAAI,KAAI,GAAK,IAAE,CAAA,EAAK,CAAA,KAAI,GAAK,IAAE,CAAG;AAC9B,gBAAU,EAAI,CAAA,WAAU,UAAU,AAAC,CAAC,CAAA,CAAC,CAAC;IAC1C;AAAA,AACA,cAAU,MAAM,AAAC,CAAC,UAAS,CAAC,QACjB,AAAC,EAAC,SAAC,KAAI,CAAM;AACpB,AAAI,QAAA,CAAA,KAAI,EAAI,CAAA,KAAI,MAAM,AAAC,CAAC,GAAE,CAAC,CAAC;AAC5B,AAAI,QAAA,CAAA,GAAE,EAAI,CAAA,KAAI,CAAE,CAAA,CAAC,CAAC;AAClB,SAAI,CAAC,SAAQ,AAAC,CAAC,WAAU,CAAE,GAAE,CAAC,CAAC,CAAG;AAC9B,AAAI,UAAA,CAAA,KAAI,EAAI,CAAA,KAAI,OAAO,EAAI,EAAA,CAAA,CAAI,CAAA,KAAI,CAAE,CAAA,CAAC,EAAI,KAAG,CAAC;AAC9C,kBAAU,CAAE,GAAE,CAAC,EAAI,MAAI,CAAC;MAC5B;AAAA,IACJ,EAAC,CAAC;EACN;AAfA,UAAQ,AAAC,wDAAqC,CAAA;AAA9C,OAAO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AAAf,gBAAoB,KAAG,UAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;IAAmB;EAC3B,CAAA;AAAM,CAAC,CAAC;AAasB;AChBlC,KAAK,SAAS,AAAC,yDACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,4BAAoB,CAAC;;;;;AAG7B,SAAS,YAAU,CAAE,MAAK;AAC7B,SAAO,CAAA,aAAY,iBAAiB,AAAC,CAAC,MAAK,CAAG,SAAO,GAAG,SAAC,KAAI,CAAM;AAAE,WAAO,CAAA,IAAG,EAAI,MAAI,CAAC;IAAE,EAAC,CAAC;EAChG;AALA,UAAQ,AAAC,4BAAqC,CAAA;AAA9C,OAAO;AACD,UAAM,GADZ,SAAS,IAAG;AAAZ,oBAAoB,KAAG,cAAkB,CAAC;AAA1C,oBAAoB,KAAG,cAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;wBADY,EAAC,GAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,KAAG,CAAC;eAC1E,CAAA,aAAY,OAAO,AAAC,CAAC,KAAI,EAAI,CAAA,iBAAgB,KAAK,AAAC,CAAC,KAAI,CAAC,CAAA,CAAI,IAAE,CAAG,IAAE,CAAC;IAArD;EAC3B,CAAA;AAAM,CAAC,CAAC;AAGkB;ACN9B,KAAK,SAAS,AAAC,uEACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,0CAAoB,CAAC;;;;;;;;AAApC,OAAO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AAAf,YAAoB,KAAG,MAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;iBAFK,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,eAAQ,SAAQ,OAAO;AACnB,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;YAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,KAAG,CAAC,CAAC;AAAA,QACzG;MACJ;iBACiB,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,MAC5G;oBAVA,CAAC,eAAc,YAAY,CAAC,AAAC,CAoBJ,SACT,OAAM,CAAG;AACjB,WAAG,QAAQ,EAAI,QAAM,CAAC;MAC1B,AACJ,SAxBqF;AAArF,cAAQ,AAAC,4BAAqC,CAAA;AAA9C,AAyBA,cAzBQ,AAAC,eAyBT,CAAA,WAAU,EAAI,CAAA,UAAS,AAAC,CAAC,CACrB,KAAI,AAAC,EAAC,CACN,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,MAAK,CAAC,CAAC,CAC5C,CAAG,YAAU,CAAC,CA5BgC,CA4B/B;cA5Bf,CAAC,eAAc,YAAY,CAAC,AAAC,CA6BV,SACH,IAAsB;;AAApB,eAAG;AAAG,oBAAQ;AAAG,aAAC;AAC5B,WAAG,KAAK,EAAI,KAAG,CAAC;AAChB,WAAG,UAAU,EAAI,UAAQ,CAAC;AAC1B,WAAG,GAAG,EAAI,GAAC,CAAC;MAEpB,SAnCqF;AAArF,cAAQ,AAAC,gBAAqC,CAAA;AAA9C,AAoCA,cApCQ,AAAC,SAoCT,CAAA,KAAI,EAAI,CAAA,UAAS,AAAC,CAAC,CACf,KAAI,AAAC,EAAC,CACN,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,MAAK,CAAC,CAAC,CAC5C,CAAG,MAAI,CAAC,CAvCsC,CAuCrC;mBAvCT,CAAC,eAAc,YAAY,CAAC,AAAC,CAwCL,SACR,IAAmB;;AAAjB,eAAG;AAAG,iBAAK;AAAG,aAAC;AACzB,WAAG,KAAK,EAAI,KAAG,CAAC;AAChB,WAAG,OAAO,EAAI,OAAK,CAAC;AACpB,WAAG,GAAG,EAAI,GAAC,CAAC;MAEpB,SA9CqF;AAArF,cAAQ,AAAC,0BAAqC,CAAA;AAA9C,AA+CA,cA/CQ,AAAC,cA+CT,CAAA,UAAS,EAAI,CAAA,UAAS,AAAC,CAAC,CACpB,KAAI,AAAC,EAAC,CACN,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,MAAK,CAAC,CAAC,CAC5C,CAAG,WAAS,CAAC,CAlDiC,CAkDhC;iBAlDd,CAAC,eAAc,YAAY,CAAC,AAAC,CAmDP,SACN,IAAmB;;AAAjB,eAAG;AAAG,qBAAS;AACzB,WAAG,GAAG,EAAI,KAAG,CAAC;AACd,WAAG,KAAK,EAAI,KAAG,CAAC;AAChB,WAAG,WAAW,EAAI,WAAS,CAAC;MAEpC,SAzDqF;AAArF,cAAQ,AAAC,sBAAqC,CAAA;AAA9C,AA0DA,cA1DQ,AAAC,YA0DT,CAAA,QAAO,EAAI,CAAA,UAAS,AAAC,CAAC,CAClB,KAAI,AAAC,EAAC,CACN,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,MAAK,CAAC,CAAC,CAC5C,CAAG,SAAO,CAAC,CA7DmC,CA6DlC;IA3DmB;EAC3B,CAAA;AAAM,CAAC,CAAC;AA2DgC;AC9D5C,KAAK,SAAS,AAAC,yEACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,4CAAoB,CAAC;;;AAApC,OAAO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AAAf,gBAAoB,KAAG,UAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;AAFZ,0BAAA,SAAQ,AAAC;AACF,eAAM,kBAAgB,CACb,OAAM,CAAG;AACjB,aAAG,QAAQ,EAAI,QAAM,CAAC;AACtB,aAAG,mBAAmB,EAAI,KAAG,CAAC;QAClC;AAHM,AAaV,aAbiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC,qBAI1C,oBAAmB,CAAnB,UAAoB,AAAC;;AACjB,eAAI,SAAQ,AAAC,CAAC,IAAG,mBAAmB,CAAC,CAAG;AACpC,mBAAO,CAAA,IAAG,mBAAmB,CAAC;YAClC;AAAA,AACA,iBAAO,CAAA,IAAG,mBAAmB,EAAI,CAAA,IAAG,QAAQ,AAAC,EAAC,KAAK,AAAC,EAAC,SAAC,aAAY,CAAM;AACpE,+BAAiB,EAAI,cAAY,CAAC;AAClC,mBAAO,cAAY,CAAC;YACxB,EAAC,CAAC;UACN,MAX4D,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;AAApC,cAAQ,AAAC,wCAAqC,CAAA;IAEf;EAC3B,CAAA;AAAM,CAAC,CAAC;AAakC;AChB9C,KAAK,SAAS,AAAC,yEACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,2CAAoB,CAAC;;;AAApC,OAAO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AAAf,qBAAoB,KAAG,eAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;AAFZ,yBAAA,SAAQ,AAAC;AACF,eAAM,iBAAe,CACZ,aAAY,CAAG;AACvB,aAAG,cAAc,EAAI,cAAY,CAAC;AAClC,aAAG,mBAAmB,EAAI,KAAG,CAAC;AAC9B,aAAG,mBAAmB,EAAI,CAAA,cAAa,QAAQ,AAAC,CAAC,aAAY,CAAC,CAAC;QACnE;AAJM,AAMV,aANiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC,oBAK1C,oBAAmB,CAAnB,UAAoB,AAAC,CAAE;AAAE,iBAAO,CAAA,IAAG,mBAAmB,CAAC;UAAE,MAJG,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;AAApC,cAAQ,AAAC,sCAAqC,CAAA;IAEf;EAC3B,CAAA;AAAM,CAAC,CAAC;AAMiC;ACT7C,KAAK,SAAS,AAAC,yHACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,+CAAoB,CAAC;;;;AAApC,OAAO;AACD,UAAM,GADZ,SAAS,IAAG;AAAZ,4BAAoB,KAAG,YAAkB,CAAC;AAA1C,cAAQ,AAAC,SAAoB,KAAG,OAAmB,CAAC;AAApD,cAAQ,AAAC,YAAoB,KAAG,UAAmB,CAAC;AAApD,cAAQ,AAAC,cAAoB,KAAG,YAAmB,CAAC;IAE5C,CAFR,UAAS,IAAG,CAAG;AAAf,oBAAoB,KAAG,cAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;kBACa,CAAA,aAAY,AAAC,CAAC,qBAAoB,CAAC;AAH5D,cAAQ,AAAC,4BAAqC,CAAA;IAEf;EAC3B,CAAA;AAAM,CAAC,CAAC;AACqC;ACJjD,KAAK,SAAS,AAAC,wIACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,+CAAoB,CAAC;;;;;;;AAApC,OAAO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AAAf,UAAoB,KAAG,IAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,iBAAoB,KAAG,WAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,uBAAoB,KAAG,iBAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;iBAFK,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,eAAQ,SAAQ,OAAO;AACnB,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;YAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,KAAG,CAAC,CAAC;AAAA,QACzG;MACJ;iBACiB,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,MAC5G;6BAVA,SAAS,QAAO;AAckB,qBACnB,AAAC,CAAE;AAflB,AAgBQ,wBAhBM,iBAAiB,AAAC,MAAkB,KAAK,MAAmB,CAgB3D;AACP,aAAG,UAAU,EAAI,CAAA,GAAE,YAAY,AAAC,EAAC,CAAC;AAClC,aAAG,SAAS,EAAI,CAAA,GAAE,WAAW,AAAC,EAAC,CAAC;QACpC;AAjBM,AAoCV,aApCiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC;AAkB1C,mBAAS,CAAT,UAAW,EAAC,CAAG;AACX,cAAE,qBAAqB,AAAC,CAAC,QAAO,CAAC,iBAAiB,AAAC,CAAC,UAAS,CAAG,GAAC,CAAG,MAAI,CAAC,CAAC;UAC9E;AACA,oBAAU,CAAV,UAAW,AAAC,CAAE;AAAE,iBAAO,GAAC,CAAC;UAAE;AAC3B,aAAG,CAAH,UAAI,AAAC,CAAE;AAGH,AAAI,cAAA,CAAA,IAAG,EAAI,CAAA,IAAG,UAAU,KAAK,CAAC;AAI9B,iBAAO,CAAA,IAAG,OAAO,EAAI,EAAA,CAAA,CAAI,CAAA,IAAG,UAAU,AAAC,CAAC,CAAA,CAAC,CAAA,CAAI,KAAG,CAAC;UACrD;AACA,kBAAQ,CAAR,UAAU,KAAI,CAAG,CAAA,KAAI,CAAG,CAAA,GAAE,CAAG;AACzB,eAAG,SAAS,UAAU,AAAC,CAAC,KAAI,CAAG,MAAI,CAAG,CAAA,GAAE,EAAI,IAAE,CAAC,CAAC;UACpD;AACA,gBAAM,CAAN,UAAO,AAAC,CAAE;AAAE,eAAG,SAAS,QAAQ,AAAC,EAAC,CAAC;UAAE;AACrC,aAAG,CAAH,UAAI,AAAC,CAAE;AAAE,eAAG,SAAS,KAAK,AAAC,EAAC,CAAC;UAAE;AAAA,aAlC+B,SAAO,CAAC,CAAC;MACnE,AAAC,CAUuC,gBAAe,CAVpC;AAJ3B,cAAQ,AAAC,8CAAqC,CAAA;AAA9C,AAuCA,cAvCQ,AAAC,wBAuCT,CAAA,oBAAmB,EAAI,CAAA,UAAS,AAAC,CAAC,CAC9B,UAAS,AAAC,EAAC,CACX,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,GAAC,CAAC,CACtC,CAAG,qBAAmB,CAAC,CA1CuB,CA0CtB;IAxCO;EAC3B,CAAA;AAAM,CAAC,CAAC;AAwCqC;AC3CjD,KAAK,SAAS,AAAC,yIACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,gDAAoB,CAAC;;;;;;;AAApC,OAAO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AAAf,UAAoB,KAAG,IAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,iBAAoB,KAAG,WAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,uBAAoB,KAAG,iBAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;iBAFK,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,eAAQ,SAAQ,OAAO;AACnB,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;YAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,KAAG,CAAC,CAAC;AAAA,QACzG;MACJ;iBACiB,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,MAC5G;8BAVA,SAAS,QAAO;AAcmB,qBACpB,AAAC,CAAE;AAflB,AAgBQ,wBAhBM,iBAAiB,AAAC,MAAkB,KAAK,MAAmB,CAgB3D;AACP,aAAG,UAAU,EAAI,CAAA,GAAE,YAAY,AAAC,EAAC,CAAC;AAClC,aAAG,SAAS,EAAI,CAAA,GAAE,WAAW,AAAC,EAAC,CAAC;AAChC,aAAG,UAAU,EAAI,CAAA,GAAE,YAAY,AAAC,EAAC,CAAC;QACtC;AAlBM,AA2BV,aA3BiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC;AAmB1C,mBAAS,CAAT,UAAW,EAAC,CAAG;AACX,cAAE,qBAAqB,AAAC,CAAC,QAAO,CAAC,iBAAiB,AAAC,CAAC,UAAS,CAAG,GAAC,CAAG,MAAI,CAAC,CAAC;UAC9E;AACA,oBAAU,CAAV,UAAW,AAAC,CAAE;AAAE,iBAAO,CAAA,IAAG,UAAU,CAAC;UAAE;AACvC,aAAG,CAAH,UAAI,AAAC,CAAE;AAAE,iBAAO,CAAA,IAAG,UAAU,SAAS,CAAC;UAAE;AACzC,kBAAQ,CAAR,UAAU,KAAI,CAAG,CAAA,KAAI,CAAG,CAAA,GAAE,CAAG;AAAE,eAAG,SAAS,UAAU,AAAC,CAAC,KAAI,CAAG,MAAI,CAAG,IAAE,CAAC,CAAC;UAAE;AAC3E,gBAAM,CAAN,UAAO,AAAC,CAAE;AAAE,eAAG,SAAS,QAAQ,AAAC,EAAC,CAAC;UAAE;AACrC,aAAG,CAAH,UAAI,AAAC,CAAE;AAAE,eAAG,SAAS,KAAK,AAAC,EAAC,CAAC;UAAE;AAAA,aAzB+B,SAAO,CAAC,CAAC;MACnE,AAAC,CAUwC,gBAAe,CAVrC;AAJ3B,cAAQ,AAAC,gDAAqC,CAAA;AAA9C,AA8BA,cA9BQ,AAAC,yBA8BT,CAAA,qBAAoB,EAAI,CAAA,UAAS,AAAC,CAAC,CAC/B,UAAS,AAAC,EAAC,CACX,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,GAAC,CAAC,CACtC,CAAG,sBAAoB,CAAC,CAjCsB,CAiCrB;IA/BM;EAC3B,CAAA;AAAM,CAAC,CAAC;AA+BsC;AClClD,KAAK,SAAS,AAAC,8EACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,iCAAoB,CAAC;;;;;;AAApC,OAAO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AAAf,qBAAoB,KAAG,eAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,iBAAoB,KAAG,WAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;iBAFK,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,eAAQ,SAAQ,OAAO;AACnB,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;YAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,KAAG,CAAC,CAAC;AAAA,QACzG;MACJ;iBACiB,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,MAC5G;iBAVA,CAAC,eAAc,YAAY,CAAC,AAAC,CAiBP,SACP,AAAC;AACR,WAAG,MAAM,EAAI,GAAC,SAAA,WAAU;eAAK,CAAA,WAAU,OAAO,gBAAgB,AAAC,CAAC,WAAU,CAAC;QAAA,EAAC,CAAC;MAcrF,GAZI,OAAM,CAAN,UAAQ,WAAU;AACd,AAAI,YAAA,CAAA,KAAI,EAAI,CAAA,IAAG,MAAM;AAAG,wBAAU,EAAI,EAAA,CAAC;AACvC,iBAAS,WAAS,CAAE,AAAY,CAAG;cAAf,OAAK,6CAAI,KAAG;AAC5B,eAAI,WAAU,GAAK,CAAA,KAAI,OAAO,CAAG;AAC7B,mBAAO,CAAA,cAAa,QAAQ,AAAC,CAAC,MAAK,CAAC,CAAC;YACzC;AAAA,AACI,cAAA,CAAA,IAAG,EAAI,CAAA,KAAI,CAAE,WAAU,CAAC,CAAC;AAC7B,sBAAU,GAAK,EAAA,CAAC;AAChB,iBAAO,CAAA,cAAa,QAAQ,AAAC,CAAC,IAAG,AAAC,CAAC,WAAU,CAAC,CAAC,KAAK,AAAC,CAAC,UAAS,CAAC,CAAC;UACrE;AAAA,AACA,eAAO,CAAA,UAAS,AAAC,EAAC,CAAC;QACvB,MAhCiF;AAArF,cAAQ,AAAC,sBAAqC,CAAA;AAA9C,AAkCA,cAlCQ,AAAC,YAkCT,CAAA,QAAO,EAAI,CAAA,UAAS,AAAC,CAAC,CAClB,UAAS,AAAC,EAAC,CACX,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,GAAC,CAAC,CACtC,CAAG,SAAO,CAAC,CArCmC,CAqClC;IAnCmB;EAC3B,CAAA;AAAM,CAAC,CAAC;AAmCuB;ACtCnC,KAAK,SAAS,AAAC,mJACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,iCAAoB,CAAC;;;;;;;;;;;;;;;;;AAgFpC,SAAS,eAAa,CAAE,GAAE,CAAG;AACzB,OAAI,gBAAe,KAAK,AAAC,CAAC,GAAE,CAAC,CAAG;AAE5B,WAAO,CAAA,GAAE,UAAU,AAAC,CAAC,CAAA,CAAG,CAAA,GAAE,OAAO,EAAI,GAAC,CAAC,CAAC;IAC5C;AAAA,AACA,SAAO,IAAE,CAAC;EACd;AAAA,AACA,SAAS,mBAAiB,CAAE,GAAE,CAAG;AAC7B,OAAI,MAAK,KAAK,AAAC,CAAC,GAAE,CAAC,CAAG;AAClB,QAAE,EAAI,CAAA,GAAE,UAAU,AAAC,CAAC,CAAA,CAAG,CAAA,GAAE,OAAO,EAAI,EAAA,CAAC,CAAC;IAC1C;AAAA,AACA,SAAO,IAAE,CAAC;EACd;AA5FA,AA4FA,OA5FO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AAAf,uBAAoB,KAAG,iBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,gBAAoB,KAAG,UAAkB,CAAC;AAA1C,iBAAoB,KAAG,WAAkB,CAAC;AAA1C,oBAAoB,KAAG,cAAkB,CAAC;AAA1C,cAAoB,KAAG,QAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,mBAAoB,KAAG,aAAkB,CAAC;AAA1C,wBAAoB,KAAG,kBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,kBAAoB,KAAG,YAAkB,CAAC;AAA1C,iBAAoB,KAAG,WAAkB,CAAC;AAA1C,eAAoB,KAAG,SAAkB,CAAC;AAA1C,aAAoB,KAAG,OAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;iBAFK,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,eAAQ,SAAQ,OAAO;AACnB,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;YAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,KAAG,CAAC,CAAC;AAAA,QACzG;MACJ;iBACiB,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,MAC5G;cACc,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,QAAQ,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,SAAQ,CAAG;AACrE,aAAO,UAAU,MAAK,CAAG,CAAA,GAAE,CAAG;AAAE,kBAAQ,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,WAAS,CAAC,CAAC;QAAE,CAAA;MACxE;uBAMgC,CAAA,UAAS,AAAC,CAAC,GAAI,YAAU,AAAC,CAAC,mBAAkB,CAAC,CAAC;AAnB/E,cAAQ,AAAC,sCAAqC,CAAA;iBAA9C,CAAC,eAAc,YAAY,CAAC,AAAC,CA8BP,SACN,iBAAgB,CAAG,CAAA,IAAG;;AAC9B,WAAG,kBAAkB,EAAI,kBAAgB,CAAC;AAC1C,WAAG,SAAS,EAAI,IAAI,aAAW,AAAC,EAAC,CAAC;AAClC,AAAI,UAAA,CAAA,eAAc,EAAI,CAAA,SAAQ,AAAC,CAAC,IAAG,CAAC,CAAA,CAAI,KAAG,EAAI,CAAA,IAAG,kBAAkB,YAAY,AAAC,EAAC,CAAC;AACnF,WAAI,OAAM,AAAC,CAAC,eAAc,CAAC,CAAG;AAC1B,cAAM,IAAI,cAAY,AAAC,CAAC,2FAAwF,CAAC,CAAC;QACtH;AAAA,AACA,WAAG,UAAU,EAAI,CAAA,kBAAiB,AAAC,CAAC,cAAa,AAAC,CAAC,eAAc,CAAC,CAAC,CAAC;AACpE,WAAG,kBAAkB,WAAW,AAAC,EAAC,SAAC,CAAA;eAAM,CAAA,gBAAe,AAAC,CAAC,CAAA,CAAC;QAAA,EAAC,CAAC;MAkCrE;AAhCI,kBAAU,CAAV,UAAY,CAAA,CAAG;AAAE,0BAAgB,SAAS,AAAC,CAAC,IAAG,SAAS,CAAG,EAAE,KAAI,CAAG,CAAA,IAAG,KAAK,AAAC,EAAC,CAAE,CAAC,CAAC;QAAE;AACpF,WAAG,CAAH,UAAI,AAAC,CAAE;AAAE,eAAO,CAAA,IAAG,UAAU,AAAC,CAAC,IAAG,kBAAkB,KAAK,AAAC,EAAC,CAAC,CAAC;QAAE;AAC/D,gBAAQ,CAAR,UAAU,GAAE,CAAG;AACX,eAAO,CAAA,kBAAiB,AAAC,CAAC,IAAG,eAAe,AAAC,CAAC,cAAa,AAAC,CAAC,GAAE,CAAC,CAAC,CAAC,CAAC;QACvE;AACA,0BAAkB,CAAlB,UAAoB,GAAE,CAAG;AACrB,aAAI,CAAC,GAAE,WAAW,AAAC,CAAC,GAAE,CAAC,CAAG;AACtB,cAAE,EAAI,CAAA,GAAE,EAAI,IAAE,CAAC;UACnB;AAAA,AACA,eAAO,CAAA,kBAAiB,AAAC,CAAC,IAAG,aAAa,AAAC,CAAC,GAAE,CAAC,CAAC,CAAC;QACrD;AACA,qBAAa,CAAb,UAAe,GAAE,CAAG;AAChB,aAAI,IAAG,UAAU,OAAO,EAAI,EAAA,CAAA,EAAK,CAAA,GAAE,WAAW,AAAC,CAAC,IAAG,UAAU,CAAC,CAAG;AAC7D,iBAAO,CAAA,GAAE,UAAU,AAAC,CAAC,IAAG,UAAU,OAAO,CAAC,CAAC;UAC/C;AAAA,AACA,eAAO,IAAE,CAAC;QACd;AACA,mBAAW,CAAX,UAAa,GAAE,CAAG;AACd,aAAI,CAAC,GAAE,WAAW,AAAC,CAAC,IAAG,UAAU,CAAC,CAAG;AACjC,iBAAO,CAAA,IAAG,UAAU,EAAI,IAAE,CAAC;UAC/B;AAAA,AACA,eAAO,IAAE,CAAC;QACd;AACA,SAAC,CAAD,UAAG,GAAE,CAAG;AACJ,AAAI,YAAA,CAAA,QAAO,EAAI,CAAA,IAAG,oBAAoB,AAAC,CAAC,GAAE,CAAC,CAAC;AAC5C,aAAG,kBAAkB,UAAU,AAAC,CAAC,IAAG,CAAG,GAAC,CAAG,SAAO,CAAC,CAAC;QACxD;AACA,cAAM,CAAN,UAAO,AAAC,CAAE;AAAE,aAAG,kBAAkB,QAAQ,AAAC,EAAC,CAAC;QAAE;AAC9C,WAAG,CAAH,UAAI,AAAC,CAAE;AAAE,aAAG,kBAAkB,KAAK,AAAC,EAAC,CAAC;QAAE;AACxC,gBAAQ,CAAR,UAAU,MAAK,AAAiC,CAAG;YAAjC,QAAM,6CAAI,KAAG;YAAG,SAAO,6CAAI,KAAG;AAC5C,0BAAgB,UAAU,AAAC,CAAC,IAAG,SAAS,CAAG,OAAK,CAAG,QAAM,CAAG,SAAO,CAAC,CAAC;QACzE;AAAA,WAxEiF;AAArF,cAAQ,AAAC,sBAAqC,CAAA;AAA9C,AA0EA,cA1EQ,AAAC,YA0ET,CAAA,QAAO,EAAI,CAAA,UAAS,AAAC,CAAC,CAClB,UAAS,AAAC,EAAC,CACX,CAAA,OAAM,AAAC,CAAC,CAAA,CAAG,CAAA,QAAO,AAAC,EAAC,CAAC,CACrB,CAAA,OAAM,AAAC,CAAC,CAAA,CAAG,CAAA,MAAK,AAAC,CAAC,gBAAe,CAAC,CAAC,CACnC,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,gBAAe,CAAG,OAAK,CAAC,CAAC,CAC9D,CAAG,SAAO,CAAC,CA/EmC,CA+ElC;IA7EmB;EAC3B,CAAA;AAAM,CAAC,CAAC;AA0FuB;AC7FnC,KAAK,SAAS,AAAC,iKACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,wCAAoB,CAAC;;;;;;;;;;;;;;;;;;;;;;;AA2CpC,SAAS,gBAAc,CAAE,GAAE,CAAG;AAC1B,OAAI,OAAM,AAAC,CAAC,GAAE,CAAC,CAAG;AACd,WAAO,KAAG,CAAC;IACf,KACK;AACD,WAAO,CAAA,GAAE,SAAS,AAAC,EAAC,CAAC;IACzB;AAAA,EACJ;AAAA,AAyCA,SAAS,gBAAc,CAAE,KAAI,CAAG;AAG5B,OAAI,aAAY,WAAW,AAAC,CAAC,KAAI,CAAG,IAAE,CAAC,CAAG;AACtC,UAAI,EAAI,CAAA,aAAY,UAAU,AAAC,CAAC,KAAI,CAAG,EAAA,CAAC,CAAC;IAC7C;AAAA,AACI,MAAA,CAAA,QAAO,EAAI,CAAA,YAAW,AAAC,CAAC,KAAI,CAAC,CAAC;AAClC,AAAI,MAAA,CAAA,OAAM,EAAI,GAAC,CAAC;AAChB,AAAI,MAAA,CAAA,WAAU,EAAI,EAAA,CAAC;AAWnB,OAAI,QAAO,OAAO,EAAI,GAAC,CAAG;AACtB,UAAM,IAAI,cAAY,AAAC,EAAC,GAAG,EAAC,MAAI,EAAC,4DAA0D,EAAC,CAAC;IACjG;AAAA,AACI,MAAA,CAAA,KAAI,EAAI,CAAA,QAAO,OAAO,EAAI,EAAA,CAAC;AAC/B,QAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,GAAK,MAAI,CAAG,CAAA,CAAA,EAAE,CAAG;AAC7B,AAAI,QAAA,CAAA,OAAM,EAAI,CAAA,QAAO,CAAE,CAAA,CAAC;AAAG,cAAI,EAnHvC,KAAK,EAAA,AAmHkC,CAAC;AAChC,SAAI,SAAQ,AAAC,CAAC,KAAI,EAAI,CAAA,aAAY,WAAW,AAAC,CAAC,YAAW,CAAG,QAAM,CAAC,CAAC,CAAG;AACpE,cAAM,KAAK,AAAC,CAAC,GAAI,eAAa,AAAC,CAAC,KAAI,CAAE,CAAA,CAAC,CAAC,CAAC,CAAC;AAC1C,kBAAU,GAAK,EAAC,GAAE,EAAI,EAAA,CAAC,CAAC;MAC5B,KACK,KAAI,SAAQ,AAAC,CAAC,KAAI,EAAI,CAAA,aAAY,WAAW,AAAC,CAAC,eAAc,CAAG,QAAM,CAAC,CAAC,CAAG;AAC5E,cAAM,KAAK,AAAC,CAAC,GAAI,YAAU,AAAC,CAAC,KAAI,CAAE,CAAA,CAAC,CAAC,CAAC,CAAC;MAC3C,KACK,KAAI,OAAM,GAAK,MAAI,CAAG;AACvB,WAAI,CAAA,EAAI,MAAI,CAAG;AAEX,cAAM,IAAI,cAAY,AAAC,EAAC,sDAAmD,EAAC,MAAI,EAAC,MAAG,EAAC,CAAC;QAC1F;AAAA,AACA,cAAM,KAAK,AAAC,CAAC,GAAI,oBAAkB,AAAC,EAAC,CAAC,CAAC;MAC3C,KACK,KAAI,OAAM,OAAO,EAAI,EAAA,CAAG;AACzB,cAAM,KAAK,AAAC,CAAC,GAAI,cAAY,AAAC,CAAC,OAAM,CAAC,CAAC,CAAC;AACxC,kBAAU,GAAK,CAAA,GAAE,EAAI,EAAC,GAAE,EAAI,EAAA,CAAC,CAAC;MAClC;AAAA,IACJ;AAAA,AACI,MAAA,CAAA,MAAK,EAAI,CAAA,gBAAe,OAAO,AAAC,EAAC,CAAC;AACtC,mBAAe,IAAI,AAAC,CAAC,MAAK,CAAG,WAAS,CAAG,QAAM,CAAC,CAAC;AACjD,mBAAe,IAAI,AAAC,CAAC,MAAK,CAAG,cAAY,CAAG,YAAU,CAAC,CAAC;AACxD,SAAO,OAAK,CAAC;EACjB;AAAA,AACA,SAAS,aAAW,CAAE,GAAE,CAAG;AACvB,SAAO,CAAA,GAAE,MAAM,AAAC,CAAC,GAAE,CAAC,CAAC;EACzB;AAAA,AAEA,SAAS,WAAS,CAAE,IAAG,CAAG;AACtB,OAAI,aAAY,SAAS,AAAC,CAAC,IAAG,CAAG,IAAE,CAAC,CAAG;AACnC,UAAM,IAAI,cAAY,AAAC,EAAC,SAAQ,EAAC,KAAG,EAAC,qEAA8D,EAAC,CAAC;IACzG;AAAA,AACI,MAAA,CAAA,gBAAe,EAAI,CAAA,aAAY,WAAW,AAAC,CAAC,cAAa,CAAG,KAAG,CAAC,CAAC;AACrE,OAAI,SAAQ,AAAC,CAAC,gBAAe,CAAC,CAAG;AAC7B,UAAM,IAAI,cAAY,AAAC,EAAC,SAAQ,EAAC,KAAG,EAAC,iBAAc,EAAC,CAAA,gBAAe,CAAE,CAAA,CAAC,EAAC,6CAA0C,EAAC,CAAC;IACvH;AAAA,EACJ;AAxJA,AAwJA,OAxJO;AACD,UAAM,GADZ,SAAS,IAAG;AAAZ,oBAAoB,KAAG,cAAkB,CAAC;AAA1C,oBAAoB,KAAG,cAAkB,CAAC;AAA1C,gBAAoB,KAAG,UAAkB,CAAC;AAA1C,cAAoB,KAAG,QAAkB,CAAC;AAA1C,oBAAoB,KAAG,cAAkB,CAAC;AAA1C,iBAAoB,KAAG,WAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,uBAAoB,KAAG,iBAAkB,CAAC;AAA1C,kBAAoB,KAAG,YAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,gCAAoB,KAAG,0BAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,kBAAoB,KAAG,YAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;iBAFK,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,eAAQ,SAAQ,OAAO;AACnB,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;YAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,KAAG,CAAC,CAAC;AAAA,QACzG;MACJ;iBACiB,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,MAC5G;AAVA,gBAAA,SAAQ,AAAC;AAkBF,eAAM,QAAM,KAEnB;AAlBU,aAAO,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC,WAiB1C,QAAO,CAAP,UAAS,MAAK,CAAG;AAAE,iBAAO,GAAC,CAAC;UAAE,MAhB8B,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;AAApC,cAAQ,AAAC,oBAAqC,CAAA;AAA9C,iBAAA,SAAQ,AAAC;AAqBT,eAAM,SAAO,CACG,GAAE;;AACV,aAAG,IAAI,EAAI,CAAA,gBAAe,OAAO,AAAC,EAAC,CAAC;AACpC,aAAG,KAAK,EAAI,CAAA,gBAAe,OAAO,AAAC,EAAC,CAAC;AACrC,aAAI,SAAQ,AAAC,CAAC,GAAE,CAAC,CAAG;AAChB,2BAAe,QAAQ,AAAC,CAAC,GAAE,GAAG,SAAC,KAAI,CAAG,CAAA,GAAE,CAAM;AAC1C,qBAAO,CAAE,GAAE,CAAC,EAAI,CAAA,SAAQ,AAAC,CAAC,KAAI,CAAC,CAAA,CAAI,CAAA,KAAI,SAAS,AAAC,EAAC,CAAA,CAAI,KAAG,CAAC;AAC1D,sBAAQ,CAAE,GAAE,CAAC,EAAI,KAAG,CAAC;YACzB,EAAC,CAAC;UACN;AAAA,QAYR;AAxCU,aAAO,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC;AA8B1C,YAAE,CAAF,UAAI,GAAE,CAAG;AACL,2BAAe,OAAO,AAAC,CAAC,IAAG,KAAK,CAAG,IAAE,CAAC,CAAC;AACvC,iBAAO,CAAA,IAAG,IAAI,CAAE,GAAE,CAAC,CAAC;UACxB;AACA,kBAAQ,CAAR,UAAS,AAAC;;AACN,AAAI,cAAA,CAAA,MAAK,EAAI,CAAA,gBAAe,OAAO,AAAC,EAAC,CAAC;AACtC,AAAI,cAAA,CAAA,IAAG,EAAI,CAAA,gBAAe,KAAK,AAAC,CAAC,IAAG,KAAK,CAAC,CAAC;AAC3C,sBAAU,QAAQ,AAAC,CAAC,IAAG,GAAG,SAAC,GAAE,CAAM;AAAE,mBAAK,CAAE,GAAE,CAAC,EAAI,CAAA,gBAAe,IAAI,AAAC,CAAC,QAAO,CAAG,IAAE,CAAC,CAAC;YAAE,EAAC,CAAC;AAC1F,iBAAO,OAAK,CAAC;UACjB;aAtC4D,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;AAApC,4BAAA,SAAS,QAAO,CAAG;AAmDnB,eAAM,oBAAkB;AAnDxB,wBAAc,iBAAiB,AAAC,qBACL,MAAM,AAAC,CAAC,IAAG,CAAG,UAAQ,CAAC,CAAA;QAmDlD;AAlDU,aAAO,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC,6BACoB,SAAO,CAAC,CAAC;MACnE,AAAC,CA+CyB,OAAM,CA/Cb,CAJS,CAAA;AAApC,sBAAA,SAAS,QAAO;AAqDhB,eAAM,cAAY,CACF,MAAK,CAAG;AAtDxB,AAuDQ,wBAvDM,iBAAiB,AAAC,eAAkB,KAAK,MAAmB,CAuD3D;AACP,aAAG,OAAO,EAAI,OAAK,CAAC;AACpB,aAAG,KAAK,EAAI,GAAC,CAAC;AACd,aAAG,MAAM,EAAI,CAAA,WAAU,AAAC,CAAC,MAAK,CAAC,CAAC;AAIhC,aAAG,MAAM,GAAK,aAAW,CAAC;QAC9B;AA7DM,AA+DV,aA/DiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC,iBA8D1C,QAAO,CAAP,UAAS,MAAK,CAAG;AAAE,iBAAO,CAAA,IAAG,OAAO,CAAC;UAAE,MA7DuB,SAAO,CAAC,CAAC;MACnE,AAAC,CAiDmB,OAAM,CAjDP,CAJS,CAAA;uBAApC,CAAC,eAAc,YAAY,CAAC,AAAC,CAkER,SACL,IAAG,CAAG;AACd,WAAG,KAAK,EAAI,KAAG,CAAC;AAChB,WAAG,MAAM,EAAI,UAAQ,CAAC;MAC1B,AAOJ,GANI,QAAO,CAAP,UAAS,MAAK,CAAG;AACb,aAAI,CAAC,gBAAe,SAAS,AAAC,CAAC,MAAK,IAAI,CAAG,CAAA,IAAG,KAAK,CAAC,CAAG;AACnD,gBAAM,IAAI,cAAY,AAAC,EAAC,uBAAuB,EAAC,CAAA,IAAG,KAAK,EAAC,2CAAyC,EAAC,CAAC;UACxG;AAAA,AACA,eAAO,CAAA,eAAc,AAAC,CAAC,MAAK,IAAI,AAAC,CAAC,IAAG,KAAK,CAAC,CAAC,CAAC;QACjD,MA5EiF;AA8ErF,mBAAa,EAAI,CAAA,UAAS,AAAC,CAAC,CACxB,UAAS,AAAC,CAAC,OAAM,CAAC,CAClB,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,MAAK,CAAC,CAAC,CAC5C,CAAG,eAAa,CAAC,CAAC;AAjFlB,oBAAA,SAAQ,AAAC;AAkFT,eAAM,YAAU,CACA,IAAG,CAAG;AACd,aAAG,KAAK,EAAI,KAAG,CAAC;AAChB,aAAG,MAAM,EAAI,OAAK,CAAC;QACvB;AApFM,AAsFV,aAtFiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC,eAqF1C,QAAO,CAAP,UAAS,MAAK,CAAG;AAAE,iBAAO,CAAA,eAAc,AAAC,CAAC,MAAK,IAAI,AAAC,CAAC,IAAG,KAAK,CAAC,CAAC,CAAC;UAAE,MApFN,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;mBAyFjB,eAAa;sBACV,gBAAc;qBAqDf,CAAA,aAAY,OAAO,AAAC,CAAC,oBAAmB,CAAC;AA/I9D,uBAAA,SAAQ,AAAC;AA0JF,eAAM,eAAa,CACV,IAAG,CAAG,CAAA,OAAM,AAAgB;YAAb,OAAK,6CAAI,MAAI;;AACpC,aAAG,KAAK,EAAI,KAAG,CAAC;AAChB,aAAG,QAAQ,EAAI,QAAM,CAAC;AACtB,aAAG,OAAO,EAAI,OAAK,CAAC;AACpB,aAAG,SAAS,EAAI,KAAG,CAAC;AACpB,mBAAS,AAAC,CAAC,IAAG,CAAC,CAAC;AAChB,AAAI,YAAA,CAAA,MAAK,EAAI,CAAA,eAAc,AAAC,CAAC,IAAG,CAAC,CAAC;AAClC,AAAI,YAAA,CAAA,WAAU,EAAI,CAAA,MAAK,CAAE,aAAY,CAAC,CAAC;AACvC,AAAI,YAAA,CAAA,QAAO,EAAI,CAAA,MAAK,CAAE,UAAS,CAAC,CAAC;AACjC,AAAI,YAAA,CAAA,WAAU,EAAI,IAAE,CAAC;AACrB,oBAAU,QAAQ,AAAC,CAAC,QAAO,GAAG,SAAC,OAAM,CAAM;AACvC,eAAI,OAAM,WAAa,oBAAkB,CAAG;AACxC,0BAAY,EAAI,MAAI,CAAC;YACzB,KACK;AACD,wBAAU,GAAK,CAAA,GAAE,EAAI,CAAA,OAAM,MAAM,CAAC;YACtC;AAAA,UACJ,EAAC,CAAC;AACF,aAAI,IAAG,SAAS,CAAG;AACf,sBAAU,GAAK,IAAE,CAAC;UACtB;AAAA,AACA,aAAG,MAAM,EAAI,CAAA,aAAY,OAAO,AAAC,CAAC,WAAU,CAAC,CAAC;AAC9C,aAAG,SAAS,EAAI,SAAO,CAAC;AACxB,aAAG,YAAY,EAAI,YAAU,CAAC;QAyEtC;AAzPU,aAAO,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC;AAkL1C,oBAAU,CAAV,UAAY,GAAE,CAAG;AAEb,AAAI,cAAA,CAAA,aAAY,EAAI,CAAA,IAAG,SAAS,OAAO,EAAI,EAAA,CAAC;AAC5C,AAAI,cAAA,CAAA,mBAAkB,EAAI,CAAA,aAAY,GAAK,EAAA,CAAA,EAAK,CAAA,IAAG,SAAS,CAAE,aAAY,CAAC,WAAa,YAAU,CAAC;AACnG,AAAI,cAAA,CAAA,YAAW;AAAG,6BAAa,EAAI,CAAA,IAAG,OAAO,GAAK,CAAA,IAAG,SAAS,CAAC;AAC/D,eAAI,CAAC,mBAAkB,CAAG;AACtB,AAAI,gBAAA,CAAA,OAAM,EAAI,CAAA,aAAY,WAAW,AAAC,CAAC,cAAa,EAAI,CAAA,cAAa,WAAW,EAAI,CAAA,cAAa,YAAY,CAAG,IAAE,CAAC,CAAC;AACpH,iBAAI,SAAQ,AAAC,CAAC,OAAM,CAAC,CAAG;AACpB,kBAAE,EAAI,CAAA,OAAM,CAAE,CAAA,CAAC,CAAC;AAChB,2BAAW,EAAI,CAAA,OAAM,CAAE,CAAA,CAAC,CAAC;cAC7B;AAAA,AACA,gBAAE,EAAI,CAAA,aAAY,WAAW,AAAC,CAAC,GAAE,CAAG,uBAAqB,CAAG,GAAC,CAAC,CAAC;YACnE;AAAA,AACI,cAAA,CAAA,MAAK,EAAI,CAAA,gBAAe,OAAO,AAAC,EAAC,CAAC;AACtC,AAAI,cAAA,CAAA,OAAM,EAAI,IAAE,CAAC;AACjB,gBAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,GAAK,cAAY,CAAG,CAAA,CAAA,EAAE,CAAG;AACrC,AAAI,gBAAA,CAAA,OAAM,EAAI,CAAA,IAAG,SAAS,CAAE,CAAA,CAAC,CAAC;AAC9B,iBAAI,OAAM,WAAa,oBAAkB,CAAG;AACxC,wBAAQ;cACZ;AAAA,AACI,gBAAA,CAAA,KAAI,EAAI,CAAA,aAAY,WAAW,AAAC,CAAC,aAAY,OAAO,AAAC,CAAC,GAAE,EAAI,CAAA,OAAM,MAAM,CAAC,CAAG,QAAM,CAAC,CAAC;AACxF,oBAAM,EAAI,CAAA,aAAY,UAAU,AAAC,CAAC,OAAM,CAAG,CAAA,KAAI,CAAE,CAAA,CAAC,OAAO,CAAC,CAAC;AAC3D,iBAAI,OAAM,KAAK,OAAO,EAAI,EAAA,CAAG;AACzB,qBAAK,CAAE,OAAM,KAAK,CAAC,EAAI,CAAA,KAAI,CAAE,CAAA,CAAC,CAAC;cACnC;AAAA,YACJ;AAAA,AACA,eAAI,SAAQ,AAAC,CAAC,YAAW,CAAC,CAAA,EAAK,CAAA,YAAW,OAAO,EAAI,EAAA,CAAG;AACpD,AAAI,gBAAA,CAAA,qBAAoB,EAAI,CAAA,cAAa,EAAI,IAAE,EAAI,IAAE,CAAC;AACtD,iBAAI,YAAW,CAAE,CAAA,CAAC,GAAK,sBAAoB,CAAG;AAC1C,wCAAwB,AAAC,CAAC,qBAAoB,CAAG,aAAW,CAAG,OAAK,CAAC,CAAC;cAC1E;AAAA,YACJ;AAAA,AACA,iBAAO,OAAK,CAAC;UACjB;AACA,iBAAO,CAAP,UAAS,MAAK;AACV,AAAI,cAAA,CAAA,WAAU,EAAI,IAAI,SAAO,AAAC,CAAC,MAAK,CAAC,CAAC;AACtC,AAAI,cAAA,CAAA,iBAAgB,EAAI,MAAI,CAAC;AAC7B,AAAI,cAAA,CAAA,cAAa,EAAI,CAAA,IAAG,OAAO,GAAK,CAAA,IAAG,SAAS,CAAC;AACjD,AAAI,cAAA,CAAA,GAAE,EAAI,GAAC,CAAC;AACZ,gBAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,IAAG,SAAS,OAAO,CAAG,CAAA,CAAA,EAAE,CAAG;AAC3C,AAAI,gBAAA,CAAA,OAAM,EAAI,CAAA,IAAG,SAAS,CAAE,CAAA,CAAC,CAAC;AAC9B,AAAI,gBAAA,CAAA,CAAA,EAAI,CAAA,OAAM,SAAS,AAAC,CAAC,WAAU,CAAC,CAAC;AACrC,8BAAgB,EAAI,CAAA,iBAAgB,GAAK,EAAC,OAAM,WAAa,oBAAkB,CAAC,CAAC;AACjF,iBAAI,CAAA,OAAO,EAAI,EAAA,CAAG;AACd,kBAAE,GAAK,CAAA,CAAC,CAAA,EAAI,EAAA,CAAA,CAAI,IAAE,EAAI,GAAC,CAAC,EAAI,EAAA,CAAC;cACjC;AAAA,YACJ;AAAA,AACI,cAAA,CAAA,YAAW,EAAI,CAAA,WAAU,UAAU,AAAC,EAAC,CAAC;AAC1C,eAAI,CAAC,gBAAe,QAAQ,AAAC,CAAC,YAAW,CAAC,CAAG;AACzC,gBAAE,GAAK,CAAA,cAAa,EAAI,IAAE,EAAI,IAAE,CAAC;AACjC,AAAI,gBAAA,CAAA,UAAS,EAAI,CAAA,cAAa,EAAI,IAAE,EAAI,IAAE,CAAC;AAC3C,AAAI,gBAAA,CAAA,CAAA,EAAI,EAAA,CAAC;AACT,6BAAe,QAAQ,AAAC,CAAC,YAAW,GAAG,SAAC,KAAI,CAAG,CAAA,GAAE,CAAM;AACnD,mBAAI,CAAA,EAAE,EAAI,EAAA,CAAG;AACT,oBAAE,GAAK,WAAS,CAAC;gBACrB;AAAA,AACA,kBAAE,GAAK,IAAE,CAAC;AACV,mBAAI,CAAC,SAAQ,AAAC,CAAC,KAAI,CAAC,CAAA,EAAK,eAAa,CAAG;AACrC,sBAAI,EAAI,OAAK,CAAC;gBAClB;AAAA,AACA,mBAAI,SAAQ,AAAC,CAAC,KAAI,CAAC,CAAG;AAClB,oBAAE,GAAK,CAAA,GAAE,EAAI,MAAI,CAAC;gBACtB;AAAA,cACJ,EAAC,CAAC;YACN;AAAA,AACA,eAAI,iBAAgB,CAAG;AACnB,gBAAE,GAAK,IAAE,CAAC;YACd;AAAA,AACA,iBAAO,IAAE,CAAC;UACd;AACA,6BAAmB,CAAnB,UAAoB,AAAC,CAAE;AAAE,iBAAO,CAAA,IAAG,QAAQ,qBAAqB,AAAC,EAAC,CAAC;UAAE;AAAA,aAvPT,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;AAApC,cAAQ,AAAC,kCAAqC,CAAA;AA4P9C,mBAAa,YAAY,EAAI,CAAA,aAAY,OAAO,AAAC,CAAC,8BAA6B,CAAC,CAAC;AACjF,mBAAa,WAAW,EAAI,CAAA,aAAY,OAAO,AAAC,CAAC,6BAA4B,CAAC,CAAC;IA3PhD;EAC3B,CAAA;AAAM,CAAC,CAAC;AA2P8B;AC9P1C,KAAK,SAAS,AAAC,0HACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,+CAAoB,CAAC;;;;;AAK7B,SAAS,qBAAmB,CAAE,MAAK,CAAG;AACzC,OAAI,MAAK,WAAa,MAAI,CAAA,EAAK,CAAA,MAAK,WAAa,SAAO,CAAA,EAAK,CAAA,MAAK,WAAa,WAAS,CAAG;AACvF,WAAO,OAAK,CAAC;IACjB;AAAA,AACA,OAAI,CAAC,CAAC,MAAK,UAAU,CAAC,GAAK,EAAC,CAAC,MAAK,WAAW,CAAC,CAAG;AAC7C,UAAM,IAAI,cAAY,AAAC,CAAC,+EAA8E,CAAC,CAAC;IAC5G;AAAA,AACA,OAAI,MAAK,UAAU,CAAG;AAClB,SAAI,MAAO,OAAK,UAAU,CAAA,EAAK,SAAO,CAAG;AACrC,AAAI,UAAA,CAAA,yBAAwB,EAAI,CAAA,MAAK,UAAU,CAAC;AAChD,WAAI,yBAAwB,KAAK,GAAK,cAAY,CAAG;AACjD,eAAO,IAAI,MAAI,AAAC,CAAC;AACb,eAAG,CAAG,CAAA,MAAK,KAAK;AAChB,oBAAQ,CAAG,CAAA,yBAAwB,YAAY;AAC/C,aAAC,CAAG,CAAA,MAAK,GAAG;AAAA,UAChB,CAAC,CAAC;QACN,KACK,KAAI,yBAAwB,KAAK,GAAK,SAAO,CAAG;AACjD,eAAO,IAAI,WAAS,AAAC,CAAC;AAAE,eAAG,CAAG,CAAA,MAAK,KAAK;AAAG,iBAAK,CAAG,CAAA,yBAAwB,OAAO;AAAG,aAAC,CAAG,CAAA,MAAK,GAAG;AAAA,UAAE,CAAC,CAAC;QACzG,KACK;AACD,cAAM,IAAI,cAAY,AAAC,EAAC,0BAA0B,EAAC,CAAA,yBAAwB,KAAK,EAAC,qDAA+C,EAAC,CAAC;QACtI;AAAA,MACJ;AAAA,AACA,WAAO,IAAI,MAAI,AAAC,CAAC,MAAK,CAAC,CAAC;IAC5B;AAAA,AACA,OAAI,MAAK,WAAW,CAAG;AACnB,WAAO,IAAI,SAAO,AAAC,CAAC;AAAE,WAAG,CAAG,CAAA,MAAK,KAAK;AAAG,iBAAS,CAAG,CAAA,MAAK,WAAW;AAAA,MAAE,CAAC,CAAC;IAC7E;AAAA,AACA,SAAO,OAAK,CAAC;EACjB;AAnCA,AAmCA,UAnCQ,AAAC,8CAAqC,CAAA;AAA9C,OAAO;AACD,UAAM,GADZ,SAAS,IAAG;AAAZ,iBAAoB,KAAG,WAAkB,CAAC;AAA1C,YAAoB,KAAG,MAAkB,CAAC;AAA1C,eAAoB,KAAG,SAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,oBAAoB,KAAG,cAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;IAAmB;EAC3B,CAAA;AAAM,CAAC,CAAC;AAiCqC;ACpCjD,KAAK,SAAS,AAAC,uKACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,kDAAoB,CAAC;;;;AAG7B,SAAS,iBAAe,CAAE,CAAA,CAAG,CAAA,IAAG,CAAG;AACtC,OAAI,CAAC,CAAC,IAAG,WAAa,KAAG,CAAC;AACtB,WAAO,MAAI,CAAC;AAAA,AAChB,SAAO,CAAA,CAAA,KAAK,GAAK,CAAA,IAAG,UAAU,CAAC;EACnC;AAAA,AACO,SAAS,mBAAiB,CAAE,IAAG,CAAG;AACrC,AAAI,MAAA,CAAA,WAAU,EAAI,CAAA,SAAQ,YAAY,AAAC,CAAC,IAAG,CAAC,CAAC;AAC7C,eAAa,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,WAAU,OAAO,CAAG,CAAA,CAAA,GAAK,EAAA,CAAG;AAC5C,AAAI,QAAA,CAAA,UAAS,EAAI,CAAA,WAAU,CAAE,CAAA,CAAC,CAAC;AAC/B,SAAI,UAAS,WAAa,YAAU,CAAG;AACnC,aAAO,CAAA,UAAS,GAAG,CAAC;MACxB;AAAA,IACJ;AAAA,AACA,SAAO,KAAG,CAAC;EACf;AAjBA,AAiBA,UAjBQ,AAAC,sCAAqC,CAAA;AAA9C,UAAQ,AAAC,0CAAqC,CAAA;AAA9C,OAAO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AAAf,WAAoB,KAAG,KAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,kBAAoB,KAAG,YAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,gBAAoB,KAAG,UAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;IAAmB;EAC3B,CAAA;AAAM,CAAC,CAAC;AAewC;AClBpD,KAAK,SAAS,AAAC,+IACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,oCAAoB,CAAC;;;;;;;AAApC,OAAO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AAAf,gBAAoB,KAAG,UAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,aAAoB,KAAG,OAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,eAAoB,KAAG,SAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;iBAFK,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,eAAQ,SAAQ,OAAO;AACnB,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;YAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,KAAG,CAAC,CAAC;AAAA,QACzG;MACJ;iBACiB,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,MAC5G;mBAVA,CAAC,eAAc,YAAY,CAAC,AAAC,CA2CL,SACR,OAAM,CAAG,CAAA,SAAQ,CAAG;AAC5B,WAAG,QAAQ,EAAI,QAAM,CAAC;AACtB,WAAG,UAAU,EAAI,UAAQ,CAAC;MAC9B,AAUJ;AATI,UAAI,YAAU,CAAE,OAAM,CAAG;AACrB,aAAG,aAAa,EAAI,QAAM,CAAC;AAC3B,aAAG,gBAAgB,EAAI,CAAA,IAAG,QAAQ,SAAS,AAAC,CAAC,IAAG,aAAa,CAAC,CAAC;AAC/D,aAAG,YAAY,EAAI,CAAA,IAAG,UAAU,oBAAoB,AAAC,CAAC,IAAG,gBAAgB,CAAC,CAAC;QAC/E;AACA,cAAM,CAAN,UAAO,AAAC,CAAE;AACN,aAAG,QAAQ,SAAS,AAAC,CAAC,IAAG,gBAAgB,CAAC,CAAC;AAC3C,eAAO,MAAI,CAAC;QAChB;AAAA,WAxDiF;AAArF,cAAQ,AAAC,0BAAqC,CAAA;AAA9C,AA0DA,cA1DQ,AAAC,cA0DT,CAAA,UAAS,EAAI,CAAA,UAAS,AAAC,CAAC,CACpB,SAAQ,AAAC,CAAC;AACN,eAAO,CAAG,gBAAc;AACxB,iBAAS,CAAG,EAAC,yBAAwB,CAAC;AACtC,WAAG,CAAG;AAAE,mBAAS,CAAG,YAAU;AAAG,sBAAY,CAAG,cAAY;AAAA,QAAE;AAAA,MAClE,CAAC,CACD,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,MAAK,CAAG,SAAO,CAAC,CAAC,CACtD,CAAG,WAAS,CAAC,CAjEiC,CAiEhC;IA/DiB;EAC3B,CAAA;AAAM,CAAC,CAAC;AA+D0B;AClEtC,KAAK,SAAS,AAAC,4SACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,yCAAoB,CAAC;;;;;;;;;;;;;;;;;;;AAuHpC,SAAS,mBAAiB,CAAE,MAAK,CAAG;AAChC,OAAI,MAAK,AAAC,CAAC,MAAK,CAAC,CAAG;AAChB,WAAO,IAAI,iBAAe,AAAC,CAAC,MAAK,CAAC,CAAC;IACvC,KACK,KAAI,WAAU,AAAC,CAAC,MAAK,CAAC,CAAG;AAC1B,SAAI,OAAM,AAAC,CAAC,MAAK,CAAE,MAAK,CAAC,CAAC,CAAG;AACzB,YAAM,IAAI,cAAY,AAAC,CAAC,+EAA8E,CAAC,CAAC;MAC5G;AAAA,AACI,QAAA,CAAA,aAAY,EAAI,CAAA,MAAK,CAAE,MAAK,CAAC,CAAC;AAClC,SAAI,aAAY,GAAK,cAAY,CAAG;AAChC,aAAO,IAAI,iBAAe,AAAC,CAAC,MAAK,CAAE,aAAY,CAAC,CAAC,CAAC;MACtD,KACK,KAAI,aAAY,GAAK,SAAO,CAAG;AAChC,aAAO,IAAI,kBAAgB,AAAC,CAAC,MAAK,CAAE,QAAO,CAAC,CAAC,CAAC;MAClD,KACK;AACD,YAAM,IAAI,cAAY,AAAC,CAAC,MAAK,CAAC,CAAC;MACnC;AAAA,IACJ;AAAA,AACA,QAAM,IAAI,cAAY,AAAC,EAAC,yBAAwB,EAAC,OAAK,EAAC,MAAG,EAAC,CAAC;EAChE;AA3IA,AA2IA,OA3IO;AACD,UAAM,GADZ,SAAS,IAAG;AAAZ,oBAAoB,KAAG,cAAkB,CAAC;AAA1C,cAAoB,KAAG,QAAkB,CAAC;AAA1C,gBAAoB,KAAG,UAAkB,CAAC;AAA1C,aAAoB,KAAG,OAAkB,CAAC;AAA1C,kBAAoB,KAAG,YAAkB,CAAC;AAA1C,oBAAoB,KAAG,cAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,UAAoB,KAAG,IAAkB,CAAC;AAA1C,iBAAoB,KAAG,WAAkB,CAAC;AAA1C,uBAAoB,KAAG,iBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,qBAAoB,KAAG,eAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,YAAoB,KAAG,MAAkB,CAAC;AAA1C,iBAAoB,KAAG,WAAkB,CAAC;AAA1C,eAAoB,KAAG,SAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,wBAAoB,KAAG,kBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,uBAAoB,KAAG,iBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,gCAAoB,KAAG,0BAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;AAFZ,wBAAA,SAAQ,AAAC;AAYF,eAAM,gBAAc,CACX,AAAa,CAAG;YAAhB,OAAK,6CAAI,MAAI;AACrB,aAAG,OAAO,EAAI,OAAK,CAAC;AACpB,aAAG,MAAM,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AACtB,aAAG,UAAU,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AAC1B,aAAG,SAAS,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;QAC7B;AAhBM,AAoGV,aApGiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC;AAiB1C,eAAK,CAAL,UAAO,MAAK;AACR,AAAI,cAAA,CAAA,OAAM,CAAC;AACX,eAAI,MAAK,WAAa,SAAO,CAAG;AAC5B,AAAI,gBAAA,CAAA,IAAG,EAAI,CAAA,MAAK,KAAK,GAAK,IAAE,CAAA,CAAI,GAAC,EAAI,CAAA,MAAK,KAAK,CAAC;AAChD,iBAAG,UAAU,IAAI,AAAC,CAAC,IAAG,CAAG,CAAA,MAAK,WAAW,CAAC,CAAC;AAC3C,mBAAO,KAAG,CAAC;YACf,KACK,KAAI,MAAK,WAAa,MAAI,CAAG;AAC9B,oBAAM,EAAI,IAAI,iBAAe,AAAC,CAAC,MAAK,UAAU,CAAC,CAAC;YACpD,KACK,KAAI,MAAK,WAAa,WAAS,CAAG;AACnC,oBAAM,EAAI,IAAI,kBAAgB,AAAC,CAAC,MAAK,OAAO,CAAC,CAAC;YAClD;AAAA,AACI,cAAA,CAAA,UAAS,EAAI,IAAI,eAAa,AAAC,CAAC,MAAK,KAAK,CAAG,QAAM,CAAG,CAAA,IAAG,OAAO,CAAC,CAAC;AACtE,qBAAS,QAAQ,AAAC,CAAC,IAAG,SAAS,GAAG,SAAC,OAAM,CAAG,CAAA,CAAA,CAAM;AAC9C,iBAAI,UAAS,MAAM,SAAS,AAAC,EAAC,CAAA,EAAK,CAAA,OAAM,MAAM,SAAS,AAAC,EAAC,CAAG;AACzD,oBAAM,IAAI,cAAY,AAAC,EAAC,iBAAiB,EAAC,CAAA,MAAK,KAAK,EAAC,oCAAmC,EAAC,CAAA,OAAM,KAAK,EAAC,IAAE,EAAC,CAAC;cAC7G;AAAA,YACJ,EAAC,CAAC;AACF,eAAG,SAAS,IAAI,AAAC,CAAC,UAAS,MAAM,CAAG,WAAS,CAAC,CAAC;AAC/C,eAAI,SAAQ,AAAC,CAAC,MAAK,GAAG,CAAC,CAAG;AACtB,iBAAG,MAAM,IAAI,AAAC,CAAC,MAAK,GAAG,CAAG,WAAS,CAAC,CAAC;YACzC;AAAA,AACA,iBAAO,CAAA,UAAS,SAAS,CAAC;UAC9B;AAKA,kBAAQ,CAAR,UAAU,GAAE;AACR,AAAI,cAAA,CAAA,SAAQ,EAAI,GAAC,CAAC;AAClB,eAAI,GAAE,OAAO,EAAI,EAAA,CAAA,EAAK,CAAA,GAAE,CAAE,GAAE,OAAO,EAAI,EAAA,CAAC,GAAK,IAAE,CAAG;AAC9C,gBAAE,EAAI,CAAA,GAAE,UAAU,AAAC,CAAC,CAAA,CAAG,CAAA,GAAE,OAAO,EAAI,EAAA,CAAC,CAAC;YAC1C;AAAA,AACA,qBAAS,QAAQ,AAAC,CAAC,IAAG,UAAU,GAAG,SAAC,MAAK,CAAG,CAAA,IAAG,CAAM;AAEjD,iBAAI,IAAG,GAAK,IAAE,CAAA,EAAK,CAAA,IAAG,GAAK,GAAC,CAAG;AAC3B,mBAAI,IAAG,GAAK,IAAE,CAAG;AACb,oBAAE,EAAI,OAAK,CAAC;gBAChB;AAAA,cACJ,KACK,KAAI,GAAE,WAAW,AAAC,CAAC,IAAG,CAAC,CAAG;AAC3B,kBAAE,EAAI,CAAA,MAAK,EAAI,CAAA,GAAE,UAAU,AAAC,CAAC,IAAG,OAAO,CAAC,CAAC;cAC7C;AAAA,YACJ,EAAC,CAAC;AACF,AAAI,cAAA,CAAA,WAAU,EAAI,CAAA,gBAAe,OAAO,AAAC,EAAC,CAAC;AAC3C,AAAI,cAAA,CAAA,WAAU,EAAI,GAAC,CAAC;AACpB,AAAI,cAAA,CAAA,UAAS,EAAI,CAAA,GAAE,QAAQ,AAAC,CAAC,GAAE,CAAC,CAAC;AACjC,eAAI,UAAS,GAAK,EAAA,CAAG;AACjB,wBAAU,EAAI,CAAA,GAAE,UAAU,AAAC,CAAC,UAAS,EAAI,EAAA,CAAC,CAAC;AAC3C,gBAAE,EAAI,CAAA,GAAE,UAAU,AAAC,CAAC,CAAA,CAAG,WAAS,CAAC,CAAC;YACtC;AAAA,AACA,eAAI,IAAG,OAAO,GAAK,CAAA,WAAU,OAAO,EAAI,EAAA,CAAG;AACvC,sCAAwB,AAAC,CAAC,GAAE,CAAG,YAAU,CAAG,YAAU,CAAC,CAAC;YAC5D;AAAA,AACA,qBAAS,QAAQ,AAAC,CAAC,IAAG,SAAS,GAAG,SAAC,cAAa,CAAG,CAAA,KAAI,CAAM;AACzD,AAAI,gBAAA,CAAA,KAAI,CAAC;AACT,iBAAI,SAAQ,AAAC,CAAC,KAAI,EAAI,CAAA,aAAY,WAAW,AAAC,CAAC,KAAI,CAAG,IAAE,CAAC,CAAC,CAAG;AACzD,AAAI,kBAAA,CAAA,UAAS,EAAI,IAAE,CAAC;AACpB,AAAI,kBAAA,CAAA,YAAW,EAAI,GAAC,CAAC;AACrB,mBAAI,GAAE,GAAK,IAAE,CAAG;AACZ,2BAAS,EAAI,CAAA,KAAI,CAAE,CAAA,CAAC,CAAC;AACrB,6BAAW,EAAI,CAAA,GAAE,UAAU,AAAC,CAAC,KAAI,CAAE,CAAA,CAAC,OAAO,CAAC,CAAC;gBACjD;AAAA,AACI,kBAAA,CAAA,MAAK,EAAI,KAAG,CAAC;AACjB,mBAAI,cAAa,SAAS,GAAK,EAAC,gBAAe,QAAQ,AAAC,CAAC,WAAU,CAAC,CAAG;AACnE,uBAAK,EAAI,YAAU,CAAC;AACpB,2BAAS,GAAK,CAAA,GAAE,EAAI,YAAU,CAAC;gBACnC;AAAA,AACA,wBAAQ,KAAK,AAAC,CAAC,GAAI,WAAS,AAAC,CAAC,cAAa,CAAG,WAAS,CAAG,aAAW,CAAG,OAAK,CAAC,CAAC,CAAC;cACpF;AAAA,YACJ,EAAC,CAAC;AACF,iBAAO,UAAQ,CAAC;UACpB;AACA,iBAAO,CAAP,UAAS,IAAG,CAAG;AAAE,iBAAO,CAAA,IAAG,MAAM,IAAI,AAAC,CAAC,IAAG,CAAC,CAAC;UAAE;AAC9C,iBAAO,CAAP,UAAS,IAAG,CAAG,CAAA,MAAK,CAAG;AACnB,AAAI,cAAA,CAAA,cAAa,EAAI,CAAA,IAAG,MAAM,IAAI,AAAC,CAAC,IAAG,CAAC,CAAC;AACzC,eAAI,OAAM,AAAC,CAAC,cAAa,CAAC,CAAG;AACzB,mBAAO,KAAG,CAAC;YACf;AAAA,AACI,cAAA,CAAA,GAAE,EAAI,CAAA,cAAa,SAAS,AAAC,CAAC,MAAK,CAAC,CAAC;AACzC,iBAAO;AAAE,gBAAE,CAAF,IAAE;AAAG,4BAAc,CAAG,CAAA,cAAa,QAAQ,cAAc;AAAA,YAAE,CAAC;UACzE;AAAA,aAlG4D,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;AAApC,cAAQ,AAAC,oCAAqC,CAAA;AAA9C,mBAAA,SAAQ,AAAC;AAuGF,eAAM,WAAS,CACN,UAAS,CAAG,CAAA,UAAS,CAAG,CAAA,YAAW,AAAU,CAAG;YAAV,EAAA,6CAAI,KAAG;AACrD,aAAG,WAAW,EAAI,WAAS,CAAC;AAC5B,aAAG,WAAW,EAAI,WAAS,CAAC;AAC5B,aAAG,aAAa,EAAI,aAAW,CAAC;AAChC,aAAG,cAAc,EAAI,MAAI,CAAC;AAC1B,aAAG,QAAQ,EAAI,CAAA,SAAQ,AAAC,CAAC,CAAA,CAAC,CAAA,CAAI,EAAA,EAAI,CAAA,gBAAe,OAAO,AAAC,EAAC,CAAC;QAC/D;AA5GM,AAoHV,aApHiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC,cA6G1C,MAAK,CAAL,UAAM,AAAC;;AACH,eAAI,CAAC,IAAG,cAAc,CAAG;AACrB,iBAAG,cAAc,EAAI,KAAG,CAAC;AACzB,6BAAe,QAAQ,AAAC,CAAC,IAAG,WAAW,YAAY,AAAC,CAAC,IAAG,WAAW,CAAC,GAAG,SAAC,KAAI,CAAG,CAAA,GAAE,CAAM;AAAE,+BAAe,IAAI,AAAC,CAAC,YAAW,CAAG,IAAE,CAAG,MAAI,CAAC,CAAC;cAAE,EAAC,CAAC;YAC/I;AAAA,AACA,iBAAO,CAAA,IAAG,QAAQ,CAAC;UACvB,MAlH4D,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;AAApC,cAAQ,AAAC,0BAAqC,CAAA;IAEf;EAC3B,CAAA;AAAM,CAAC,CAAC;AAyI+B;AC5I3C,KAAK,SAAS,AAAC,4KACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,+BAAoB,CAAC;;;;;;;;;;;;;;;;;AAwQpC,SAAS,0BAAwB,CAAE,UAAS;AACxC,SAAO,CAAA,WAAU,OAAO,AAAC,CAAC,UAAS,GAAG,SAAC,YAAW,CAAG,CAAA,IAAG,CAAM;AAC1D,SAAI,QAAO,AAAC,CAAC,IAAG,CAAC,CAAG;AAChB,aAAO,CAAA,WAAU,OAAO,AAAC,CAAC,YAAW,CAAG,CAAA,aAAY,MAAM,AAAC,CAAC,IAAG,CAAG,MAAI,CAAC,CAAC,CAAC;MAC7E;AAAA,AACA,iBAAW,KAAK,AAAC,CAAC,IAAG,CAAC,CAAC;AACvB,WAAO,aAAW,CAAC;IACvB,EAAG,GAAC,CAAC,CAAC;EACV;AACA,SAAS,eAAa,CAAE,eAAc,CAAG,CAAA,kBAAiB;AACtD,AAAI,MAAA,CAAA,IAAG,EAAI,eAAa,CAAC;AACzB,OAAI,SAAQ,AAAC,CAAC,eAAc,MAAM,CAAC,CAAG;AAClC,SAAG,EAAI,CAAA,cAAa,AAAC,CAAC,eAAc,MAAM,CAAG,CAAA,SAAQ,AAAC,CAAC,kBAAiB,CAAC,CAAA,CAAI,CAAA,kBAAiB,MAAM,EAAI,KAAG,CAAC,CAAC;IACjH;AAAA,AACA,SAAO,CAAA,IAAG,KAAK,AAAC,EAAC,SAAC,GAAE,CAAM;AACtB,SAAI,GAAE,GAAK,MAAI,CAAG;AACd,aAAO,MAAI,CAAC;MAChB;AAAA,AACA,SAAI,eAAc,MAAM,CAAG;AACvB,aAAO,KAAG,CAAC;MACf;AAAA,AACI,QAAA,CAAA,IAAG,EAAI,CAAA,kBAAiB,AAAC,CAAC,eAAc,UAAU,CAAC,CAAC;AACxD,SAAI,SAAQ,AAAC,CAAC,IAAG,CAAC,CAAG;AACjB,aAAO,CAAA,IAAG,AAAC,CAAC,eAAc,CAAG,mBAAiB,CAAC,CAAC;MACpD;AAAA,AACA,WAAO,KAAG,CAAC;IACf,EAAC,CAAC;EACN;AAnSA,OAAO;AACD,UAAM,GADZ,SAAS,IAAG;AAAZ,qBAAoB,KAAG,eAAkB,CAAC;AAA1C,mBAAoB,KAAG,aAAkB,CAAC;AAA1C,wBAAoB,KAAG,kBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,kBAAoB,KAAG,YAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,cAAoB,KAAG,QAAkB,CAAC;AAA1C,eAAoB,KAAG,SAAkB,CAAC;AAA1C,oBAAoB,KAAG,cAAkB,CAAC;AAA1C,gBAAoB,KAAG,UAAkB,CAAC;AAA1C,oBAAoB,KAAG,cAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,yBAAoB,KAAG,mBAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;qBAES,CAAA,cAAa,QAAQ,AAAC,CAAC,IAAG,CAAC;sBAC1B,CAAA,cAAa,QAAQ,AAAC,CAAC,KAAI,CAAC;AALlD,eAAA,SAAQ,AAAC;AAuBF,eAAM,OAAK,CAGF,QAAO,CAAG,CAAA,SAAQ,CAAG,CAAA,MAAK,CAAG,CAAA,aAAY,CAAG;AACpD,aAAG,SAAS,EAAI,SAAO,CAAC;AACxB,aAAG,UAAU,EAAI,UAAQ,CAAC;AAC1B,aAAG,OAAO,EAAI,OAAK,CAAC;AACpB,aAAG,cAAc,EAAI,cAAY,CAAC;AAClC,aAAG,WAAW,EAAI,MAAI,CAAC;AACvB,aAAG,oBAAoB,EAAI,KAAG,CAAC;AAC/B,aAAG,mBAAmB,EAAI,eAAa,CAAC;AACxC,aAAG,QAAQ,EAAI,KAAG,CAAC;AACnB,aAAG,SAAS,EAAI,IAAI,aAAW,AAAC,EAAC,CAAC;QACtC;AAlCM,AAyOV,aAzOiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC;AAuC1C,oBAAU,CAAV,UAAY,aAAY,CAAG;AAAE,iBAAO,IAAI,YAAU,AAAC,CAAC,IAAG,CAAG,cAAY,CAAC,CAAC;UAAE;AAK1E,uBAAa,CAAb,UAAe,MAAK,CAAG;AAEnB,eAAG,QAAQ,EAAI,OAAK,CAAC;AACrB,eAAI,SAAQ,AAAC,CAAC,IAAG,oBAAoB,CAAC,CAAG;AACrC,mBAAO,CAAA,MAAK,OAAO,AAAC,CAAC,IAAG,oBAAoB,CAAC,CAAC;YAClD;AAAA,AACA,iBAAO,eAAa,CAAC;UACzB;AAaA,eAAK,CAAL,UAAO,WAAU;;AACb,sBAAU,QAAQ,AAAC,EAAC,SAAC,eAAc,CAAM;AACrC,0BAAY,OAAO,AAAC,CAAC,kBAAiB,CAAG,gBAAc,CAAG,gBAAgB,WAAS,CAAC,CAAC;YACzF,EAAC,CAAC;AACF,iBAAO,CAAA,IAAG,WAAW,AAAC,EAAC,CAAC;UAC5B;AAOA,iBAAO,CAAP,UAAS,GAAE;;AACP,iBAAO,CAAA,IAAG,mBAAmB,EAAI,CAAA,IAAG,mBAAmB,KAAK,AAAC,EAAC,SAAC,CAAA;AAC3D,uCAAyB,EAAI,IAAE,CAAC;AAChC,kCAAoB,AAAC,EAAC,CAAC;AACvB,mBAAO,CAAA,kCAAiC,AAAC,CAAC,cAAa,AAAC,CAAC,GAAE,CAAC,KAAK,AAAC,EAAC,SAAC,kBAAiB;AACjF,mBAAI,OAAM,AAAC,CAAC,kBAAiB,CAAC,CAAG;AAC7B,uBAAO,MAAI,CAAC;gBAChB;AAAA,AACA,qBAAO,CAAA,WAAU,AAAC,CAAC,kBAAiB,CAAC,KAC7B,AAAC,EAAC,SAAC,CAAA;uBAAM,CAAA,iBAAgB,AAAC,CAAC,kBAAiB,CAAC;gBAAA,EAAC,KAC9C,AAAC,EAAC,SAAC,MAAK;AACZ,qBAAI,CAAC,MAAK,CAAG;AACT,yBAAO,MAAI,CAAC;kBAChB;AAAA,AACA,uBAAO,CAAA,mBAAkB,AAAC,CAAC,kBAAiB,CAAC,KACrC,AAAC,EAAC,SAAC,MAAK;AACZ,uBAAI,MAAK,CAAG;AACR,2BAAO,CAAA,WAAU,AAAC,CAAC,kBAAiB,CAAC,KAC7B,AAAC,EAAC,SAAC,CAAA,CAAM;AACb,iDAAyB,AAAC,CAAC,kBAAiB,eAAe,CAAC,CAAC;AAC7D,6BAAO,KAAG,CAAC;sBACf,EAAC,CAAC;oBACN;AAAA,kBACJ,EAAC,CAAC;gBACN,EAAC,CAAC;cACN,EAAC,CAAC,CAAC;YACP,EAAC,CAAC;UACN;AACA,8BAAoB,CAApB,UAAsB,GAAE,CAAG;AAAE,4BAAgB,SAAS,AAAC,CAAC,IAAG,SAAS,CAAG,IAAE,CAAC,CAAC;UAAE;AAC7E,sCAA4B,CAA5B,UAA8B,OAAM;;AAChC,iBAAO,CAAA,cAAa,WAAW,AAAC,CAAC,OAAM,KAAK,AAAC,EAAC,SAAC,CAAA;mBAAM,CAAA,sBAAqB,AAAC,EAAC;YAAA,EAAC,GAAG,SAAC,GAAE,CAAM;AACrF,mCAAqB,AAAC,EAAC,CAAC;AACxB,kBAAM,IAAE,CAAC;YACb,EAAC,CAAC;UACN;AACA,eAAK,CAAL,UAAO,WAAU;;AACb,eAAI,OAAM,AAAC,CAAC,IAAG,QAAQ,CAAC,CAAG;AACvB,mBAAO,gBAAc,CAAC;YAC1B;AAAA,AACA,iBAAO,CAAA,IAAG,QAAQ,SAAS,AAAC,CAAC,WAAU,CAAC,KAChC,AAAC,EAAC,SAAC,MAAK,CAAM;AAClB,wBAAU,MAAM,EAAI,OAAK,CAAC;AAC1B,iBAAI,SAAQ,AAAC,CAAC,YAAW,YAAY,CAAC,CAAA,EAAK,CAAA,SAAQ,AAAC,CAAC,WAAU,MAAM,CAAC,CAAG;AACrE,qBAAO,CAAA,YAAW,YAAY,OAAO,AAAC,CAAC,WAAU,MAAM,CAAC,CAAC;cAC7D;AAAA,YACJ,EAAC,CAAC;UACN;AACA,qBAAW,CAAX,UAAa,WAAU,CAAG;AACtB,iBAAO,CAAA,cAAa,AAAC,CAAC,WAAU,CAAG,CAAA,IAAG,oBAAoB,CAAC,CAAC;UAChE;AACA,uBAAa,CAAb,UAAe,WAAU;;AACrB,eAAI,OAAM,AAAC,CAAC,IAAG,QAAQ,CAAC,CAAG;AACvB,mBAAO,eAAa,CAAC;YACzB;AAAA,AACI,cAAA,CAAA,IAAG,CAAC;AACR,eAAI,SAAQ,AAAC,CAAC,WAAU,CAAC,CAAA,EAAK,CAAA,WAAU,MAAM,CAAG;AAC7C,iBAAG,EAAI,eAAa,CAAC;YACzB,KACK;AACD,iBAAG,EAAI,CAAA,IAAG,QAAQ,cAAc,AAAC,CAAC,WAAU,CAAC,CAAC;YAClD;AAAA,AACA,iBAAO,CAAA,IAAG,KAAK,AAAC,EAAC,SAAC,MAAK,CAAM;AACzB,iBAAI,MAAK,GAAK,MAAI,CAAG;AACjB,qBAAO,MAAI,CAAC;cAChB;AAAA,AACA,iBAAI,SAAQ,AAAC,CAAC,YAAW,YAAY,CAAC,CAAG;AACrC,qBAAO,CAAA,YAAW,YAAY,eAAe,AAAC,CAAC,SAAQ,AAAC,CAAC,WAAU,CAAC,CAAA,CAAI,CAAA,WAAU,MAAM,EACpF,KAAG,CAAC,CAAC;cACb;AAAA,AACA,mBAAO,KAAG,CAAC;YACf,EAAC,CAAC;UACN;AAIA,eAAK,CAAL,UAAO,WAAU,CAAG;AAChB,eAAG,oBAAoB,EAAI,YAAU,CAAC;AACtC,eAAI,SAAQ,AAAC,CAAC,IAAG,QAAQ,CAAC,CAAG;AACzB,mBAAO,CAAA,IAAG,QAAQ,OAAO,AAAC,CAAC,WAAU,CAAC,CAAC;YAC3C;AAAA,AACA,iBAAO,eAAa,CAAC;UACzB;AACA,yBAAe,CAAf,UAAgB,AAAC,CAAE;AAAE,eAAG,WAAW,EAAI,KAAG,CAAC;UAAE;AAC7C,0BAAgB,CAAhB,UAAiB,AAAC,CAAE;AAAE,eAAG,WAAW,EAAI,MAAI,CAAC;UAAE;AAI/C,kBAAQ,CAAR,UAAU,MAAK,CAAG;AACd,4BAAgB,UAAU,AAAC,CAAC,IAAG,SAAS,CAAG,OAAK,CAAC,CAAC;UACtD;AAIA,mBAAS,CAAT,UAAW,WAAU,CAAG;AACpB,eAAI,SAAQ,AAAC,CAAC,IAAG,QAAQ,CAAC,CAAG;AACzB,mBAAO,CAAA,IAAG,QAAQ,WAAW,AAAC,CAAC,WAAU,CAAC,CAAC;YAC/C;AAAA,AACA,iBAAO,eAAa,CAAC;UACzB;AAIA,kBAAQ,CAAR,UAAU,GAAE,CAAG;AACX,iBAAO,CAAA,IAAG,SAAS,UAAU,AAAC,CAAC,GAAE,CAAG,CAAA,IAAG,cAAc,CAAC,CAAC;UAC3D;AAKA,mBAAS,CAAT,UAAU,AAAC,CAAE;AACT,eAAI,OAAM,AAAC,CAAC,IAAG,sBAAsB,CAAC,CAAG;AACrC,mBAAO,CAAA,IAAG,mBAAmB,CAAC;YAClC;AAAA,AACA,iBAAO,CAAA,IAAG,SAAS,AAAC,CAAC,IAAG,sBAAsB,CAAC,CAAC;UACpD;AAKA,iBAAO,CAAP,UAAS,UAAS,CAAG;AACjB,AAAI,cAAA,CAAA,oBAAmB,EAAI,CAAA,yBAAwB,AAAC,CAAC,UAAS,CAAC,CAAC;AAChE,AAAI,cAAA,CAAA,KAAI,EAAI,CAAA,WAAU,MAAM,AAAC,CAAC,oBAAmB,CAAC,CAAC;AACnD,AAAI,cAAA,CAAA,IAAG,EAAI,CAAA,WAAU,MAAM,AAAC,CAAC,oBAAmB,CAAG,EAAA,CAAC,CAAC;AACrD,AAAI,cAAA,CAAA,MAAK,EAAI,KAAG,CAAC;AAGjB,eAAI,KAAI,GAAK,GAAC,CAAG;AACb,oBAAO,SAAQ,AAAC,CAAC,MAAK,OAAO,CAAC,CAAG;AAC7B,qBAAK,EAAI,CAAA,MAAK,OAAO,CAAC;cAC1B;AAAA,YACJ,KACK,KAAI,KAAI,GAAK,KAAG,CAAG;AACpB,mBAAK,EAAI,CAAA,MAAK,OAAO,CAAC;AACtB,oBAAO,WAAU,MAAM,AAAC,CAAC,IAAG,CAAC,CAAA,EAAK,KAAG,CAAG;AACpC,mBAAG,EAAI,CAAA,WAAU,MAAM,AAAC,CAAC,IAAG,CAAG,EAAA,CAAC,CAAC;AACjC,qBAAK,EAAI,CAAA,MAAK,OAAO,CAAC;AACtB,mBAAI,OAAM,AAAC,CAAC,MAAK,CAAC,CAAG;AACjB,sBAAM,IAAI,cAAY,AAAC,EAAC,SAAQ,EAAC,CAAA,WAAU,OAAO,AAAC,CAAC,UAAS,CAAC,CAAA,CAAC,oCAA+B,EAAC,CAAC;gBACpG;AAAA,cACJ;AAAA,YACJ,KACK,KAAI,KAAI,GAAK,IAAE,CAAG;AACnB,kBAAM,IAAI,cAAY,AAAC,EAAC,SAAQ,EAAC,CAAA,WAAU,OAAO,AAAC,CAAC,UAAS,CAAC,CAAA,CAAC,+CAAsC,EAAC,CAAC;YAC3G;AAAA,AACA,eAAI,IAAG,CAAE,IAAG,OAAO,EAAI,EAAA,CAAC,GAAK,GAAC,CAAG;AAC7B,wBAAU,WAAW,AAAC,CAAC,IAAG,CAAC,CAAC;YAChC;AAAA,AACA,eAAI,IAAG,OAAO,EAAI,EAAA,CAAG;AACjB,AAAI,gBAAA,CAAA,GAAE,IAAI,SAAQ,EAAC,CAAA,WAAU,OAAO,AAAC,CAAC,UAAS,CAAC,CAAA,CAAC,gCAA6B,CAAA,CAAC;AAC/E,kBAAM,IAAI,cAAY,AAAC,CAAC,GAAE,CAAC,CAAC;YAChC;AAAA,AACI,cAAA,CAAA,GAAE,EAAI,GAAC,CAAC;AACZ,eAAI,SAAQ,AAAC,CAAC,MAAK,OAAO,CAAC,CAAA,EAAK,CAAA,SAAQ,AAAC,CAAC,MAAK,OAAO,oBAAoB,CAAC,CAAG;AAC1E,gBAAE,EAAI,CAAA,MAAK,OAAO,oBAAoB,YAAY,CAAC;YACvD;AAAA,AACA,iBAAO,CAAA,GAAE,EAAI,IAAE,CAAA,CAAI,CAAA,IAAG,SAAS,SAAS,AAAC,CAAC,IAAG,CAAG,CAAA,MAAK,cAAc,CAAC,CAAC;UACzE;AAAA,aAvO4D,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;AAApC,cAAQ,AAAC,kBAAqC,CAAA;AAA9C,mBAAA,SAAS,QAAO;AA4OT,eAAM,WAAS,CACN,QAAO,CAAG,CAAA,QAAO,CAAG,CAAA,QAAO,CAAG,CAAA,aAAY;;AA7O1D,AA8OQ,wBA9OM,iBAAiB,AAAC,YAAkB,KAAK,MA8OzC,SAAO,CAAG,SAAO,CAAG,KAAG,CAAG,cAAY,CA9OsB,CA8OpB;AAC9C,aAAG,UAAU,EAAI,SAAO,CAAC;AACzB,aAAG,UAAU,UAAU,AAAC,cAAC,UAAC,MAAK;iBAAM,CAAA,aAAY,AAAC,CAAC,MAAK,CAAE,KAAI,CAAC,CAAC;UAAA,EAAC,CAAC;AAClE,aAAG,SAAS,oBAAoB,AAAC,CAAC,aAAY,CAAG,KAAG,CAAC,CAAC;AACtD,aAAG,SAAS,AAAC,CAAC,QAAO,KAAK,AAAC,EAAC,CAAC,CAAC;QAMtC;AAtPU,aAAO,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC,cAkP1C,MAAK,CAAL,UAAO,WAAU;;AACb,iBAAO,CArPf,eAAc,SAAS,AAAC,sCAAwD,KAA3D,MAqPO,YAAU,CArPE,KAsPxB,AAAC,EAAC,SAAC,CAAA,CAAM;AAAE,2BAAa,GAAG,AAAC,CAAC,WAAU,eAAe,CAAC,CAAC;YAAE,EAAC,CAAC;UACxE,MApP8D,SAAO,CAAC,CAAC;MACnE,AAAC,CAwOuB,MAAK,CAxOV,CAJS,CAAA;AAApC,cAAQ,AAAC,0BAAqC,CAAA;AAA9C,oBAAA,SAAS,QAAO;AAyPhB,eAAM,YAAU,CACA,MAAK,CAAG,CAAA,aAAY,CAAG;AA1PvC,AA2PQ,wBA3PM,iBAAiB,AAAC,aAAkB,KAAK,MA2PzC,CAAA,MAAK,SAAS,CAAG,CAAA,MAAK,UAAU,CAAG,OAAK,CAAG,cAAY,CA3PK,CA2PH;AAC/D,aAAG,OAAO,EAAI,OAAK,CAAC;QACxB;AA3PM,AAgQV,aAhQiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC,eA4P1C,QAAO,CAAP,UAAS,GAAE,CAAG;AAEV,iBAAO,CAAA,IAAG,OAAO,SAAS,AAAC,CAAC,GAAE,CAAC,CAAC;UACpC,MA9P8D,SAAO,CAAC,CAAC;MACnE,AAAC,CAqPiB,MAAK,CArPJ,CAJS,CAAA;YAuQxB,IAAI,OAAK,AAAC,CAAC,GAAE,CAAC;IArQK;EAC3B,CAAA;AAAM,CAAC,CAAC;AAiSqB;ACpSjC,KAAK,SAAS,AAAC,0VACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,uCAAoB,CAAC;;;;;;;;;;;;;;;;;;;;;AAoKpC,SAAS,aAAW,CAAE,YAAW,CAAG;AAChC,AAAI,MAAA,CAAA,oBAAmB,EAAI,CAAA,YAAW,CAAE,CAAA,CAAC,CAAC;AAC1C,QAAS,GAAA,CAAA,aAAY,EAAI,EAAA,CAAG,CAAA,aAAY,EAAI,CAAA,YAAW,OAAO,CAAG,CAAA,aAAY,EAAE,CAAG;AAC9E,AAAI,QAAA,CAAA,QAAO,EAAI,CAAA,YAAW,CAAE,aAAY,CAAC,CAAC;AAC1C,SAAI,QAAO,YAAY,EAAI,CAAA,oBAAmB,YAAY,CAAG;AACzD,2BAAmB,EAAI,SAAO,CAAC;MACnC;AAAA,IACJ;AAAA,AACA,SAAO,qBAAmB,CAAC;EAC/B;AAAA,AACA,SAAS,wBAAsB,CAAE,SAAQ,CAAG,CAAA,IAAG,CAAG;AAC9C,OAAI,CAAC,MAAK,AAAC,CAAC,SAAQ,CAAC,CAAG;AACpB,aAAM;IACV;AAAA,AACI,MAAA,CAAA,WAAU,EAAI,CAAA,SAAQ,YAAY,AAAC,CAAC,SAAQ,CAAC,CAAC;AAClD,OAAI,SAAQ,AAAC,CAAC,WAAU,CAAC,CAAG;AACxB,UAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,WAAU,OAAO,CAAG,CAAA,CAAA,EAAE,CAAG;AACzC,AAAI,UAAA,CAAA,UAAS,EAAI,CAAA,WAAU,CAAE,CAAA,CAAC,CAAC;AAC/B,WAAI,UAAS,WAAa,YAAU,CAAG;AACnC,cAAM,IAAI,cAAY,AAAC,EAAC,qCAAoC,EAAC,KAAG,EAAC,8CAAyC,EAAC,CAAC;QAChH;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AA3LA,AA2LA,OA3LO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AAAf,sBAAoB,KAAG,gBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,kBAAoB,KAAG,YAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,kBAAoB,KAAG,YAAkB,CAAC;AAA1C,UAAoB,KAAG,IAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,qBAAoB,KAAG,eAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,gBAAoB,KAAG,UAAkB,CAAC;AAA1C,cAAoB,KAAG,QAAkB,CAAC;AAA1C,aAAoB,KAAG,OAAkB,CAAC;AAA1C,eAAoB,KAAG,SAAkB,CAAC;AAA1C,kBAAoB,KAAG,YAAkB,CAAC;AAA1C,oBAAoB,KAAG,cAAkB,CAAC;AAA1C,8BAAoB,KAAG,wBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,kBAAoB,KAAG,YAAkB,CAAC;AAA1C,YAAoB,KAAG,MAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,gBAAoB,KAAG,UAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,iBAAoB,KAAG,WAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,2BAAoB,KAAG,qBAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;iBAFK,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,eAAQ,SAAQ,OAAO;AACnB,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;YAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,KAAG,CAAC,CAAC;AAAA,QACzG;MACJ;iBACiB,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,MAC5G;sBAVA,CAAC,eAAc,YAAY,CAAC,AAAC,CAyBF,SACZ,AAAC,CAAE;AACV,WAAG,OAAO,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;MAC3B,AAgIJ;AA5HI,aAAK,CAAL,UAAO,eAAc,CAAG,CAAA,MAAK,AAA0B,CAAG;YAA1B,iBAAe,6CAAI,MAAI;AACnD,eAAK,EAAI,CAAA,oBAAmB,AAAC,CAAC,MAAK,CAAC,CAAC;AACrC,AAAI,YAAA,CAAA,UAAS,EAAI,CAAA,IAAG,OAAO,IAAI,AAAC,CAAC,eAAc,CAAC,CAAC;AACjD,aAAI,OAAM,AAAC,CAAC,UAAS,CAAC,CAAG;AACrB,qBAAS,EAAI,IAAI,gBAAc,AAAC,CAAC,gBAAe,CAAC,CAAC;AAClD,eAAG,OAAO,IAAI,AAAC,CAAC,eAAc,CAAG,WAAS,CAAC,CAAC;UAChD;AAAA,AACI,YAAA,CAAA,QAAO,EAAI,CAAA,UAAS,OAAO,AAAC,CAAC,MAAK,CAAC,CAAC;AACxC,aAAI,MAAK,WAAa,MAAI,CAAG;AACzB,eAAI,QAAO,CAAG;AACV,oCAAsB,AAAC,CAAC,MAAK,UAAU,CAAG,CAAA,MAAK,KAAK,CAAC,CAAC;YAC1D,KACK;AACD,iBAAG,oBAAoB,AAAC,CAAC,MAAK,UAAU,CAAC,CAAC;YAC9C;AAAA,UACJ;AAAA,QACJ;AAIA,0BAAkB,CAAlB,UAAoB,SAAQ,AAAyB;YAAtB,gBAAc,6CAAI,MAAI;;AACjD,aAAI,CAAC,MAAK,AAAC,CAAC,SAAQ,CAAC,CAAG;AACpB,mBAAM;UACV;AAAA,AAGA,aAAI,IAAG,OAAO,IAAI,AAAC,CAAC,SAAQ,CAAC,CAAG;AAC5B,mBAAM;UACV;AAAA,AACI,YAAA,CAAA,WAAU,EAAI,CAAA,SAAQ,YAAY,AAAC,CAAC,SAAQ,CAAC,CAAC;AAClD,aAAI,SAAQ,AAAC,CAAC,WAAU,CAAC,CAAG;AACxB,gBAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,WAAU,OAAO,CAAG,CAAA,CAAA,EAAE,CAAG;AACzC,AAAI,gBAAA,CAAA,UAAS,EAAI,CAAA,WAAU,CAAE,CAAA,CAAC,CAAC;AAC/B,iBAAI,UAAS,WAAa,YAAU,CAAG;AACnC,0BAAU,QAAQ,AAAC,CAAC,UAAS,QAAQ,GAAG,SAAC,MAAK;uBAAM,CAAA,WAAU,AAAC,CAAC,SAAQ,CAAG,OAAK,CAAG,gBAAc,CAAC;gBAAA,EAAC,CAAC;cACxG;AAAA,YACJ;AAAA,UACJ;AAAA,QACJ;AAKA,gBAAQ,CAAR,UAAU,GAAE,CAAG,CAAA,eAAc;;AACzB,AAAI,YAAA,CAAA,mBAAkB,EAAI,CAAA,IAAG,OAAO,IAAI,AAAC,CAAC,eAAc,CAAC,CAAC;AAC1D,aAAI,OAAM,AAAC,CAAC,mBAAkB,CAAC,CAAG;AAC9B,iBAAO,CAAA,cAAa,QAAQ,AAAC,CAAC,IAAG,CAAC,CAAC;UACvC;AAAA,AAEI,YAAA,CAAA,eAAc,EAAI,CAAA,mBAAkB,UAAU,AAAC,CAAC,GAAE,CAAC,CAAC;AACxD,AAAI,YAAA,CAAA,aAAY,EAAI,CAAA,WAAU,IAAI,AAAC,CAAC,eAAc,GAAG,SAAC,SAAQ;iBAAM,CAAA,wBAAuB,AAAC,CAAC,SAAQ,CAAC;UAAA,EAAC,CAAC;AACxG,eAAO,CAAA,cAAa,IAAI,AAAC,CAAC,aAAY,CAAC,KAC/B,AAAC,EAAC,SAAC,SAAQ;AAEf,AAAI,cAAA,CAAA,aAAY,EAAI,CAAA,WAAU,OAAO,AAAC,CAAC,SAAQ,GAAG,SAAC,QAAO;mBAAM,CAAA,SAAQ,AAAC,CAAC,QAAO,CAAC;YAAA,EAAC,CAAC;AACpF,eAAI,aAAY,OAAO,EAAI,EAAA,CAAG;AAC1B,mBAAO,CAAA,YAAW,AAAC,CAAC,aAAY,CAAC,CAAC;YACtC;AAAA,AACA,iBAAO,KAAG,CAAC;UACf,EAAC,CAAC;QACN;AACA,0BAAkB,CAAlB,UAAoB,YAAW;;AAC3B,AAAI,YAAA,CAAA,UAAS,EAAI,CAAA,YAAW,WAAW,CAAC;AACxC,AAAI,YAAA,CAAA,OAAM,EAAI,CAAA,UAAS,QAAQ,CAAC;AAChC,eAAO,CAAA,OAAM,qBAAqB,AAAC,EAAC,KAAK,AAAC,EAAC,SAAC,aAAY;AACpD,mCAAuB,AAAC,CAAC,aAAY,CAAC,CAAC;AACvC,eAAI,YAAW,aAAa,OAAO,GAAK,EAAA,CAAG;AACvC,iBAAI,UAAS,SAAS,CAAG;AACrB,qBAAO,IAAI,YAAU,AAAC,CAAC,aAAY,CAAG,CAAA,YAAW,WAAW,CAAG,WAAS,CAAG,KAAG,CAAG,CAAA,YAAW,OAAO,AAAC,EAAC,CAAC,CAAC;cAC3G,KACK;AACD,qBAAO,KAAG,CAAC;cACf;AAAA,YACJ;AAAA,AACA,iBAAO,CAAA,cAAa,AAAC,CAAC,YAAW,aAAa,CAAG,cAAY,CAAC,KACtD,AAAC,EAAC,SAAA,gBAAe,CAAK;AAC1B,iBAAI,OAAM,AAAC,CAAC,gBAAe,CAAC,CAAG;AAC3B,qBAAO,KAAG,CAAC;cACf,KACK;AACD,qBAAO,IAAI,YAAU,AAAC,CAAC,aAAY,CAAG,CAAA,YAAW,WAAW,CAAG,WAAS,CAAG,iBAAe,CAAC,CAAC;cAChG;AAAA,YACJ,EAAC,CAAC;UACN,EAAC,CAAC;QACN;AAKA,eAAO,CAAP,UAAS,UAAS,CAAG,CAAA,eAAc,CAAG;AAClC,AAAI,YAAA,CAAA,GAAE,EAAI,GAAC,CAAC;AACZ,AAAI,YAAA,CAAA,eAAc,EAAI,gBAAc,CAAC;AACrC,qBAAa,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,UAAS,OAAO,CAAG,CAAA,CAAA,GAAK,EAAA,CAAG;AAC3C,AAAI,cAAA,CAAA,OAAM,EAAI,CAAA,UAAS,CAAE,CAAA,CAAC,CAAC;AAC3B,eAAI,OAAM,AAAC,CAAC,eAAc,CAAC,CAAG;AAC1B,kBAAM,IAAI,cAAY,AAAC,EAAC,+BAA8B,EAAC,QAAM,EAAC,MAAG,EAAC,CAAC;YACvE;AAAA,AACA,eAAI,CAAC,QAAO,AAAC,CAAC,OAAM,CAAC,CAAG;AACpB,kBAAM,IAAI,cAAY,AAAC,EAAC,uBAAsB,EAAC,QAAM,EAAC,qCAAkC,EAAC,CAAC;YAC9F,KACK,KAAI,OAAM,GAAK,GAAC,CAAA,EAAK,CAAA,OAAM,GAAK,IAAE,CAAA,EAAK,CAAA,OAAM,GAAK,KAAG,CAAG;AACzD,kBAAM,IAAI,cAAY,AAAC,EAAC,IAAG,EAAC,QAAM,EAAC,sDAAmD,EAAC,CAAC;YAC5F;AAAA,AACI,cAAA,CAAA,MAAK,EAAI,KAAG,CAAC;AACjB,eAAI,CAAA,EAAI,EAAA,CAAA,CAAI,CAAA,UAAS,OAAO,CAAG;AAC3B,AAAI,gBAAA,CAAA,WAAU,EAAI,CAAA,UAAS,CAAE,CAAA,EAAI,EAAA,CAAC,CAAC;AACnC,iBAAI,WAAU,AAAC,CAAC,WAAU,CAAC,CAAG;AAC1B,qBAAK,EAAI,YAAU,CAAC;AACpB,gBAAA,GAAK,EAAA,CAAC;cACV;AAAA,YACJ;AAAA,AACI,cAAA,CAAA,mBAAkB,EAAI,CAAA,IAAG,OAAO,IAAI,AAAC,CAAC,eAAc,CAAC,CAAC;AAC1D,eAAI,OAAM,AAAC,CAAC,mBAAkB,CAAC,CAAG;AAC9B,kBAAM,IAAI,cAAY,AAAC,EAAC,cAAa,EAAC,CAAA,uBAAsB,AAAC,CAAC,eAAc,CAAC,CAAA,CAAC,0BAAuB,EAAC,CAAC;YAC3G;AAAA,AACI,cAAA,CAAA,QAAO,EAAI,CAAA,mBAAkB,SAAS,AAAC,CAAC,OAAM,CAAG,OAAK,CAAC,CAAC;AAC5D,eAAI,OAAM,AAAC,CAAC,QAAO,CAAC,CAAG;AACnB,kBAAM,IAAI,cAAY,AAAC,EAAC,cAAa,EAAC,CAAA,uBAAsB,AAAC,CAAC,eAAc,CAAC,CAAA,CAAC,2BAAwB,EAAC,QAAM,EAAC,MAAG,EAAC,CAAC;YACvH;AAAA,AACA,cAAE,GAAK,CAAA,QAAO,CAAE,KAAI,CAAC,CAAC;AACtB,0BAAc,EAAI,CAAA,QAAO,CAAE,eAAc,CAAC,CAAC;UAC/C;AAAA,AACA,eAAO,IAAE,CAAC;QACd;AAAA,WA3JiF;AAArF,cAAQ,AAAC,gCAAqC,CAAA;AAA9C,AA6JA,cA7JQ,AAAC,iBA6JT,CAAA,aAAY,EAAI,CAAA,UAAS,AAAC,CAAC,CACvB,UAAS,AAAC,EAAC,CACX,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,GAAC,CAAC,CACtC,CAAG,cAAY,CAAC,CAhK8B,CAgK7B;IA9Jc;EAC3B,CAAA;AAAM,CAAC,CAAC;AAyL6B;AC5LzC,KAAK,SAAS,AAAC,6WACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,sCAAoB,CAAC;;;;;;;;;;;;;;;;;;;AAApC,OAAO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AAAf,qBAAoB,KAAG,eAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,uBAAoB,KAAG,iBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,cAAoB,KAAG,QAAkB,CAAC;AAA1C,gBAAoB,KAAG,UAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,gBAAoB,KAAG,UAAkB,CAAC;AAA1C,gBAAoB,KAAG,UAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,6BAAoB,KAAG,uBAAkB,CAAC;AAA1C,iBAAoB,KAAG,WAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,eAAoB,KAAG,SAAkB,CAAC;AAA1C,WAAoB,KAAG,KAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,gBAAoB,KAAG,CAAC;IAEhB,CAFR,UAAS,IAAG,CAAG;AAAf,kBAAoB,KAAG,YAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,cAAoB,KAAG,CAAC;IAEhB,CAFR,UAAS,IAAG,CAAG;AAAf,uBAAoB,KAAG,iBAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;iBAFK,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,eAAQ,SAAQ,OAAO;AACnB,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;YAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,KAAG,CAAC,CAAC;AAAA,QACzG;MACJ;iBACiB,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,MAC5G;cACc,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,QAAQ,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,SAAQ,CAAG;AACrE,aAAO,UAAU,MAAK,CAAG,CAAA,GAAE,CAAG;AAAE,kBAAQ,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,WAAS,CAAC,CAAC;QAAE,CAAA;MACxE;qBAbA,CAAC,eAAc,YAAY,CAAC,AAAC,CAiCH,SACV,WAAU,CAAG,CAAA,OAAM,CAAG,CAAA,aAAY,CAAG,CAAA,QAAO,CAAG;AACvD,WAAG,YAAY,EAAI,YAAU,CAAC;AAC9B,WAAG,QAAQ,EAAI,QAAM,CAAC;AACtB,WAAG,cAAc,EAAI,cAAY,CAAC;AAClC,WAAG,YAAY,EAAI,KAAG,CAAC;AACvB,WAAG,cAAc,EAAI,KAAG,CAAC;AACzB,WAAG,oBAAoB,EAAI,KAAG,CAAC;AAK/B,WAAG,cAAc,eAAe,AAAC,CAAC,IAAG,CAAC,CAAC;MAC3C,AA8FJ;AA1FI,aAAK,CAAL,UAAO,WAAU;;AACb,AAAI,YAAA,CAAA,IAAG,CAAC;AACR,aAAI,WAAU,MAAM,CAAG;AACnB,eAAG,EAAI,CAAA,IAAG,OAAO,AAAC,CAAC,WAAU,CAAC,CAAC;UACnC,KACK;AACD,eAAG,EAAI,CAAA,IAAG,WAAW,AAAC,CAAC,WAAU,CAAC,KAAK,AAAC,EAAC,SAAC,CAAA;mBAAM,CAAA,cAAa,AAAC,CAAC,WAAU,CAAC;YAAA,EAAC,CAAC;UAChF;AAAA,AACA,eAAO,CAAA,IAAG,KAAK,AAAC,EAAC,SAAC,CAAA;iBAAM,CAAA,iBAAgB,AAAC,CAAC,WAAU,CAAC;UAAA,EAAC,CAAC;QAC3D;AACA,mBAAW,CAAX,UAAa,WAAU,CAAG;AACtB,aAAI,SAAQ,AAAC,CAAC,IAAG,YAAY,CAAC,CAAG;AAC7B,iBAAO,CAAA,IAAG,YAAY,OAAO,AAAC,CAAC,WAAU,MAAM,CAAC,CAAC;UACrD,KACK;AACD,iBAAO,CAAA,cAAa,QAAQ,AAAC,CAAC,IAAG,CAAC,CAAC;UACvC;AAAA,QACJ;AACA,gBAAQ,CAAR,UAAU,WAAU;;AAChB,AAAI,YAAA,CAAA,mBAAkB,EAAI,CAAA,IAAG,oBAAoB,CAAC;AAClD,aAAG,oBAAoB,EAAI,YAAU,CAAC;AACtC,aAAG,YAAY,EAAI,CAAA,IAAG,cAAc,YAAY,AAAC,CAAC,WAAU,UAAU,CAAC,CAAC;AACxE,AAAI,YAAA,CAAA,QAAO,EAAI,CAAA,QAAO,QAAQ,AAAC,CAAC,CAC5B,IAAG,AAAC,CAAC,WAAU,CAAC,QACL,AAAC,CAAC,GAAI,YAAU,AAAC,CAAC,WAAU,OAAO,AAAC,EAAC,CAAC,CAAC,CAClD,CAAA,IAAG,AAAC,CAAC,SAAQ,OAAO,CAAC,QAAQ,AAAC,CAAC,IAAG,YAAY,CAAC,CACnD,CAAC,CAAC;AACF,eAAO,CAAA,IAAG,QAAQ,mBAAmB,AAAC,CAAC,WAAU,UAAU,CAAG,CAAA,IAAG,YAAY,CAAG,SAAO,CAAC,KAChF,AAAC,EAAC,SAAC,YAAW,CAAM;AACxB,6BAAiB,EAAI,aAAW,CAAC;AACjC,eAAI,gBAAe,AAAC,CAAC,OAAM,WAAW,CAAG,CAAA,WAAU,UAAU,CAAC,CAAG;AAC7D,mBAAO,CAAA,kBAAiB,SAAS,WAAW,AAAC,CAAC,WAAU,CAAG,oBAAkB,CAAC,CAAC;YACnF;AAAA,UACJ,EAAC,CAAC;QACN;AAIA,oBAAY,CAAZ,UAAc,eAAc,CAAG;AAC3B,aAAI,OAAM,AAAC,CAAC,IAAG,oBAAoB,CAAC,CAAG;AACnC,iBAAO,CAAA,cAAa,QAAQ,AAAC,CAAC,IAAG,CAAC,CAAC;UACvC;AAAA,AACA,aAAI,gBAAe,AAAC,CAAC,OAAM,cAAc,CAAG,CAAA,IAAG,oBAAoB,UAAU,CAAC,CAAG;AAC7E,iBAAO,CAAA,cAAa,QAAQ,AAAC,CAAC,IAAG,cAAc,SAAS,cAAc,AAAC,CAAC,eAAc,CAAG,CAAA,IAAG,oBAAoB,CAAC,CAAC,CAAC;UACvH;AAAA,AACA,eAAO,CAAA,cAAa,QAAQ,AAAC,CAAC,IAAG,CAAC,CAAC;QACvC;AAIA,eAAO,CAAP,UAAS,eAAc,CAAG;AACtB,AAAI,YAAA,CAAA,MAAK,CAAC;AACV,aAAI,OAAM,AAAC,CAAC,IAAG,oBAAoB,CAAC,CAAA,EAChC,CAAA,IAAG,oBAAoB,UAAU,GAAK,CAAA,eAAc,UAAU,CAAG;AACjE,iBAAK,EAAI,MAAI,CAAC;UAClB,KACK,KAAI,gBAAe,AAAC,CAAC,OAAM,SAAS,CAAG,CAAA,IAAG,oBAAoB,UAAU,CAAC,CAAG;AAC7E,iBAAK,EAAI,CAAA,IAAG,cAAc,SAAS,SAAS,AAAC,CAAC,eAAc,CAAG,CAAA,IAAG,oBAAoB,CAAC,CAAC;UAC5F,KACK;AACD,iBAAK,EAAI,CAAA,eAAc,GAAK,CAAA,IAAG,oBAAoB,CAAA,EAC/C,CAAA,gBAAe,OAAO,AAAC,CAAC,eAAc,OAAO,AAAC,EAAC,CAAG,CAAA,IAAG,oBAAoB,OAAO,AAAC,EAAC,CAAC,CAAC;UAC5F;AAAA,AACA,eAAO,CAAA,cAAa,QAAQ,AAAC,CAAC,MAAK,CAAC,CAAC;QACzC;AACA,aAAK,CAAL,UAAO,WAAU,CAAG;AAChB,AAAI,YAAA,CAAA,mBAAkB,EAAI,CAAA,IAAG,oBAAoB,CAAC;AAClD,aAAG,oBAAoB,EAAI,YAAU,CAAC;AACtC,eAAO,CAAA,cAAa,QAAQ,AAAC,CAAC,gBAAe,AAAC,CAAC,OAAM,QAAQ,CAAG,CAAA,IAAG,oBAAoB,UAAU,CAAC,CAAA,CAC9F,CAAA,IAAG,cAAc,SAAS,QAAQ,AAAC,CAAC,WAAU,CAAG,oBAAkB,CAAC,CAAA,CACpE,KAAG,CAAC,CAAC;QACb;AACA,iBAAS,CAAT,UAAW,eAAc;;AACrB,eAAO,CAAA,CAAC,SAAQ,AAAC,CAAC,IAAG,YAAY,CAAC,CAAA,CAC9B,CAAA,IAAG,YAAY,WAAW,AAAC,CAAC,SAAQ,AAAC,CAAC,eAAc,CAAC,CAAA,CAAI,CAAA,eAAc,MAAM,EACzE,KAAG,CAAC,CAAA,CACR,CAAA,cAAa,QAAQ,AAAC,CAAC,IAAG,CAAC,CAAC,KACxB,AAAC,EAAC,SAAC,CAAA,CAAM;AACb,eAAI,SAAQ,AAAC,CAAC,kBAAiB,CAAC,CAAA,EAAK,CAAA,SAAQ,AAAC,CAAC,wBAAuB,CAAC,CAAA,EACnE,CAAA,gBAAe,AAAC,CAAC,OAAM,aAAa,CAAG,CAAA,wBAAuB,UAAU,CAAC,CAAG;AAC5E,mBAAO,CAAA,kBAAiB,SAAS,aAAa,AAAC,CAAC,eAAc,CAAG,yBAAuB,CAAC,CAAC;YAC9F;AAAA,UACJ,EAAC,KACO,AAAC,EAAC,SAAC,CAAA,CAAM;AACb,eAAI,SAAQ,AAAC,CAAC,kBAAiB,CAAC,CAAG;AAC/B,+BAAiB,QAAQ,AAAC,EAAC,CAAC;AAC5B,+BAAiB,EAAI,KAAG,CAAC;YAC7B;AAAA,UACJ,EAAC,CAAC;QACN;WA3IiF;AAArF,cAAQ,AAAC,8BAAqC,CAAA;AAA9C,AA6IA,cA7IQ,AAAC,gBA6IT,CAAA,YAAW,EAAI,CAAA,UAAS,AAAC,CAAC,CACtB,SAAQ,AAAC,CAAC,CAAE,QAAO,CAAG,gBAAc,CAAE,CAAC,CACvC,CAAA,OAAM,AAAC,CAAC,CAAA,CAAG,CAAA,SAAQ,AAAC,CAAC,MAAK,CAAC,CAAC,CAC5B,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,UAAS,CAAG,uBAAqB,CAAG,CAAA,SAAQ,OAAO,CAAG,OAAK,CAAC,CAAC,CAClG,CAAG,aAAW,CAAC,CAjJ+B,CAiJ9B;IA/Ie;EAC3B,CAAA;AAAM,CAAC,CAAC;AA+I4B;AClJxC,KAAK,SAAS,AAAC,wjBACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,oBAAoB,CAAC;;;;;;;;;;;;;;;AAC1B,AAAI,IAAA,CAAA,cAAa;;;;EAAoB,CAAC;AADhD,OAAO;AACD,UAAM,GADZ,SAAS,IAAG;AAAZ,aAAoB,KAAG,OAAkB,CAAC;AAA1C,iBAAoB,KAAG,WAAkB,CAAC;AAA1C,cAAQ,AAAC,UAAoB,KAAG,QAAmB,CAAC;AAApD,cAAQ,AAAC,cAAoB,KAAG,YAAmB,CAAC;IAE5C,CAFR,UAAS,IAAG;AAAZ,mBAAoB,KAAG,aAAkB,CAAC;AAA1C,cAAQ,AAAC,gBAAoB,KAAG,cAAmB,CAAC;IAE5C,CAFR,UAAS,IAAG;AAAZ,iBAAoB,KAAG,WAAkB,CAAC;AAA1C,cAAQ,AAAC,cAAoB,KAAG,YAAmB,CAAC;IAE5C,CAFR,UAAS,IAAG,CAAG;AAAf,cAAQ,AAAC,eAAoB,KAAG,aAAmB,CAAC;IAE5C,CAFR,UAAS,IAAG;AAAZ,oBAAoB,KAAG,cAAkB,CAAC;AAA1C,cAAQ,AAAC,iBAAoB,KAAG,eAAmB,CAAC;IAE5C,CAFR,UAAS,IAAG;AAAZ,uBAAoB,KAAG,iBAAkB,CAAC;AAA1C,cAAQ,AAAC,oBAAoB,KAAG,kBAAmB,CAAC;IAE5C,CAFR,UAAS,IAAG,CAAG;AAAf,cAAQ,AAAC,wBAAoB,KAAG,sBAAmB,CAAC;IAE5C,CAFR,UAAS,IAAG;AAAZ,4BAAoB,KAAG,sBAAkB,CAAC;AAA1C,cAAQ,AAAC,yBAAoB,KAAG,uBAAmB,CAAC;IAE5C,CAFR,UAAS,IAAG;AAAZ,eAAoB,KAAG,SAAkB,CAAC;AAA1C,cAAQ,AAAC,YAAoB,KAAG,UAAmB,CAAC;AAApD,cAAQ,AAAC,oBAAoB,KAAG,kBAAmB,CAAC;IAE5C,CAFR,UAAS,IAAG;AAAZ,eAAoB,KAAG,SAAkB,CAAC;AAA1C,cAAQ,AAAC,YAAoB,KAAG,UAAmB,CAAC;IAE5C,CAFR,UAAS,IAAG,CAAG;AACL,WAAK,KAAK,AAAC,CAAC,IAAG,CAAC,QAAQ,AAAC,CAAC,SAAS,CAAA,CAAG;AACpC,WAAI,CAAC,cAAa,CAAE,CAAA,CAAC;AACnB,kBAAQ,AAAC,CAAC,CAAA,CAAG,CAAA,IAAG,CAAE,CAAA,CAAC,CAAC,CAAC;AAAA,MACzB,CAAC,CAAC;IAFJ,CAFR,UAAS,IAAG,CAAG;AAAf,cAAQ,AAAC,eAAoB,KAAG,aAAmB,CAAC;IAE5C,CAFR,UAAS,IAAG,CAAG;AAAf,4BAAoB,KAAG,sBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,WAAoB,KAAG,KAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,iBAAoB,KAAG,WAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;uBA0BoB,CAAA,UAAS,AAAC,CAAC,CAAC,YAAW,CAAG,WAAS,CAAC,CAAC;AA5BrE,cAAQ,AAAC,sCAAqC,CAAA;wBA6Bf,EAC3B,aAAY,CACZ,SAAO,CACP,CAAA,IAAG,AAAC,CAAC,gBAAe,CAAC,QAAQ,AAAC,CAAC,qBAAoB,CAAC,CACpD,SAAO,CACP,CAAA,IAAG,AAAC,CAAC,MAAK,CAAC,UACE,AAAC,EAAC,SAAC,QAAO,CAAG,CAAA,QAAO,CAAG,CAAA,QAAO,CAAG,CAAA,OAAM,CAAM;AAAE,aAAO,IAAI,WAAS,AAAC,CAAC,QAAO,CAAG,SAAO,CAAG,SAAO,CAAG,QAAM,CAAC,CAAC;MAAE,EAAG,EAAC,aAAY,CAAG,SAAO,CAAG,SAAO,CAAG,sBAAoB,CAAC,CAAC,CAC3L;AApCA,cAAQ,AAAC,wCAAqC,CAAA;IAEf;EAC3B,CAAA;AAAM,CAAC,CAAC;AAkCqB","file":"dist/js/bundle/router.dev.js"} \ No newline at end of file diff --git a/2.0.0-alpha.33/test_lib.dev.js b/2.0.0-alpha.33/test_lib.dev.js new file mode 100644 index 0000000000..716468925e --- /dev/null +++ b/2.0.0-alpha.33/test_lib.dev.js @@ -0,0 +1,2280 @@ +"format register"; +System.register("angular2/src/router/location_strategy", ["angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/router/location_strategy"; + var BaseException, + LocationStrategy; + function _abstract() { + return new BaseException('This method is abstract'); + } + return { + setters: [function($__m) { + BaseException = $__m.BaseException; + }], + execute: function() { + LocationStrategy = (function() { + function LocationStrategy() {} + return ($traceurRuntime.createClass)(LocationStrategy, { + path: function() { + throw _abstract(); + }, + pushState: function(ctx, title, url) { + throw _abstract(); + }, + forward: function() { + throw _abstract(); + }, + back: function() { + throw _abstract(); + }, + onPopState: function(fn) { + throw _abstract(); + }, + getBaseHref: function() { + throw _abstract(); + } + }, {}); + }()); + $__export("LocationStrategy", LocationStrategy); + } + }; +}); + +System.register("angular2/src/render/xhr_mock", ["angular2/src/render/xhr", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/facade/async"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/render/xhr_mock"; + var XHR, + ListWrapper, + Map, + isBlank, + normalizeBlank, + BaseException, + PromiseWrapper, + MockXHR, + _PendingRequest, + _Expectation; + return { + setters: [function($__m) { + XHR = $__m.XHR; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + Map = $__m.Map; + }, function($__m) { + isBlank = $__m.isBlank; + normalizeBlank = $__m.normalizeBlank; + BaseException = $__m.BaseException; + }, function($__m) { + PromiseWrapper = $__m.PromiseWrapper; + }], + execute: function() { + MockXHR = (function($__super) { + function MockXHR() { + $traceurRuntime.superConstructor(MockXHR).call(this); + this._expectations = []; + this._definitions = new Map(); + this._requests = []; + } + return ($traceurRuntime.createClass)(MockXHR, { + get: function(url) { + var request = new _PendingRequest(url); + this._requests.push(request); + return request.getPromise(); + }, + expect: function(url, response) { + var expectation = new _Expectation(url, response); + this._expectations.push(expectation); + }, + when: function(url, response) { + this._definitions.set(url, response); + }, + flush: function() { + if (this._requests.length === 0) { + throw new BaseException('No pending requests to flush'); + } + do { + var request = ListWrapper.removeAt(this._requests, 0); + this._processRequest(request); + } while (this._requests.length > 0); + this.verifyNoOustandingExpectations(); + }, + verifyNoOustandingExpectations: function() { + if (this._expectations.length === 0) + return ; + var urls = []; + for (var i = 0; i < this._expectations.length; i++) { + var expectation = this._expectations[i]; + urls.push(expectation.url); + } + throw new BaseException(("Unsatisfied requests: " + ListWrapper.join(urls, ', '))); + }, + _processRequest: function(request) { + var url = request.url; + if (this._expectations.length > 0) { + var expectation = this._expectations[0]; + if (expectation.url == url) { + ListWrapper.remove(this._expectations, expectation); + request.complete(expectation.response); + return ; + } + } + if (this._definitions.has(url)) { + var response = this._definitions.get(url); + request.complete(normalizeBlank(response)); + return ; + } + throw new BaseException(("Unexpected request " + url)); + } + }, {}, $__super); + }(XHR)); + $__export("MockXHR", MockXHR); + _PendingRequest = (function() { + function _PendingRequest(url) { + this.url = url; + this.completer = PromiseWrapper.completer(); + } + return ($traceurRuntime.createClass)(_PendingRequest, { + complete: function(response) { + if (isBlank(response)) { + this.completer.reject(("Failed to load " + this.url), null); + } else { + this.completer.resolve(response); + } + }, + getPromise: function() { + return this.completer.promise; + } + }, {}); + }()); + _Expectation = (function() { + function _Expectation(url, response) { + this.url = url; + this.response = response; + } + return ($traceurRuntime.createClass)(_Expectation, {}, {}); + }()); + } + }; +}); + +System.register("angular2/src/mock/mock_location_strategy", ["angular2/src/facade/async", "angular2/src/router/location_strategy"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/mock/mock_location_strategy"; + var EventEmitter, + ObservableWrapper, + LocationStrategy, + MockLocationStrategy; + return { + setters: [function($__m) { + EventEmitter = $__m.EventEmitter; + ObservableWrapper = $__m.ObservableWrapper; + }, function($__m) { + LocationStrategy = $__m.LocationStrategy; + }], + execute: function() { + MockLocationStrategy = (function($__super) { + function MockLocationStrategy() { + $traceurRuntime.superConstructor(MockLocationStrategy).call(this); + this.internalBaseHref = '/'; + this.internalPath = '/'; + this.internalTitle = ''; + this.urlChanges = []; + this._subject = new EventEmitter(); + } + return ($traceurRuntime.createClass)(MockLocationStrategy, { + simulatePopState: function(url) { + this.internalPath = url; + ObservableWrapper.callNext(this._subject, null); + }, + path: function() { + return this.internalPath; + }, + simulateUrlPop: function(pathname) { + ObservableWrapper.callNext(this._subject, {'url': pathname}); + }, + pushState: function(ctx, title, url) { + this.internalTitle = title; + this.internalPath = url; + this.urlChanges.push(url); + }, + onPopState: function(fn) { + ObservableWrapper.subscribe(this._subject, fn); + }, + getBaseHref: function() { + return this.internalBaseHref; + } + }, {}, $__super); + }(LocationStrategy)); + $__export("MockLocationStrategy", MockLocationStrategy); + } + }; +}); + +System.register("angular2/src/mock/view_resolver_mock", ["angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/core/annotations_impl/view", "angular2/src/core/compiler/view_resolver"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/mock/view_resolver_mock"; + var Map, + MapWrapper, + ListWrapper, + isPresent, + BaseException, + stringify, + isBlank, + View, + ViewResolver, + MockViewResolver; + return { + setters: [function($__m) { + Map = $__m.Map; + MapWrapper = $__m.MapWrapper; + ListWrapper = $__m.ListWrapper; + }, function($__m) { + isPresent = $__m.isPresent; + BaseException = $__m.BaseException; + stringify = $__m.stringify; + isBlank = $__m.isBlank; + }, function($__m) { + View = $__m.View; + }, function($__m) { + ViewResolver = $__m.ViewResolver; + }], + execute: function() { + MockViewResolver = (function($__super) { + function MockViewResolver() { + $traceurRuntime.superConstructor(MockViewResolver).call(this); + this._views = new Map(); + this._inlineTemplates = new Map(); + this._viewCache = new Map(); + this._directiveOverrides = new Map(); + } + return ($traceurRuntime.createClass)(MockViewResolver, { + setView: function(component, view) { + this._checkOverrideable(component); + this._views.set(component, view); + }, + setInlineTemplate: function(component, template) { + this._checkOverrideable(component); + this._inlineTemplates.set(component, template); + }, + overrideViewDirective: function(component, from, to) { + this._checkOverrideable(component); + var overrides = this._directiveOverrides.get(component); + if (isBlank(overrides)) { + overrides = new Map(); + this._directiveOverrides.set(component, overrides); + } + overrides.set(from, to); + }, + resolve: function(component) { + var view = this._viewCache.get(component); + if (isPresent(view)) + return view; + view = this._views.get(component); + if (isBlank(view)) { + view = $traceurRuntime.superGet(this, MockViewResolver.prototype, "resolve").call(this, component); + } + var directives = view.directives; + var overrides = this._directiveOverrides.get(component); + if (isPresent(overrides) && isPresent(directives)) { + directives = ListWrapper.clone(view.directives); + MapWrapper.forEach(overrides, (function(to, from) { + var srcIndex = directives.indexOf(from); + if (srcIndex == -1) { + throw new BaseException(("Overriden directive " + stringify(from) + " not found in the template of " + stringify(component))); + } + directives[srcIndex] = to; + })); + view = new View({ + template: view.template, + templateUrl: view.templateUrl, + directives: directives + }); + } + var inlineTemplate = this._inlineTemplates.get(component); + if (isPresent(inlineTemplate)) { + view = new View({ + template: inlineTemplate, + templateUrl: null, + directives: view.directives + }); + } + this._viewCache.set(component, view); + return view; + }, + _checkOverrideable: function(component) { + var cached = this._viewCache.get(component); + if (isPresent(cached)) { + throw new BaseException(("The component " + stringify(component) + " has already been compiled, its configuration can not be changed")); + } + } + }, {}, $__super); + }(ViewResolver)); + $__export("MockViewResolver", MockViewResolver); + } + }; +}); + +System.register("angular2/mock", ["angular2/src/mock/mock_location_strategy", "angular2/src/router/location_strategy", "angular2/src/mock/view_resolver_mock", "angular2/src/render/xhr_mock"], function($__export) { + "use strict"; + var __moduleName = "angular2/mock"; + var $__exportNames = {undefined: true}; + return { + setters: [function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + $__export("LocationStrategy", $__m.LocationStrategy); + }, function($__m) { + $__export("MockViewResolver", $__m.MockViewResolver); + }, function($__m) { + $__export("MockXHR", $__m.MockXHR); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/mock/ng_zone_mock", ["angular2/src/core/zone/ng_zone"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/mock/ng_zone_mock"; + var NgZone, + MockNgZone; + return { + setters: [function($__m) { + NgZone = $__m.NgZone; + }], + execute: function() { + MockNgZone = (function($__super) { + function MockNgZone() { + $traceurRuntime.superConstructor(MockNgZone).call(this, {enableLongStackTrace: false}); + } + return ($traceurRuntime.createClass)(MockNgZone, { + run: function(fn) { + return fn(); + }, + runOutsideAngular: function(fn) { + return fn(); + } + }, {}, $__super); + }(NgZone)); + $__export("MockNgZone", MockNgZone); + } + }; +}); + +System.register("angular2/src/test_lib/utils", ["angular2/src/facade/collection", "angular2/src/dom/dom_adapter", "angular2/src/facade/lang"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/test_lib/utils"; + var ListWrapper, + MapWrapper, + DOM, + isString, + RegExpWrapper, + StringWrapper, + Log, + _RE_SPECIAL_CHARS, + _ESCAPE_RE, + _singleTagWhitelist; + function dispatchEvent(element, eventType) { + DOM.dispatchEvent(element, DOM.createEvent(eventType)); + } + function el(html) { + return DOM.firstChild(DOM.content(DOM.createTemplate(html))); + } + function containsRegexp(input) { + return RegExpWrapper.create(StringWrapper.replaceAllMapped(input, _ESCAPE_RE, (function(match) { + return ("\\" + match[0]); + }))); + } + function normalizeCSS(css) { + css = StringWrapper.replaceAll(css, /\s+/g, ' '); + css = StringWrapper.replaceAll(css, /:\s/g, ':'); + css = StringWrapper.replaceAll(css, /'"/g, '"'); + css = StringWrapper.replaceAllMapped(css, /url\(\"(.+)\\"\)/g, (function(match) { + return ("url(" + match[1] + ")"); + })); + css = StringWrapper.replaceAllMapped(css, /\[(.+)=([^"\]]+)\]/g, (function(match) { + return ("[" + match[1] + "=\"" + match[2] + "\"]"); + })); + return css; + } + function stringifyElement(el) { + var result = ''; + if (DOM.isElementNode(el)) { + var tagName = StringWrapper.toLowerCase(DOM.tagName(el)); + result += ("<" + tagName); + var attributeMap = DOM.attributeMap(el); + var keys = []; + MapWrapper.forEach(attributeMap, (function(v, k) { + keys.push(k); + })); + ListWrapper.sort(keys); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var attValue = attributeMap.get(key); + if (!isString(attValue)) { + result += (" " + key); + } else { + result += (" " + key + "=\"" + attValue + "\""); + } + } + result += '>'; + var children = DOM.childNodes(DOM.templateAwareRoot(el)); + for (var j = 0; j < children.length; j++) { + result += stringifyElement(children[j]); + } + if (!ListWrapper.contains(_singleTagWhitelist, tagName)) { + result += (""); + } + } else { + result += DOM.getText(el); + } + return result; + } + $__export("dispatchEvent", dispatchEvent); + $__export("el", el); + $__export("containsRegexp", containsRegexp); + $__export("normalizeCSS", normalizeCSS); + $__export("stringifyElement", stringifyElement); + return { + setters: [function($__m) { + ListWrapper = $__m.ListWrapper; + MapWrapper = $__m.MapWrapper; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + isString = $__m.isString; + RegExpWrapper = $__m.RegExpWrapper; + StringWrapper = $__m.StringWrapper; + }], + execute: function() { + Log = (function() { + function Log() { + this._result = []; + } + return ($traceurRuntime.createClass)(Log, { + add: function(value) { + this._result.push(value); + }, + fn: function(value) { + var $__0 = this; + return (function() { + var a1 = arguments[0] !== (void 0) ? arguments[0] : null; + var a2 = arguments[1] !== (void 0) ? arguments[1] : null; + var a3 = arguments[2] !== (void 0) ? arguments[2] : null; + var a4 = arguments[3] !== (void 0) ? arguments[3] : null; + var a5 = arguments[4] !== (void 0) ? arguments[4] : null; + $__0._result.push(value); + }); + }, + result: function() { + return ListWrapper.join(this._result, "; "); + } + }, {}); + }()); + $__export("Log", Log); + _RE_SPECIAL_CHARS = ['-', '[', ']', '/', '{', '}', '\\', '(', ')', '*', '+', '?', '.', '^', '$', '|']; + _ESCAPE_RE = RegExpWrapper.create(("[\\" + _RE_SPECIAL_CHARS.join('\\') + "]")); + _singleTagWhitelist = ['br', 'hr', 'input']; + } + }; +}); + +System.register("angular2/src/debug/debug_element", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/dom/dom_adapter", "angular2/src/core/compiler/view_ref"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/debug/debug_element"; + var isPresent, + ListWrapper, + DOM, + internalView, + DebugElement, + Scope, + By; + function inspectElement(elementRef) { + return DebugElement.create(elementRef); + } + function asNativeElements(arr) { + return arr.map((function(debugEl) { + return debugEl.nativeElement; + })); + } + $__export("inspectElement", inspectElement); + $__export("asNativeElements", asNativeElements); + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + internalView = $__m.internalView; + }], + execute: function() { + DebugElement = (function() { + function DebugElement(_parentView, _boundElementIndex) { + this._parentView = _parentView; + this._boundElementIndex = _boundElementIndex; + this._elementInjector = this._parentView.elementInjectors[this._boundElementIndex]; + } + return ($traceurRuntime.createClass)(DebugElement, { + get componentInstance() { + if (!isPresent(this._elementInjector)) { + return null; + } + return this._elementInjector.getComponent(); + }, + get nativeElement() { + return this.elementRef.nativeElement; + }, + get elementRef() { + return this._parentView.elementRefs[this._boundElementIndex]; + }, + getDirectiveInstance: function(directiveIndex) { + return this._elementInjector.getDirectiveAtIndex(directiveIndex); + }, + get children() { + return this._getChildElements(this._parentView, this._boundElementIndex); + }, + get componentViewChildren() { + var shadowView = this._parentView.getNestedView(this._boundElementIndex); + if (!isPresent(shadowView)) { + return []; + } + return this._getChildElements(shadowView, null); + }, + triggerEventHandler: function(eventName, eventObj) { + this._parentView.triggerEventHandlers(eventName, eventObj, this._boundElementIndex); + }, + hasDirective: function(type) { + if (!isPresent(this._elementInjector)) { + return false; + } + return this._elementInjector.hasDirective(type); + }, + inject: function(type) { + if (!isPresent(this._elementInjector)) { + return null; + } + return this._elementInjector.get(type); + }, + getLocal: function(name) { + return this._parentView.locals.get(name); + }, + query: function(predicate) { + var scope = arguments[1] !== (void 0) ? arguments[1] : Scope.all; + var results = this.queryAll(predicate, scope); + return results.length > 0 ? results[0] : null; + }, + queryAll: function(predicate) { + var scope = arguments[1] !== (void 0) ? arguments[1] : Scope.all; + var elementsInScope = scope(this); + return ListWrapper.filter(elementsInScope, predicate); + }, + _getChildElements: function(view, parentBoundElementIndex) { + var $__0 = this; + var els = []; + var parentElementBinder = null; + if (isPresent(parentBoundElementIndex)) { + parentElementBinder = view.proto.elementBinders[parentBoundElementIndex - view.elementOffset]; + } + for (var i = 0; i < view.proto.elementBinders.length; ++i) { + var binder = view.proto.elementBinders[i]; + if (binder.parent == parentElementBinder) { + els.push(new DebugElement(view, view.elementOffset + i)); + var views = view.viewContainers[view.elementOffset + i]; + if (isPresent(views)) { + ListWrapper.forEach(views.views, (function(nextView) { + els = ListWrapper.concat(els, $__0._getChildElements(nextView, null)); + })); + } + } + } + return els; + } + }, {create: function(elementRef) { + return new DebugElement(internalView(elementRef.parentView), elementRef.boundElementIndex); + }}); + }()); + $__export("DebugElement", DebugElement); + Scope = (function() { + function Scope() {} + return ($traceurRuntime.createClass)(Scope, {}, { + all: function(debugElement) { + var scope = []; + scope.push(debugElement); + ListWrapper.forEach(debugElement.children, (function(child) { + scope = ListWrapper.concat(scope, Scope.all(child)); + })); + ListWrapper.forEach(debugElement.componentViewChildren, (function(child) { + scope = ListWrapper.concat(scope, Scope.all(child)); + })); + return scope; + }, + light: function(debugElement) { + var scope = []; + ListWrapper.forEach(debugElement.children, (function(child) { + scope.push(child); + scope = ListWrapper.concat(scope, Scope.light(child)); + })); + return scope; + }, + view: function(debugElement) { + var scope = []; + ListWrapper.forEach(debugElement.componentViewChildren, (function(child) { + scope.push(child); + scope = ListWrapper.concat(scope, Scope.light(child)); + })); + return scope; + } + }); + }()); + $__export("Scope", Scope); + By = (function() { + function By() {} + return ($traceurRuntime.createClass)(By, {}, { + all: function() { + return (function(debugElement) { + return true; + }); + }, + css: function(selector) { + return (function(debugElement) { + return isPresent(debugElement.nativeElement) ? DOM.elementMatches(debugElement.nativeElement, selector) : false; + }); + }, + directive: function(type) { + return (function(debugElement) { + return debugElement.hasDirective(type); + }); + } + }); + }()); + $__export("By", By); + } + }; +}); + +System.register("angular2/src/debug/debug_element_view_listener", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/di", "angular2/src/core/compiler/view_listener", "angular2/src/dom/dom_adapter", "angular2/src/render/api", "angular2/src/debug/debug_element"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/debug/debug_element_view_listener"; + var __decorate, + __metadata, + isPresent, + NumberWrapper, + MapWrapper, + Map, + ListWrapper, + Injectable, + bind, + AppViewListener, + DOM, + Renderer, + DebugElement, + NG_ID_PROPERTY, + INSPECT_GLOBAL_NAME, + NG_ID_SEPARATOR, + _allIdsByView, + _allViewsById, + _nextId, + DebugElementViewListener, + ELEMENT_PROBE_CONFIG; + function _setElementId(element, indices) { + if (isPresent(element)) { + DOM.setData(element, NG_ID_PROPERTY, ListWrapper.join(indices, NG_ID_SEPARATOR)); + } + } + function _getElementId(element) { + var elId = DOM.getData(element, NG_ID_PROPERTY); + if (isPresent(elId)) { + return ListWrapper.map(elId.split(NG_ID_SEPARATOR), (function(partStr) { + return NumberWrapper.parseInt(partStr, 10); + })); + } else { + return null; + } + } + function inspectNativeElement(element) { + var elId = _getElementId(element); + if (isPresent(elId)) { + var view = _allViewsById.get(elId[0]); + if (isPresent(view)) { + return new DebugElement(view, elId[1]); + } + } + return null; + } + $__export("inspectNativeElement", inspectNativeElement); + return { + setters: [function($__m) { + isPresent = $__m.isPresent; + NumberWrapper = $__m.NumberWrapper; + }, function($__m) { + MapWrapper = $__m.MapWrapper; + Map = $__m.Map; + ListWrapper = $__m.ListWrapper; + }, function($__m) { + Injectable = $__m.Injectable; + bind = $__m.bind; + }, function($__m) { + AppViewListener = $__m.AppViewListener; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + Renderer = $__m.Renderer; + }, function($__m) { + DebugElement = $__m.DebugElement; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + NG_ID_PROPERTY = 'ngid'; + INSPECT_GLOBAL_NAME = 'ngProbe'; + NG_ID_SEPARATOR = '#'; + _allIdsByView = new Map(); + _allViewsById = new Map(); + _nextId = 0; + DebugElementViewListener = (($traceurRuntime.createClass)(function(_renderer) { + this._renderer = _renderer; + DOM.setGlobalVar(INSPECT_GLOBAL_NAME, inspectNativeElement); + }, { + viewCreated: function(view) { + var viewId = _nextId++; + _allViewsById.set(viewId, view); + _allIdsByView.set(view, viewId); + for (var i = 0; i < view.elementRefs.length; i++) { + var el = view.elementRefs[i]; + _setElementId(this._renderer.getNativeElementSync(el), [viewId, i]); + } + }, + viewDestroyed: function(view) { + var viewId = _allIdsByView.get(view); + MapWrapper.delete(_allIdsByView, view); + MapWrapper.delete(_allViewsById, viewId); + } + }, {})); + $__export("DebugElementViewListener", DebugElementViewListener); + $__export("DebugElementViewListener", DebugElementViewListener = __decorate([Injectable(), __metadata('design:paramtypes', [Renderer])], DebugElementViewListener)); + ELEMENT_PROBE_CONFIG = [DebugElementViewListener, bind(AppViewListener).toAlias(DebugElementViewListener)]; + $__export("ELEMENT_PROBE_CONFIG", ELEMENT_PROBE_CONFIG); + } + }; +}); + +System.register("angular2/src/web-workers/shared/api", ["angular2/src/facade/lang", "angular2/di"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/web-workers/shared/api"; + var CONST_EXPR, + OpaqueToken, + ON_WEBWORKER, + WorkerElementRef; + return { + setters: [function($__m) { + CONST_EXPR = $__m.CONST_EXPR; + }, function($__m) { + OpaqueToken = $__m.OpaqueToken; + }], + execute: function() { + ON_WEBWORKER = CONST_EXPR(new OpaqueToken('WebWorker.onWebWorker')); + $__export("ON_WEBWORKER", ON_WEBWORKER); + WorkerElementRef = (function() { + function WorkerElementRef(renderView, renderBoundElementIndex) { + this.renderView = renderView; + this.renderBoundElementIndex = renderBoundElementIndex; + } + return ($traceurRuntime.createClass)(WorkerElementRef, {}, {}); + }()); + $__export("WorkerElementRef", WorkerElementRef); + } + }; +}); + +System.register("angular2/src/web-workers/shared/render_proto_view_ref_store", ["angular2/di", "angular2/src/render/api", "angular2/src/web-workers/shared/api"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/web-workers/shared/render_proto_view_ref_store"; + var __decorate, + __metadata, + __param, + Injectable, + Inject, + RenderProtoViewRef, + ON_WEBWORKER, + RenderProtoViewRefStore, + WebworkerRenderProtoViewRef; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + Inject = $__m.Inject; + }, function($__m) { + RenderProtoViewRef = $__m.RenderProtoViewRef; + }, function($__m) { + ON_WEBWORKER = $__m.ON_WEBWORKER; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + RenderProtoViewRefStore = (($traceurRuntime.createClass)(function(onWebworker) { + this._lookupByIndex = new Map(); + this._lookupByProtoView = new Map(); + this._nextIndex = 0; + this._onWebworker = onWebworker; + }, { + storeRenderProtoViewRef: function(ref) { + if (this._lookupByProtoView.has(ref)) { + return this._lookupByProtoView.get(ref); + } else { + this._lookupByIndex.set(this._nextIndex, ref); + this._lookupByProtoView.set(ref, this._nextIndex); + return this._nextIndex++; + } + }, + retreiveRenderProtoViewRef: function(index) { + return this._lookupByIndex.get(index); + }, + deserialize: function(index) { + if (index == null) { + return null; + } + if (this._onWebworker) { + return new WebworkerRenderProtoViewRef(index); + } else { + return this.retreiveRenderProtoViewRef(index); + } + }, + serialize: function(ref) { + if (ref == null) { + return null; + } + if (this._onWebworker) { + return ref.refNumber; + } else { + return this.storeRenderProtoViewRef(ref); + } + } + }, {})); + $__export("RenderProtoViewRefStore", RenderProtoViewRefStore); + $__export("RenderProtoViewRefStore", RenderProtoViewRefStore = __decorate([Injectable(), __param(0, Inject(ON_WEBWORKER)), __metadata('design:paramtypes', [Object])], RenderProtoViewRefStore)); + WebworkerRenderProtoViewRef = (function($__super) { + function WebworkerRenderProtoViewRef(refNumber) { + $traceurRuntime.superConstructor(WebworkerRenderProtoViewRef).call(this); + this.refNumber = refNumber; + } + return ($traceurRuntime.createClass)(WebworkerRenderProtoViewRef, {}, {}, $__super); + }(RenderProtoViewRef)); + $__export("WebworkerRenderProtoViewRef", WebworkerRenderProtoViewRef); + } + }; +}); + +System.register("angular2/src/web-workers/shared/render_view_with_fragments_store", ["angular2/di", "angular2/src/render/api", "angular2/src/web-workers/shared/api", "angular2/src/facade/collection"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/web-workers/shared/render_view_with_fragments_store"; + var __decorate, + __metadata, + __param, + Injectable, + Inject, + RenderViewRef, + RenderFragmentRef, + RenderViewWithFragments, + ON_WEBWORKER, + ListWrapper, + RenderViewWithFragmentsStore, + WorkerRenderViewRef, + WorkerRenderFragmentRef; + return { + setters: [function($__m) { + Injectable = $__m.Injectable; + Inject = $__m.Inject; + }, function($__m) { + RenderViewRef = $__m.RenderViewRef; + RenderFragmentRef = $__m.RenderFragmentRef; + RenderViewWithFragments = $__m.RenderViewWithFragments; + }, function($__m) { + ON_WEBWORKER = $__m.ON_WEBWORKER; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + RenderViewWithFragmentsStore = (($traceurRuntime.createClass)(function(onWebWorker) { + this._nextIndex = 0; + this._onWebWorker = onWebWorker; + if (!onWebWorker) { + this._lookupByIndex = new Map(); + this._lookupByView = new Map(); + } + }, { + allocate: function(fragmentCount) { + var viewRef = new WorkerRenderViewRef(this._nextIndex++); + var fragmentRefs = ListWrapper.createGrowableSize(fragmentCount); + for (var i = 0; i < fragmentCount; i++) { + fragmentRefs[i] = new WorkerRenderFragmentRef(this._nextIndex++); + } + return new RenderViewWithFragments(viewRef, fragmentRefs); + }, + store: function(view, startIndex) { + var $__0 = this; + this._lookupByIndex.set(startIndex, view.viewRef); + this._lookupByView.set(view.viewRef, startIndex); + startIndex++; + ListWrapper.forEach(view.fragmentRefs, (function(ref) { + $__0._lookupByIndex.set(startIndex, ref); + $__0._lookupByView.set(ref, startIndex); + startIndex++; + })); + }, + retreive: function(ref) { + if (ref == null) { + return null; + } + return this._lookupByIndex.get(ref); + }, + serializeRenderViewRef: function(viewRef) { + return this._serializeRenderFragmentOrViewRef(viewRef); + }, + serializeRenderFragmentRef: function(fragmentRef) { + return this._serializeRenderFragmentOrViewRef(fragmentRef); + }, + deserializeRenderViewRef: function(ref) { + if (ref == null) { + return null; + } + if (this._onWebWorker) { + return WorkerRenderViewRef.deserialize(ref); + } else { + return this.retreive(ref); + } + }, + deserializeRenderFragmentRef: function(ref) { + if (ref == null) { + return null; + } + if (this._onWebWorker) { + return WorkerRenderFragmentRef.deserialize(ref); + } else { + return this.retreive(ref); + } + }, + _serializeRenderFragmentOrViewRef: function(ref) { + if (ref == null) { + return null; + } + if (this._onWebWorker) { + return ref.serialize(); + } else { + return this._lookupByView.get(ref); + } + }, + serializeViewWithFragments: function(view) { + var $__0 = this; + if (view == null) { + return null; + } + if (this._onWebWorker) { + return { + 'viewRef': view.viewRef.serialize(), + 'fragmentRefs': ListWrapper.map(view.fragmentRefs, (function(val) { + return val.serialize(); + })) + }; + } else { + return { + 'viewRef': this._lookupByView.get(view.viewRef), + 'fragmentRefs': ListWrapper.map(view.fragmentRefs, (function(val) { + return $__0._lookupByView.get(val); + })) + }; + } + }, + deserializeViewWithFragments: function(obj) { + var $__0 = this; + if (obj == null) { + return null; + } + var viewRef; + var fragments; + if (this._onWebWorker) { + viewRef = WorkerRenderViewRef.deserialize(obj['viewRef']); + fragments = ListWrapper.map(obj['fragmentRefs'], (function(val) { + return WorkerRenderFragmentRef.deserialize(val); + })); + return new RenderViewWithFragments(viewRef, fragments); + } else { + viewRef = this.retreive(obj['viewRef']); + fragments = ListWrapper.map(obj['fragmentRefs'], (function(val) { + return $__0.retreive(val); + })); + return new RenderViewWithFragments(viewRef, fragments); + } + } + }, {})); + $__export("RenderViewWithFragmentsStore", RenderViewWithFragmentsStore); + $__export("RenderViewWithFragmentsStore", RenderViewWithFragmentsStore = __decorate([Injectable(), __param(0, Inject(ON_WEBWORKER)), __metadata('design:paramtypes', [Object])], RenderViewWithFragmentsStore)); + WorkerRenderViewRef = (function($__super) { + function WorkerRenderViewRef(refNumber) { + $traceurRuntime.superConstructor(WorkerRenderViewRef).call(this); + this.refNumber = refNumber; + } + return ($traceurRuntime.createClass)(WorkerRenderViewRef, {serialize: function() { + return this.refNumber; + }}, {deserialize: function(ref) { + return new WorkerRenderViewRef(ref); + }}, $__super); + }(RenderViewRef)); + $__export("WorkerRenderViewRef", WorkerRenderViewRef); + WorkerRenderFragmentRef = (function($__super) { + function WorkerRenderFragmentRef(refNumber) { + $traceurRuntime.superConstructor(WorkerRenderFragmentRef).call(this); + this.refNumber = refNumber; + } + return ($traceurRuntime.createClass)(WorkerRenderFragmentRef, {serialize: function() { + return this.refNumber; + }}, {deserialize: function(ref) { + return new WorkerRenderFragmentRef(ref); + }}, $__super); + }(RenderFragmentRef)); + $__export("WorkerRenderFragmentRef", WorkerRenderFragmentRef); + } + }; +}); + +System.register("angular2/debug", ["angular2/src/debug/debug_element", "angular2/src/debug/debug_element_view_listener"], function($__export) { + "use strict"; + var __moduleName = "angular2/debug"; + var $__exportNames = {undefined: true}; + return { + setters: [function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + $__export("inspectNativeElement", $__m.inspectNativeElement); + $__export("ELEMENT_PROBE_CONFIG", $__m.ELEMENT_PROBE_CONFIG); + }], + execute: function() {} + }; +}); + +System.register("angular2/src/web-workers/shared/serializer", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/render/api", "angular2/src/web-workers/shared/api", "angular2/src/change_detection/change_detection", "angular2/src/change_detection/parser/parser", "angular2/di", "angular2/src/web-workers/shared/render_proto_view_ref_store", "angular2/src/web-workers/shared/render_view_with_fragments_store"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/web-workers/shared/serializer"; + var __decorate, + __metadata, + isArray, + isPresent, + serializeEnum, + deserializeEnum, + List, + ListWrapper, + Map, + StringMapWrapper, + MapWrapper, + ProtoViewDto, + DirectiveMetadata, + ElementBinder, + DirectiveBinder, + ElementPropertyBinding, + EventBinding, + ViewDefinition, + RenderProtoViewRef, + RenderProtoViewMergeMapping, + RenderViewRef, + RenderFragmentRef, + ViewType, + WorkerElementRef, + ASTWithSource, + Parser, + Injectable, + RenderProtoViewRefStore, + RenderViewWithFragmentsStore, + Serializer; + return { + setters: [function($__m) { + isArray = $__m.isArray; + isPresent = $__m.isPresent; + serializeEnum = $__m.serializeEnum; + deserializeEnum = $__m.deserializeEnum; + }, function($__m) { + List = $__m.List; + ListWrapper = $__m.ListWrapper; + Map = $__m.Map; + StringMapWrapper = $__m.StringMapWrapper; + MapWrapper = $__m.MapWrapper; + }, function($__m) { + ProtoViewDto = $__m.ProtoViewDto; + DirectiveMetadata = $__m.DirectiveMetadata; + ElementBinder = $__m.ElementBinder; + DirectiveBinder = $__m.DirectiveBinder; + ElementPropertyBinding = $__m.ElementPropertyBinding; + EventBinding = $__m.EventBinding; + ViewDefinition = $__m.ViewDefinition; + RenderProtoViewRef = $__m.RenderProtoViewRef; + RenderProtoViewMergeMapping = $__m.RenderProtoViewMergeMapping; + RenderViewRef = $__m.RenderViewRef; + RenderFragmentRef = $__m.RenderFragmentRef; + ViewType = $__m.ViewType; + }, function($__m) { + WorkerElementRef = $__m.WorkerElementRef; + }, function($__m) { + ASTWithSource = $__m.ASTWithSource; + }, function($__m) { + Parser = $__m.Parser; + }, function($__m) { + Injectable = $__m.Injectable; + }, function($__m) { + RenderProtoViewRefStore = $__m.RenderProtoViewRefStore; + }, function($__m) { + RenderViewWithFragmentsStore = $__m.RenderViewWithFragmentsStore; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + Serializer = (($traceurRuntime.createClass)(function(_parser, _protoViewStore, _renderViewStore) { + this._parser = _parser; + this._protoViewStore = _protoViewStore; + this._renderViewStore = _renderViewStore; + this._enumRegistry = new Map(); + var viewTypeMap = new Map(); + viewTypeMap[0] = ViewType.HOST; + viewTypeMap[1] = ViewType.COMPONENT; + viewTypeMap[2] = ViewType.EMBEDDED; + this._enumRegistry.set(ViewType, viewTypeMap); + }, { + serialize: function(obj, type) { + var $__0 = this; + if (!isPresent(obj)) { + return null; + } + if (isArray(obj)) { + var serializedObj = []; + ListWrapper.forEach(obj, (function(val) { + serializedObj.push($__0.serialize(val, type)); + })); + return serializedObj; + } + if (type == String) { + return obj; + } + if (type == ViewDefinition) { + return this._serializeViewDefinition(obj); + } else if (type == DirectiveBinder) { + return this._serializeDirectiveBinder(obj); + } else if (type == ProtoViewDto) { + return this._serializeProtoViewDto(obj); + } else if (type == ElementBinder) { + return this._serializeElementBinder(obj); + } else if (type == DirectiveMetadata) { + return this._serializeDirectiveMetadata(obj); + } else if (type == ASTWithSource) { + return this._serializeASTWithSource(obj); + } else if (type == RenderProtoViewRef) { + return this._protoViewStore.serialize(obj); + } else if (type == RenderProtoViewMergeMapping) { + return this._serializeRenderProtoViewMergeMapping(obj); + } else if (type == RenderViewRef) { + return this._renderViewStore.serializeRenderViewRef(obj); + } else if (type == RenderFragmentRef) { + return this._renderViewStore.serializeRenderFragmentRef(obj); + } else if (type == WorkerElementRef) { + return this._serializeWorkerElementRef(obj); + } else { + throw "No serializer for " + type.toString(); + } + }, + deserialize: function(map, type, data) { + var $__0 = this; + if (!isPresent(map)) { + return null; + } + if (isArray(map)) { + var obj = new List(); + ListWrapper.forEach(map, (function(val) { + obj.push($__0.deserialize(val, type, data)); + })); + return obj; + } + if (type == String) { + return map; + } + if (type == ViewDefinition) { + return this._deserializeViewDefinition(map); + } else if (type == DirectiveBinder) { + return this._deserializeDirectiveBinder(map); + } else if (type == ProtoViewDto) { + return this._deserializeProtoViewDto(map); + } else if (type == DirectiveMetadata) { + return this._deserializeDirectiveMetadata(map); + } else if (type == ElementBinder) { + return this._deserializeElementBinder(map); + } else if (type == ASTWithSource) { + return this._deserializeASTWithSource(map, data); + } else if (type == RenderProtoViewRef) { + return this._protoViewStore.deserialize(map); + } else if (type == RenderProtoViewMergeMapping) { + return this._deserializeRenderProtoViewMergeMapping(map); + } else if (type == RenderViewRef) { + return this._renderViewStore.deserializeRenderViewRef(map); + } else if (type == RenderFragmentRef) { + return this._renderViewStore.deserializeRenderFragmentRef(map); + } else if (type == WorkerElementRef) { + return this._deserializeWorkerElementRef(map); + } else { + throw "No deserializer for " + type.toString(); + } + }, + mapToObject: function(map, type) { + var $__0 = this; + var object = {}; + var serialize = isPresent(type); + MapWrapper.forEach(map, (function(value, key) { + if (serialize) { + object[key] = $__0.serialize(value, type); + } else { + object[key] = value; + } + })); + return object; + }, + objectToMap: function(obj, type, data) { + var $__0 = this; + if (isPresent(type)) { + var map = new Map(); + StringMapWrapper.forEach(obj, (function(key, val) { + map.set(key, $__0.deserialize(val, type, data)); + })); + return map; + } else { + return MapWrapper.createFromStringMap(obj); + } + }, + allocateRenderViews: function(fragmentCount) { + this._renderViewStore.allocate(fragmentCount); + }, + _serializeWorkerElementRef: function(elementRef) { + return { + 'renderView': this.serialize(elementRef.renderView, RenderViewRef), + 'renderBoundElementIndex': elementRef.renderBoundElementIndex + }; + }, + _deserializeWorkerElementRef: function(map) { + return new WorkerElementRef(this.deserialize(map['renderView'], RenderViewRef), map['renderBoundElementIndex']); + }, + _serializeRenderProtoViewMergeMapping: function(mapping) { + return { + 'mergedProtoViewRef': this._protoViewStore.serialize(mapping.mergedProtoViewRef), + 'fragmentCount': mapping.fragmentCount, + 'mappedElementIndices': mapping.mappedElementIndices, + 'mappedElementCount': mapping.mappedElementCount, + 'mappedTextIndices': mapping.mappedTextIndices, + 'hostElementIndicesByViewIndex': mapping.hostElementIndicesByViewIndex, + 'nestedViewCountByViewIndex': mapping.nestedViewCountByViewIndex + }; + }, + _deserializeRenderProtoViewMergeMapping: function(obj) { + return new RenderProtoViewMergeMapping(this._protoViewStore.deserialize(obj['mergedProtoViewRef']), obj['fragmentCount'], obj['mappedElementIndices'], obj['mappedElementCount'], obj['mappedTextIndices'], obj['hostElementIndicesByViewIndex'], obj['nestedViewCountByViewIndex']); + }, + _serializeASTWithSource: function(tree) { + return { + 'input': tree.source, + 'location': tree.location + }; + }, + _deserializeASTWithSource: function(obj, data) { + var ast; + switch (data) { + case "interpolation": + ast = this._parser.parseInterpolation(obj['input'], obj['location']); + break; + case "binding": + ast = this._parser.parseBinding(obj['input'], obj['location']); + break; + case "simpleBinding": + ast = this._parser.parseSimpleBinding(obj['input'], obj['location']); + break; + case "interpolation": + ast = this._parser.parseInterpolation(obj['input'], obj['location']); + break; + default: + throw "No AST deserializer for " + data; + } + return ast; + }, + _serializeViewDefinition: function(view) { + return { + 'componentId': view.componentId, + 'templateAbsUrl': view.templateAbsUrl, + 'template': view.template, + 'directives': this.serialize(view.directives, DirectiveMetadata), + 'styleAbsUrls': view.styleAbsUrls, + 'styles': view.styles, + 'encapsulation': view.encapsulation + }; + }, + _deserializeViewDefinition: function(obj) { + return new ViewDefinition({ + componentId: obj['componentId'], + templateAbsUrl: obj['templateAbsUrl'], + template: obj['template'], + directives: this.deserialize(obj['directives'], DirectiveMetadata), + styleAbsUrls: obj['styleAbsUrls'], + styles: obj['styles'], + encapsulation: obj['encapsulation'] + }); + }, + _serializeDirectiveBinder: function(binder) { + return { + 'directiveIndex': binder.directiveIndex, + 'propertyBindings': this.mapToObject(binder.propertyBindings, ASTWithSource), + 'eventBindings': this.serialize(binder.eventBindings, EventBinding), + 'hostPropertyBindings': this.serialize(binder.hostPropertyBindings, ElementPropertyBinding) + }; + }, + _deserializeDirectiveBinder: function(obj) { + return new DirectiveBinder({ + directiveIndex: obj['directiveIndex'], + propertyBindings: this.objectToMap(obj['propertyBindings'], ASTWithSource, "binding"), + eventBindings: this.deserialize(obj['eventBindings'], EventBinding), + hostPropertyBindings: this.deserialize(obj['hostPropertyBindings'], ElementPropertyBinding) + }); + }, + _serializeElementBinder: function(binder) { + return { + 'index': binder.index, + 'parentIndex': binder.parentIndex, + 'distanceToParent': binder.distanceToParent, + 'directives': this.serialize(binder.directives, DirectiveBinder), + 'nestedProtoView': this.serialize(binder.nestedProtoView, ProtoViewDto), + 'propertyBindings': this.serialize(binder.propertyBindings, ElementPropertyBinding), + 'variableBindings': this.mapToObject(binder.variableBindings), + 'eventBindings': this.serialize(binder.eventBindings, EventBinding), + 'readAttributes': this.mapToObject(binder.readAttributes) + }; + }, + _deserializeElementBinder: function(obj) { + return new ElementBinder({ + index: obj['index'], + parentIndex: obj['parentIndex'], + distanceToParent: obj['distanceToParent'], + directives: this.deserialize(obj['directives'], DirectiveBinder), + nestedProtoView: this.deserialize(obj['nestedProtoView'], ProtoViewDto), + propertyBindings: this.deserialize(obj['propertyBindings'], ElementPropertyBinding), + variableBindings: this.objectToMap(obj['variableBindings']), + eventBindings: this.deserialize(obj['eventBindings'], EventBinding), + readAttributes: this.objectToMap(obj['readAttributes']) + }); + }, + _serializeProtoViewDto: function(view) { + return { + 'render': this._protoViewStore.serialize(view.render), + 'elementBinders': this.serialize(view.elementBinders, ElementBinder), + 'variableBindings': this.mapToObject(view.variableBindings), + 'type': serializeEnum(view.type), + 'textBindings': this.serialize(view.textBindings, ASTWithSource), + 'transitiveNgContentCount': view.transitiveNgContentCount + }; + }, + _deserializeProtoViewDto: function(obj) { + return new ProtoViewDto({ + render: this._protoViewStore.deserialize(obj["render"]), + elementBinders: this.deserialize(obj['elementBinders'], ElementBinder), + variableBindings: this.objectToMap(obj['variableBindings']), + textBindings: this.deserialize(obj['textBindings'], ASTWithSource, "interpolation"), + type: deserializeEnum(obj['type'], this._enumRegistry.get(ViewType)), + transitiveNgContentCount: obj['transitivengContentCount'] + }); + }, + _serializeDirectiveMetadata: function(meta) { + var obj = { + 'id': meta.id, + 'selector': meta.selector, + 'compileChildren': meta.compileChildren, + 'events': meta.events, + 'properties': meta.properties, + 'readAttributes': meta.readAttributes, + 'type': meta.type, + 'callOnDestroy': meta.callOnDestroy, + 'callOnChange': meta.callOnChange, + 'callOnCheck': meta.callOnCheck, + 'callOnInit': meta.callOnInit, + 'callOnAllChangesDone': meta.callOnAllChangesDone, + 'changeDetection': meta.changeDetection, + 'exportAs': meta.exportAs, + 'hostProperties': this.mapToObject(meta.hostProperties), + 'hostListeners': this.mapToObject(meta.hostListeners), + 'hostActions': this.mapToObject(meta.hostActions), + 'hostAttributes': this.mapToObject(meta.hostAttributes) + }; + return obj; + }, + _deserializeDirectiveMetadata: function(obj) { + return new DirectiveMetadata({ + id: obj['id'], + selector: obj['selector'], + compileChildren: obj['compileChildren'], + hostProperties: this.objectToMap(obj['hostProperties']), + hostListeners: this.objectToMap(obj['hostListeners']), + hostActions: this.objectToMap(obj['hostActions']), + hostAttributes: this.objectToMap(obj['hostAttributes']), + properties: obj['properties'], + readAttributes: obj['readAttributes'], + type: obj['type'], + exportAs: obj['exportAs'], + callOnDestroy: obj['callOnDestroy'], + callOnChange: obj['callOnChange'], + callOnCheck: obj['callOnCheck'], + callOnInit: obj['callOnInit'], + callOnAllChangesDone: obj['callOnAllChangesDone'], + changeDetection: obj['changeDetection'], + events: obj['events'] + }); + } + }, {})); + $__export("Serializer", Serializer); + $__export("Serializer", Serializer = __decorate([Injectable(), __metadata('design:paramtypes', [Parser, RenderProtoViewRefStore, RenderViewWithFragmentsStore])], Serializer)); + } + }; +}); + +System.register("angular2/src/test_lib/test_component_builder", ["angular2/di", "angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/test_lib/utils", "angular2/src/render/render", "angular2/src/dom/dom_adapter", "angular2/src/debug/debug_element"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/test_lib/test_component_builder"; + var __decorate, + __metadata, + Injector, + Injectable, + isPresent, + MapWrapper, + ViewResolver, + internalView, + DynamicComponentLoader, + el, + DOCUMENT_TOKEN, + DOM, + DebugElement, + RootTestComponent, + _nextRootElementId, + TestComponentBuilder; + return { + setters: [function($__m) { + Injector = $__m.Injector; + Injectable = $__m.Injectable; + }, function($__m) { + isPresent = $__m.isPresent; + }, function($__m) { + MapWrapper = $__m.MapWrapper; + }, function($__m) { + ViewResolver = $__m.ViewResolver; + }, function($__m) { + internalView = $__m.internalView; + }, function($__m) { + DynamicComponentLoader = $__m.DynamicComponentLoader; + }, function($__m) { + el = $__m.el; + }, function($__m) { + DOCUMENT_TOKEN = $__m.DOCUMENT_TOKEN; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + DebugElement = $__m.DebugElement; + }], + execute: function() { + __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + RootTestComponent = (function($__super) { + function RootTestComponent(componentRef) { + $traceurRuntime.superConstructor(RootTestComponent).call(this, internalView(componentRef.hostView), 0); + this._componentParentView = internalView(componentRef.hostView); + this._componentRef = componentRef; + } + return ($traceurRuntime.createClass)(RootTestComponent, { + detectChanges: function() { + this._componentParentView.changeDetector.detectChanges(); + this._componentParentView.changeDetector.checkNoChanges(); + }, + destroy: function() { + this._componentRef.dispose(); + } + }, {}, $__super); + }(DebugElement)); + $__export("RootTestComponent", RootTestComponent); + _nextRootElementId = 0; + TestComponentBuilder = (($traceurRuntime.createClass)(function(injector) { + this._injector = injector; + this._viewOverrides = new Map(); + this._directiveOverrides = new Map(); + this._templateOverrides = new Map(); + }, { + _clone: function() { + var clone = new TestComponentBuilder(this._injector); + clone._viewOverrides = MapWrapper.clone(this._viewOverrides); + clone._directiveOverrides = MapWrapper.clone(this._directiveOverrides); + clone._templateOverrides = MapWrapper.clone(this._templateOverrides); + return clone; + }, + overrideTemplate: function(componentType, template) { + var clone = this._clone(); + clone._templateOverrides.set(componentType, template); + return clone; + }, + overrideView: function(componentType, view) { + var clone = this._clone(); + clone._viewOverrides.set(componentType, view); + return clone; + }, + overrideDirective: function(componentType, from, to) { + var clone = this._clone(); + var overridesForComponent = clone._directiveOverrides.get(componentType); + if (!isPresent(overridesForComponent)) { + clone._directiveOverrides.set(componentType, new Map()); + overridesForComponent = clone._directiveOverrides.get(componentType); + } + overridesForComponent.set(from, to); + return clone; + }, + createAsync: function(rootComponentType) { + var mockViewResolver = this._injector.get(ViewResolver); + MapWrapper.forEach(this._viewOverrides, (function(view, type) { + mockViewResolver.setView(type, view); + })); + MapWrapper.forEach(this._templateOverrides, (function(template, type) { + mockViewResolver.setInlineTemplate(type, template); + })); + MapWrapper.forEach(this._directiveOverrides, (function(overrides, component) { + MapWrapper.forEach(overrides, (function(to, from) { + mockViewResolver.overrideViewDirective(component, from, to); + })); + })); + var rootElId = ("root" + _nextRootElementId++); + var rootEl = el(("
")); + var doc = this._injector.get(DOCUMENT_TOKEN); + DOM.appendChild(doc.body, rootEl); + return this._injector.get(DynamicComponentLoader).loadAsRoot(rootComponentType, ("#" + rootElId), this._injector).then((function(componentRef) { + return new RootTestComponent(componentRef); + })); + } + }, {})); + $__export("TestComponentBuilder", TestComponentBuilder); + $__export("TestComponentBuilder", TestComponentBuilder = __decorate([Injectable(), __metadata('design:paramtypes', [Injector])], TestComponentBuilder)); + } + }; +}); + +System.register("angular2/src/test_lib/test_injector", ["angular2/di", "angular2/src/core/compiler/compiler", "angular2/src/reflection/reflection", "angular2/src/change_detection/change_detection", "angular2/src/core/exception_handler", "angular2/src/render/dom/compiler/view_loader", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/render/xhr", "angular2/src/core/compiler/component_url_mapper", "angular2/src/services/url_resolver", "angular2/src/services/app_root_url", "angular2/src/services/anchor_based_app_root_url", "angular2/src/render/dom/compiler/style_url_resolver", "angular2/src/render/dom/compiler/style_inliner", "angular2/src/core/zone/ng_zone", "angular2/src/dom/dom_adapter", "angular2/src/render/dom/events/event_manager", "angular2/src/mock/view_resolver_mock", "angular2/src/render/xhr_mock", "angular2/src/mock/mock_location_strategy", "angular2/src/router/location_strategy", "angular2/src/mock/ng_zone_mock", "angular2/src/test_lib/test_component_builder", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_manager_utils", "angular2/debug", "angular2/src/core/compiler/proto_view_factory", "angular2/src/render/api", "angular2/src/render/render", "angular2/src/web-workers/shared/serializer", "angular2/src/test_lib/utils"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/test_lib/test_injector"; + var bind, + Compiler, + CompilerCache, + Reflector, + reflector, + Parser, + Lexer, + ChangeDetection, + DynamicChangeDetection, + Pipes, + defaultPipes, + ExceptionHandler, + ViewLoader, + ViewResolver, + DirectiveResolver, + DynamicComponentLoader, + XHR, + ComponentUrlMapper, + UrlResolver, + AppRootUrl, + AnchorBasedAppRootUrl, + StyleUrlResolver, + StyleInliner, + NgZone, + DOM, + EventManager, + DomEventsPlugin, + MockViewResolver, + MockXHR, + MockLocationStrategy, + LocationStrategy, + MockNgZone, + TestComponentBuilder, + Injector, + ListWrapper, + FunctionWrapper, + AppViewPool, + APP_VIEW_POOL_CAPACITY, + AppViewManager, + AppViewManagerUtils, + ELEMENT_PROBE_CONFIG, + ProtoViewFactory, + RenderCompiler, + Renderer, + DomRenderer, + DOCUMENT_TOKEN, + DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES, + DefaultDomCompiler, + APP_ID_TOKEN, + SharedStylesHost, + DomSharedStylesHost, + Serializer, + Log, + FunctionWithParamTokens; + function _getRootBindings() { + return [bind(Reflector).toValue(reflector)]; + } + function _getAppBindings() { + var appDoc; + try { + appDoc = DOM.createHtmlDocument(); + } catch (e) { + appDoc = null; + } + return [bind(DOCUMENT_TOKEN).toValue(appDoc), DomRenderer, bind(Renderer).toAlias(DomRenderer), bind(APP_ID_TOKEN).toValue('a'), DefaultDomCompiler, bind(RenderCompiler).toAlias(DefaultDomCompiler), DomSharedStylesHost, bind(SharedStylesHost).toAlias(DomSharedStylesHost), bind(DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES).toValue(false), ProtoViewFactory, AppViewPool, AppViewManager, AppViewManagerUtils, Serializer, ELEMENT_PROBE_CONFIG, bind(APP_VIEW_POOL_CAPACITY).toValue(500), Compiler, CompilerCache, bind(ViewResolver).toClass(MockViewResolver), bind(Pipes).toValue(defaultPipes), Log, bind(ChangeDetection).toClass(DynamicChangeDetection), ViewLoader, DynamicComponentLoader, DirectiveResolver, Parser, Lexer, bind(ExceptionHandler).toValue(new ExceptionHandler(DOM)), bind(LocationStrategy).toClass(MockLocationStrategy), bind(XHR).toClass(MockXHR), ComponentUrlMapper, UrlResolver, AnchorBasedAppRootUrl, bind(AppRootUrl).toAlias(AnchorBasedAppRootUrl), StyleUrlResolver, StyleInliner, TestComponentBuilder, bind(NgZone).toClass(MockNgZone), bind(EventManager).toFactory((function(zone) { + var plugins = [new DomEventsPlugin()]; + return new EventManager(plugins, zone); + }), [NgZone])]; + } + function createTestInjector(bindings) { + var rootInjector = Injector.resolveAndCreate(_getRootBindings()); + return rootInjector.resolveAndCreateChild(ListWrapper.concat(_getAppBindings(), bindings)); + } + function inject(tokens, fn) { + return new FunctionWithParamTokens(tokens, fn); + } + $__export("createTestInjector", createTestInjector); + $__export("inject", inject); + return { + setters: [function($__m) { + bind = $__m.bind; + Injector = $__m.Injector; + }, function($__m) { + Compiler = $__m.Compiler; + CompilerCache = $__m.CompilerCache; + }, function($__m) { + Reflector = $__m.Reflector; + reflector = $__m.reflector; + }, function($__m) { + Parser = $__m.Parser; + Lexer = $__m.Lexer; + ChangeDetection = $__m.ChangeDetection; + DynamicChangeDetection = $__m.DynamicChangeDetection; + Pipes = $__m.Pipes; + defaultPipes = $__m.defaultPipes; + }, function($__m) { + ExceptionHandler = $__m.ExceptionHandler; + }, function($__m) { + ViewLoader = $__m.ViewLoader; + }, function($__m) { + ViewResolver = $__m.ViewResolver; + }, function($__m) { + DirectiveResolver = $__m.DirectiveResolver; + }, function($__m) { + DynamicComponentLoader = $__m.DynamicComponentLoader; + }, function($__m) { + XHR = $__m.XHR; + }, function($__m) { + ComponentUrlMapper = $__m.ComponentUrlMapper; + }, function($__m) { + UrlResolver = $__m.UrlResolver; + }, function($__m) { + AppRootUrl = $__m.AppRootUrl; + }, function($__m) { + AnchorBasedAppRootUrl = $__m.AnchorBasedAppRootUrl; + }, function($__m) { + StyleUrlResolver = $__m.StyleUrlResolver; + }, function($__m) { + StyleInliner = $__m.StyleInliner; + }, function($__m) { + NgZone = $__m.NgZone; + }, function($__m) { + DOM = $__m.DOM; + }, function($__m) { + EventManager = $__m.EventManager; + DomEventsPlugin = $__m.DomEventsPlugin; + }, function($__m) { + MockViewResolver = $__m.MockViewResolver; + }, function($__m) { + MockXHR = $__m.MockXHR; + }, function($__m) { + MockLocationStrategy = $__m.MockLocationStrategy; + }, function($__m) { + LocationStrategy = $__m.LocationStrategy; + }, function($__m) { + MockNgZone = $__m.MockNgZone; + }, function($__m) { + TestComponentBuilder = $__m.TestComponentBuilder; + }, function($__m) { + ListWrapper = $__m.ListWrapper; + }, function($__m) { + FunctionWrapper = $__m.FunctionWrapper; + }, function($__m) { + AppViewPool = $__m.AppViewPool; + APP_VIEW_POOL_CAPACITY = $__m.APP_VIEW_POOL_CAPACITY; + }, function($__m) { + AppViewManager = $__m.AppViewManager; + }, function($__m) { + AppViewManagerUtils = $__m.AppViewManagerUtils; + }, function($__m) { + ELEMENT_PROBE_CONFIG = $__m.ELEMENT_PROBE_CONFIG; + }, function($__m) { + ProtoViewFactory = $__m.ProtoViewFactory; + }, function($__m) { + RenderCompiler = $__m.RenderCompiler; + Renderer = $__m.Renderer; + }, function($__m) { + DomRenderer = $__m.DomRenderer; + DOCUMENT_TOKEN = $__m.DOCUMENT_TOKEN; + DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES = $__m.DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES; + DefaultDomCompiler = $__m.DefaultDomCompiler; + APP_ID_TOKEN = $__m.APP_ID_TOKEN; + SharedStylesHost = $__m.SharedStylesHost; + DomSharedStylesHost = $__m.DomSharedStylesHost; + }, function($__m) { + Serializer = $__m.Serializer; + }, function($__m) { + Log = $__m.Log; + }], + execute: function() { + FunctionWithParamTokens = (function() { + function FunctionWithParamTokens(tokens, fn) { + this._tokens = tokens; + this._fn = fn; + } + return ($traceurRuntime.createClass)(FunctionWithParamTokens, {execute: function(injector) { + var params = ListWrapper.map(this._tokens, (function(t) { + return injector.get(t); + })); + return FunctionWrapper.apply(this._fn, params); + }}, {}); + }()); + $__export("FunctionWithParamTokens", FunctionWithParamTokens); + } + }; +}); + +System.register("angular2/src/test_lib/test_lib", ["angular2/src/dom/dom_adapter", "angular2/src/facade/collection", "angular2/src/facade/lang", "angular2/di", "angular2/src/core/exception_handler", "angular2/src/test_lib/test_injector"], function($__export) { + "use strict"; + var __moduleName = "angular2/src/test_lib/test_lib"; + var DOM, + StringMapWrapper, + global, + bind, + ExceptionHandler, + createTestInjector, + FunctionWithParamTokens, + inject, + _global, + afterEach, + expect, + IS_DARTIUM, + AsyncTestCompleter, + jsmBeforeEach, + jsmDescribe, + jsmDDescribe, + jsmXDescribe, + jsmIt, + jsmIIt, + jsmXIt, + runnerStack, + inIt, + testBindings, + BeforeEachRunner, + SpyObject; + function proxy() {} + function _describe(jsmFn) { + for (var args = [], + $__1 = 1; $__1 < arguments.length; $__1++) + args[$__1 - 1] = arguments[$__1]; + var parentRunner = runnerStack.length === 0 ? null : runnerStack[runnerStack.length - 1]; + var runner = new BeforeEachRunner(parentRunner); + runnerStack.push(runner); + var suite = jsmFn.apply((void 0), $traceurRuntime.spread(args)); + runnerStack.pop(); + return suite; + } + function describe() { + for (var args = [], + $__2 = 0; $__2 < arguments.length; $__2++) + args[$__2] = arguments[$__2]; + return _describe.apply((void 0), $traceurRuntime.spread([jsmDescribe], args)); + } + function ddescribe() { + for (var args = [], + $__3 = 0; $__3 < arguments.length; $__3++) + args[$__3] = arguments[$__3]; + return _describe.apply((void 0), $traceurRuntime.spread([jsmDDescribe], args)); + } + function xdescribe() { + for (var args = [], + $__4 = 0; $__4 < arguments.length; $__4++) + args[$__4] = arguments[$__4]; + return _describe.apply((void 0), $traceurRuntime.spread([jsmXDescribe], args)); + } + function beforeEach(fn) { + if (runnerStack.length > 0) { + var runner = runnerStack[runnerStack.length - 1]; + if (!(fn instanceof FunctionWithParamTokens)) { + fn = inject([], fn); + } + runner.beforeEach(fn); + } else { + jsmBeforeEach(fn); + } + } + function beforeEachBindings(fn) { + jsmBeforeEach((function() { + var bindings = fn(); + if (!bindings) + return ; + testBindings = $traceurRuntime.spread(testBindings, bindings); + })); + } + function _it(jsmFn, name, fn, timeOut) { + var runner = runnerStack[runnerStack.length - 1]; + jsmFn(name, function(done) { + var async = false; + var completerBinding = bind(AsyncTestCompleter).toFactory((function() { + if (!inIt) + throw new Error('AsyncTestCompleter can only be injected in an "it()"'); + async = true; + return new AsyncTestCompleter(done); + })); + var injector = createTestInjector($traceurRuntime.spread(testBindings, [completerBinding])); + runner.run(injector); + if (!(fn instanceof FunctionWithParamTokens)) { + fn = inject([], fn); + } + inIt = true; + fn.execute(injector); + inIt = false; + if (!async) + done(); + }, timeOut); + } + function it(name, fn) { + var timeOut = arguments[2] !== (void 0) ? arguments[2] : null; + return _it(jsmIt, name, fn, timeOut); + } + function xit(name, fn) { + var timeOut = arguments[2] !== (void 0) ? arguments[2] : null; + return _it(jsmXIt, name, fn, timeOut); + } + function iit(name, fn) { + var timeOut = arguments[2] !== (void 0) ? arguments[2] : null; + return _it(jsmIIt, name, fn, timeOut); + } + function elementText(n) { + var hasNodes = (function(n) { + var children = DOM.childNodes(n); + return children && children.length > 0; + }); + if (n instanceof Array) { + return n.map((function(nn) { + return elementText(nn); + })).join(""); + } + if (DOM.isCommentNode(n)) { + return ''; + } + if (DOM.isElementNode(n) && DOM.tagName(n) == 'CONTENT') { + return elementText(Array.prototype.slice.apply(DOM.getDistributedNodes(n))); + } + if (DOM.hasShadowRoot(n)) { + return elementText(DOM.childNodesAsList(DOM.getShadowRoot(n))); + } + if (hasNodes(n)) { + return elementText(DOM.childNodesAsList(n)); + } + return DOM.getText(n); + } + function isInInnerZone() { + return global.zone._innerZone === true; + } + $__export("proxy", proxy); + $__export("describe", describe); + $__export("ddescribe", ddescribe); + $__export("xdescribe", xdescribe); + $__export("beforeEach", beforeEach); + $__export("beforeEachBindings", beforeEachBindings); + $__export("it", it); + $__export("xit", xit); + $__export("iit", iit); + $__export("isInInnerZone", isInInnerZone); + return { + setters: [function($__m) { + DOM = $__m.DOM; + }, function($__m) { + StringMapWrapper = $__m.StringMapWrapper; + }, function($__m) { + global = $__m.global; + }, function($__m) { + bind = $__m.bind; + }, function($__m) { + ExceptionHandler = $__m.ExceptionHandler; + }, function($__m) { + createTestInjector = $__m.createTestInjector; + FunctionWithParamTokens = $__m.FunctionWithParamTokens; + inject = $__m.inject; + $__export("inject", $__m.inject); + }], + execute: function() { + _global = (typeof window === 'undefined' ? global : window); + afterEach = _global.afterEach; + $__export("afterEach", afterEach); + expect = _global.expect; + $__export("expect", expect); + IS_DARTIUM = false; + $__export("IS_DARTIUM", IS_DARTIUM); + AsyncTestCompleter = (function() { + function AsyncTestCompleter(done) { + this._done = done; + } + return ($traceurRuntime.createClass)(AsyncTestCompleter, {done: function() { + this._done(); + }}, {}); + }()); + $__export("AsyncTestCompleter", AsyncTestCompleter); + jsmBeforeEach = _global.beforeEach; + jsmDescribe = _global.describe; + jsmDDescribe = _global.fdescribe; + jsmXDescribe = _global.xdescribe; + jsmIt = _global.it; + jsmIIt = _global.fit; + jsmXIt = _global.xit; + runnerStack = []; + inIt = false; + BeforeEachRunner = (function() { + function BeforeEachRunner(parent) { + this._fns = []; + this._parent = parent; + } + return ($traceurRuntime.createClass)(BeforeEachRunner, { + beforeEach: function(fn) { + this._fns.push(fn); + }, + run: function(injector) { + if (this._parent) + this._parent.run(injector); + this._fns.forEach((function(fn) { + return fn.execute(injector); + })); + } + }, {}); + }()); + jsmBeforeEach((function() { + testBindings = []; + })); + Map.prototype['jasmineToString'] = function() { + var m = this; + if (!m) { + return '' + m; + } + var res = []; + m.forEach((function(v, k) { + res.push((k + ":" + v)); + })); + return ("{ " + res.join(',') + " }"); + }; + _global.beforeEach(function() { + jasmine.addMatchers({ + toEqual: function(util, customEqualityTesters) { + return {compare: function(actual, expected) { + return {pass: util.equals(actual, expected, [compareMap])}; + }}; + function compareMap(actual, expected) { + if (actual instanceof Map) { + var pass = actual.size === expected.size; + if (pass) { + actual.forEach((function(v, k) { + pass = pass && util.equals(v, expected.get(k)); + })); + } + return pass; + } else { + return undefined; + } + } + }, + toBePromise: function() { + return {compare: function(actual, expectedClass) { + var pass = typeof actual === 'object' && typeof actual.then === 'function'; + return { + pass: pass, + get message() { + return 'Expected ' + actual + ' to be a promise'; + } + }; + }}; + }, + toBeAnInstanceOf: function() { + return {compare: function(actual, expectedClass) { + var pass = typeof actual === 'object' && actual instanceof expectedClass; + return { + pass: pass, + get message() { + return 'Expected ' + actual + ' to be an instance of ' + expectedClass; + } + }; + }}; + }, + toHaveText: function() { + return {compare: function(actual, expectedText) { + var actualText = elementText(actual); + return { + pass: actualText == expectedText, + get message() { + return 'Expected ' + actualText + ' to be equal to ' + expectedText; + } + }; + }}; + }, + toContainError: function() { + return {compare: function(actual, expectedText) { + var errorMessage = ExceptionHandler.exceptionToString(actual); + return { + pass: errorMessage.indexOf(expectedText) > -1, + get message() { + return 'Expected ' + errorMessage + ' to contain ' + expectedText; + } + }; + }}; + }, + toThrowErrorWith: function() { + return {compare: function(actual, expectedText) { + try { + actual(); + return { + pass: false, + get message() { + return "Was expected to throw, but did not throw"; + } + }; + } catch (e) { + var errorMessage = ExceptionHandler.exceptionToString(e); + return { + pass: errorMessage.indexOf(expectedText) > -1, + get message() { + return 'Expected ' + errorMessage + ' to contain ' + expectedText; + } + }; + } + }}; + }, + toImplement: function() { + return {compare: function(actualObject, expectedInterface) { + var objProps = Object.keys(actualObject.constructor.prototype); + var intProps = Object.keys(expectedInterface.prototype); + var missedMethods = []; + intProps.forEach((function(k) { + if (!actualObject.constructor.prototype[k]) + missedMethods.push(k); + })); + return { + pass: missedMethods.length == 0, + get message() { + return 'Expected ' + actualObject + ' to have the following methods: ' + missedMethods.join(", "); + } + }; + }}; + } + }); + }); + SpyObject = (function() { + function SpyObject() { + var type = arguments[0] !== (void 0) ? arguments[0] : null; + if (type) { + for (var prop in type.prototype) { + var m = null; + try { + m = type.prototype[prop]; + } catch (e) {} + if (typeof m === 'function') { + this.spy(prop); + } + } + } + } + return ($traceurRuntime.createClass)(SpyObject, { + noSuchMethod: function(args) {}, + spy: function(name) { + if (!this[name]) { + this[name] = this._createGuinnessCompatibleSpy(name); + } + return this[name]; + }, + rttsAssert: function(value) { + return true; + }, + _createGuinnessCompatibleSpy: function(name) { + var newSpy = jasmine.createSpy(name); + newSpy.andCallFake = newSpy.and.callFake; + newSpy.andReturn = newSpy.and.returnValue; + newSpy.reset = newSpy.calls.reset; + newSpy.and.returnValue(null); + return newSpy; + } + }, {stub: function() { + var object = arguments[0] !== (void 0) ? arguments[0] : null; + var config = arguments[1] !== (void 0) ? arguments[1] : null; + var overrides = arguments[2] !== (void 0) ? arguments[2] : null; + if (!(object instanceof SpyObject)) { + overrides = config; + config = object; + object = new SpyObject(); + } + var m = StringMapWrapper.merge(config, overrides); + StringMapWrapper.forEach(m, (function(value, key) { + object.spy(key).andReturn(value); + })); + return object; + }}); + }()); + $__export("SpyObject", SpyObject); + } + }; +}); + +System.register("angular2/test", ["angular2/src/test_lib/test_lib", "angular2/src/test_lib/test_component_builder", "angular2/src/test_lib/test_injector", "angular2/debug"], function($__export) { + "use strict"; + var __moduleName = "angular2/test"; + var $__exportNames = {}; + var $__exportNames = {}; + var $__exportNames = {}; + var $__exportNames = {}; + return { + setters: [function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }, function($__m) { + Object.keys($__m).forEach(function(p) { + if (!$__exportNames[p]) + $__export(p, $__m[p]); + }); + }], + execute: function() {} + }; +}); + +//# sourceMappingURL=test_lib.dev.js.map \ No newline at end of file diff --git a/2.0.0-alpha.33/test_lib.dev.js.map b/2.0.0-alpha.33/test_lib.dev.js.map new file mode 100644 index 0000000000..b63080a7d2 --- /dev/null +++ b/2.0.0-alpha.33/test_lib.dev.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../dev/es6/angular2/src/router/location_strategy.js","../dev/es6/angular2/src/render/xhr_mock.js","../dev/es6/angular2/src/mock/mock_location_strategy.js","../dev/es6/angular2/src/mock/view_resolver_mock.js","../dev/es6/angular2/mock.js","../dev/es6/angular2/src/mock/ng_zone_mock.js","../dev/es6/angular2/src/test_lib/utils.js","../dev/es6/angular2/src/debug/debug_element.js","../dev/es6/angular2/src/debug/debug_element_view_listener.js","../dev/es6/angular2/src/web-workers/shared/api.js","../dev/es6/angular2/src/web-workers/shared/render_proto_view_ref_store.js","../dev/es6/angular2/src/web-workers/shared/render_view_with_fragments_store.js","../dev/es6/angular2/debug.js","../dev/es6/angular2/src/web-workers/shared/serializer.js","../dev/es6/angular2/src/test_lib/test_component_builder.js","../dev/es6/angular2/src/test_lib/test_injector.js","../dev/es6/angular2/src/test_lib/test_lib.js","../dev/es6/angular2/test.js"],"names":[],"mappings":";AAAA,KAAK,SAAS,AAAC,uEACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,0CAAoB,CAAC;;;AACpC,SAAS,UAAQ,CAAC,AAAC,CAAE;AACjB,SAAO,IAAI,cAAY,AAAC,CAAC,yBAAwB,CAAC,CAAC;EACvD;AAHA,AAGA,OAHO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AAAf,oBAAoB,KAAG,cAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;AAFZ,yBAAA,SAAQ,AAAC;AAIF,eAAM,iBAAe,KAO5B;AATU,aAAO,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC;AAG1C,aAAG,CAAH,UAAI,AAAC,CAAE;AAAE,gBAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;UAAE;AAC5B,kBAAQ,CAAR,UAAU,GAAE,CAAG,CAAA,KAAI,CAAG,CAAA,GAAE,CAAG;AAAE,gBAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;UAAE;AAChD,gBAAM,CAAN,UAAO,AAAC,CAAE;AAAE,gBAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;UAAE;AAC/B,aAAG,CAAH,UAAI,AAAC,CAAE;AAAE,gBAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;UAAE;AAC5B,mBAAS,CAAT,UAAW,EAAC,CAAG;AAAE,gBAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;UAAE;AACpC,oBAAU,CAAV,UAAW,AAAC,CAAE;AAAE,gBAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;UAAE;AAAA,aAPyB,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;AAApC,cAAQ,AAAC,sCAAqC,CAAA;IAEf;EAC3B,CAAA;AAAM,CAAC,CAAC;AASgC;ACZ5C,KAAK,SAAS,AAAC,wJACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,iCAAoB,CAAC;;;;;;;;;;;AAApC,OAAO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AAAf,UAAoB,KAAG,IAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,kBAAoB,KAAG,YAAkB,CAAC;AAA1C,UAAoB,KAAG,IAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,cAAoB,KAAG,QAAkB,CAAC;AAA1C,qBAAoB,KAAG,eAAkB,CAAC;AAA1C,oBAAoB,KAAG,cAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,qBAAoB,KAAG,eAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;AAFZ,gBAAA,SAAS,QAAO;AAIT,eAAM,QAAM,CACJ,AAAC,CAAE;AALlB,AAMQ,wBANM,iBAAiB,AAAC,SAAkB,KAAK,MAAmB,CAM3D;AACP,aAAG,cAAc,EAAI,GAAC,CAAC;AACvB,aAAG,aAAa,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AAC7B,aAAG,UAAU,EAAI,GAAC,CAAC;QACvB;AARM,AAwDV,aAxDiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC;AAS1C,YAAE,CAAF,UAAI,GAAE,CAAG;AACL,AAAI,cAAA,CAAA,OAAM,EAAI,IAAI,gBAAc,AAAC,CAAC,GAAE,CAAC,CAAC;AACtC,eAAG,UAAU,KAAK,AAAC,CAAC,OAAM,CAAC,CAAC;AAC5B,iBAAO,CAAA,OAAM,WAAW,AAAC,EAAC,CAAC;UAC/B;AACA,eAAK,CAAL,UAAO,GAAE,CAAG,CAAA,QAAO,CAAG;AAClB,AAAI,cAAA,CAAA,WAAU,EAAI,IAAI,aAAW,AAAC,CAAC,GAAE,CAAG,SAAO,CAAC,CAAC;AACjD,eAAG,cAAc,KAAK,AAAC,CAAC,WAAU,CAAC,CAAC;UACxC;AACA,aAAG,CAAH,UAAK,GAAE,CAAG,CAAA,QAAO,CAAG;AAAE,eAAG,aAAa,IAAI,AAAC,CAAC,GAAE,CAAG,SAAO,CAAC,CAAC;UAAE;AAC5D,cAAI,CAAJ,UAAK,AAAC,CAAE;AACJ,eAAI,IAAG,UAAU,OAAO,IAAM,EAAA,CAAG;AAC7B,kBAAM,IAAI,cAAY,AAAC,CAAC,8BAA6B,CAAC,CAAC;YAC3D;AAAA,AACA,aAAG;AACC,AAAI,gBAAA,CAAA,OAAM,EAAI,CAAA,WAAU,SAAS,AAAC,CAAC,IAAG,UAAU,CAAG,EAAA,CAAC,CAAC;AACrD,iBAAG,gBAAgB,AAAC,CAAC,OAAM,CAAC,CAAC;YACjC,QAAS,IAAG,UAAU,OAAO,EAAI,EAAA,EAAE;AACnC,eAAG,+BAA+B,AAAC,EAAC,CAAC;UACzC;AACA,uCAA6B,CAA7B,UAA8B,AAAC,CAAE;AAC7B,eAAI,IAAG,cAAc,OAAO,IAAM,EAAA;AAC9B,qBAAM;AAAA,AACN,cAAA,CAAA,IAAG,EAAI,GAAC,CAAC;AACb,gBAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,IAAG,cAAc,OAAO,CAAG,CAAA,CAAA,EAAE,CAAG;AAChD,AAAI,gBAAA,CAAA,WAAU,EAAI,CAAA,IAAG,cAAc,CAAE,CAAA,CAAC,CAAC;AACvC,iBAAG,KAAK,AAAC,CAAC,WAAU,IAAI,CAAC,CAAC;YAC9B;AAAA,AACA,gBAAM,IAAI,cAAY,AAAC,EAAC,wBAAwB,EAAC,CAAA,WAAU,KAAK,AAAC,CAAC,IAAG,CAAG,KAAG,CAAC,EAAG,CAAC;UACpF;AACA,wBAAc,CAAd,UAAgB,OAAM,CAAG;AACrB,AAAI,cAAA,CAAA,GAAE,EAAI,CAAA,OAAM,IAAI,CAAC;AACrB,eAAI,IAAG,cAAc,OAAO,EAAI,EAAA,CAAG;AAC/B,AAAI,gBAAA,CAAA,WAAU,EAAI,CAAA,IAAG,cAAc,CAAE,CAAA,CAAC,CAAC;AACvC,iBAAI,WAAU,IAAI,GAAK,IAAE,CAAG;AACxB,0BAAU,OAAO,AAAC,CAAC,IAAG,cAAc,CAAG,YAAU,CAAC,CAAC;AACnD,sBAAM,SAAS,AAAC,CAAC,WAAU,SAAS,CAAC,CAAC;AACtC,uBAAM;cACV;AAAA,YACJ;AAAA,AACA,eAAI,IAAG,aAAa,IAAI,AAAC,CAAC,GAAE,CAAC,CAAG;AAC5B,AAAI,gBAAA,CAAA,QAAO,EAAI,CAAA,IAAG,aAAa,IAAI,AAAC,CAAC,GAAE,CAAC,CAAC;AACzC,oBAAM,SAAS,AAAC,CAAC,cAAa,AAAC,CAAC,QAAO,CAAC,CAAC,CAAC;AAC1C,qBAAM;YACV;AAAA,AACA,gBAAM,IAAI,cAAY,AAAC,EAAC,qBAAqB,EAAC,IAAE,EAAG,CAAC;UACxD;AAAA,aAtD8D,SAAO,CAAC,CAAC;MACnE,AAAC,CAAoB,GAAE,CAAJ,CAJS,CAAA;AAApC,cAAQ,AAAC,oBAAqC,CAAA;AAA9C,wBAAA,SAAQ,AAAC;AA2DT,eAAM,gBAAc,CACJ,GAAE,CAAG;AACb,aAAG,IAAI,EAAI,IAAE,CAAC;AACd,aAAG,UAAU,EAAI,CAAA,cAAa,UAAU,AAAC,EAAC,CAAC;QAC/C;AA7DM,AAuEV,aAvEiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC;AA8D1C,iBAAO,CAAP,UAAS,QAAO,CAAG;AACf,eAAI,OAAM,AAAC,CAAC,QAAO,CAAC,CAAG;AACnB,iBAAG,UAAU,OAAO,AAAC,EAAC,iBAAiB,EAAC,CAAA,IAAG,IAAI,EAAK,KAAG,CAAC,CAAC;YAC7D,KACK;AACD,iBAAG,UAAU,QAAQ,AAAC,CAAC,QAAO,CAAC,CAAC;YACpC;AAAA,UACJ;AACA,mBAAS,CAAT,UAAU,AAAC,CAAE;AAAE,iBAAO,CAAA,IAAG,UAAU,QAAQ,CAAC;UAAE;AAAA,aArEc,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;AAApC,qBAAA,SAAQ,AAAC,CAAE;AA0EX,eAAM,aAAW,CACD,GAAE,CAAG,CAAA,QAAO,CAAG;AACvB,aAAG,IAAI,EAAI,IAAE,CAAC;AACd,aAAG,SAAS,EAAI,SAAO,CAAC;QAC5B;AA5EM,AA6EV,aA7EiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC,sBACkB,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;IAEL;EAC3B,CAAA;AAAM,CAAC,CAAC;AA6EuB;AChFnC,KAAK,SAAS,AAAC,oHACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,6CAAoB,CAAC;;;;;AAApC,OAAO;AACD,UAAM,GADZ,SAAS,IAAG;AAAZ,mBAAoB,KAAG,aAAkB,CAAC;AAA1C,wBAAoB,KAAG,kBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,uBAAoB,KAAG,iBAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;AAFZ,6BAAA,SAAS,QAAO;AAET,eAAM,qBAAmB,CACjB,AAAC,CAAE;AAHlB,AAIQ,wBAJM,iBAAiB,AAAC,sBAAkB,KAAK,MAAmB,CAI3D;AACP,aAAG,iBAAiB,EAAI,IAAE,CAAC;AAC3B,aAAG,aAAa,EAAI,IAAE,CAAC;AACvB,aAAG,cAAc,EAAI,GAAC,CAAC;AACvB,aAAG,WAAW,EAAI,GAAC,CAAC;AACpB,aAAG,SAAS,EAAI,IAAI,aAAW,AAAC,EAAC,CAAC;QACtC;AARM,AAwBV,aAxBiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC;AAS1C,yBAAe,CAAf,UAAiB,GAAE,CAAG;AAClB,eAAG,aAAa,EAAI,IAAE,CAAC;AACvB,4BAAgB,SAAS,AAAC,CAAC,IAAG,SAAS,CAAG,KAAG,CAAC,CAAC;UACnD;AACA,aAAG,CAAH,UAAI,AAAC,CAAE;AAAE,iBAAO,CAAA,IAAG,aAAa,CAAC;UAAE;AACnC,uBAAa,CAAb,UAAe,QAAO,CAAG;AACrB,4BAAgB,SAAS,AAAC,CAAC,IAAG,SAAS,CAAG,EAAE,KAAI,CAAG,SAAO,CAAE,CAAC,CAAC;UAClE;AACA,kBAAQ,CAAR,UAAU,GAAE,CAAG,CAAA,KAAI,CAAG,CAAA,GAAE,CAAG;AACvB,eAAG,cAAc,EAAI,MAAI,CAAC;AAC1B,eAAG,aAAa,EAAI,IAAE,CAAC;AACvB,eAAG,WAAW,KAAK,AAAC,CAAC,GAAE,CAAC,CAAC;UAC7B;AACA,mBAAS,CAAT,UAAW,EAAC,CAAG;AAAE,4BAAgB,UAAU,AAAC,CAAC,IAAG,SAAS,CAAG,GAAC,CAAC,CAAC;UAAE;AACjE,oBAAU,CAAV,UAAW,AAAC,CAAE;AAAE,iBAAO,CAAA,IAAG,iBAAiB,CAAC;UAAE;AAAA,aAtBgB,SAAO,CAAC,CAAC;MACnE,AAAC,CAFiC,gBAAe,CAE9B,CAJS,CAAA;AAApC,cAAQ,AAAC,8CAAqC,CAAA;IAEf;EAC3B,CAAA;AAAM,CAAC,CAAC;AAwBqC;AC3BjD,KAAK,SAAS,AAAC,+LACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,yCAAoB,CAAC;;;;;;;;;;;AAApC,OAAO;AACD,UAAM,GADZ,SAAS,IAAG;AAAZ,UAAoB,KAAG,IAAkB,CAAC;AAA1C,iBAAoB,KAAG,WAAkB,CAAC;AAA1C,kBAAoB,KAAG,YAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,gBAAoB,KAAG,UAAkB,CAAC;AAA1C,oBAAoB,KAAG,cAAkB,CAAC;AAA1C,gBAAoB,KAAG,UAAkB,CAAC;AAA1C,cAAoB,KAAG,QAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,WAAoB,KAAG,KAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,mBAAoB,KAAG,aAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;AAFZ,yBAAA,SAAS,QAAO;AAIT,eAAM,iBAAe,CACb,AAAC,CAAE;AALlB,AAMQ,wBANM,iBAAiB,AAAC,kBAAkB,KAAK,MAAmB,CAM3D;AACP,aAAG,OAAO,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AACvB,aAAG,iBAAiB,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AACjC,aAAG,WAAW,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AAC3B,aAAG,oBAAoB,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;QACxC;AATM,AAmGV,aAnGiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC;AAgB1C,gBAAM,CAAN,UAAQ,SAAQ,CAAG,CAAA,IAAG,CAAG;AACrB,eAAG,mBAAmB,AAAC,CAAC,SAAQ,CAAC,CAAC;AAClC,eAAG,OAAO,IAAI,AAAC,CAAC,SAAQ,CAAG,KAAG,CAAC,CAAC;UACpC;AAOA,0BAAgB,CAAhB,UAAkB,SAAQ,CAAG,CAAA,QAAO,CAAG;AACnC,eAAG,mBAAmB,AAAC,CAAC,SAAQ,CAAC,CAAC;AAClC,eAAG,iBAAiB,IAAI,AAAC,CAAC,SAAQ,CAAG,SAAO,CAAC,CAAC;UAClD;AAQA,8BAAoB,CAApB,UAAsB,SAAQ,CAAG,CAAA,IAAG,CAAG,CAAA,EAAC,CAAG;AACvC,eAAG,mBAAmB,AAAC,CAAC,SAAQ,CAAC,CAAC;AAClC,AAAI,cAAA,CAAA,SAAQ,EAAI,CAAA,IAAG,oBAAoB,IAAI,AAAC,CAAC,SAAQ,CAAC,CAAC;AACvD,eAAI,OAAM,AAAC,CAAC,SAAQ,CAAC,CAAG;AACpB,sBAAQ,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AACrB,iBAAG,oBAAoB,IAAI,AAAC,CAAC,SAAQ,CAAG,UAAQ,CAAC,CAAC;YACtD;AAAA,AACA,oBAAQ,IAAI,AAAC,CAAC,IAAG,CAAG,GAAC,CAAC,CAAC;UAC3B;AAYA,gBAAM,CAAN,UAAQ,SAAQ;AACZ,AAAI,cAAA,CAAA,IAAG,EAAI,CAAA,IAAG,WAAW,IAAI,AAAC,CAAC,SAAQ,CAAC,CAAC;AACzC,eAAI,SAAQ,AAAC,CAAC,IAAG,CAAC;AACd,mBAAO,KAAG,CAAC;AAAA,AACf,eAAG,EAAI,CAAA,IAAG,OAAO,IAAI,AAAC,CAAC,SAAQ,CAAC,CAAC;AACjC,eAAI,OAAM,AAAC,CAAC,IAAG,CAAC,CAAG;AACf,iBAAG,EAjEf,CAAA,eAAc,SAAS,AAAC,6CAAwD,KAA3D,MAiEY,UAAQ,CAjED,AAiEE,CAAC;YACnC;AAAA,AACI,cAAA,CAAA,UAAS,EAAI,CAAA,IAAG,WAAW,CAAC;AAChC,AAAI,cAAA,CAAA,SAAQ,EAAI,CAAA,IAAG,oBAAoB,IAAI,AAAC,CAAC,SAAQ,CAAC,CAAC;AACvD,eAAI,SAAQ,AAAC,CAAC,SAAQ,CAAC,CAAA,EAAK,CAAA,SAAQ,AAAC,CAAC,UAAS,CAAC,CAAG;AAC/C,uBAAS,EAAI,CAAA,WAAU,MAAM,AAAC,CAAC,IAAG,WAAW,CAAC,CAAC;AAC/C,uBAAS,QAAQ,AAAC,CAAC,SAAQ,GAAG,SAAC,EAAC,CAAG,CAAA,IAAG,CAAM;AACxC,AAAI,kBAAA,CAAA,QAAO,EAAI,CAAA,UAAS,QAAQ,AAAC,CAAC,IAAG,CAAC,CAAC;AACvC,mBAAI,QAAO,GAAK,EAAC,CAAA,CAAG;AAChB,sBAAM,IAAI,cAAY,AAAC,EAAC,sBAAsB,EAAC,CAAA,SAAQ,AAAC,CAAC,IAAG,CAAC,CAAA,CAAC,iCAAgC,EAAC,CAAA,SAAQ,AAAC,CAAC,SAAQ,CAAC,EAAG,CAAC;gBAC1H;AAAA,AACA,yBAAS,CAAE,QAAO,CAAC,EAAI,GAAC,CAAC;cAC7B,EAAC,CAAC;AACF,iBAAG,EAAI,IAAI,KAAG,AAAC,CAAC;AAAE,uBAAO,CAAG,CAAA,IAAG,SAAS;AAAG,0BAAU,CAAG,CAAA,IAAG,YAAY;AAAG,yBAAS,CAAG,WAAS;AAAA,cAAE,CAAC,CAAC;YACvG;AAAA,AACI,cAAA,CAAA,cAAa,EAAI,CAAA,IAAG,iBAAiB,IAAI,AAAC,CAAC,SAAQ,CAAC,CAAC;AACzD,eAAI,SAAQ,AAAC,CAAC,cAAa,CAAC,CAAG;AAC3B,iBAAG,EAAI,IAAI,KAAG,AAAC,CAAC;AAAE,uBAAO,CAAG,eAAa;AAAG,0BAAU,CAAG,KAAG;AAAG,yBAAS,CAAG,CAAA,IAAG,WAAW;AAAA,cAAE,CAAC,CAAC;YACjG;AAAA,AACA,eAAG,WAAW,IAAI,AAAC,CAAC,SAAQ,CAAG,KAAG,CAAC,CAAC;AACpC,iBAAO,KAAG,CAAC;UACf;AASA,2BAAiB,CAAjB,UAAmB,SAAQ,CAAG;AAC1B,AAAI,cAAA,CAAA,MAAK,EAAI,CAAA,IAAG,WAAW,IAAI,AAAC,CAAC,SAAQ,CAAC,CAAC;AAC3C,eAAI,SAAQ,AAAC,CAAC,MAAK,CAAC,CAAG;AACnB,kBAAM,IAAI,cAAY,AAAC,EAAC,gBAAgB,EAAC,CAAA,SAAQ,AAAC,CAAC,SAAQ,CAAC,CAAA,CAAC,mEAAiE,EAAC,CAAC;YACpI;AAAA,UACJ;AAAA,aAjG8D,SAAO,CAAC,CAAC;MACnE,AAAC,CAA6B,YAAW,CAAtB,CAJS,CAAA;AAApC,cAAQ,AAAC,sCAAqC,CAAA;IAEf;EAC3B,CAAA;AAAM,CAAC,CAAC;AAmGiC;ACtG7C,KAAK,SAAS,AAAC,gLACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,kBAAoB,CAAC;AAC1B,AAAI,IAAA,CAAA,cAAa,oBAAoB,CAAC;AADhD,OAAO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AACL,WAAK,KAAK,AAAC,CAAC,IAAG,CAAC,QAAQ,AAAC,CAAC,SAAS,CAAA,CAAG;AACpC,WAAI,CAAC,cAAa,CAAE,CAAA,CAAC;AACnB,kBAAQ,AAAC,CAAC,CAAA,CAAG,CAAA,IAAG,CAAE,CAAA,CAAC,CAAC,CAAC;AAAA,MACzB,CAAC,CAAC;IAFJ,CAFR,UAAS,IAAG,CAAG;AAAf,cAAQ,AAAC,oBAAoB,KAAG,kBAAmB,CAAC;IAE5C,CAFR,UAAS,IAAG,CAAG;AAAf,cAAQ,AAAC,oBAAoB,KAAG,kBAAmB,CAAC;IAE5C,CAFR,UAAS,IAAG,CAAG;AAAf,cAAQ,AAAC,WAAoB,KAAG,SAAmB,CAAC;IAE5C,CADuB;AACzB,UAAM,eAAmB;EAC3B,CAAA;AAAM,CAAC,CAAC;AACmB;ACJ/B,KAAK,SAAS,AAAC,sEACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,mCAAoB,CAAC;;;AAApC,OAAO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AAAf,aAAoB,KAAG,OAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;AAFZ,mBAAA,SAAS,QAAO;AACT,eAAM,WAAS,CACP,AAAC,CAAE;AAFlB,AAGQ,wBAHM,iBAAiB,AAAC,YAAkB,KAAK,MAGzC,EAAE,oBAAmB,CAAG,MAAI,CAAE,CAH8B,CAG5B;QAC1C;AAFM,AAKV,aALiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC;AAG1C,YAAE,CAAF,UAAI,EAAC,CAAG;AAAE,iBAAO,CAAA,EAAC,AAAC,EAAC,CAAC;UAAE;AACvB,0BAAgB,CAAhB,UAAkB,EAAC,CAAG;AAAE,iBAAO,CAAA,EAAC,AAAC,EAAC,CAAC;UAAE;AAAA,aAHyB,SAAO,CAAC,CAAC;MACnE,AAAC,CAHuB,MAAK,CAGV,CAJS,CAAA;AAApC,cAAQ,AAAC,0BAAqC,CAAA;IAEf;EAC3B,CAAA;AAAM,CAAC,CAAC;AAK2B;ACRvC,KAAK,SAAS,AAAC,+HACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,gCAAoB,CAAC;;;;;;;;;;;AAa7B,SAAS,cAAY,CAAE,OAAM,CAAG,CAAA,SAAQ,CAAG;AAC9C,MAAE,cAAc,AAAC,CAAC,OAAM,CAAG,CAAA,GAAE,YAAY,AAAC,CAAC,SAAQ,CAAC,CAAC,CAAC;EAC1D;AAAA,AACO,SAAS,GAAC,CAAE,IAAG,CAAG;AACrB,SAAO,CAAA,GAAE,WAAW,AAAC,CAAC,GAAE,QAAQ,AAAC,CAAC,GAAE,eAAe,AAAC,CAAC,IAAG,CAAC,CAAC,CAAC,CAAC;EAChE;AAAA,AAGO,SAAS,eAAa,CAAE,KAAI;AAC/B,SAAO,CAAA,aAAY,OAAO,AAAC,CAAC,aAAY,iBAAiB,AAAC,CAAC,KAAI,CAAG,WAAS,GAAG,SAAC,KAAI;aAAM,IAAI,EAAC,CAAA,KAAI,CAAE,CAAA,CAAC;IAAE,EAAC,CAAC,CAAC;EAC9G;AACO,SAAS,aAAW,CAAE,GAAE;AAC3B,MAAE,EAAI,CAAA,aAAY,WAAW,AAAC,CAAC,GAAE,CAAG,OAAK,CAAG,IAAE,CAAC,CAAC;AAChD,MAAE,EAAI,CAAA,aAAY,WAAW,AAAC,CAAC,GAAE,CAAG,OAAK,CAAG,IAAE,CAAC,CAAC;AAChD,MAAE,EAAI,CAAA,aAAY,WAAW,AAAC,CAAC,GAAE,CAAG,MAAI,CAAG,IAAE,CAAC,CAAC;AAC/C,MAAE,EAAI,CAAA,aAAY,iBAAiB,AAAC,CAAC,GAAE,CAAG,oBAAkB,GAAG,SAAC,KAAI;aAAM,MAAM,EAAC,CAAA,KAAI,CAAE,CAAA,CAAC,EAAC,IAAE;IAAA,EAAC,CAAC;AAC7F,MAAE,EAAI,CAAA,aAAY,iBAAiB,AAAC,CAAC,GAAE,CAAG,sBAAoB,GAAG,SAAC,KAAI;aAAM,GAAG,EAAC,CAAA,KAAI,CAAE,CAAA,CAAC,EAAC,MAAI,EAAC,CAAA,KAAI,CAAE,CAAA,CAAC,EAAC,MAAG;IAAA,EAAC,CAAC;AAC1G,SAAO,IAAE,CAAC;EACd;AAEO,SAAS,iBAAe,CAAE,EAAC;AAC9B,AAAI,MAAA,CAAA,MAAK,EAAI,GAAC,CAAC;AACf,OAAI,GAAE,cAAc,AAAC,CAAC,EAAC,CAAC,CAAG;AACvB,AAAI,QAAA,CAAA,OAAM,EAAI,CAAA,aAAY,YAAY,AAAC,CAAC,GAAE,QAAQ,AAAC,CAAC,EAAC,CAAC,CAAC,CAAC;AAExD,WAAK,KAAK,GAAG,EAAC,QAAM,CAAE,CAAC;AAEvB,AAAI,QAAA,CAAA,YAAW,EAAI,CAAA,GAAE,aAAa,AAAC,CAAC,EAAC,CAAC,CAAC;AACvC,AAAI,QAAA,CAAA,IAAG,EAAI,GAAC,CAAC;AACb,eAAS,QAAQ,AAAC,CAAC,YAAW,GAAG,SAAC,CAAA,CAAG,CAAA,CAAA,CAAM;AAAE,WAAG,KAAK,AAAC,CAAC,CAAA,CAAC,CAAC;MAAE,EAAC,CAAC;AAC7D,gBAAU,KAAK,AAAC,CAAC,IAAG,CAAC,CAAC;AACtB,iBAAa,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,IAAG,OAAO,CAAG,CAAA,CAAA,EAAE,CAAG;AAClC,AAAI,UAAA,CAAA,GAAE,EAAI,CAAA,IAAG,CAAE,CAAA,CAAC,CAAC;AACjB,AAAI,UAAA,CAAA,QAAO,EAAI,CAAA,YAAW,IAAI,AAAC,CAAC,GAAE,CAAC,CAAC;AACpC,WAAI,CAAC,QAAO,AAAC,CAAC,QAAO,CAAC,CAAG;AACrB,eAAK,KAAK,GAAG,EAAC,IAAE,CAAE,CAAC;QACvB,KACK;AACD,eAAK,KAAK,GAAG,EAAC,IAAE,EAAC,MAAI,EAAC,SAAO,EAAC,KAAE,CAAA,CAAC;QACrC;AAAA,MACJ;AAAA,AACA,WAAK,GAAK,IAAE,CAAC;AAEb,AAAI,QAAA,CAAA,QAAO,EAAI,CAAA,GAAE,WAAW,AAAC,CAAC,GAAE,kBAAkB,AAAC,CAAC,EAAC,CAAC,CAAC,CAAC;AACxD,iBAAa,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,QAAO,OAAO,CAAG,CAAA,CAAA,EAAE,CAAG;AACtC,aAAK,GAAK,CAAA,gBAAe,AAAC,CAAC,QAAO,CAAE,CAAA,CAAC,CAAC,CAAC;MAC3C;AAAA,AAEA,SAAI,CAAC,WAAU,SAAS,AAAC,CAAC,mBAAkB,CAAG,QAAM,CAAC,CAAG;AACrD,aAAK,KAAK,IAAI,EAAC,QAAM,EAAC,IAAE,CAAA,CAAC;MAC7B;AAAA,IACJ,KACK;AACD,WAAK,GAAK,CAAA,GAAE,QAAQ,AAAC,CAAC,EAAC,CAAC,CAAC;IAC7B;AAAA,AACA,SAAO,OAAK,CAAC;EACjB;AArEA,UAAQ,AAAC,gCAAqC,CAAA;AAA9C,UAAQ,AAAC,UAAqC,CAAA;AAA9C,UAAQ,AAAC,kCAAqC,CAAA;AAA9C,UAAQ,AAAC,8BAAqC,CAAA;AAA9C,UAAQ,AAAC,sCAAqC,CAAA;AAA9C,OAAO;AACD,UAAM,GADZ,SAAS,IAAG;AAAZ,kBAAoB,KAAG,YAAkB,CAAC;AAA1C,iBAAoB,KAAG,WAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,UAAoB,KAAG,IAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,eAAoB,KAAG,SAAkB,CAAC;AAA1C,oBAAoB,KAAG,cAAkB,CAAC;AAA1C,oBAAoB,KAAG,cAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;AAFZ,YAAA,SAAQ,AAAC;AAGF,eAAM,IAAE,CACA,AAAC,CAAE;AACV,aAAG,QAAQ,EAAI,GAAC,CAAC;QACrB;AAJM,AAUV,aAViB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC;AAK1C,YAAE,CAAF,UAAI,KAAI,CAAG;AAAE,eAAG,QAAQ,KAAK,AAAC,CAAC,KAAI,CAAC,CAAC;UAAE;AACvC,WAAC,CAAD,UAAG,KAAI;;AACH,mBAAO,SAAC,AAAoD,CAAM;gBAA1D,GAAC,6CAAI,KAAG;gBAAG,GAAC,6CAAI,KAAG;gBAAG,GAAC,6CAAI,KAAG;gBAAG,GAAC,6CAAI,KAAG;gBAAG,GAAC,6CAAI,KAAG;AAAQ,yBAAW,KAAK,AAAC,CAAC,KAAI,CAAC,CAAC;YAAE,EAAC;UACnG;AACA,eAAK,CAAL,UAAM,AAAC,CAAE;AAAE,iBAAO,CAAA,WAAU,KAAK,AAAC,CAAC,IAAG,QAAQ,CAAG,KAAG,CAAC,CAAC;UAAE;AAAA,aARI,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;AAApC,cAAQ,AAAC,YAAqC,CAAA;wBAmBtB,EAAC,GAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,KAAG,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAC;iBACvF,CAAA,aAAY,OAAO,AAAC,EAAC,KAAK,EAAC,CAAA,iBAAgB,KAAK,AAAC,CAAC,IAAG,CAAC,CAAA,CAAC,IAAE,EAAC;0BAYjD,EAAC,IAAG,CAAG,KAAG,CAAG,QAAM,CAAC;IA9Bf;EAC3B,CAAA;AAAM,CAAC,CAAC;AAmEoB;ACtEhC,KAAK,SAAS,AAAC,2KACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,qCAAoB,CAAC;;;;;;;;AAkH7B,SAAS,eAAa,CAAE,UAAS,CAAG;AACvC,SAAO,CAAA,YAAW,OAAO,AAAC,CAAC,UAAS,CAAC,CAAC;EAC1C;AAAA,AACO,SAAS,iBAAe,CAAE,GAAE;AAC/B,SAAO,CAAA,GAAE,IAAI,AAAC,EAAC,SAAC,OAAM;WAAM,CAAA,OAAM,cAAc;IAAA,EAAC,CAAC;EACtD;AAvHA,UAAQ,AAAC,kCAAqC,CAAA;AAA9C,UAAQ,AAAC,sCAAqC,CAAA;AAA9C,OAAO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AAAf,gBAAoB,KAAG,UAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,kBAAoB,KAAG,YAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,UAAoB,KAAG,IAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,mBAAoB,KAAG,aAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;AAFZ,qBAAA,SAAQ,AAAC;AASF,eAAM,aAAW,CACR,WAAU,CAAG,CAAA,kBAAiB,CAAG;AACzC,aAAG,YAAY,EAAI,YAAU,CAAC;AAC9B,aAAG,mBAAmB,EAAI,mBAAiB,CAAC;AAC5C,aAAG,iBAAiB,EAAI,CAAA,IAAG,YAAY,iBAAiB,CAAE,IAAG,mBAAmB,CAAC,CAAC;QACtF;AAZM,AA+GV,aA/GiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC;AAgB1C,YAAI,kBAAgB,EAAI;AACpB,eAAI,CAAC,SAAQ,AAAC,CAAC,IAAG,iBAAiB,CAAC,CAAG;AACnC,mBAAO,KAAG,CAAC;YACf;AAAA,AACA,iBAAO,CAAA,IAAG,iBAAiB,aAAa,AAAC,EAAC,CAAC;UAC/C;AACA,YAAI,cAAY,EAAI;AAAE,iBAAO,CAAA,IAAG,WAAW,cAAc,CAAC;UAAE;AAC5D,YAAI,WAAS,EAAI;AAAE,iBAAO,CAAA,IAAG,YAAY,YAAY,CAAE,IAAG,mBAAmB,CAAC,CAAC;UAAE;AACjF,6BAAmB,CAAnB,UAAqB,cAAa,CAAG;AACjC,iBAAO,CAAA,IAAG,iBAAiB,oBAAoB,AAAC,CAAC,cAAa,CAAC,CAAC;UACpE;AAMA,YAAI,SAAO,EAAI;AACX,iBAAO,CAAA,IAAG,kBAAkB,AAAC,CAAC,IAAG,YAAY,CAAG,CAAA,IAAG,mBAAmB,CAAC,CAAC;UAC5E;AAOA,YAAI,sBAAoB,EAAI;AACxB,AAAI,cAAA,CAAA,UAAS,EAAI,CAAA,IAAG,YAAY,cAAc,AAAC,CAAC,IAAG,mBAAmB,CAAC,CAAC;AACxE,eAAI,CAAC,SAAQ,AAAC,CAAC,UAAS,CAAC,CAAG;AAExB,mBAAO,GAAC,CAAC;YACb;AAAA,AACA,iBAAO,CAAA,IAAG,kBAAkB,AAAC,CAAC,UAAS,CAAG,KAAG,CAAC,CAAC;UACnD;AACA,4BAAkB,CAAlB,UAAoB,SAAQ,CAAG,CAAA,QAAO,CAAG;AACrC,eAAG,YAAY,qBAAqB,AAAC,CAAC,SAAQ,CAAG,SAAO,CAAG,CAAA,IAAG,mBAAmB,CAAC,CAAC;UACvF;AACA,qBAAW,CAAX,UAAa,IAAG,CAAG;AACf,eAAI,CAAC,SAAQ,AAAC,CAAC,IAAG,iBAAiB,CAAC,CAAG;AACnC,mBAAO,MAAI,CAAC;YAChB;AAAA,AACA,iBAAO,CAAA,IAAG,iBAAiB,aAAa,AAAC,CAAC,IAAG,CAAC,CAAC;UACnD;AACA,eAAK,CAAL,UAAO,IAAG,CAAG;AACT,eAAI,CAAC,SAAQ,AAAC,CAAC,IAAG,iBAAiB,CAAC,CAAG;AACnC,mBAAO,KAAG,CAAC;YACf;AAAA,AACA,iBAAO,CAAA,IAAG,iBAAiB,IAAI,AAAC,CAAC,IAAG,CAAC,CAAC;UAC1C;AACA,iBAAO,CAAP,UAAS,IAAG,CAAG;AAAE,iBAAO,CAAA,IAAG,YAAY,OAAO,IAAI,AAAC,CAAC,IAAG,CAAC,CAAC;UAAE;AAU3D,cAAI,CAAJ,UAAM,SAAQ,AAAmB,CAAG;cAAnB,MAAI,6CAAI,CAAA,KAAI,IAAI;AAC7B,AAAI,cAAA,CAAA,OAAM,EAAI,CAAA,IAAG,SAAS,AAAC,CAAC,SAAQ,CAAG,MAAI,CAAC,CAAC;AAC7C,iBAAO,CAAA,OAAM,OAAO,EAAI,EAAA,CAAA,CAAI,CAAA,OAAM,CAAE,CAAA,CAAC,EAAI,KAAG,CAAC;UACjD;AAUA,iBAAO,CAAP,UAAS,SAAQ,AAAmB,CAAG;cAAnB,MAAI,6CAAI,CAAA,KAAI,IAAI;AAChC,AAAI,cAAA,CAAA,eAAc,EAAI,CAAA,KAAI,AAAC,CAAC,IAAG,CAAC,CAAC;AACjC,iBAAO,CAAA,WAAU,OAAO,AAAC,CAAC,eAAc,CAAG,UAAQ,CAAC,CAAC;UACzD;AACA,0BAAgB,CAAhB,UAAkB,IAAG,CAAG,CAAA,uBAAsB;;AAC1C,AAAI,cAAA,CAAA,GAAE,EAAI,GAAC,CAAC;AACZ,AAAI,cAAA,CAAA,mBAAkB,EAAI,KAAG,CAAC;AAC9B,eAAI,SAAQ,AAAC,CAAC,uBAAsB,CAAC,CAAG;AACpC,gCAAkB,EAAI,CAAA,IAAG,MAAM,eAAe,CAAE,uBAAsB,EAAI,CAAA,IAAG,cAAc,CAAC,CAAC;YACjG;AAAA,AACA,gBAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,IAAG,MAAM,eAAe,OAAO,CAAG,GAAE,CAAA,CAAG;AACvD,AAAI,gBAAA,CAAA,MAAK,EAAI,CAAA,IAAG,MAAM,eAAe,CAAE,CAAA,CAAC,CAAC;AACzC,iBAAI,MAAK,OAAO,GAAK,oBAAkB,CAAG;AACtC,kBAAE,KAAK,AAAC,CAAC,GAAI,aAAW,AAAC,CAAC,IAAG,CAAG,CAAA,IAAG,cAAc,EAAI,EAAA,CAAC,CAAC,CAAC;AACxD,AAAI,kBAAA,CAAA,KAAI,EAAI,CAAA,IAAG,eAAe,CAAE,IAAG,cAAc,EAAI,EAAA,CAAC,CAAC;AACvD,mBAAI,SAAQ,AAAC,CAAC,KAAI,CAAC,CAAG;AAClB,4BAAU,QAAQ,AAAC,CAAC,KAAI,MAAM,GAAG,SAAC,QAAO,CAAM;AAC3C,sBAAE,EAAI,CAAA,WAAU,OAAO,AAAC,CAAC,GAAE,CAAG,CAAA,sBAAqB,AAAC,CAAC,QAAO,CAAG,KAAG,CAAC,CAAC,CAAC;kBACzE,EAAC,CAAC;gBACN;AAAA,cACJ;AAAA,YACJ;AAAA,AACA,iBAAO,IAAE,CAAC;UACd;WAjGO,MAAK,CAAZ,UAAc,UAAS,CAAG;AACtB,iBAAO,IAAI,aAAW,AAAC,CAAC,YAAW,AAAC,CAAC,UAAS,WAAW,CAAC,CAAG,CAAA,UAAS,kBAAkB,CAAC,CAAC;UAC9F,EAd4D,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;AAApC,cAAQ,AAAC,8BAAqC,CAAA;AAA9C,cAAA,SAAQ,AAAC;AAwHF,eAAM,MAAI,KAwBjB;AA9IU,aAAO,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC;AAuHnC,YAAE,CAAT,UAAW,YAAW;AAClB,AAAI,cAAA,CAAA,KAAI,EAAI,GAAC,CAAC;AACd,gBAAI,KAAK,AAAC,CAAC,YAAW,CAAC,CAAC;AACxB,sBAAU,QAAQ,AAAC,CAAC,YAAW,SAAS,GAAG,SAAC,KAAI,CAAM;AAAE,kBAAI,EAAI,CAAA,WAAU,OAAO,AAAC,CAAC,KAAI,CAAG,CAAA,KAAI,IAAI,AAAC,CAAC,KAAI,CAAC,CAAC,CAAC;YAAE,EAAC,CAAC;AAC/G,sBAAU,QAAQ,AAAC,CAAC,YAAW,sBAAsB,GAAG,SAAC,KAAI,CAAM;AAAE,kBAAI,EAAI,CAAA,WAAU,OAAO,AAAC,CAAC,KAAI,CAAG,CAAA,KAAI,IAAI,AAAC,CAAC,KAAI,CAAC,CAAC,CAAC;YAAE,EAAC,CAAC;AAC5H,iBAAO,MAAI,CAAC;UAChB;AACO,cAAI,CAAX,UAAa,YAAW;AACpB,AAAI,cAAA,CAAA,KAAI,EAAI,GAAC,CAAC;AACd,sBAAU,QAAQ,AAAC,CAAC,YAAW,SAAS,GAAG,SAAC,KAAI,CAAM;AAClD,kBAAI,KAAK,AAAC,CAAC,KAAI,CAAC,CAAC;AACjB,kBAAI,EAAI,CAAA,WAAU,OAAO,AAAC,CAAC,KAAI,CAAG,CAAA,KAAI,MAAM,AAAC,CAAC,KAAI,CAAC,CAAC,CAAC;YACzD,EAAC,CAAC;AACF,iBAAO,MAAI,CAAC;UAChB;AACO,aAAG,CAAV,UAAY,YAAW;AACnB,AAAI,cAAA,CAAA,KAAI,EAAI,GAAC,CAAC;AACd,sBAAU,QAAQ,AAAC,CAAC,YAAW,sBAAsB,GAAG,SAAC,KAAI,CAAM;AAC/D,kBAAI,KAAK,AAAC,CAAC,KAAI,CAAC,CAAC;AACjB,kBAAI,EAAI,CAAA,WAAU,OAAO,AAAC,CAAC,KAAI,CAAG,CAAA,KAAI,MAAM,AAAC,CAAC,KAAI,CAAC,CAAC,CAAC;YACzD,EAAC,CAAC;AACF,iBAAO,MAAI,CAAC;UAChB;SA5I4D,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;AAApC,cAAQ,AAAC,gBAAqC,CAAA;AAA9C,WAAA,SAAQ,AAAC;AAiJF,eAAM,GAAC,KAYd;AA3JU,aAAO,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC;AAgJnC,YAAE,CAAT,UAAU,AAAC;AAAI,mBAAO,SAAC,YAAW;mBAAM,KAAG;YAAA,EAAC;UAAE;AACvC,YAAE,CAAT,UAAW,QAAO;AACd,mBAAO,SAAC,YAAW,CAAM;AACrB,mBAAO,CAAA,SAAQ,AAAC,CAAC,YAAW,cAAc,CAAC,CAAA,CACvC,CAAA,GAAE,eAAe,AAAC,CAAC,YAAW,cAAc,CAAG,SAAO,CAAC,CAAA,CACvD,MAAI,CAAC;YACb,EAAC;UACL;AACO,kBAAQ,CAAf,UAAiB,IAAG;AAChB,mBAAO,SAAC,YAAW,CAAM;AAAE,mBAAO,CAAA,YAAW,aAAa,AAAC,CAAC,IAAG,CAAC,CAAC;YAAE,EAAC;UACxE;SAzJ4D,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;AAApC,cAAQ,AAAC,UAAqC,CAAA;IAEf;EAC3B,CAAA;AAAM,CAAC,CAAC;AA2J4B;AC9JxC,KAAK,SAAS,AAAC,4QACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,mDAAoB,CAAC;;;;;;;;;;;;;;;;;;;;;;AAyBpC,SAAS,cAAY,CAAE,OAAM,CAAG,CAAA,OAAM,CAAG;AACrC,OAAI,SAAQ,AAAC,CAAC,OAAM,CAAC,CAAG;AACpB,QAAE,QAAQ,AAAC,CAAC,OAAM,CAAG,eAAa,CAAG,CAAA,WAAU,KAAK,AAAC,CAAC,OAAM,CAAG,gBAAc,CAAC,CAAC,CAAC;IACpF;AAAA,EACJ;AAAA,AACA,SAAS,cAAY,CAAE,OAAM;AACzB,AAAI,MAAA,CAAA,IAAG,EAAI,CAAA,GAAE,QAAQ,AAAC,CAAC,OAAM,CAAG,eAAa,CAAC,CAAC;AAC/C,OAAI,SAAQ,AAAC,CAAC,IAAG,CAAC,CAAG;AACjB,WAAO,CAAA,WAAU,IAAI,AAAC,CAAC,IAAG,MAAM,AAAC,CAAC,eAAc,CAAC,GAAG,SAAC,OAAM;aAAM,CAAA,aAAY,SAAS,AAAC,CAAC,OAAM,CAAG,GAAC,CAAC;MAAA,EAAC,CAAC;IACzG,KACK;AACD,WAAO,KAAG,CAAC;IACf;AAAA,EACJ;AACO,SAAS,qBAAmB,CAAE,OAAM,CAAG;AAC1C,AAAI,MAAA,CAAA,IAAG,EAAI,CAAA,aAAY,AAAC,CAAC,OAAM,CAAC,CAAC;AACjC,OAAI,SAAQ,AAAC,CAAC,IAAG,CAAC,CAAG;AACjB,AAAI,QAAA,CAAA,IAAG,EAAI,CAAA,aAAY,IAAI,AAAC,CAAC,IAAG,CAAE,CAAA,CAAC,CAAC,CAAC;AACrC,SAAI,SAAQ,AAAC,CAAC,IAAG,CAAC,CAAG;AACjB,aAAO,IAAI,aAAW,AAAC,CAAC,IAAG,CAAG,CAAA,IAAG,CAAE,CAAA,CAAC,CAAC,CAAC;MAC1C;AAAA,IACJ;AAAA,AACA,SAAO,KAAG,CAAC;EACf;AAhDA,AAgDA,UAhDQ,AAAC,8CAAqC,CAAA;AAA9C,OAAO;AACD,UAAM,GADZ,SAAS,IAAG;AAAZ,gBAAoB,KAAG,UAAkB,CAAC;AAA1C,oBAAoB,KAAG,cAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,iBAAoB,KAAG,WAAkB,CAAC;AAA1C,UAAoB,KAAG,IAAkB,CAAC;AAA1C,kBAAoB,KAAG,YAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,iBAAoB,KAAG,WAAkB,CAAC;AAA1C,WAAoB,KAAG,KAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,sBAAoB,KAAG,gBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,UAAoB,KAAG,IAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,eAAoB,KAAG,SAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,mBAAoB,KAAG,aAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;iBAFK,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,eAAQ,SAAQ,OAAO;AACnB,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;YAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,KAAG,CAAC,CAAC;AAAA,QACzG;MACJ;iBACiB,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,MAC5G;qBAQuB,OAAK;0BACA,UAAQ;sBACd,IAAE;oBAEJ,IAAI,IAAE,AAAC,EAAC;oBACR,IAAI,IAAE,AAAC,EAAC;cACd,EAAA;iCAxBd,CAAC,eAAc,YAAY,CAAC,AAAC,CAiDS,SACtB,SAAQ,CAAG;AACnB,WAAG,UAAU,EAAI,UAAQ,CAAC;AAC1B,UAAE,aAAa,AAAC,CAAC,mBAAkB,CAAG,qBAAmB,CAAC,CAAC;MAC/D,AAeJ;AAdI,kBAAU,CAAV,UAAY,IAAG,CAAG;AACd,AAAI,YAAA,CAAA,MAAK,EAAI,CAAA,OAAM,EAAE,CAAC;AACtB,sBAAY,IAAI,AAAC,CAAC,MAAK,CAAG,KAAG,CAAC,CAAC;AAC/B,sBAAY,IAAI,AAAC,CAAC,IAAG,CAAG,OAAK,CAAC,CAAC;AAC/B,cAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,IAAG,YAAY,OAAO,CAAG,CAAA,CAAA,EAAE,CAAG;AAC9C,AAAI,cAAA,CAAA,EAAC,EAAI,CAAA,IAAG,YAAY,CAAE,CAAA,CAAC,CAAC;AAC5B,wBAAY,AAAC,CAAC,IAAG,UAAU,qBAAqB,AAAC,CAAC,EAAC,CAAC,CAAG,EAAC,MAAK,CAAG,EAAA,CAAC,CAAC,CAAC;UACvE;AAAA,QACJ;AACA,oBAAY,CAAZ,UAAc,IAAG,CAAG;AAChB,AAAI,YAAA,CAAA,MAAK,EAAI,CAAA,aAAY,IAAI,AAAC,CAAC,IAAG,CAAC,CAAC;AACpC,mBAAS,OAAO,AAAC,CAAC,aAAY,CAAG,KAAG,CAAC,CAAC;AACtC,mBAAS,OAAO,AAAC,CAAC,aAAY,CAAG,OAAK,CAAC,CAAC;QAC5C;AAAA,WAnEiF;AAArF,cAAQ,AAAC,sDAAqC,CAAA;AAA9C,AAqEA,cArEQ,AAAC,4BAqET,CAAA,wBAAuB,EAAI,CAAA,UAAS,AAAC,CAAC,CAClC,UAAS,AAAC,EAAC,CACX,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,QAAO,CAAC,CAAC,CAC9C,CAAG,yBAAuB,CAAC,CAxEmB,CAwElB;2BACM,EAC9B,wBAAuB,CACvB,CAAA,IAAG,AAAC,CAAC,eAAc,CAAC,QAAQ,AAAC,CAAC,wBAAuB,CAAC,CAC1D;AA5EA,cAAQ,AAAC,8CAAqC,CAAA;IAEf;EAC3B,CAAA;AAAM,CAAC,CAAC;AA0E0C;AC7EtD,KAAK,SAAS,AAAC,oFACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,wCAAoB,CAAC;;;;;AAApC,OAAO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AAAf,iBAAoB,KAAG,WAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,kBAAoB,KAAG,YAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;mBAAgB,CAAA,UAAS,AAAC,CAAC,GAAI,YAAU,AAAC,CAAC,uBAAsB,CAAC,CAAC;AAF/E,cAAQ,AAAC,8BAAqC,CAAA;AAA9C,yBAAA,SAAQ,AAAC,CAAE;AAGJ,eAAM,iBAAe,CACZ,UAAS,CAAG,CAAA,uBAAsB,CAAG;AAC7C,aAAG,WAAW,EAAI,WAAS,CAAC;AAC5B,aAAG,wBAAwB,EAAI,wBAAsB,CAAC;QAC1D;AALM,AAMV,aANiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC,0BACkB,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;AAApC,cAAQ,AAAC,sCAAqC,CAAA;IAEf;EAC3B,CAAA;AAAM,CAAC,CAAC;AAMkB;ACT9B,KAAK,SAAS,AAAC,kJACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,gEAAoB,CAAC;;;;;;;;;;AAApC,OAAO;AACD,UAAM,GADZ,SAAS,IAAG;AAAZ,iBAAoB,KAAG,WAAkB,CAAC;AAA1C,aAAoB,KAAG,OAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,yBAAoB,KAAG,mBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,mBAAoB,KAAG,aAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;iBAFK,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,eAAQ,SAAQ,OAAO;AACnB,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;YAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,KAAG,CAAC,CAAC;AAAA,QACzG;MACJ;iBACiB,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,MAC5G;cACc,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,QAAQ,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,SAAQ,CAAG;AACrE,aAAO,UAAU,MAAK,CAAG,CAAA,GAAE,CAAG;AAAE,kBAAQ,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,WAAS,CAAC,CAAC;QAAE,CAAA;MACxE;gCAbA,CAAC,eAAc,YAAY,CAAC,AAAC,CAiBQ,SACrB,WAAU,CAAG;AACrB,WAAG,eAAe,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AAC/B,WAAG,mBAAmB,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AACnC,WAAG,WAAW,EAAI,EAAA,CAAC;AACnB,WAAG,aAAa,EAAI,YAAU,CAAC;MACnC,AAoCJ;AAnCI,8BAAsB,CAAtB,UAAwB,GAAE,CAAG;AACzB,aAAI,IAAG,mBAAmB,IAAI,AAAC,CAAC,GAAE,CAAC,CAAG;AAClC,iBAAO,CAAA,IAAG,mBAAmB,IAAI,AAAC,CAAC,GAAE,CAAC,CAAC;UAC3C,KACK;AACD,eAAG,eAAe,IAAI,AAAC,CAAC,IAAG,WAAW,CAAG,IAAE,CAAC,CAAC;AAC7C,eAAG,mBAAmB,IAAI,AAAC,CAAC,GAAE,CAAG,CAAA,IAAG,WAAW,CAAC,CAAC;AACjD,iBAAO,CAAA,IAAG,WAAW,EAAE,CAAC;UAC5B;AAAA,QACJ;AACA,iCAAyB,CAAzB,UAA2B,KAAI,CAAG;AAC9B,eAAO,CAAA,IAAG,eAAe,IAAI,AAAC,CAAC,KAAI,CAAC,CAAC;QACzC;AACA,kBAAU,CAAV,UAAY,KAAI,CAAG;AACf,aAAI,KAAI,GAAK,KAAG,CAAG;AACf,iBAAO,KAAG,CAAC;UACf;AAAA,AACA,aAAI,IAAG,aAAa,CAAG;AACnB,iBAAO,IAAI,4BAA0B,AAAC,CAAC,KAAI,CAAC,CAAC;UACjD,KACK;AACD,iBAAO,CAAA,IAAG,2BAA2B,AAAC,CAAC,KAAI,CAAC,CAAC;UACjD;AAAA,QACJ;AACA,gBAAQ,CAAR,UAAU,GAAE,CAAG;AACX,aAAI,GAAE,GAAK,KAAG,CAAG;AACb,iBAAO,KAAG,CAAC;UACf;AAAA,AACA,aAAI,IAAG,aAAa,CAAG;AACnB,iBAAO,CAAA,GAAE,UAAU,CAAC;UACxB,KACK;AACD,iBAAO,CAAA,IAAG,wBAAwB,AAAC,CAAC,GAAE,CAAC,CAAC;UAC5C;AAAA,QACJ;AAAA,WA1DiF;AAArF,cAAQ,AAAC,oDAAqC,CAAA;AAA9C,AA4DA,cA5DQ,AAAC,2BA4DT,CAAA,uBAAsB,EAAI,CAAA,UAAS,AAAC,CAAC,CACjC,UAAS,AAAC,EAAC,CACX,CAAA,OAAM,AAAC,CAAC,CAAA,CAAG,CAAA,MAAK,AAAC,CAAC,YAAW,CAAC,CAAC,CAC/B,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,MAAK,CAAC,CAAC,CAC5C,CAAG,wBAAsB,CAAC,CAhEoB,CAgEnB;AAhE3B,oCAAA,SAAS,QAAO,CAAG;AAiEZ,eAAM,4BAA0B,CACvB,SAAQ,CAAG;AAlE3B,AAmEQ,wBAnEM,iBAAiB,AAAC,6BAAkB,KAAK,MAAmB,CAmE3D;AACP,aAAG,UAAU,EAAI,UAAQ,CAAC;QAC9B;AAnEM,AAoEV,aApEiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC,qCACoB,SAAO,CAAC,CAAC;MACnE,AAAC,CA6DwC,kBAAiB,CA7DvC,CAJS,CAAA;AAApC,cAAQ,AAAC,4DAAqC,CAAA;IAEf;EAC3B,CAAA;AAAM,CAAC,CAAC;AAoE0C;ACvEtD,KAAK,SAAS,AAAC,yLACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,qEAAoB,CAAC;;;;;;;;;;;;;;AAApC,OAAO;AACD,UAAM,GADZ,SAAS,IAAG;AAAZ,iBAAoB,KAAG,WAAkB,CAAC;AAA1C,aAAoB,KAAG,OAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,oBAAoB,KAAG,cAAkB,CAAC;AAA1C,wBAAoB,KAAG,kBAAkB,CAAC;AAA1C,8BAAoB,KAAG,wBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,mBAAoB,KAAG,aAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,kBAAoB,KAAG,YAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;iBAFK,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,eAAQ,SAAQ,OAAO;AACnB,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;YAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,KAAG,CAAC,CAAC;AAAA,QACzG;MACJ;iBACiB,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,MAC5G;cACc,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,QAAQ,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,SAAQ,CAAG;AACrE,aAAO,UAAU,MAAK,CAAG,CAAA,GAAE,CAAG;AAAE,kBAAQ,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,WAAS,CAAC,CAAC;QAAE,CAAA;MACxE;qCAbA,CAAC,eAAc,YAAY,CAAC,AAAC,CAkBa,SAC1B,WAAU,CAAG;AACrB,WAAG,WAAW,EAAI,EAAA,CAAC;AACnB,WAAG,aAAa,EAAI,YAAU,CAAC;AAC/B,WAAI,CAAC,WAAU,CAAG;AACd,aAAG,eAAe,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AAC/B,aAAG,cAAc,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;QAClC;AAAA,MACJ,AAmGJ;AAlGI,eAAO,CAAP,UAAS,aAAY,CAAG;AACpB,AAAI,YAAA,CAAA,OAAM,EAAI,IAAI,oBAAkB,AAAC,CAAC,IAAG,WAAW,EAAE,CAAC,CAAC;AACxD,AAAI,YAAA,CAAA,YAAW,EAAI,CAAA,WAAU,mBAAmB,AAAC,CAAC,aAAY,CAAC,CAAC;AAChE,cAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,EAAI,cAAY,CAAG,CAAA,CAAA,EAAE,CAAG;AACpC,uBAAW,CAAE,CAAA,CAAC,EAAI,IAAI,wBAAsB,AAAC,CAAC,IAAG,WAAW,EAAE,CAAC,CAAC;UACpE;AAAA,AACA,eAAO,IAAI,wBAAsB,AAAC,CAAC,OAAM,CAAG,aAAW,CAAC,CAAC;QAC7D;AACA,YAAI,CAAJ,UAAM,IAAG,CAAG,CAAA,UAAS;;AACjB,aAAG,eAAe,IAAI,AAAC,CAAC,UAAS,CAAG,CAAA,IAAG,QAAQ,CAAC,CAAC;AACjD,aAAG,cAAc,IAAI,AAAC,CAAC,IAAG,QAAQ,CAAG,WAAS,CAAC,CAAC;AAChD,mBAAS,EAAE,CAAC;AACZ,oBAAU,QAAQ,AAAC,CAAC,IAAG,aAAa,GAAG,SAAC,GAAE,CAAM;AAC5C,8BAAkB,IAAI,AAAC,CAAC,UAAS,CAAG,IAAE,CAAC,CAAC;AACxC,6BAAiB,IAAI,AAAC,CAAC,GAAE,CAAG,WAAS,CAAC,CAAC;AACvC,qBAAS,EAAE,CAAC;UAChB,EAAC,CAAC;QACN;AACA,eAAO,CAAP,UAAS,GAAE,CAAG;AACV,aAAI,GAAE,GAAK,KAAG,CAAG;AACb,iBAAO,KAAG,CAAC;UACf;AAAA,AACA,eAAO,CAAA,IAAG,eAAe,IAAI,AAAC,CAAC,GAAE,CAAC,CAAC;QACvC;AACA,6BAAqB,CAArB,UAAuB,OAAM,CAAG;AAC5B,eAAO,CAAA,IAAG,kCAAkC,AAAC,CAAC,OAAM,CAAC,CAAC;QAC1D;AACA,iCAAyB,CAAzB,UAA2B,WAAU,CAAG;AACpC,eAAO,CAAA,IAAG,kCAAkC,AAAC,CAAC,WAAU,CAAC,CAAC;QAC9D;AACA,+BAAuB,CAAvB,UAAyB,GAAE,CAAG;AAC1B,aAAI,GAAE,GAAK,KAAG,CAAG;AACb,iBAAO,KAAG,CAAC;UACf;AAAA,AACA,aAAI,IAAG,aAAa,CAAG;AACnB,iBAAO,CAAA,mBAAkB,YAAY,AAAC,CAAC,GAAE,CAAC,CAAC;UAC/C,KACK;AACD,iBAAO,CAAA,IAAG,SAAS,AAAC,CAAC,GAAE,CAAC,CAAC;UAC7B;AAAA,QACJ;AACA,mCAA2B,CAA3B,UAA6B,GAAE,CAAG;AAC9B,aAAI,GAAE,GAAK,KAAG,CAAG;AACb,iBAAO,KAAG,CAAC;UACf;AAAA,AACA,aAAI,IAAG,aAAa,CAAG;AACnB,iBAAO,CAAA,uBAAsB,YAAY,AAAC,CAAC,GAAE,CAAC,CAAC;UACnD,KACK;AACD,iBAAO,CAAA,IAAG,SAAS,AAAC,CAAC,GAAE,CAAC,CAAC;UAC7B;AAAA,QACJ;AACA,wCAAgC,CAAhC,UAAkC,GAAE,CAAG;AACnC,aAAI,GAAE,GAAK,KAAG,CAAG;AACb,iBAAO,KAAG,CAAC;UACf;AAAA,AACA,aAAI,IAAG,aAAa,CAAG;AACnB,iBAAO,CAAA,GAAE,UAAU,AAAC,EAAC,CAAC;UAC1B,KACK;AACD,iBAAO,CAAA,IAAG,cAAc,IAAI,AAAC,CAAC,GAAE,CAAC,CAAC;UACtC;AAAA,QACJ;AACA,iCAAyB,CAAzB,UAA2B,IAAG;;AAC1B,aAAI,IAAG,GAAK,KAAG,CAAG;AACd,iBAAO,KAAG,CAAC;UACf;AAAA,AACA,aAAI,IAAG,aAAa,CAAG;AACnB,iBAAO;AACH,sBAAQ,CAAG,CAAA,IAAG,QAAQ,UAAU,AAAC,EAAC;AAClC,2BAAa,CAAG,CAAA,WAAU,IAAI,AAAC,CAAC,IAAG,aAAa,GAAG,SAAC,GAAE;qBAAM,CAAA,GAAE,UAAU,AAAC,EAAC;cAAA,EAAC;AAAA,YAC/E,CAAC;UACL,KACK;AACD,iBAAO;AACH,sBAAQ,CAAG,CAAA,IAAG,cAAc,IAAI,AAAC,CAAC,IAAG,QAAQ,CAAC;AAC9C,2BAAa,CAAG,CAAA,WAAU,IAAI,AAAC,CAAC,IAAG,aAAa,GAAG,SAAC,GAAE;qBAAM,CAAA,kBAAiB,IAAI,AAAC,CAAC,GAAE,CAAC;cAAA,EAAC;AAAA,YAC3F,CAAC;UACL;AAAA,QACJ;AACA,mCAA2B,CAA3B,UAA6B,GAAE;;AAC3B,aAAI,GAAE,GAAK,KAAG,CAAG;AACb,iBAAO,KAAG,CAAC;UACf;AAAA,AACI,YAAA,CAAA,OAAM,CAAC;AACX,AAAI,YAAA,CAAA,SAAQ,CAAC;AACb,aAAI,IAAG,aAAa,CAAG;AACnB,kBAAM,EAAI,CAAA,mBAAkB,YAAY,AAAC,CAAC,GAAE,CAAE,SAAQ,CAAC,CAAC,CAAC;AACzD,oBAAQ,EACJ,CAAA,WAAU,IAAI,AAAC,CAAC,GAAE,CAAE,cAAa,CAAC,GAAG,SAAC,GAAE;mBAAM,CAAA,uBAAsB,YAAY,AAAC,CAAC,GAAE,CAAC;YAAA,EAAC,CAAC;AAC3F,iBAAO,IAAI,wBAAsB,AAAC,CAAC,OAAM,CAAG,UAAQ,CAAC,CAAC;UAC1D,KACK;AACD,kBAAM,EAAI,CAAA,IAAG,SAAS,AAAC,CAAC,GAAE,CAAE,SAAQ,CAAC,CAAC,CAAC;AACvC,oBAAQ,EAAI,CAAA,WAAU,IAAI,AAAC,CAAC,GAAE,CAAE,cAAa,CAAC,GAAG,SAAC,GAAE;mBAAM,CAAA,aAAY,AAAC,CAAC,GAAE,CAAC;YAAA,EAAC,CAAC;AAC7E,iBAAO,IAAI,wBAAsB,AAAC,CAAC,OAAM,CAAG,UAAQ,CAAC,CAAC;UAC1D;AAAA,QACJ;WA5HiF;AAArF,cAAQ,AAAC,8DAAqC,CAAA;AAA9C,AA8HA,cA9HQ,AAAC,gCA8HT,CAAA,4BAA2B,EAAI,CAAA,UAAS,AAAC,CAAC,CACtC,UAAS,AAAC,EAAC,CACX,CAAA,OAAM,AAAC,CAAC,CAAA,CAAG,CAAA,MAAK,AAAC,CAAC,YAAW,CAAC,CAAC,CAC/B,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,MAAK,CAAC,CAAC,CAC5C,CAAG,6BAA2B,CAAC,CAlIe,CAkId;AAlIhC,4BAAA,SAAS,QAAO;AAmIT,eAAM,oBAAkB,CACf,SAAQ,CAAG;AApI3B,AAqIQ,wBArIM,iBAAiB,AAAC,qBAAkB,KAAK,MAAmB,CAqI3D;AACP,aAAG,UAAU,EAAI,UAAQ,CAAC;QAC9B;AArIM,AAwIV,aAxIiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC,uBAsI1C,SAAQ,CAAR,UAAS,AAAC,CAAE;AAAE,iBAAO,CAAA,IAAG,UAAU,CAAC;UAAE,IAC9B,WAAU,CAAjB,UAAmB,GAAE,CAAG;AAAE,iBAAO,IAAI,oBAAkB,AAAC,CAAC,GAAE,CAAC,CAAC;UAAE,EAtID,SAAO,CAAC,CAAC;MACnE,AAAC,CA+HgC,aAAY,CA/H1B,CAJS,CAAA;AAApC,cAAQ,AAAC,4CAAqC,CAAA;AAA9C,gCAAA,SAAS,QAAO;AA2IT,eAAM,wBAAsB,CACnB,SAAQ,CAAG;AA5I3B,AA6IQ,wBA7IM,iBAAiB,AAAC,yBAAkB,KAAK,MAAmB,CA6I3D;AACP,aAAG,UAAU,EAAI,UAAQ,CAAC;QAC9B;AA7IM,AAkJV,aAlJiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC,2BA8I1C,SAAQ,CAAR,UAAS,AAAC,CAAE;AAAE,iBAAO,CAAA,IAAG,UAAU,CAAC;UAAE,IAC9B,WAAU,CAAjB,UAAmB,GAAE,CAAG;AACpB,iBAAO,IAAI,wBAAsB,AAAC,CAAC,GAAE,CAAC,CAAC;UAC3C,EAhJ8D,SAAO,CAAC,CAAC;MACnE,AAAC,CAuIoC,iBAAgB,CAvIlC,CAJS,CAAA;AAApC,cAAQ,AAAC,oDAAqC,CAAA;IAEf;EAC3B,CAAA;AAAM,CAAC,CAAC;AAkJ+C;ACrJ3D,KAAK,SAAS,AAAC,0GACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,mBAAoB,CAAC;AAC1B,AAAI,IAAA,CAAA,cAAa,oBAAoB,CAAC;AADhD,OAAO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AACL,WAAK,KAAK,AAAC,CAAC,IAAG,CAAC,QAAQ,AAAC,CAAC,SAAS,CAAA,CAAG;AACpC,WAAI,CAAC,cAAa,CAAE,CAAA,CAAC;AACnB,kBAAQ,AAAC,CAAC,CAAA,CAAG,CAAA,IAAG,CAAE,CAAA,CAAC,CAAC,CAAC;AAAA,MACzB,CAAC,CAAC;IAFJ,CAFR,UAAS,IAAG;AAAZ,cAAQ,AAAC,wBAAoB,KAAG,sBAAmB,CAAC;AAApD,cAAQ,AAAC,wBAAoB,KAAG,sBAAmB,CAAC;IAE5C,CADuB;AACzB,UAAM,eAAmB;EAC3B,CAAA;AAAM,CAAC,CAAC;AADoB;ACFhC,KAAK,SAAS,AAAC,maACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,+CAAoB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAApC,OAAO;AACD,UAAM,GADZ,SAAS,IAAG;AAAZ,cAAoB,KAAG,QAAkB,CAAC;AAA1C,gBAAoB,KAAG,UAAkB,CAAC;AAA1C,oBAAoB,KAAG,cAAkB,CAAC;AAA1C,sBAAoB,KAAG,gBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,WAAoB,KAAG,KAAkB,CAAC;AAA1C,kBAAoB,KAAG,YAAkB,CAAC;AAA1C,UAAoB,KAAG,IAAkB,CAAC;AAA1C,uBAAoB,KAAG,iBAAkB,CAAC;AAA1C,iBAAoB,KAAG,WAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,mBAAoB,KAAG,aAAkB,CAAC;AAA1C,wBAAoB,KAAG,kBAAkB,CAAC;AAA1C,oBAAoB,KAAG,cAAkB,CAAC;AAA1C,sBAAoB,KAAG,gBAAkB,CAAC;AAA1C,6BAAoB,KAAG,uBAAkB,CAAC;AAA1C,mBAAoB,KAAG,aAAkB,CAAC;AAA1C,qBAAoB,KAAG,eAAkB,CAAC;AAA1C,yBAAoB,KAAG,mBAAkB,CAAC;AAA1C,kCAAoB,KAAG,4BAAkB,CAAC;AAA1C,oBAAoB,KAAG,cAAkB,CAAC;AAA1C,wBAAoB,KAAG,kBAAkB,CAAC;AAA1C,eAAoB,KAAG,SAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,uBAAoB,KAAG,iBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,oBAAoB,KAAG,cAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,aAAoB,KAAG,OAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,iBAAoB,KAAG,WAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,8BAAoB,KAAG,wBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,mCAAoB,KAAG,6BAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;iBAFK,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,eAAQ,SAAQ,OAAO;AACnB,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;YAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,KAAG,CAAC,CAAC;AAAA,QACzG;MACJ;iBACiB,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,MAC5G;mBAVA,CAAC,eAAc,YAAY,CAAC,AAAC,CAoBL,SACR,OAAM,CAAG,CAAA,eAAc,CAAG,CAAA,gBAAe,CAAG;AACpD,WAAG,QAAQ,EAAI,QAAM,CAAC;AACtB,WAAG,gBAAgB,EAAI,gBAAc,CAAC;AACtC,WAAG,iBAAiB,EAAI,iBAAe,CAAC;AACxC,WAAG,cAAc,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AAC9B,AAAI,UAAA,CAAA,WAAU,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AAC3B,kBAAU,CAAE,CAAA,CAAC,EAAI,CAAA,QAAO,KAAK,CAAC;AAC9B,kBAAU,CAAE,CAAA,CAAC,EAAI,CAAA,QAAO,UAAU,CAAC;AACnC,kBAAU,CAAE,CAAA,CAAC,EAAI,CAAA,QAAO,SAAS,CAAC;AAClC,WAAG,cAAc,IAAI,AAAC,CAAC,QAAO,CAAG,YAAU,CAAC,CAAC;MACjD,AA+SJ;AA9SI,gBAAQ,CAAR,UAAU,GAAE,CAAG,CAAA,IAAG;;AACd,aAAI,CAAC,SAAQ,AAAC,CAAC,GAAE,CAAC,CAAG;AACjB,iBAAO,KAAG,CAAC;UACf;AAAA,AACA,aAAI,OAAM,AAAC,CAAC,GAAE,CAAC,CAAG;AACd,AAAI,cAAA,CAAA,aAAY,EAAI,GAAC,CAAC;AACtB,sBAAU,QAAQ,AAAC,CAAC,GAAE,GAAG,SAAC,GAAE,CAAM;AAAE,0BAAY,KAAK,AAAC,CAAC,cAAa,AAAC,CAAC,GAAE,CAAG,KAAG,CAAC,CAAC,CAAC;YAAE,EAAC,CAAC;AACrF,iBAAO,cAAY,CAAC;UACxB;AAAA,AACA,aAAI,IAAG,GAAK,OAAK,CAAG;AAChB,iBAAO,IAAE,CAAC;UACd;AAAA,AACA,aAAI,IAAG,GAAK,eAAa,CAAG;AACxB,iBAAO,CAAA,IAAG,yBAAyB,AAAC,CAAC,GAAE,CAAC,CAAC;UAC7C,KACK,KAAI,IAAG,GAAK,gBAAc,CAAG;AAC9B,iBAAO,CAAA,IAAG,0BAA0B,AAAC,CAAC,GAAE,CAAC,CAAC;UAC9C,KACK,KAAI,IAAG,GAAK,aAAW,CAAG;AAC3B,iBAAO,CAAA,IAAG,uBAAuB,AAAC,CAAC,GAAE,CAAC,CAAC;UAC3C,KACK,KAAI,IAAG,GAAK,cAAY,CAAG;AAC5B,iBAAO,CAAA,IAAG,wBAAwB,AAAC,CAAC,GAAE,CAAC,CAAC;UAC5C,KACK,KAAI,IAAG,GAAK,kBAAgB,CAAG;AAChC,iBAAO,CAAA,IAAG,4BAA4B,AAAC,CAAC,GAAE,CAAC,CAAC;UAChD,KACK,KAAI,IAAG,GAAK,cAAY,CAAG;AAC5B,iBAAO,CAAA,IAAG,wBAAwB,AAAC,CAAC,GAAE,CAAC,CAAC;UAC5C,KACK,KAAI,IAAG,GAAK,mBAAiB,CAAG;AACjC,iBAAO,CAAA,IAAG,gBAAgB,UAAU,AAAC,CAAC,GAAE,CAAC,CAAC;UAC9C,KACK,KAAI,IAAG,GAAK,4BAA0B,CAAG;AAC1C,iBAAO,CAAA,IAAG,sCAAsC,AAAC,CAAC,GAAE,CAAC,CAAC;UAC1D,KACK,KAAI,IAAG,GAAK,cAAY,CAAG;AAC5B,iBAAO,CAAA,IAAG,iBAAiB,uBAAuB,AAAC,CAAC,GAAE,CAAC,CAAC;UAC5D,KACK,KAAI,IAAG,GAAK,kBAAgB,CAAG;AAChC,iBAAO,CAAA,IAAG,iBAAiB,2BAA2B,AAAC,CAAC,GAAE,CAAC,CAAC;UAChE,KACK,KAAI,IAAG,GAAK,iBAAe,CAAG;AAC/B,iBAAO,CAAA,IAAG,2BAA2B,AAAC,CAAC,GAAE,CAAC,CAAC;UAC/C,KACK;AACD,gBAAM,CAAA,oBAAmB,EAAI,CAAA,IAAG,SAAS,AAAC,EAAC,CAAC;UAChD;AAAA,QACJ;AACA,kBAAU,CAAV,UAAY,GAAE,CAAG,CAAA,IAAG,CAAG,CAAA,IAAG;;AACtB,aAAI,CAAC,SAAQ,AAAC,CAAC,GAAE,CAAC,CAAG;AACjB,iBAAO,KAAG,CAAC;UACf;AAAA,AACA,aAAI,OAAM,AAAC,CAAC,GAAE,CAAC,CAAG;AACd,AAAI,cAAA,CAAA,GAAE,EAAI,IAAI,KAAG,AAAC,EAAC,CAAC;AACpB,sBAAU,QAAQ,AAAC,CAAC,GAAE,GAAG,SAAC,GAAE,CAAM;AAAE,gBAAE,KAAK,AAAC,CAAC,gBAAe,AAAC,CAAC,GAAE,CAAG,KAAG,CAAG,KAAG,CAAC,CAAC,CAAC;YAAE,EAAC,CAAC;AACnF,iBAAO,IAAE,CAAC;UACd;AAAA,AACA,aAAI,IAAG,GAAK,OAAK,CAAG;AAChB,iBAAO,IAAE,CAAC;UACd;AAAA,AACA,aAAI,IAAG,GAAK,eAAa,CAAG;AACxB,iBAAO,CAAA,IAAG,2BAA2B,AAAC,CAAC,GAAE,CAAC,CAAC;UAC/C,KACK,KAAI,IAAG,GAAK,gBAAc,CAAG;AAC9B,iBAAO,CAAA,IAAG,4BAA4B,AAAC,CAAC,GAAE,CAAC,CAAC;UAChD,KACK,KAAI,IAAG,GAAK,aAAW,CAAG;AAC3B,iBAAO,CAAA,IAAG,yBAAyB,AAAC,CAAC,GAAE,CAAC,CAAC;UAC7C,KACK,KAAI,IAAG,GAAK,kBAAgB,CAAG;AAChC,iBAAO,CAAA,IAAG,8BAA8B,AAAC,CAAC,GAAE,CAAC,CAAC;UAClD,KACK,KAAI,IAAG,GAAK,cAAY,CAAG;AAC5B,iBAAO,CAAA,IAAG,0BAA0B,AAAC,CAAC,GAAE,CAAC,CAAC;UAC9C,KACK,KAAI,IAAG,GAAK,cAAY,CAAG;AAC5B,iBAAO,CAAA,IAAG,0BAA0B,AAAC,CAAC,GAAE,CAAG,KAAG,CAAC,CAAC;UACpD,KACK,KAAI,IAAG,GAAK,mBAAiB,CAAG;AACjC,iBAAO,CAAA,IAAG,gBAAgB,YAAY,AAAC,CAAC,GAAE,CAAC,CAAC;UAChD,KACK,KAAI,IAAG,GAAK,4BAA0B,CAAG;AAC1C,iBAAO,CAAA,IAAG,wCAAwC,AAAC,CAAC,GAAE,CAAC,CAAC;UAC5D,KACK,KAAI,IAAG,GAAK,cAAY,CAAG;AAC5B,iBAAO,CAAA,IAAG,iBAAiB,yBAAyB,AAAC,CAAC,GAAE,CAAC,CAAC;UAC9D,KACK,KAAI,IAAG,GAAK,kBAAgB,CAAG;AAChC,iBAAO,CAAA,IAAG,iBAAiB,6BAA6B,AAAC,CAAC,GAAE,CAAC,CAAC;UAClE,KACK,KAAI,IAAG,GAAK,iBAAe,CAAG;AAC/B,iBAAO,CAAA,IAAG,6BAA6B,AAAC,CAAC,GAAE,CAAC,CAAC;UACjD,KACK;AACD,gBAAM,CAAA,sBAAqB,EAAI,CAAA,IAAG,SAAS,AAAC,EAAC,CAAC;UAClD;AAAA,QACJ;AACA,kBAAU,CAAV,UAAY,GAAE,CAAG,CAAA,IAAG;;AAChB,AAAI,YAAA,CAAA,MAAK,EAAI,GAAC,CAAC;AACf,AAAI,YAAA,CAAA,SAAQ,EAAI,CAAA,SAAQ,AAAC,CAAC,IAAG,CAAC,CAAC;AAC/B,mBAAS,QAAQ,AAAC,CAAC,GAAE,GAAG,SAAC,KAAI,CAAG,CAAA,GAAE,CAAM;AACpC,eAAI,SAAQ,CAAG;AACX,mBAAK,CAAE,GAAE,CAAC,EAAI,CAAA,cAAa,AAAC,CAAC,KAAI,CAAG,KAAG,CAAC,CAAC;YAC7C,KACK;AACD,mBAAK,CAAE,GAAE,CAAC,EAAI,MAAI,CAAC;YACvB;AAAA,UACJ,EAAC,CAAC;AACF,eAAO,OAAK,CAAC;QACjB;AAMA,kBAAU,CAAV,UAAY,GAAE,CAAG,CAAA,IAAG,CAAG,CAAA,IAAG;;AACtB,aAAI,SAAQ,AAAC,CAAC,IAAG,CAAC,CAAG;AACjB,AAAI,cAAA,CAAA,GAAE,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AACnB,2BAAe,QAAQ,AAAC,CAAC,GAAE,GAAG,SAAC,GAAE,CAAG,CAAA,GAAE,CAAM;AAAE,gBAAE,IAAI,AAAC,CAAC,GAAE,CAAG,CAAA,gBAAe,AAAC,CAAC,GAAE,CAAG,KAAG,CAAG,KAAG,CAAC,CAAC,CAAC;YAAE,EAAC,CAAC;AACjG,iBAAO,IAAE,CAAC;UACd,KACK;AACD,iBAAO,CAAA,UAAS,oBAAoB,AAAC,CAAC,GAAE,CAAC,CAAC;UAC9C;AAAA,QACJ;AACA,0BAAkB,CAAlB,UAAoB,aAAY,CAAG;AAAE,aAAG,iBAAiB,SAAS,AAAC,CAAC,aAAY,CAAC,CAAC;QAAE;AACpF,iCAAyB,CAAzB,UAA2B,UAAS,CAAG;AACnC,eAAO;AACH,uBAAW,CAAG,CAAA,IAAG,UAAU,AAAC,CAAC,UAAS,WAAW,CAAG,cAAY,CAAC;AACjE,oCAAwB,CAAG,CAAA,UAAS,wBAAwB;AAAA,UAChE,CAAC;QACL;AACA,mCAA2B,CAA3B,UAA6B,GAAE,CAAG;AAC9B,eAAO,IAAI,iBAAe,AAAC,CAAC,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,YAAW,CAAC,CAAG,cAAY,CAAC,CAAG,CAAA,GAAE,CAAE,yBAAwB,CAAC,CAAC,CAAC;QACnH;AACA,4CAAoC,CAApC,UAAsC,OAAM,CAAG;AAC3C,eAAO;AACH,+BAAmB,CAAG,CAAA,IAAG,gBAAgB,UAAU,AAAC,CAAC,OAAM,mBAAmB,CAAC;AAC/E,0BAAc,CAAG,CAAA,OAAM,cAAc;AACrC,iCAAqB,CAAG,CAAA,OAAM,qBAAqB;AACnD,+BAAmB,CAAG,CAAA,OAAM,mBAAmB;AAC/C,8BAAkB,CAAG,CAAA,OAAM,kBAAkB;AAC7C,0CAA8B,CAAG,CAAA,OAAM,8BAA8B;AACrE,uCAA2B,CAAG,CAAA,OAAM,2BAA2B;AAAA,UACnE,CAAC;QACL;AACA,8CAAsC,CAAtC,UAAwC,GAAE,CAAG;AACzC,eAAO,IAAI,4BAA0B,AAAC,CAAC,IAAG,gBAAgB,YAAY,AAAC,CAAC,GAAE,CAAE,oBAAmB,CAAC,CAAC,CAAG,CAAA,GAAE,CAAE,eAAc,CAAC,CAAG,CAAA,GAAE,CAAE,sBAAqB,CAAC,CAAG,CAAA,GAAE,CAAE,oBAAmB,CAAC,CAAG,CAAA,GAAE,CAAE,mBAAkB,CAAC,CAAG,CAAA,GAAE,CAAE,+BAA8B,CAAC,CAAG,CAAA,GAAE,CAAE,4BAA2B,CAAC,CAAC,CAAC;QACxR;AACA,8BAAsB,CAAtB,UAAwB,IAAG,CAAG;AAC1B,eAAO;AAAE,kBAAM,CAAG,CAAA,IAAG,OAAO;AAAG,qBAAS,CAAG,CAAA,IAAG,SAAS;AAAA,UAAE,CAAC;QAC9D;AACA,gCAAwB,CAAxB,UAA0B,GAAE,CAAG,CAAA,IAAG,CAAG;AAEjC,AAAI,YAAA,CAAA,GAAE,CAAC;AACP,iBAAQ,IAAG;AACP,eAAK,gBAAc;AACf,gBAAE,EAAI,CAAA,IAAG,QAAQ,mBAAmB,AAAC,CAAC,GAAE,CAAE,OAAM,CAAC,CAAG,CAAA,GAAE,CAAE,UAAS,CAAC,CAAC,CAAC;AACpE,mBAAK;AAAA,AACT,eAAK,UAAQ;AACT,gBAAE,EAAI,CAAA,IAAG,QAAQ,aAAa,AAAC,CAAC,GAAE,CAAE,OAAM,CAAC,CAAG,CAAA,GAAE,CAAE,UAAS,CAAC,CAAC,CAAC;AAC9D,mBAAK;AAAA,AACT,eAAK,gBAAc;AACf,gBAAE,EAAI,CAAA,IAAG,QAAQ,mBAAmB,AAAC,CAAC,GAAE,CAAE,OAAM,CAAC,CAAG,CAAA,GAAE,CAAE,UAAS,CAAC,CAAC,CAAC;AACpE,mBAAK;AAAA,AACT,eAAK,gBAAc;AACf,gBAAE,EAAI,CAAA,IAAG,QAAQ,mBAAmB,AAAC,CAAC,GAAE,CAAE,OAAM,CAAC,CAAG,CAAA,GAAE,CAAE,UAAS,CAAC,CAAC,CAAC;AACpE,mBAAK;AAAA,AACT;AACI,kBAAM,CAAA,0BAAyB,EAAI,KAAG,CAAC;AADpC,UAEX;AACA,eAAO,IAAE,CAAC;QACd;AACA,+BAAuB,CAAvB,UAAyB,IAAG,CAAG;AAC3B,eAAO;AACH,wBAAY,CAAG,CAAA,IAAG,YAAY;AAC9B,2BAAe,CAAG,CAAA,IAAG,eAAe;AACpC,qBAAS,CAAG,CAAA,IAAG,SAAS;AACxB,uBAAW,CAAG,CAAA,IAAG,UAAU,AAAC,CAAC,IAAG,WAAW,CAAG,kBAAgB,CAAC;AAC/D,yBAAa,CAAG,CAAA,IAAG,aAAa;AAChC,mBAAO,CAAG,CAAA,IAAG,OAAO;AACpB,0BAAc,CAAG,CAAA,IAAG,cAAc;AAAA,UACtC,CAAC;QACL;AACA,iCAAyB,CAAzB,UAA2B,GAAE,CAAG;AAC5B,eAAO,IAAI,eAAa,AAAC,CAAC;AACtB,sBAAU,CAAG,CAAA,GAAE,CAAE,aAAY,CAAC;AAC9B,yBAAa,CAAG,CAAA,GAAE,CAAE,gBAAe,CAAC;AAAG,mBAAO,CAAG,CAAA,GAAE,CAAE,UAAS,CAAC;AAC/D,qBAAS,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,YAAW,CAAC,CAAG,kBAAgB,CAAC;AACjE,uBAAW,CAAG,CAAA,GAAE,CAAE,cAAa,CAAC;AAChC,iBAAK,CAAG,CAAA,GAAE,CAAE,QAAO,CAAC;AACpB,wBAAY,CAAG,CAAA,GAAE,CAAE,eAAc,CAAC;AAAA,UACtC,CAAC,CAAC;QACN;AACA,gCAAwB,CAAxB,UAA0B,MAAK,CAAG;AAC9B,eAAO;AACH,2BAAe,CAAG,CAAA,MAAK,eAAe;AACtC,6BAAiB,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,MAAK,iBAAiB,CAAG,cAAY,CAAC;AAC3E,0BAAc,CAAG,CAAA,IAAG,UAAU,AAAC,CAAC,MAAK,cAAc,CAAG,aAAW,CAAC;AAClE,iCAAqB,CAAG,CAAA,IAAG,UAAU,AAAC,CAAC,MAAK,qBAAqB,CAAG,uBAAqB,CAAC;AAAA,UAC9F,CAAC;QACL;AACA,kCAA0B,CAA1B,UAA4B,GAAE,CAAG;AAC7B,eAAO,IAAI,gBAAc,AAAC,CAAC;AACvB,yBAAa,CAAG,CAAA,GAAE,CAAE,gBAAe,CAAC;AACpC,2BAAe,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,kBAAiB,CAAC,CAAG,cAAY,CAAG,UAAQ,CAAC;AACpF,wBAAY,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,eAAc,CAAC,CAAG,aAAW,CAAC;AAClE,+BAAmB,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,sBAAqB,CAAC,CAAG,uBAAqB,CAAC;AAAA,UAC9F,CAAC,CAAC;QACN;AACA,8BAAsB,CAAtB,UAAwB,MAAK,CAAG;AAC5B,eAAO;AACH,kBAAM,CAAG,CAAA,MAAK,MAAM;AACpB,wBAAY,CAAG,CAAA,MAAK,YAAY;AAChC,6BAAiB,CAAG,CAAA,MAAK,iBAAiB;AAC1C,uBAAW,CAAG,CAAA,IAAG,UAAU,AAAC,CAAC,MAAK,WAAW,CAAG,gBAAc,CAAC;AAC/D,4BAAgB,CAAG,CAAA,IAAG,UAAU,AAAC,CAAC,MAAK,gBAAgB,CAAG,aAAW,CAAC;AACtE,6BAAiB,CAAG,CAAA,IAAG,UAAU,AAAC,CAAC,MAAK,iBAAiB,CAAG,uBAAqB,CAAC;AAClF,6BAAiB,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,MAAK,iBAAiB,CAAC;AAC5D,0BAAc,CAAG,CAAA,IAAG,UAAU,AAAC,CAAC,MAAK,cAAc,CAAG,aAAW,CAAC;AAClE,2BAAe,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,MAAK,eAAe,CAAC;AAAA,UAC5D,CAAC;QACL;AACA,gCAAwB,CAAxB,UAA0B,GAAE,CAAG;AAC3B,eAAO,IAAI,cAAY,AAAC,CAAC;AACrB,gBAAI,CAAG,CAAA,GAAE,CAAE,OAAM,CAAC;AAClB,sBAAU,CAAG,CAAA,GAAE,CAAE,aAAY,CAAC;AAC9B,2BAAe,CAAG,CAAA,GAAE,CAAE,kBAAiB,CAAC;AACxC,qBAAS,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,YAAW,CAAC,CAAG,gBAAc,CAAC;AAC/D,0BAAc,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,iBAAgB,CAAC,CAAG,aAAW,CAAC;AACtE,2BAAe,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,kBAAiB,CAAC,CAAG,uBAAqB,CAAC;AAClF,2BAAe,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,kBAAiB,CAAC,CAAC;AAC1D,wBAAY,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,eAAc,CAAC,CAAG,aAAW,CAAC;AAClE,yBAAa,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,gBAAe,CAAC,CAAC;AAAA,UAC1D,CAAC,CAAC;QACN;AACA,6BAAqB,CAArB,UAAuB,IAAG,CAAG;AACzB,eAAO;AACH,mBAAO,CAAG,CAAA,IAAG,gBAAgB,UAAU,AAAC,CAAC,IAAG,OAAO,CAAC;AACpD,2BAAe,CAAG,CAAA,IAAG,UAAU,AAAC,CAAC,IAAG,eAAe,CAAG,cAAY,CAAC;AACnE,6BAAiB,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,IAAG,iBAAiB,CAAC;AAC1D,iBAAK,CAAG,CAAA,aAAY,AAAC,CAAC,IAAG,KAAK,CAAC;AAC/B,yBAAa,CAAG,CAAA,IAAG,UAAU,AAAC,CAAC,IAAG,aAAa,CAAG,cAAY,CAAC;AAC/D,qCAAyB,CAAG,CAAA,IAAG,yBAAyB;AAAA,UAC5D,CAAC;QACL;AACA,+BAAuB,CAAvB,UAAyB,GAAE,CAAG;AAC1B,eAAO,IAAI,aAAW,AAAC,CAAC;AACpB,iBAAK,CAAG,CAAA,IAAG,gBAAgB,YAAY,AAAC,CAAC,GAAE,CAAE,QAAO,CAAC,CAAC;AACtD,yBAAa,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,gBAAe,CAAC,CAAG,cAAY,CAAC;AACrE,2BAAe,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,kBAAiB,CAAC,CAAC;AAC1D,uBAAW,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,cAAa,CAAC,CAAG,cAAY,CAAG,gBAAc,CAAC;AAClF,eAAG,CAAG,CAAA,eAAc,AAAC,CAAC,GAAE,CAAE,MAAK,CAAC,CAAG,CAAA,IAAG,cAAc,IAAI,AAAC,CAAC,QAAO,CAAC,CAAC;AACnE,mCAAuB,CAAG,CAAA,GAAE,CAAE,0BAAyB,CAAC;AAAA,UAC5D,CAAC,CAAC;QACN;AACA,kCAA0B,CAA1B,UAA4B,IAAG,CAAG;AAC9B,AAAI,YAAA,CAAA,GAAE,EAAI;AACN,eAAG,CAAG,CAAA,IAAG,GAAG;AACZ,qBAAS,CAAG,CAAA,IAAG,SAAS;AACxB,4BAAgB,CAAG,CAAA,IAAG,gBAAgB;AACtC,mBAAO,CAAG,CAAA,IAAG,OAAO;AACpB,uBAAW,CAAG,CAAA,IAAG,WAAW;AAC5B,2BAAe,CAAG,CAAA,IAAG,eAAe;AACpC,iBAAK,CAAG,CAAA,IAAG,KAAK;AAChB,0BAAc,CAAG,CAAA,IAAG,cAAc;AAClC,yBAAa,CAAG,CAAA,IAAG,aAAa;AAChC,wBAAY,CAAG,CAAA,IAAG,YAAY;AAC9B,uBAAW,CAAG,CAAA,IAAG,WAAW;AAC5B,iCAAqB,CAAG,CAAA,IAAG,qBAAqB;AAChD,4BAAgB,CAAG,CAAA,IAAG,gBAAgB;AACtC,qBAAS,CAAG,CAAA,IAAG,SAAS;AACxB,2BAAe,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,IAAG,eAAe,CAAC;AACtD,0BAAc,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,IAAG,cAAc,CAAC;AACpD,wBAAY,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,IAAG,YAAY,CAAC;AAChD,2BAAe,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,IAAG,eAAe,CAAC;AAAA,UAC1D,CAAC;AACD,eAAO,IAAE,CAAC;QACd;AACA,oCAA4B,CAA5B,UAA8B,GAAE,CAAG;AAC/B,eAAO,IAAI,kBAAgB,AAAC,CAAC;AACzB,aAAC,CAAG,CAAA,GAAE,CAAE,IAAG,CAAC;AACZ,mBAAO,CAAG,CAAA,GAAE,CAAE,UAAS,CAAC;AACxB,0BAAc,CAAG,CAAA,GAAE,CAAE,iBAAgB,CAAC;AACtC,yBAAa,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,gBAAe,CAAC,CAAC;AACtD,wBAAY,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,eAAc,CAAC,CAAC;AACpD,sBAAU,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,aAAY,CAAC,CAAC;AAChD,yBAAa,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,gBAAe,CAAC,CAAC;AACtD,qBAAS,CAAG,CAAA,GAAE,CAAE,YAAW,CAAC;AAC5B,yBAAa,CAAG,CAAA,GAAE,CAAE,gBAAe,CAAC;AACpC,eAAG,CAAG,CAAA,GAAE,CAAE,MAAK,CAAC;AAChB,mBAAO,CAAG,CAAA,GAAE,CAAE,UAAS,CAAC;AACxB,wBAAY,CAAG,CAAA,GAAE,CAAE,eAAc,CAAC;AAClC,uBAAW,CAAG,CAAA,GAAE,CAAE,cAAa,CAAC;AAChC,sBAAU,CAAG,CAAA,GAAE,CAAE,aAAY,CAAC;AAC9B,qBAAS,CAAG,CAAA,GAAE,CAAE,YAAW,CAAC;AAC5B,+BAAmB,CAAG,CAAA,GAAE,CAAE,sBAAqB,CAAC;AAChD,0BAAc,CAAG,CAAA,GAAE,CAAE,iBAAgB,CAAC;AACtC,iBAAK,CAAG,CAAA,GAAE,CAAE,QAAO,CAAC;AAAA,UACxB,CAAC,CAAC;QACN;AAAA,WA7UiF;AAArF,cAAQ,AAAC,0BAAqC,CAAA;AAA9C,AA+UA,cA/UQ,AAAC,cA+UT,CAAA,UAAS,EAAI,CAAA,UAAS,AAAC,CAAC,CACpB,UAAS,AAAC,EAAC,CACX,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,MAAK,CAAG,wBAAsB,CAAG,6BAA2B,CAAC,CAAC,CACnG,CAAG,WAAS,CAAC,CAlViC,CAkVhC;IAhViB;EAC3B,CAAA;AAAM,CAAC,CAAC;AAgVyB;ACnVrC,KAAK,SAAS,AAAC,0YACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,iDAAoB,CAAC;;;;;;;;;;;;;;;;;AAApC,OAAO;AACD,UAAM,GADZ,SAAS,IAAG;AAAZ,eAAoB,KAAG,SAAkB,CAAC;AAA1C,iBAAoB,KAAG,WAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,gBAAoB,KAAG,UAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,iBAAoB,KAAG,WAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,mBAAoB,KAAG,aAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,mBAAoB,KAAG,aAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,6BAAoB,KAAG,uBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,SAAoB,KAAG,GAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,qBAAoB,KAAG,eAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,UAAoB,KAAG,IAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,mBAAoB,KAAG,aAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;iBAFK,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,eAAQ,SAAQ,OAAO;AACnB,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;YAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,aAAK,EAAA;AAAG,iBAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;YAAE,CAAG,KAAG,CAAC,CAAC;AAAA,QACzG;MACJ;iBACiB,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,WAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,eAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,MAC5G;AAVA,0BAAA,SAAS,QAAO;AAqBT,eAAM,kBAAgB,CACb,YAAW,CAAG;AAtB9B,AAuBQ,wBAvBM,iBAAiB,AAAC,mBAAkB,KAAK,MAuBzC,CAAA,YAAW,AAAC,CAAC,YAAW,SAAS,CAAC,CAAG,EAAA,CAvBuB,CAuBrB;AAC7C,aAAG,qBAAqB,EAAI,CAAA,YAAW,AAAC,CAAC,YAAW,SAAS,CAAC,CAAC;AAC/D,aAAG,cAAc,EAAI,aAAW,CAAC;QACrC;AAxBM,AA8BV,aA9BiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC;AAyB1C,sBAAY,CAAZ,UAAa,AAAC,CAAE;AACZ,eAAG,qBAAqB,eAAe,cAAc,AAAC,EAAC,CAAC;AACxD,eAAG,qBAAqB,eAAe,eAAe,AAAC,EAAC,CAAC;UAC7D;AACA,gBAAM,CAAN,UAAO,AAAC,CAAE;AAAE,eAAG,cAAc,QAAQ,AAAC,EAAC,CAAC;UAAE;AAAA,aA5BoB,SAAO,CAAC,CAAC;MACnE,AAAC,CAiB8B,YAAW,CAjBvB,CAJS,CAAA;AAApC,cAAQ,AAAC,wCAAqC,CAAA;yBAiCrB,EAAA;6BAjCzB,CAAC,eAAc,YAAY,CAAC,AAAC,CAqCK,SAClB,QAAO,CAAG;AAClB,WAAG,UAAU,EAAI,SAAO,CAAC;AACzB,WAAG,eAAe,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AAC/B,WAAG,oBAAoB,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AACpC,WAAG,mBAAmB,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;MACvC,AA6EJ;AA5EI,aAAK,CAAL,UAAM,AAAC,CAAE;AACL,AAAI,YAAA,CAAA,KAAI,EAAI,IAAI,qBAAmB,AAAC,CAAC,IAAG,UAAU,CAAC,CAAC;AACpD,cAAI,eAAe,EAAI,CAAA,UAAS,MAAM,AAAC,CAAC,IAAG,eAAe,CAAC,CAAC;AAC5D,cAAI,oBAAoB,EAAI,CAAA,UAAS,MAAM,AAAC,CAAC,IAAG,oBAAoB,CAAC,CAAC;AACtE,cAAI,mBAAmB,EAAI,CAAA,UAAS,MAAM,AAAC,CAAC,IAAG,mBAAmB,CAAC,CAAC;AACpE,eAAO,MAAI,CAAC;QAChB;AAUA,uBAAe,CAAf,UAAiB,aAAY,CAAG,CAAA,QAAO,CAAG;AACtC,AAAI,YAAA,CAAA,KAAI,EAAI,CAAA,IAAG,OAAO,AAAC,EAAC,CAAC;AACzB,cAAI,mBAAmB,IAAI,AAAC,CAAC,aAAY,CAAG,SAAO,CAAC,CAAC;AACrD,eAAO,MAAI,CAAC;QAChB;AASA,mBAAW,CAAX,UAAa,aAAY,CAAG,CAAA,IAAG,CAAG;AAC9B,AAAI,YAAA,CAAA,KAAI,EAAI,CAAA,IAAG,OAAO,AAAC,EAAC,CAAC;AACzB,cAAI,eAAe,IAAI,AAAC,CAAC,aAAY,CAAG,KAAG,CAAC,CAAC;AAC7C,eAAO,MAAI,CAAC;QAChB;AAUA,wBAAgB,CAAhB,UAAkB,aAAY,CAAG,CAAA,IAAG,CAAG,CAAA,EAAC,CAAG;AACvC,AAAI,YAAA,CAAA,KAAI,EAAI,CAAA,IAAG,OAAO,AAAC,EAAC,CAAC;AACzB,AAAI,YAAA,CAAA,qBAAoB,EAAI,CAAA,KAAI,oBAAoB,IAAI,AAAC,CAAC,aAAY,CAAC,CAAC;AACxE,aAAI,CAAC,SAAQ,AAAC,CAAC,qBAAoB,CAAC,CAAG;AACnC,gBAAI,oBAAoB,IAAI,AAAC,CAAC,aAAY,CAAG,IAAI,IAAE,AAAC,EAAC,CAAC,CAAC;AACvD,gCAAoB,EAAI,CAAA,KAAI,oBAAoB,IAAI,AAAC,CAAC,aAAY,CAAC,CAAC;UACxE;AAAA,AACA,8BAAoB,IAAI,AAAC,CAAC,IAAG,CAAG,GAAC,CAAC,CAAC;AACnC,eAAO,MAAI,CAAC;QAChB;AAMA,kBAAU,CAAV,UAAY,iBAAgB;AACxB,AAAI,YAAA,CAAA,gBAAe,EAAI,CAAA,IAAG,UAAU,IAAI,AAAC,CAAC,YAAW,CAAC,CAAC;AACvD,mBAAS,QAAQ,AAAC,CAAC,IAAG,eAAe,GAAG,SAAC,IAAG,CAAG,CAAA,IAAG,CAAM;AAAE,2BAAe,QAAQ,AAAC,CAAC,IAAG,CAAG,KAAG,CAAC,CAAC;UAAE,EAAC,CAAC;AAClG,mBAAS,QAAQ,AAAC,CAAC,IAAG,mBAAmB,GAAG,SAAC,QAAO,CAAG,CAAA,IAAG,CAAM;AAAE,2BAAe,kBAAkB,AAAC,CAAC,IAAG,CAAG,SAAO,CAAC,CAAC;UAAE,EAAC,CAAC;AACxH,mBAAS,QAAQ,AAAC,CAAC,IAAG,oBAAoB,GAAG,SAAC,SAAQ,CAAG,CAAA,SAAQ;AAC7D,qBAAS,QAAQ,AAAC,CAAC,SAAQ,GAAG,SAAC,EAAC,CAAG,CAAA,IAAG,CAAM;AACxC,6BAAe,sBAAsB,AAAC,CAAC,SAAQ,CAAG,KAAG,CAAG,GAAC,CAAC,CAAC;YAC/D,EAAC,CAAC;UACN,EAAC,CAAC;AACF,AAAI,YAAA,CAAA,QAAO,IAAI,MAAM,EAAC,CAAA,kBAAiB,EAAE,CAAE,CAAC;AAC5C,AAAI,YAAA,CAAA,MAAK,EAAI,CAAA,EAAC,AAAC,EAAC,YAAW,EAAC,SAAO,EAAC,YAAS,EAAC,CAAC;AAC/C,AAAI,YAAA,CAAA,GAAE,EAAI,CAAA,IAAG,UAAU,IAAI,AAAC,CAAC,cAAa,CAAC,CAAC;AAE5C,YAAE,YAAY,AAAC,CAAC,GAAE,KAAK,CAAG,OAAK,CAAC,CAAC;AACjC,eAAO,CAAA,IAAG,UAAU,IAAI,AAAC,CAAC,sBAAqB,CAAC,WAClC,AAAC,CAAC,iBAAgB,GAAG,GAAG,EAAC,SAAO,EAAK,CAAA,IAAG,UAAU,CAAC,KACzD,AAAC,EAAC,SAAC,YAAW,CAAM;AAAE,iBAAO,IAAI,kBAAgB,AAAC,CAAC,YAAW,CAAC,CAAC;UAAE,EAAC,CAAC;QAChF;WAvHiF;AAArF,cAAQ,AAAC,8CAAqC,CAAA;AAA9C,AAyHA,cAzHQ,AAAC,wBAyHT,CAAA,oBAAmB,EAAI,CAAA,UAAS,AAAC,CAAC,CAC9B,UAAS,AAAC,EAAC,CACX,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,QAAO,CAAC,CAAC,CAC9C,CAAG,qBAAmB,CAAC,CA5HuB,CA4HtB;IA1HO;EAC3B,CAAA;AAAM,CAAC,CAAC;AA0HqC;AC7HjD,KAAK,SAAS,AAAC,o8CACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,wCAAoB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CpC,SAAS,iBAAe,CAAC,AAAC,CAAE;AACxB,SAAO,EACH,IAAG,AAAC,CAAC,SAAQ,CAAC,QACH,AAAC,CAAC,SAAQ,CAAC,CAC1B,CAAC;EACL;AAAA,AAQA,SAAS,gBAAc,CAAC,AAAC;AACrB,AAAI,MAAA,CAAA,MAAK,CAAC;AAEV,MAAI;AACA,WAAK,EAAI,CAAA,GAAE,mBAAmB,AAAC,EAAC,CAAC;IACrC,CACA,OAAO,CAAA,CAAG;AACN,WAAK,EAAI,KAAG,CAAC;IACjB;AAAA,AACA,SAAO,EACH,IAAG,AAAC,CAAC,cAAa,CAAC,QACR,AAAC,CAAC,MAAK,CAAC,CACnB,YAAU,CACV,CAAA,IAAG,AAAC,CAAC,QAAO,CAAC,QAAQ,AAAC,CAAC,WAAU,CAAC,CAClC,CAAA,IAAG,AAAC,CAAC,YAAW,CAAC,QAAQ,AAAC,CAAC,GAAE,CAAC,CAC9B,mBAAiB,CACjB,CAAA,IAAG,AAAC,CAAC,cAAa,CAAC,QAAQ,AAAC,CAAC,kBAAiB,CAAC,CAC/C,oBAAkB,CAClB,CAAA,IAAG,AAAC,CAAC,gBAAe,CAAC,QAAQ,AAAC,CAAC,mBAAkB,CAAC,CAClD,CAAA,IAAG,AAAC,CAAC,oCAAmC,CAAC,QAAQ,AAAC,CAAC,KAAI,CAAC,CACxD,iBAAe,CACf,YAAU,CACV,eAAa,CACb,oBAAkB,CAClB,WAAS,CACT,qBAAmB,CACnB,CAAA,IAAG,AAAC,CAAC,sBAAqB,CAAC,QAAQ,AAAC,CAAC,GAAE,CAAC,CACxC,SAAO,CACP,cAAY,CACZ,CAAA,IAAG,AAAC,CAAC,YAAW,CAAC,QAAQ,AAAC,CAAC,gBAAe,CAAC,CAC3C,CAAA,IAAG,AAAC,CAAC,KAAI,CAAC,QAAQ,AAAC,CAAC,YAAW,CAAC,CAChC,IAAE,CACF,CAAA,IAAG,AAAC,CAAC,eAAc,CAAC,QAAQ,AAAC,CAAC,sBAAqB,CAAC,CACpD,WAAS,CACT,uBAAqB,CACrB,kBAAgB,CAChB,OAAK,CACL,MAAI,CACJ,CAAA,IAAG,AAAC,CAAC,gBAAe,CAAC,QAAQ,AAAC,CAAC,GAAI,iBAAe,AAAC,CAAC,GAAE,CAAC,CAAC,CACxD,CAAA,IAAG,AAAC,CAAC,gBAAe,CAAC,QAAQ,AAAC,CAAC,oBAAmB,CAAC,CACnD,CAAA,IAAG,AAAC,CAAC,GAAE,CAAC,QAAQ,AAAC,CAAC,OAAM,CAAC,CACzB,mBAAiB,CACjB,YAAU,CACV,sBAAoB,CACpB,CAAA,IAAG,AAAC,CAAC,UAAS,CAAC,QAAQ,AAAC,CAAC,qBAAoB,CAAC,CAC9C,iBAAe,CACf,aAAW,CACX,qBAAmB,CACnB,CAAA,IAAG,AAAC,CAAC,MAAK,CAAC,QAAQ,AAAC,CAAC,UAAS,CAAC,CAC/B,CAAA,IAAG,AAAC,CAAC,YAAW,CAAC,UACJ,AAAC,EAAC,SAAC,IAAG,CAAM;AACrB,AAAI,QAAA,CAAA,OAAM,EAAI,EACV,GAAI,gBAAc,AAAC,EAAC,CACxB,CAAC;AACD,WAAO,IAAI,aAAW,AAAC,CAAC,OAAM,CAAG,KAAG,CAAC,CAAC;IAC1C,EAAG,EAAC,MAAK,CAAC,CAAC,CACf,CAAC;EACL;AACO,SAAS,mBAAiB,CAAE,QAAO,CAAG;AACzC,AAAI,MAAA,CAAA,YAAW,EAAI,CAAA,QAAO,iBAAiB,AAAC,CAAC,gBAAe,AAAC,EAAC,CAAC,CAAC;AAChE,SAAO,CAAA,YAAW,sBAAsB,AAAC,CAAC,WAAU,OAAO,AAAC,CAAC,eAAc,AAAC,EAAC,CAAG,SAAO,CAAC,CAAC,CAAC;EAC9F;AAAA,AA8BO,SAAS,OAAK,CAAE,MAAK,CAAG,CAAA,EAAC,CAAG;AAC/B,SAAO,IAAI,wBAAsB,AAAC,CAAC,MAAK,CAAG,GAAC,CAAC,CAAC;EAClD;AAtJA,AAsJA,UAtJQ,AAAC,0CAAqC,CAAA;AAA9C,UAAQ,AAAC,kBAAqC,CAAA;AAA9C,OAAO;AACD,UAAM,GADZ,SAAS,IAAG;AAAZ,WAAoB,KAAG,KAAkB,CAAC;AAA1C,eAAoB,KAAG,SAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,eAAoB,KAAG,SAAkB,CAAC;AAA1C,oBAAoB,KAAG,cAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,gBAAoB,KAAG,UAAkB,CAAC;AAA1C,gBAAoB,KAAG,UAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,aAAoB,KAAG,OAAkB,CAAC;AAA1C,YAAoB,KAAG,MAAkB,CAAC;AAA1C,sBAAoB,KAAG,gBAAkB,CAAC;AAA1C,6BAAoB,KAAG,uBAAkB,CAAC;AAA1C,YAAoB,KAAG,MAAkB,CAAC;AAA1C,mBAAoB,KAAG,aAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,uBAAoB,KAAG,iBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,iBAAoB,KAAG,WAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,mBAAoB,KAAG,aAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,wBAAoB,KAAG,kBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,6BAAoB,KAAG,uBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,UAAoB,KAAG,IAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,yBAAoB,KAAG,mBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,kBAAoB,KAAG,YAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,iBAAoB,KAAG,WAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,4BAAoB,KAAG,sBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,uBAAoB,KAAG,iBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,mBAAoB,KAAG,aAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,aAAoB,KAAG,OAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,UAAoB,KAAG,IAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,mBAAoB,KAAG,aAAkB,CAAC;AAA1C,sBAAoB,KAAG,gBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,uBAAoB,KAAG,iBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,cAAoB,KAAG,QAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,2BAAoB,KAAG,qBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,uBAAoB,KAAG,iBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,iBAAoB,KAAG,WAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,2BAAoB,KAAG,qBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,kBAAoB,KAAG,YAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,sBAAoB,KAAG,gBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,kBAAoB,KAAG,YAAkB,CAAC;AAA1C,6BAAoB,KAAG,uBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,qBAAoB,KAAG,eAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,0BAAoB,KAAG,oBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,2BAAoB,KAAG,qBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,uBAAoB,KAAG,iBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,qBAAoB,KAAG,eAAkB,CAAC;AAA1C,eAAoB,KAAG,SAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,kBAAoB,KAAG,YAAkB,CAAC;AAA1C,qBAAoB,KAAG,eAAkB,CAAC;AAA1C,2CAAoB,KAAG,qCAAkB,CAAC;AAA1C,yBAAoB,KAAG,mBAAkB,CAAC;AAA1C,mBAAoB,KAAG,aAAkB,CAAC;AAA1C,uBAAoB,KAAG,iBAAkB,CAAC;AAA1C,0BAAoB,KAAG,oBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,iBAAoB,KAAG,WAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,UAAoB,KAAG,IAAkB,CAAC;IAElC,CADuB;AACzB,UAAM;AAFZ,gCAAA,SAAQ,AAAC;AAuJF,eAAM,wBAAsB,CACnB,MAAK,CAAG,CAAA,EAAC,CAAG;AACpB,aAAG,QAAQ,EAAI,OAAK,CAAC;AACrB,aAAG,IAAI,EAAI,GAAC,CAAC;QACjB;AAzJM,AAiKV,aAjKiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC,2BA6J1C,OAAM,CAAN,UAAQ,QAAO;AACX,AAAI,cAAA,CAAA,MAAK,EAAI,CAAA,WAAU,IAAI,AAAC,CAAC,IAAG,QAAQ,GAAG,SAAC,CAAA;mBAAM,CAAA,QAAO,IAAI,AAAC,CAAC,CAAA,CAAC;YAAA,EAAC,CAAC;AAClE,iBAAO,CAAA,eAAc,MAAM,AAAC,CAAC,IAAG,IAAI,CAAG,OAAK,CAAC,CAAC;UAClD,MA/J4D,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;AAApC,cAAQ,AAAC,oDAAqC,CAAA;IAEf;EAC3B,CAAA;AAAM,CAAC,CAAC;AAiK4B;ACpKxC,KAAK,SAAS,AAAC,+NACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,mCAAoB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;AAQ7B,SAAS,MAAI,CAAC,AAAC,CAAE,GAAE;AAAA,AAoC1B,SAAS,UAAQ,CAAE,KAAI,AAAS;AA3CpB,QAAS,GAAA,OAAoB,GAAC;AAAG,eAAoC,CAChE,OAAoB,CAAA,SAAQ,OAAO,CAAG,OAAkB;AAC3D,UAAkB,QAAoC,CAAC,EAAI,CAAA,SAAQ,MAAmB,CAAC;AAAA,AA0C7F,MAAA,CAAA,YAAW,EAAI,CAAA,WAAU,OAAO,IAAM,EAAA,CAAA,CAAI,KAAG,EAAI,CAAA,WAAU,CAAE,WAAU,OAAO,EAAI,EAAA,CAAC,CAAC;AACxF,AAAI,MAAA,CAAA,MAAK,EAAI,IAAI,iBAAe,AAAC,CAAC,YAAW,CAAC,CAAC;AAC/C,cAAU,KAAK,AAAC,CAAC,MAAK,CAAC,CAAC;AACxB,AAAI,MAAA,CAAA,KAAI,EAAI,MAAI,gBAhDpB,CAAA,eAAc,OAAO,CAgDI,IAAG,CAhDY,CAgDX,CAAC;AAC1B,cAAU,IAAI,AAAC,EAAC,CAAC;AACjB,SAAO,MAAI,CAAC;EAChB;AACO,SAAS,SAAO,CAAE,AAAM;AAnDnB,QAAS,GAAA,OAAoB,GAAC;AAAG,aAAoB,EAAA,CAChD,OAAoB,CAAA,SAAQ,OAAO,CAAG,OAAkB;AAC3D,eAAmC,EAAI,CAAA,SAAQ,MAAmB,CAAC;AAAA,AAkD7E,SAAO,UAAQ,gBArDnB,CAAA,eAAc,OAAO,EAqDA,WAAU,EAAM,KAAG,CArDA,EAqDE;EAC1C;AACO,SAAS,UAAQ,CAAE,AAAM;AAtDpB,QAAS,GAAA,OAAoB,GAAC;AAAG,aAAoB,EAAA,CAChD,OAAoB,CAAA,SAAQ,OAAO,CAAG,OAAkB;AAC3D,eAAmC,EAAI,CAAA,SAAQ,MAAmB,CAAC;AAAA,AAqD7E,SAAO,UAAQ,gBAxDnB,CAAA,eAAc,OAAO,EAwDA,YAAW,EAAM,KAAG,CAxDD,EAwDG;EAC3C;AACO,SAAS,UAAQ,CAAE,AAAM;AAzDpB,QAAS,GAAA,OAAoB,GAAC;AAAG,aAAoB,EAAA,CAChD,OAAoB,CAAA,SAAQ,OAAO,CAAG,OAAkB;AAC3D,eAAmC,EAAI,CAAA,SAAQ,MAAmB,CAAC;AAAA,AAwD7E,SAAO,UAAQ,gBA3DnB,CAAA,eAAc,OAAO,EA2DA,YAAW,EAAM,KAAG,CA3DD,EA2DG;EAC3C;AACO,SAAS,WAAS,CAAE,EAAC,CAAG;AAC3B,OAAI,WAAU,OAAO,EAAI,EAAA,CAAG;AAExB,AAAI,QAAA,CAAA,MAAK,EAAI,CAAA,WAAU,CAAE,WAAU,OAAO,EAAI,EAAA,CAAC,CAAC;AAChD,SAAI,CAAC,CAAC,EAAC,WAAa,wBAAsB,CAAC,CAAG;AAC1C,SAAC,EAAI,CAAA,MAAK,AAAC,CAAC,EAAC,CAAG,GAAC,CAAC,CAAC;MACvB;AAAA,AACA,WAAK,WAAW,AAAC,CAAC,EAAC,CAAC,CAAC;IACzB,KACK;AAED,kBAAY,AAAC,CAAC,EAAC,CAAC,CAAC;IACrB;AAAA,EACJ;AAAA,AAaO,SAAS,mBAAiB,CAAE,EAAC;AAChC,gBAAY,AAAC,EAAC,SAAA,AAAC;AACX,AAAI,QAAA,CAAA,QAAO,EAAI,CAAA,EAAC,AAAC,EAAC,CAAC;AACnB,SAAI,CAAC,QAAO;AACR,eAAM;AAAA,AACV,iBAAW,EA5FnB,CAAA,eAAc,OAAO,CA4FM,YAAW,CAAM,SAAO,CA5FX,AA4FY,CAAC;IACjD,EAAC,CAAC;EACN;AACA,SAAS,IAAE,CAAE,KAAI,CAAG,CAAA,IAAG,CAAG,CAAA,EAAC,CAAG,CAAA,OAAM;AAChC,AAAI,MAAA,CAAA,MAAK,EAAI,CAAA,WAAU,CAAE,WAAU,OAAO,EAAI,EAAA,CAAC,CAAC;AAChD,QAAI,AAAC,CAAC,IAAG,CAAG,UAAU,IAAG;AACrB,AAAI,QAAA,CAAA,KAAI,EAAI,MAAI,CAAC;AACjB,AAAI,QAAA,CAAA,gBAAe,EAAI,CAAA,IAAG,AAAC,CAAC,kBAAiB,CAAC,UACjC,AAAC,EAAC,SAAA,AAAC,CAAK;AAEjB,WAAI,CAAC,IAAG;AACJ,cAAM,IAAI,MAAI,AAAC,CAAC,sDAAqD,CAAC,CAAC;AAAA,AAC3E,YAAI,EAAI,KAAG,CAAC;AACZ,aAAO,IAAI,mBAAiB,AAAC,CAAC,IAAG,CAAC,CAAC;MACvC,EAAC,CAAC;AACF,AAAI,QAAA,CAAA,QAAO,EAAI,CAAA,kBAAiB,AAAC,CA3GzC,eAAc,OAAO,CA2GyB,YAAW,GAAG,gBAAe,EA3GnC,CA2GqC,CAAC;AACtE,WAAK,IAAI,AAAC,CAAC,QAAO,CAAC,CAAC;AACpB,SAAI,CAAC,CAAC,EAAC,WAAa,wBAAsB,CAAC,CAAG;AAC1C,SAAC,EAAI,CAAA,MAAK,AAAC,CAAC,EAAC,CAAG,GAAC,CAAC,CAAC;MACvB;AAAA,AACA,SAAG,EAAI,KAAG,CAAC;AACX,OAAC,QAAQ,AAAC,CAAC,QAAO,CAAC,CAAC;AACpB,SAAG,EAAI,MAAI,CAAC;AACZ,SAAI,CAAC,KAAI;AACL,WAAG,AAAC,EAAC,CAAC;AAAA,IACd,CAAG,QAAM,CAAC,CAAC;EACf;AACO,SAAS,GAAC,CAAE,IAAG,CAAG,CAAA,EAAC,AAAgB,CAAG;MAAhB,QAAM,6CAAI,KAAG;AACtC,SAAO,CAAA,GAAE,AAAC,CAAC,KAAI,CAAG,KAAG,CAAG,GAAC,CAAG,QAAM,CAAC,CAAC;EACxC;AAAA,AACO,SAAS,IAAE,CAAE,IAAG,CAAG,CAAA,EAAC,AAAgB,CAAG;MAAhB,QAAM,6CAAI,KAAG;AACvC,SAAO,CAAA,GAAE,AAAC,CAAC,MAAK,CAAG,KAAG,CAAG,GAAC,CAAG,QAAM,CAAC,CAAC;EACzC;AAAA,AACO,SAAS,IAAE,CAAE,IAAG,CAAG,CAAA,EAAC,AAAgB,CAAG;MAAhB,QAAM,6CAAI,KAAG;AACvC,SAAO,CAAA,GAAE,AAAC,CAAC,MAAK,CAAG,KAAG,CAAG,GAAC,CAAG,QAAM,CAAC,CAAC;EACzC;AAAA,AAsKA,SAAS,YAAU,CAAE,CAAA;AACjB,AAAI,MAAA,CAAA,QAAO,IAAI,SAAC,CAAA,CAAM;AAClB,AAAI,QAAA,CAAA,QAAO,EAAI,CAAA,GAAE,WAAW,AAAC,CAAC,CAAA,CAAC,CAAC;AAChC,WAAO,CAAA,QAAO,GAAK,CAAA,QAAO,OAAO,EAAI,EAAA,CAAC;IAC1C,CAAA,CAAC;AACD,OAAI,CAAA,WAAa,MAAI,CAAG;AACpB,WAAO,CAAA,CAAA,IAAI,AAAC,EAAC,SAAC,EAAC;aAAM,CAAA,WAAU,AAAC,CAAC,EAAC,CAAC;MAAA,EAAC,KAAK,AAAC,CAAC,EAAC,CAAC,CAAC;IAClD;AAAA,AACA,OAAI,GAAE,cAAc,AAAC,CAAC,CAAA,CAAC,CAAG;AACtB,WAAO,GAAC,CAAC;IACb;AAAA,AACA,OAAI,GAAE,cAAc,AAAC,CAAC,CAAA,CAAC,CAAA,EAAK,CAAA,GAAE,QAAQ,AAAC,CAAC,CAAA,CAAC,CAAA,EAAK,UAAQ,CAAG;AACrD,WAAO,CAAA,WAAU,AAAC,CAAC,KAAI,UAAU,MAAM,MAAM,AAAC,CAAC,GAAE,oBAAoB,AAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;IAC/E;AAAA,AACA,OAAI,GAAE,cAAc,AAAC,CAAC,CAAA,CAAC,CAAG;AACtB,WAAO,CAAA,WAAU,AAAC,CAAC,GAAE,iBAAiB,AAAC,CAAC,GAAE,cAAc,AAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;IAClE;AAAA,AACA,OAAI,QAAO,AAAC,CAAC,CAAA,CAAC,CAAG;AACb,WAAO,CAAA,WAAU,AAAC,CAAC,GAAE,iBAAiB,AAAC,CAAC,CAAA,CAAC,CAAC,CAAC;IAC/C;AAAA,AACA,SAAO,CAAA,GAAE,QAAQ,AAAC,CAAC,CAAA,CAAC,CAAC;EACzB;AACO,SAAS,cAAY,CAAC,AAAC,CAAE;AAC5B,SAAO,CAAA,MAAK,KAAK,WAAW,IAAM,KAAG,CAAC;EAC1C;AA7TA,AA6TA,UA7TQ,AAAC,gBAAqC,CAAA;AAA9C,UAAQ,AAAC,sBAAqC,CAAA;AAA9C,UAAQ,AAAC,wBAAqC,CAAA;AAA9C,UAAQ,AAAC,wBAAqC,CAAA;AAA9C,UAAQ,AAAC,0BAAqC,CAAA;AAA9C,UAAQ,AAAC,0CAAqC,CAAA;AAA9C,UAAQ,AAAC,UAAqC,CAAA;AAA9C,UAAQ,AAAC,YAAqC,CAAA;AAA9C,UAAQ,AAAC,YAAqC,CAAA;AAA9C,UAAQ,AAAC,gCAAqC,CAAA;AAA9C,OAAO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AAAf,UAAoB,KAAG,IAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,uBAAoB,KAAG,iBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,aAAoB,KAAG,OAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,WAAoB,KAAG,KAAkB,CAAC;IAElC,CAFR,UAAS,IAAG,CAAG;AAAf,uBAAoB,KAAG,iBAAkB,CAAC;IAElC,CAFR,UAAS,IAAG;AAAZ,yBAAoB,KAAG,mBAAkB,CAAC;AAA1C,8BAAoB,KAAG,wBAAkB,CAAC;AAA1C,aAAoB,KAAG,OAAkB,CAAC;AAA1C,cAAQ,AAAC,UAAoB,KAAG,QAAmB,CAAC;IAE5C,CADuB;AACzB,UAAM;cAOE,EAAC,MAAO,OAAK,CAAA,GAAM,YAAU,CAAA,CAAI,OAAK,EAAI,OAAK,CAAC;gBACvC,CAAA,OAAM,UAAU;AAVvC,cAAQ,AAAC,wBAAqC,CAAA;aAW1B,CAAA,OAAM,OAAO;AAXjC,cAAQ,AAAC,kBAAqC,CAAA;iBAatB,MAAI;AAb5B,cAAQ,AAAC,0BAAqC,CAAA;AAA9C,2BAAA,SAAQ,AAAC;AAcF,eAAM,mBAAiB,CACd,IAAG,CAAG;AACd,aAAG,MAAM,EAAI,KAAG,CAAC;QACrB;AAfM,AAiBV,aAjBiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC,sBAgB1C,IAAG,CAAH,UAAI,AAAC,CAAE;AAAE,eAAG,MAAM,AAAC,EAAC,CAAC;UAAE,MAfqC,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;AAApC,cAAQ,AAAC,0CAAqC,CAAA;oBAoB1B,CAAA,OAAM,WAAW;kBACnB,CAAA,OAAM,SAAS;mBACd,CAAA,OAAM,UAAU;mBAChB,CAAA,OAAM,UAAU;YACvB,CAAA,OAAM,GAAG;aACR,CAAA,OAAM,IAAI;aACV,CAAA,OAAM,IAAI;kBACL,GAAC;WACR,MAAI;AA5Bf,yBAAA,SAAQ,AAAC;AA8BT,eAAM,iBAAe,CACL,MAAK,CAAG;AAChB,aAAG,KAAK,EAAI,GAAC,CAAC;AACd,aAAG,QAAQ,EAAI,OAAK,CAAC;QACzB;AAhCM,AAuCV,aAvCiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC;AAiC1C,mBAAS,CAAT,UAAW,EAAC,CAAG;AAAE,eAAG,KAAK,KAAK,AAAC,CAAC,EAAC,CAAC,CAAC;UAAE;AACrC,YAAE,CAAF,UAAI,QAAO;AACP,eAAI,IAAG,QAAQ;AACX,iBAAG,QAAQ,IAAI,AAAC,CAAC,QAAO,CAAC,CAAC;AAAA,AAC9B,eAAG,KAAK,QAAQ,AAAC,EAAC,SAAC,EAAC;mBAAM,CAAA,EAAC,QAAQ,AAAC,CAAC,QAAO,CAAC;YAAA,EAAC,CAAC;UACnD;aArC4D,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;AA2CpC,kBAAY,AAAC,EAAC,SAAA,AAAC,CAAK;AAAE,mBAAW,EAAI,GAAC,CAAC;MAAE,EAAC,CAAC;AAyF3C,QAAE,UAAU,CAAE,iBAAgB,CAAC,EAAI,UAAS,AAAC;AACzC,AAAI,UAAA,CAAA,CAAA,EAAI,KAAG,CAAC;AACZ,WAAI,CAAC,CAAA,CAAG;AACJ,eAAO,CAAA,EAAC,EAAI,EAAA,CAAC;QACjB;AAAA,AACI,UAAA,CAAA,GAAE,EAAI,GAAC,CAAC;AACZ,QAAA,QAAQ,AAAC,EAAC,SAAC,CAAA,CAAG,CAAA,CAAA,CAAM;AAAE,YAAE,KAAK,AAAC,EAAI,CAAA,EAAC,IAAG,EAAC,EAAA,EAAG,CAAC;QAAE,EAAC,CAAC;AAC/C,eAAO,IAAI,EAAC,CAAA,GAAE,KAAK,AAAC,CAAC,GAAE,CAAC,CAAA,CAAC,KAAG,EAAC;MACjC,CAAC;AACD,YAAM,WAAW,AAAC,CAAC,SAAS,AAAC;AACzB,cAAM,YAAY,AAAC,CAAC;AAEhB,gBAAM,CAAG,UAAU,IAAG,CAAG,CAAA,qBAAoB;AACzC,iBAAO,EACH,OAAM,CAAG,UAAU,MAAK,CAAG,CAAA,QAAO,CAAG;AACjC,qBAAO,EAAE,IAAG,CAAG,CAAA,IAAG,OAAO,AAAC,CAAC,MAAK,CAAG,SAAO,CAAG,EAAC,UAAS,CAAC,CAAC,CAAE,CAAC;cAChE,CACJ,CAAC;AACD,mBAAS,WAAS,CAAE,MAAK,CAAG,CAAA,QAAO;AAC/B,iBAAI,MAAK,WAAa,IAAE,CAAG;AACvB,AAAI,kBAAA,CAAA,IAAG,EAAI,CAAA,MAAK,KAAK,IAAM,CAAA,QAAO,KAAK,CAAC;AACxC,mBAAI,IAAG,CAAG;AACN,uBAAK,QAAQ,AAAC,EAAC,SAAC,CAAA,CAAG,CAAA,CAAA,CAAM;AAAE,uBAAG,EAAI,CAAA,IAAG,GAAK,CAAA,IAAG,OAAO,AAAC,CAAC,CAAA,CAAG,CAAA,QAAO,IAAI,AAAC,CAAC,CAAA,CAAC,CAAC,CAAC;kBAAE,EAAC,CAAC;gBACjF;AAAA,AACA,qBAAO,KAAG,CAAC;cACf,KACK;AACD,qBAAO,UAAQ,CAAC;cACpB;AAAA,YACJ;UACJ;AACA,oBAAU,CAAG,UAAS,AAAC,CAAE;AACrB,iBAAO,EACH,OAAM,CAAG,UAAU,MAAK,CAAG,CAAA,aAAY,CAAG;AACtC,AAAI,kBAAA,CAAA,IAAG,EAAI,CAAA,MAAO,OAAK,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,OAAK,KAAK,CAAA,GAAM,WAAS,CAAC;AAC1E,qBAAO;AAAE,qBAAG,CAAG,KAAG;AAAG,oBAAI,QAAM,EAAI;AAAE,yBAAO,CAAA,WAAU,EAAI,OAAK,CAAA,CAAI,mBAAiB,CAAC;kBAAE;AAAA,gBAAE,CAAC;cAC9F,CACJ,CAAC;UACL;AACA,yBAAe,CAAG,UAAS,AAAC,CAAE;AAC1B,iBAAO,EACH,OAAM,CAAG,UAAU,MAAK,CAAG,CAAA,aAAY,CAAG;AACtC,AAAI,kBAAA,CAAA,IAAG,EAAI,CAAA,MAAO,OAAK,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAK,WAAa,cAAY,CAAC;AACxE,qBAAO;AACH,qBAAG,CAAG,KAAG;AACT,oBAAI,QAAM,EAAI;AACV,yBAAO,CAAA,WAAU,EAAI,OAAK,CAAA,CAAI,yBAAuB,CAAA,CAAI,cAAY,CAAC;kBAC1E;AAAA,gBACJ,CAAC;cACL,CACJ,CAAC;UACL;AACA,mBAAS,CAAG,UAAS,AAAC,CAAE;AACpB,iBAAO,EACH,OAAM,CAAG,UAAU,MAAK,CAAG,CAAA,YAAW,CAAG;AACrC,AAAI,kBAAA,CAAA,UAAS,EAAI,CAAA,WAAU,AAAC,CAAC,MAAK,CAAC,CAAC;AACpC,qBAAO;AACH,qBAAG,CAAG,CAAA,UAAS,GAAK,aAAW;AAC/B,oBAAI,QAAM,EAAI;AAAE,yBAAO,CAAA,WAAU,EAAI,WAAS,CAAA,CAAI,mBAAiB,CAAA,CAAI,aAAW,CAAC;kBAAE;AAAA,gBACzF,CAAC;cACL,CACJ,CAAC;UACL;AACA,uBAAa,CAAG,UAAS,AAAC,CAAE;AACxB,iBAAO,EACH,OAAM,CAAG,UAAU,MAAK,CAAG,CAAA,YAAW,CAAG;AACrC,AAAI,kBAAA,CAAA,YAAW,EAAI,CAAA,gBAAe,kBAAkB,AAAC,CAAC,MAAK,CAAC,CAAC;AAC7D,qBAAO;AACH,qBAAG,CAAG,CAAA,YAAW,QAAQ,AAAC,CAAC,YAAW,CAAC,CAAA,CAAI,EAAC,CAAA;AAC5C,oBAAI,QAAM,EAAI;AAAE,yBAAO,CAAA,WAAU,EAAI,aAAW,CAAA,CAAI,eAAa,CAAA,CAAI,aAAW,CAAC;kBAAE;AAAA,gBACvF,CAAC;cACL,CACJ,CAAC;UACL;AACA,yBAAe,CAAG,UAAS,AAAC,CAAE;AAC1B,iBAAO,EACH,OAAM,CAAG,UAAU,MAAK,CAAG,CAAA,YAAW,CAAG;AACrC,kBAAI;AACA,uBAAK,AAAC,EAAC,CAAC;AACR,uBAAO;AACH,uBAAG,CAAG,MAAI;AACV,sBAAI,QAAM,EAAI;AAAE,2BAAO,2CAAyC,CAAC;oBAAE;AAAA,kBACvE,CAAC;gBACL,CACA,OAAO,CAAA,CAAG;AACN,AAAI,oBAAA,CAAA,YAAW,EAAI,CAAA,gBAAe,kBAAkB,AAAC,CAAC,CAAA,CAAC,CAAC;AACxD,uBAAO;AACH,uBAAG,CAAG,CAAA,YAAW,QAAQ,AAAC,CAAC,YAAW,CAAC,CAAA,CAAI,EAAC,CAAA;AAC5C,sBAAI,QAAM,EAAI;AAAE,2BAAO,CAAA,WAAU,EAAI,aAAW,CAAA,CAAI,eAAa,CAAA,CAAI,aAAW,CAAC;oBAAE;AAAA,kBACvF,CAAC;gBACL;AAAA,cACJ,CACJ,CAAC;UACL;AACA,oBAAU,CAAG,UAAS,AAAC;AACnB,iBAAO,EACH,OAAM,CAAG,UAAU,YAAW,CAAG,CAAA,iBAAgB;AAC7C,AAAI,kBAAA,CAAA,QAAO,EAAI,CAAA,MAAK,KAAK,AAAC,CAAC,YAAW,YAAY,UAAU,CAAC,CAAC;AAC9D,AAAI,kBAAA,CAAA,QAAO,EAAI,CAAA,MAAK,KAAK,AAAC,CAAC,iBAAgB,UAAU,CAAC,CAAC;AACvD,AAAI,kBAAA,CAAA,aAAY,EAAI,GAAC,CAAC;AACtB,uBAAO,QAAQ,AAAC,EAAC,SAAC,CAAA,CAAM;AACpB,qBAAI,CAAC,YAAW,YAAY,UAAU,CAAE,CAAA,CAAC;AACrC,gCAAY,KAAK,AAAC,CAAC,CAAA,CAAC,CAAC;AAAA,gBAC7B,EAAC,CAAC;AACF,qBAAO;AACH,qBAAG,CAAG,CAAA,aAAY,OAAO,GAAK,EAAA;AAC9B,oBAAI,QAAM,EAAI;AACV,yBAAO,CAAA,WAAU,EAAI,aAAW,CAAA,CAAI,mCAAiC,CAAA,CACjE,CAAA,aAAY,KAAK,AAAC,CAAC,IAAG,CAAC,CAAC;kBAChC;AAAA,gBACJ,CAAC;cACL,CACJ,CAAC;UACL;AAAA,QACJ,CAAC,CAAC;MACN,CAAC,CAAC;AAvPF,kBAAA,SAAQ,AAAC;AAwPF,eAAM,UAAQ,CACL,AAAU,CAAG;YAAb,KAAG,6CAAI,KAAG;AAClB,aAAI,IAAG,CAAG;AACN,gBAAS,GAAA,CAAA,IAAG,CAAA,EAAK,CAAA,IAAG,UAAU,CAAG;AAC7B,AAAI,gBAAA,CAAA,CAAA,EAAI,KAAG,CAAC;AACZ,gBAAI;AACA,gBAAA,EAAI,CAAA,IAAG,UAAU,CAAE,IAAG,CAAC,CAAC;cAC5B,CACA,OAAO,CAAA,CAAG,GACV;AAAA,AACA,iBAAI,MAAO,EAAA,CAAA,GAAM,WAAS,CAAG;AACzB,mBAAG,IAAI,AAAC,CAAC,IAAG,CAAC,CAAC;cAClB;AAAA,YACJ;AAAA,UACJ;AAAA,QACJ;AArQM,AAkSV,aAlSiB,CAAA,CAAC,eAAc,YAAY,CAAC,AAAC;AAuQ1C,qBAAW,CAAX,UAAa,IAAG,CAAG,GAAE;AACrB,YAAE,CAAF,UAAI,IAAG,CAAG;AACN,eAAI,CAAC,IAAG,CAAE,IAAG,CAAC,CAAG;AACb,iBAAG,CAAE,IAAG,CAAC,EAAI,CAAA,IAAG,6BAA6B,AAAC,CAAC,IAAG,CAAC,CAAC;YACxD;AAAA,AACA,iBAAO,CAAA,IAAG,CAAE,IAAG,CAAC,CAAC;UACrB;AAWA,mBAAS,CAAT,UAAW,KAAI,CAAG;AAAE,iBAAO,KAAG,CAAC;UAAE;AACjC,qCAA2B,CAA3B,UAA6B,IAAG,CAAG;AAC/B,AAAI,cAAA,CAAA,MAAK,EAAI,CAAA,OAAM,UAAU,AAAC,CAAC,IAAG,CAAC,CAAC;AACpC,iBAAK,YAAY,EAAI,CAAA,MAAK,IAAI,SAAS,CAAC;AACxC,iBAAK,UAAU,EAAI,CAAA,MAAK,IAAI,YAAY,CAAC;AACzC,iBAAK,MAAM,EAAI,CAAA,MAAK,MAAM,MAAM,CAAC;AAEjC,iBAAK,IAAI,YAAY,AAAC,CAAC,IAAG,CAAC,CAAC;AAC5B,iBAAO,OAAK,CAAC;UACjB;AAAA,WAnBO,IAAG,CAAV,UAAY,AAA6C;cAA7C,OAAK,6CAAI,KAAG;cAAG,OAAK,6CAAI,KAAG;cAAG,UAAQ,6CAAI,KAAG;AACrD,eAAI,CAAC,CAAC,MAAK,WAAa,UAAQ,CAAC,CAAG;AAChC,sBAAQ,EAAI,OAAK,CAAC;AAClB,mBAAK,EAAI,OAAK,CAAC;AACf,mBAAK,EAAI,IAAI,UAAQ,AAAC,EAAC,CAAC;YAC5B;AAAA,AACI,cAAA,CAAA,CAAA,EAAI,CAAA,gBAAe,MAAM,AAAC,CAAC,MAAK,CAAG,UAAQ,CAAC,CAAC;AACjD,2BAAe,QAAQ,AAAC,CAAC,CAAA,GAAG,SAAC,KAAI,CAAG,CAAA,GAAE,CAAM;AAAE,mBAAK,IAAI,AAAC,CAAC,GAAE,CAAC,UAAU,AAAC,CAAC,KAAI,CAAC,CAAC;YAAE,EAAC,CAAC;AAClF,iBAAO,OAAK,CAAC;UACjB,EAtR4D,CAAC;MACzD,AAAC,EAAC,CAJ0B,CAAA;AAApC,cAAQ,AAAC,wBAAqC,CAAA;IAEf;EAC3B,CAAA;AAAM,CAAC,CAAC;AA2TuB;AC9TnC,KAAK,SAAS,AAAC,8JACc,UAAS,SAAQ;;AAD9C,AAAI,IAAA,CAAA,YAAW,kBAAoB,CAAC;AAC1B,AAAI,IAAA,CAAA,cAAa,KAAoB,CAAC;AAAtC,AAAI,IAAA,CAAA,cAAa,KAAoB,CAAC;AAAtC,AAAI,IAAA,CAAA,cAAa,KAAoB,CAAC;AAAtC,AAAI,IAAA,CAAA,cAAa,KAAoB,CAAC;AADhD,OAAO;AACD,UAAM,GADZ,SAAS,IAAG,CAAG;AACL,WAAK,KAAK,AAAC,CAAC,IAAG,CAAC,QAAQ,AAAC,CAAC,SAAS,CAAA,CAAG;AACpC,WAAI,CAAC,cAAa,CAAE,CAAA,CAAC;AACnB,kBAAQ,AAAC,CAAC,CAAA,CAAG,CAAA,IAAG,CAAE,CAAA,CAAC,CAAC,CAAC;AAAA,MACzB,CAAC,CAAC;IAFJ,CAFR,UAAS,IAAG,CAAG;AACL,WAAK,KAAK,AAAC,CAAC,IAAG,CAAC,QAAQ,AAAC,CAAC,SAAS,CAAA,CAAG;AACpC,WAAI,CAAC,cAAa,CAAE,CAAA,CAAC;AACnB,kBAAQ,AAAC,CAAC,CAAA,CAAG,CAAA,IAAG,CAAE,CAAA,CAAC,CAAC,CAAC;AAAA,MACzB,CAAC,CAAC;IAFJ,CAFR,UAAS,IAAG,CAAG;AACL,WAAK,KAAK,AAAC,CAAC,IAAG,CAAC,QAAQ,AAAC,CAAC,SAAS,CAAA,CAAG;AACpC,WAAI,CAAC,cAAa,CAAE,CAAA,CAAC;AACnB,kBAAQ,AAAC,CAAC,CAAA,CAAG,CAAA,IAAG,CAAE,CAAA,CAAC,CAAC,CAAC;AAAA,MACzB,CAAC,CAAC;IAFJ,CAFR,UAAS,IAAG,CAAG;AACL,WAAK,KAAK,AAAC,CAAC,IAAG,CAAC,QAAQ,AAAC,CAAC,SAAS,CAAA,CAAG;AACpC,WAAI,CAAC,cAAa,CAAE,CAAA,CAAC;AACnB,kBAAQ,AAAC,CAAC,CAAA,CAAG,CAAA,IAAG,CAAE,CAAA,CAAC,CAAC,CAAC;AAAA,MACzB,CAAC,CAAC;IAFJ,CADuB;AACzB,UAAM,eAAmB;EAC3B,CAAA;AAAM,CAAC,CAAC;AASmB","file":"dist/js/bundle/test_lib.dev.js"} \ No newline at end of file