├── .penv.json ├── README.md ├── builds └── development │ ├── css │ └── style.css │ ├── images │ └── angular.png │ ├── index.html │ ├── js │ ├── app.component.js │ ├── app.component.js.map │ ├── boot.js │ ├── boot.js.map │ └── lib │ │ └── angular2 │ │ ├── Rx.js │ │ ├── angular2-polyfills.js │ │ ├── angular2.dev.js │ │ ├── es6-shim.min.js │ │ ├── system-polyfills.js │ │ └── system.src.js │ └── views │ └── app.component.html ├── gulpfile.js ├── package.json ├── process └── typescript │ ├── app.component.ts │ └── boot.ts └── tsconfig.json /.penv.json: -------------------------------------------------------------------------------- 1 | {"preview":"http://localhost:8000","terminals":[{"name":"Gulp","command":"gulp\r"}],"files":["process/typescript/app.component.ts","builds/development/index.html"],"ui":{"bottom":false}} -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # angular2 basic template 2 | -------------------------------------------------------------------------------- /builds/development/css/style.css: -------------------------------------------------------------------------------- 1 | 2 | html, body { 3 | height: 100%; 4 | } 5 | 6 | body { 7 | margin: 0; 8 | padding: 0; 9 | width: 100%; 10 | display: table; 11 | font-weight: 100; 12 | font-family: 'Lato'; 13 | } 14 | 15 | .container { 16 | text-align: center; 17 | display: table-cell; 18 | vertical-align: middle; 19 | } 20 | 21 | .content { 22 | text-align: center; 23 | display: inline-block; 24 | } 25 | 26 | .title { 27 | font-size: 96px; 28 | } -------------------------------------------------------------------------------- /builds/development/images/angular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hussien89aa/angular2/c97379d25905b13a242be9a5a318b79f28309f55/builds/development/images/angular.png -------------------------------------------------------------------------------- /builds/development/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Learn AngularJS2 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 37 | 38 | 39 | 40 |
41 | 42 | Loading... 43 | 44 |
45 | 46 | 47 | -------------------------------------------------------------------------------- /builds/development/js/app.component.js: -------------------------------------------------------------------------------- 1 | System.register(['angular2/core'], function(exports_1, context_1) { 2 | "use strict"; 3 | var __moduleName = context_1 && context_1.id; 4 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 5 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 6 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 7 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 8 | return c > 3 && r && Object.defineProperty(target, key, r), r; 9 | }; 10 | var __metadata = (this && this.__metadata) || function (k, v) { 11 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 12 | }; 13 | var core_1; 14 | var AppComponent; 15 | return { 16 | setters:[ 17 | function (core_1_1) { 18 | core_1 = core_1_1; 19 | }], 20 | execute: function() { 21 | AppComponent = (function () { 22 | function AppComponent() { 23 | this.Message = "Angular2"; 24 | } 25 | AppComponent = __decorate([ 26 | core_1.Component({ 27 | selector: 'my-app', 28 | // template: '

Welcome to Angualr 2

' 29 | templateUrl: 'views/app.component.html' 30 | }), 31 | __metadata('design:paramtypes', []) 32 | ], AppComponent); 33 | return AppComponent; 34 | }()); 35 | exports_1("AppComponent", AppComponent); 36 | } 37 | } 38 | }); 39 | 40 | //# sourceMappingURL=app.component.js.map 41 | -------------------------------------------------------------------------------- /builds/development/js/app.component.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["app.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;YAQA;gBAAA;oBACE,YAAO,GAAS,UAAU,CAAA;gBAE5B,CAAC;gBATD;oBAAC,gBAAS,CAAC;wBACT,QAAQ,EAAE,QAAQ;wBACnB,8CAA8C;wBAC7C,WAAW,EAAC,0BAA0B;qBACvC,CAAC;;gCAAA;gBAKF,mBAAC;YAAD,CAHA,AAGC,IAAA;YAHD,uCAGC,CAAA","file":"app.component.js","sourcesContent":["import {Component} from 'angular2/core';\n\n@Component({\n selector: 'my-app',\n // template: '

Welcome to Angualr 2

'\n templateUrl:'views/app.component.html'\n})\n\nexport class AppComponent {\n Message:string= \"Angular2\"\n\n}\n"],"sourceRoot":"/source/"} -------------------------------------------------------------------------------- /builds/development/js/boot.js: -------------------------------------------------------------------------------- 1 | System.register(['angular2/platform/browser', './app.component'], function(exports_1, context_1) { 2 | "use strict"; 3 | var __moduleName = context_1 && context_1.id; 4 | var browser_1, app_component_1; 5 | return { 6 | setters:[ 7 | function (browser_1_1) { 8 | browser_1 = browser_1_1; 9 | }, 10 | function (app_component_1_1) { 11 | app_component_1 = app_component_1_1; 12 | }], 13 | execute: function() { 14 | browser_1.bootstrap(app_component_1.AppComponent); 15 | } 16 | } 17 | }); 18 | 19 | //# sourceMappingURL=boot.js.map 20 | -------------------------------------------------------------------------------- /builds/development/js/boot.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["boot.ts"],"names":[],"mappings":";;;;;;;;;;;;;YAGA,mBAAS,CAAC,4BAAY,CAAC,CAAC","file":"boot.js","sourcesContent":["import {bootstrap} from 'angular2/platform/browser';\nimport {AppComponent} from './app.component';\n\nbootstrap(AppComponent);\n"],"sourceRoot":"/source/"} -------------------------------------------------------------------------------- /builds/development/js/lib/angular2/angular2-polyfills.js: -------------------------------------------------------------------------------- 1 | /** 2 | @license 3 | Copyright 2014-2015 Google, Inc. http://angularjs.org 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | 17 | */ 18 | 19 | (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; 220 | 221 | var resolvedPromise; 222 | 223 | // TODO(vicb): remove '!isFirefox' when the bug gets fixed: 224 | // https://bugzilla.mozilla.org/show_bug.cgi?id=1162013 225 | if (hasNativePromise && !isFirefox) { 226 | // When available use a native Promise to schedule microtasks. 227 | // When not available, es6-promise fallback will be used 228 | resolvedPromise = Promise.resolve(); 229 | } 230 | 231 | var es6Promise = require('es6-promise').Promise; 232 | 233 | if (resolvedPromise) { 234 | es6Promise._setScheduler(function(fn) { 235 | resolvedPromise.then(fn); 236 | }); 237 | } 238 | 239 | // es6-promise asap should schedule microtasks via zone.scheduleMicrotask so that any 240 | // user defined hooks are triggered 241 | es6Promise._setAsap(function(fn, arg) { 242 | global.zone.scheduleMicrotask(function() { 243 | fn(arg); 244 | }); 245 | }); 246 | 247 | // The default implementation of scheduleMicrotask use the original es6-promise implementation 248 | // to schedule a microtask 249 | function scheduleMicrotask(fn) { 250 | es6Promise._asap(this.bind(fn)); 251 | } 252 | 253 | function addMicrotaskSupport(zoneClass) { 254 | zoneClass.prototype.scheduleMicrotask = scheduleMicrotask; 255 | return zoneClass; 256 | } 257 | 258 | module.exports = { 259 | addMicrotaskSupport: addMicrotaskSupport 260 | }; 261 | 262 | 263 | 264 | 265 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 266 | },{"es6-promise":17}],5:[function(require,module,exports){ 267 | (function (global){ 268 | 'use strict'; 269 | 270 | var fnPatch = require('./functions'); 271 | var promisePatch = require('./promise'); 272 | var mutationObserverPatch = require('./mutation-observer'); 273 | var definePropertyPatch = require('./define-property'); 274 | var registerElementPatch = require('./register-element'); 275 | var webSocketPatch = require('./websocket'); 276 | var eventTargetPatch = require('./event-target'); 277 | var propertyDescriptorPatch = require('./property-descriptor'); 278 | var geolocationPatch = require('./geolocation'); 279 | var fileReaderPatch = require('./file-reader'); 280 | 281 | function apply() { 282 | fnPatch.patchSetClearFunction(global, [ 283 | 'timeout', 284 | 'interval', 285 | 'immediate' 286 | ]); 287 | 288 | fnPatch.patchRequestAnimationFrame(global, [ 289 | 'requestAnimationFrame', 290 | 'mozRequestAnimationFrame', 291 | 'webkitRequestAnimationFrame' 292 | ]); 293 | 294 | fnPatch.patchFunction(global, [ 295 | 'alert', 296 | 'prompt' 297 | ]); 298 | 299 | eventTargetPatch.apply(); 300 | 301 | propertyDescriptorPatch.apply(); 302 | 303 | promisePatch.apply(); 304 | 305 | mutationObserverPatch.patchClass('MutationObserver'); 306 | mutationObserverPatch.patchClass('WebKitMutationObserver'); 307 | 308 | definePropertyPatch.apply(); 309 | 310 | registerElementPatch.apply(); 311 | 312 | geolocationPatch.apply(); 313 | 314 | fileReaderPatch.apply(); 315 | } 316 | 317 | module.exports = { 318 | apply: apply 319 | }; 320 | 321 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 322 | },{"./define-property":6,"./event-target":7,"./file-reader":8,"./functions":9,"./geolocation":10,"./mutation-observer":11,"./promise":12,"./property-descriptor":13,"./register-element":14,"./websocket":15}],6:[function(require,module,exports){ 323 | 'use strict'; 324 | 325 | var keys = require('../keys'); 326 | 327 | // might need similar for object.freeze 328 | // i regret nothing 329 | 330 | var _defineProperty = Object.defineProperty; 331 | var _getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; 332 | var _create = Object.create; 333 | var unconfigurablesKey = keys.create('unconfigurables'); 334 | 335 | function apply() { 336 | Object.defineProperty = function (obj, prop, desc) { 337 | if (isUnconfigurable(obj, prop)) { 338 | throw new TypeError('Cannot assign to read only property \'' + prop + '\' of ' + obj); 339 | } 340 | if (prop !== 'prototype') { 341 | desc = rewriteDescriptor(obj, prop, desc); 342 | } 343 | return _defineProperty(obj, prop, desc); 344 | }; 345 | 346 | Object.defineProperties = function (obj, props) { 347 | Object.keys(props).forEach(function (prop) { 348 | Object.defineProperty(obj, prop, props[prop]); 349 | }); 350 | return obj; 351 | }; 352 | 353 | Object.create = function (obj, proto) { 354 | if (typeof proto === 'object') { 355 | Object.keys(proto).forEach(function (prop) { 356 | proto[prop] = rewriteDescriptor(obj, prop, proto[prop]); 357 | }); 358 | } 359 | return _create(obj, proto); 360 | }; 361 | 362 | Object.getOwnPropertyDescriptor = function (obj, prop) { 363 | var desc = _getOwnPropertyDescriptor(obj, prop); 364 | if (isUnconfigurable(obj, prop)) { 365 | desc.configurable = false; 366 | } 367 | return desc; 368 | }; 369 | }; 370 | 371 | function _redefineProperty(obj, prop, desc) { 372 | desc = rewriteDescriptor(obj, prop, desc); 373 | return _defineProperty(obj, prop, desc); 374 | }; 375 | 376 | function isUnconfigurable (obj, prop) { 377 | return obj && obj[unconfigurablesKey] && obj[unconfigurablesKey][prop]; 378 | } 379 | 380 | function rewriteDescriptor (obj, prop, desc) { 381 | desc.configurable = true; 382 | if (!desc.configurable) { 383 | if (!obj[unconfigurablesKey]) { 384 | _defineProperty(obj, unconfigurablesKey, { writable: true, value: {} }); 385 | } 386 | obj[unconfigurablesKey][prop] = true; 387 | } 388 | return desc; 389 | } 390 | 391 | module.exports = { 392 | apply: apply, 393 | _redefineProperty: _redefineProperty 394 | }; 395 | 396 | 397 | 398 | },{"../keys":3}],7:[function(require,module,exports){ 399 | (function (global){ 400 | 'use strict'; 401 | 402 | var utils = require('../utils'); 403 | 404 | function apply() { 405 | // patched properties depend on addEventListener, so this needs to come first 406 | if (global.EventTarget) { 407 | utils.patchEventTargetMethods(global.EventTarget.prototype); 408 | 409 | // Note: EventTarget is not available in all browsers, 410 | // if it's not available, we instead patch the APIs in the IDL that inherit from EventTarget 411 | } else { 412 | var apis = [ 413 | 'ApplicationCache', 414 | 'EventSource', 415 | 'FileReader', 416 | 'InputMethodContext', 417 | 'MediaController', 418 | 'MessagePort', 419 | 'Node', 420 | 'Performance', 421 | 'SVGElementInstance', 422 | 'SharedWorker', 423 | 'TextTrack', 424 | 'TextTrackCue', 425 | 'TextTrackList', 426 | 'WebKitNamedFlow', 427 | 'Worker', 428 | 'WorkerGlobalScope', 429 | 'XMLHttpRequest', 430 | 'XMLHttpRequestEventTarget', 431 | 'XMLHttpRequestUpload' 432 | ]; 433 | 434 | apis.forEach(function(api) { 435 | var proto = global[api] && global[api].prototype; 436 | 437 | // Some browsers e.g. Android 4.3's don't actually implement 438 | // the EventTarget methods for all of these e.g. FileReader. 439 | // In this case, there is nothing to patch. 440 | if (proto && proto.addEventListener) { 441 | utils.patchEventTargetMethods(proto); 442 | } 443 | }); 444 | 445 | // Patch the methods on `window` instead of `Window.prototype` 446 | // `Window` is not accessible on Android 4.3 447 | if (typeof(window) !== 'undefined') { 448 | utils.patchEventTargetMethods(window); 449 | } 450 | } 451 | } 452 | 453 | module.exports = { 454 | apply: apply 455 | }; 456 | 457 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 458 | },{"../utils":16}],8:[function(require,module,exports){ 459 | 'use strict'; 460 | 461 | var utils = require('../utils'); 462 | 463 | function apply() { 464 | utils.patchClass('FileReader'); 465 | } 466 | 467 | module.exports = { 468 | apply: apply 469 | }; 470 | },{"../utils":16}],9:[function(require,module,exports){ 471 | (function (global){ 472 | 'use strict'; 473 | 474 | var utils = require('../utils'); 475 | 476 | function patchSetClearFunction(obj, fnNames) { 477 | fnNames.map(function (name) { 478 | return name[0].toUpperCase() + name.substr(1); 479 | }).forEach(function (name) { 480 | var setName = 'set' + name; 481 | var delegate = obj[setName]; 482 | 483 | if (delegate) { 484 | var clearName = 'clear' + name; 485 | var ids = {}; 486 | 487 | var bindArgs = setName === 'setInterval' ? utils.bindArguments : utils.bindArgumentsOnce; 488 | 489 | global.zone[setName] = function (fn) { 490 | var id, fnRef = fn; 491 | arguments[0] = function () { 492 | delete ids[id]; 493 | return fnRef.apply(this, arguments); 494 | }; 495 | var args = bindArgs(arguments); 496 | id = delegate.apply(obj, args); 497 | ids[id] = true; 498 | return id; 499 | }; 500 | 501 | obj[setName] = function () { 502 | return global.zone[setName].apply(this, arguments); 503 | }; 504 | 505 | var clearDelegate = obj[clearName]; 506 | 507 | global.zone[clearName] = function (id) { 508 | if (ids[id]) { 509 | delete ids[id]; 510 | global.zone.dequeueTask(); 511 | } 512 | return clearDelegate.apply(this, arguments); 513 | }; 514 | 515 | obj[clearName] = function () { 516 | return global.zone[clearName].apply(this, arguments); 517 | }; 518 | } 519 | }); 520 | }; 521 | 522 | 523 | /** 524 | * requestAnimationFrame is typically recursively called from within the callback function 525 | * that it executes. To handle this case, only fork a zone if this is executed 526 | * within the root zone. 527 | */ 528 | function patchRequestAnimationFrame(obj, fnNames) { 529 | fnNames.forEach(function (name) { 530 | var delegate = obj[name]; 531 | if (delegate) { 532 | global.zone[name] = function (fn) { 533 | var callZone = global.zone.isRootZone() ? global.zone.fork() : global.zone; 534 | if (fn) { 535 | arguments[0] = function () { 536 | return callZone.run(fn, this, arguments); 537 | }; 538 | } 539 | return delegate.apply(obj, arguments); 540 | }; 541 | 542 | obj[name] = function () { 543 | return global.zone[name].apply(this, arguments); 544 | }; 545 | } 546 | }); 547 | }; 548 | 549 | function patchSetFunction(obj, fnNames) { 550 | fnNames.forEach(function (name) { 551 | var delegate = obj[name]; 552 | 553 | if (delegate) { 554 | global.zone[name] = function (fn) { 555 | arguments[0] = function () { 556 | return fn.apply(this, arguments); 557 | }; 558 | var args = utils.bindArgumentsOnce(arguments); 559 | return delegate.apply(obj, args); 560 | }; 561 | 562 | obj[name] = function () { 563 | return zone[name].apply(this, arguments); 564 | }; 565 | } 566 | }); 567 | }; 568 | 569 | function patchFunction(obj, fnNames) { 570 | fnNames.forEach(function (name) { 571 | var delegate = obj[name]; 572 | global.zone[name] = function () { 573 | return delegate.apply(obj, arguments); 574 | }; 575 | 576 | obj[name] = function () { 577 | return global.zone[name].apply(this, arguments); 578 | }; 579 | }); 580 | }; 581 | 582 | 583 | module.exports = { 584 | patchSetClearFunction: patchSetClearFunction, 585 | patchSetFunction: patchSetFunction, 586 | patchRequestAnimationFrame: patchRequestAnimationFrame, 587 | patchFunction: patchFunction 588 | }; 589 | 590 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 591 | },{"../utils":16}],10:[function(require,module,exports){ 592 | (function (global){ 593 | 'use strict'; 594 | 595 | var utils = require('../utils'); 596 | 597 | function apply() { 598 | if (global.navigator && global.navigator.geolocation) { 599 | utils.patchPrototype(global.navigator.geolocation, [ 600 | 'getCurrentPosition', 601 | 'watchPosition' 602 | ]); 603 | } 604 | } 605 | 606 | module.exports = { 607 | apply: apply 608 | } 609 | 610 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 611 | },{"../utils":16}],11:[function(require,module,exports){ 612 | (function (global){ 613 | 'use strict'; 614 | 615 | var keys = require('../keys'); 616 | 617 | var originalInstanceKey = keys.create('originalInstance'); 618 | var creationZoneKey = keys.create('creationZone'); 619 | var isActiveKey = keys.create('isActive'); 620 | 621 | // wrap some native API on `window` 622 | function patchClass(className) { 623 | var OriginalClass = global[className]; 624 | if (!OriginalClass) return; 625 | 626 | global[className] = function (fn) { 627 | this[originalInstanceKey] = new OriginalClass(global.zone.bind(fn, true)); 628 | // Remember where the class was instantiate to execute the enqueueTask and dequeueTask hooks 629 | this[creationZoneKey] = global.zone; 630 | }; 631 | 632 | var instance = new OriginalClass(function () {}); 633 | 634 | global[className].prototype.disconnect = function () { 635 | var result = this[originalInstanceKey].disconnect.apply(this[originalInstanceKey], arguments); 636 | if (this[isActiveKey]) { 637 | this[creationZoneKey].dequeueTask(); 638 | this[isActiveKey] = false; 639 | } 640 | return result; 641 | }; 642 | 643 | global[className].prototype.observe = function () { 644 | if (!this[isActiveKey]) { 645 | this[creationZoneKey].enqueueTask(); 646 | this[isActiveKey] = true; 647 | } 648 | return this[originalInstanceKey].observe.apply(this[originalInstanceKey], arguments); 649 | }; 650 | 651 | var prop; 652 | for (prop in instance) { 653 | (function (prop) { 654 | if (typeof global[className].prototype !== 'undefined') { 655 | return; 656 | } 657 | if (typeof instance[prop] === 'function') { 658 | global[className].prototype[prop] = function () { 659 | return this[originalInstanceKey][prop].apply(this[originalInstanceKey], arguments); 660 | }; 661 | } else { 662 | Object.defineProperty(global[className].prototype, prop, { 663 | set: function (fn) { 664 | if (typeof fn === 'function') { 665 | this[originalInstanceKey][prop] = global.zone.bind(fn); 666 | } else { 667 | this[originalInstanceKey][prop] = fn; 668 | } 669 | }, 670 | get: function () { 671 | return this[originalInstanceKey][prop]; 672 | } 673 | }); 674 | } 675 | }(prop)); 676 | } 677 | }; 678 | 679 | module.exports = { 680 | patchClass: patchClass 681 | }; 682 | 683 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 684 | },{"../keys":3}],12:[function(require,module,exports){ 685 | (function (global){ 686 | 'use strict'; 687 | 688 | var utils = require('../utils'); 689 | 690 | /* 691 | * Patches a function that returns a Promise-like instance. 692 | * 693 | * This function must be used when either: 694 | * - Native Promises are not available, 695 | * - The function returns a Promise-like object. 696 | * 697 | * This is required because zones rely on a Promise monkey patch that could not be applied when 698 | * Promise is not natively available or when the returned object is not an instance of Promise. 699 | * 700 | * Note that calling `bindPromiseFn` on a function that returns a native Promise will also work 701 | * with minimal overhead. 702 | * 703 | * ``` 704 | * var boundFunction = bindPromiseFn(FunctionReturningAPromise); 705 | * 706 | * boundFunction.then(successHandler, errorHandler); 707 | * ``` 708 | */ 709 | var bindPromiseFn; 710 | 711 | if (global.Promise) { 712 | bindPromiseFn = function (delegate) { 713 | return function() { 714 | var delegatePromise = delegate.apply(this, arguments); 715 | 716 | // if the delegate returned an instance of Promise, forward it. 717 | if (delegatePromise instanceof Promise) { 718 | return delegatePromise; 719 | } 720 | 721 | // Otherwise wrap the Promise-like in a global Promise 722 | return new Promise(function(resolve, reject) { 723 | delegatePromise.then(resolve, reject); 724 | }); 725 | }; 726 | }; 727 | } else { 728 | bindPromiseFn = function (delegate) { 729 | return function () { 730 | return _patchThenable(delegate.apply(this, arguments)); 731 | }; 732 | }; 733 | } 734 | 735 | 736 | function _patchPromiseFnsOnObject(objectPath, fnNames) { 737 | var obj = global; 738 | 739 | var exists = objectPath.every(function (segment) { 740 | obj = obj[segment]; 741 | return obj; 742 | }); 743 | 744 | if (!exists) { 745 | return; 746 | } 747 | 748 | fnNames.forEach(function (name) { 749 | var fn = obj[name]; 750 | if (fn) { 751 | obj[name] = bindPromiseFn(fn); 752 | } 753 | }); 754 | } 755 | 756 | function _patchThenable(thenable) { 757 | var then = thenable.then; 758 | thenable.then = function () { 759 | var args = utils.bindArguments(arguments); 760 | var nextThenable = then.apply(thenable, args); 761 | return _patchThenable(nextThenable); 762 | }; 763 | 764 | var ocatch = thenable.catch; 765 | thenable.catch = function () { 766 | var args = utils.bindArguments(arguments); 767 | var nextThenable = ocatch.apply(thenable, args); 768 | return _patchThenable(nextThenable); 769 | }; 770 | 771 | return thenable; 772 | } 773 | 774 | 775 | function apply() { 776 | // Patch .then() and .catch() on native Promises to execute callbacks in the zone where 777 | // those functions are called. 778 | if (global.Promise) { 779 | utils.patchPrototype(Promise.prototype, [ 780 | 'then', 781 | 'catch' 782 | ]); 783 | 784 | // Patch browser APIs that return a Promise 785 | var patchFns = [ 786 | // fetch 787 | [[], ['fetch']], 788 | [['Response', 'prototype'], ['arrayBuffer', 'blob', 'json', 'text']] 789 | ]; 790 | 791 | patchFns.forEach(function(objPathAndFns) { 792 | _patchPromiseFnsOnObject(objPathAndFns[0], objPathAndFns[1]); 793 | }); 794 | } 795 | } 796 | 797 | module.exports = { 798 | apply: apply, 799 | bindPromiseFn: bindPromiseFn 800 | }; 801 | 802 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 803 | },{"../utils":16}],13:[function(require,module,exports){ 804 | (function (global){ 805 | 'use strict'; 806 | 807 | var webSocketPatch = require('./websocket'); 808 | var utils = require('../utils'); 809 | var keys = require('../keys'); 810 | 811 | 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(' '); 812 | 813 | function apply() { 814 | if (utils.isWebWorker()){ 815 | // on WebWorker so don't apply patch 816 | return; 817 | } 818 | 819 | var supportsWebSocket = typeof WebSocket !== 'undefined'; 820 | if (canPatchViaPropertyDescriptor()) { 821 | // for browsers that we can patch the descriptor: Chrome & Firefox 822 | var onEventNames = eventNames.map(function (property) { 823 | return 'on' + property; 824 | }); 825 | utils.patchProperties(HTMLElement.prototype, onEventNames); 826 | utils.patchProperties(XMLHttpRequest.prototype); 827 | if (supportsWebSocket) { 828 | utils.patchProperties(WebSocket.prototype); 829 | } 830 | } else { 831 | // Safari, Android browsers (Jelly Bean) 832 | patchViaCapturingAllTheEvents(); 833 | utils.patchClass('XMLHttpRequest'); 834 | if (supportsWebSocket) { 835 | webSocketPatch.apply(); 836 | } 837 | } 838 | } 839 | 840 | function canPatchViaPropertyDescriptor() { 841 | if (!Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'onclick') && typeof Element !== 'undefined') { 842 | // WebKit https://bugs.webkit.org/show_bug.cgi?id=134364 843 | // IDL interface attributes are not configurable 844 | var desc = Object.getOwnPropertyDescriptor(Element.prototype, 'onclick'); 845 | if (desc && !desc.configurable) return false; 846 | } 847 | 848 | Object.defineProperty(HTMLElement.prototype, 'onclick', { 849 | get: function () { 850 | return true; 851 | } 852 | }); 853 | var elt = document.createElement('div'); 854 | var result = !!elt.onclick; 855 | Object.defineProperty(HTMLElement.prototype, 'onclick', {}); 856 | return result; 857 | }; 858 | 859 | var unboundKey = keys.create('unbound'); 860 | 861 | // Whenever any event fires, we check the event target and all parents 862 | // for `onwhatever` properties and replace them with zone-bound functions 863 | // - Chrome (for now) 864 | function patchViaCapturingAllTheEvents() { 865 | eventNames.forEach(function (property) { 866 | var onproperty = 'on' + property; 867 | document.addEventListener(property, function (event) { 868 | var elt = event.target, bound; 869 | while (elt) { 870 | if (elt[onproperty] && !elt[onproperty][unboundKey]) { 871 | bound = global.zone.bind(elt[onproperty]); 872 | bound[unboundKey] = elt[onproperty]; 873 | elt[onproperty] = bound; 874 | } 875 | elt = elt.parentElement; 876 | } 877 | }, true); 878 | }); 879 | }; 880 | 881 | module.exports = { 882 | apply: apply 883 | }; 884 | 885 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 886 | },{"../keys":3,"../utils":16,"./websocket":15}],14:[function(require,module,exports){ 887 | (function (global){ 888 | 'use strict'; 889 | 890 | var _redefineProperty = require('./define-property')._redefineProperty; 891 | var utils = require("../utils"); 892 | 893 | function apply() { 894 | if (utils.isWebWorker() || !('registerElement' in global.document)) { 895 | return; 896 | } 897 | 898 | var _registerElement = document.registerElement; 899 | var callbacks = [ 900 | 'createdCallback', 901 | 'attachedCallback', 902 | 'detachedCallback', 903 | 'attributeChangedCallback' 904 | ]; 905 | 906 | document.registerElement = function (name, opts) { 907 | if (opts && opts.prototype) { 908 | callbacks.forEach(function (callback) { 909 | if (opts.prototype.hasOwnProperty(callback)) { 910 | var descriptor = Object.getOwnPropertyDescriptor(opts.prototype, callback); 911 | if (descriptor && descriptor.value) { 912 | descriptor.value = global.zone.bind(descriptor.value); 913 | _redefineProperty(opts.prototype, callback, descriptor); 914 | } else { 915 | opts.prototype[callback] = global.zone.bind(opts.prototype[callback]); 916 | } 917 | } else if (opts.prototype[callback]) { 918 | opts.prototype[callback] = global.zone.bind(opts.prototype[callback]); 919 | } 920 | }); 921 | } 922 | 923 | return _registerElement.apply(document, [name, opts]); 924 | }; 925 | } 926 | 927 | module.exports = { 928 | apply: apply 929 | }; 930 | 931 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 932 | },{"../utils":16,"./define-property":6}],15:[function(require,module,exports){ 933 | (function (global){ 934 | 'use strict'; 935 | 936 | var utils = require('../utils'); 937 | 938 | // we have to patch the instance since the proto is non-configurable 939 | function apply() { 940 | var WS = global.WebSocket; 941 | utils.patchEventTargetMethods(WS.prototype); 942 | global.WebSocket = function(a, b) { 943 | var socket = arguments.length > 1 ? new WS(a, b) : new WS(a); 944 | var proxySocket; 945 | 946 | // Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance 947 | var onmessageDesc = Object.getOwnPropertyDescriptor(socket, 'onmessage'); 948 | if (onmessageDesc && onmessageDesc.configurable === false) { 949 | proxySocket = Object.create(socket); 950 | ['addEventListener', 'removeEventListener', 'send', 'close'].forEach(function(propName) { 951 | proxySocket[propName] = function() { 952 | return socket[propName].apply(socket, arguments); 953 | }; 954 | }); 955 | } else { 956 | // we can patch the real socket 957 | proxySocket = socket; 958 | } 959 | 960 | utils.patchProperties(proxySocket, ['onclose', 'onerror', 'onmessage', 'onopen']); 961 | 962 | return proxySocket; 963 | }; 964 | } 965 | 966 | module.exports = { 967 | apply: apply 968 | }; 969 | 970 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 971 | },{"../utils":16}],16:[function(require,module,exports){ 972 | (function (global){ 973 | 'use strict'; 974 | 975 | var keys = require('./keys'); 976 | 977 | function bindArguments(args) { 978 | for (var i = args.length - 1; i >= 0; i--) { 979 | if (typeof args[i] === 'function') { 980 | args[i] = global.zone.bind(args[i]); 981 | } 982 | } 983 | return args; 984 | }; 985 | 986 | function bindArgumentsOnce(args) { 987 | for (var i = args.length - 1; i >= 0; i--) { 988 | if (typeof args[i] === 'function') { 989 | args[i] = global.zone.bindOnce(args[i]); 990 | } 991 | } 992 | return args; 993 | }; 994 | 995 | function patchPrototype(obj, fnNames) { 996 | fnNames.forEach(function (name) { 997 | var delegate = obj[name]; 998 | if (delegate) { 999 | obj[name] = function () { 1000 | return delegate.apply(this, bindArguments(arguments)); 1001 | }; 1002 | } 1003 | }); 1004 | }; 1005 | 1006 | function isWebWorker() { 1007 | return (typeof document === "undefined"); 1008 | } 1009 | 1010 | function patchProperty(obj, prop) { 1011 | var desc = Object.getOwnPropertyDescriptor(obj, prop) || { 1012 | enumerable: true, 1013 | configurable: true 1014 | }; 1015 | 1016 | // A property descriptor cannot have getter/setter and be writable 1017 | // deleting the writable and value properties avoids this error: 1018 | // 1019 | // TypeError: property descriptors must not specify a value or be writable when a 1020 | // getter or setter has been specified 1021 | delete desc.writable; 1022 | delete desc.value; 1023 | 1024 | // substr(2) cuz 'onclick' -> 'click', etc 1025 | var eventName = prop.substr(2); 1026 | var _prop = '_' + prop; 1027 | 1028 | desc.set = function (fn) { 1029 | if (this[_prop]) { 1030 | this.removeEventListener(eventName, this[_prop]); 1031 | } 1032 | 1033 | if (typeof fn === 'function') { 1034 | this[_prop] = fn; 1035 | this.addEventListener(eventName, fn, false); 1036 | } else { 1037 | this[_prop] = null; 1038 | } 1039 | }; 1040 | 1041 | desc.get = function () { 1042 | return this[_prop]; 1043 | }; 1044 | 1045 | Object.defineProperty(obj, prop, desc); 1046 | }; 1047 | 1048 | function patchProperties(obj, properties) { 1049 | (properties || (function () { 1050 | var props = []; 1051 | for (var prop in obj) { 1052 | props.push(prop); 1053 | } 1054 | return props; 1055 | }()). 1056 | filter(function (propertyName) { 1057 | return propertyName.substr(0,2) === 'on'; 1058 | })). 1059 | forEach(function (eventName) { 1060 | patchProperty(obj, eventName); 1061 | }); 1062 | }; 1063 | 1064 | var originalFnKey = keys.create('originalFn'); 1065 | var boundFnsKey = keys.create('boundFns'); 1066 | 1067 | function patchEventTargetMethods(obj) { 1068 | // This is required for the addEventListener hook on the root zone. 1069 | obj[keys.common.addEventListener] = obj.addEventListener; 1070 | obj.addEventListener = function (eventName, handler, useCapturing) { 1071 | //Ignore special listeners of IE11 & Edge dev tools, see https://github.com/angular/zone.js/issues/150 1072 | if (handler && handler.toString() !== "[object FunctionWrapper]") { 1073 | var eventType = eventName + (useCapturing ? '$capturing' : '$bubbling'); 1074 | var fn; 1075 | if (handler.handleEvent) { 1076 | // Have to pass in 'handler' reference as an argument here, otherwise it gets clobbered in 1077 | // IE9 by the arguments[1] assignment at end of this function. 1078 | fn = (function(handler) { 1079 | return function() { 1080 | handler.handleEvent.apply(handler, arguments); 1081 | }; 1082 | })(handler); 1083 | } else { 1084 | fn = handler; 1085 | } 1086 | 1087 | handler[originalFnKey] = fn; 1088 | handler[boundFnsKey] = handler[boundFnsKey] || {}; 1089 | handler[boundFnsKey][eventType] = handler[boundFnsKey][eventType] || zone.bind(fn); 1090 | arguments[1] = handler[boundFnsKey][eventType]; 1091 | } 1092 | 1093 | // - Inside a Web Worker, `this` is undefined, the context is `global` (= `self`) 1094 | // - When `addEventListener` is called on the global context in strict mode, `this` is undefined 1095 | // see https://github.com/angular/zone.js/issues/190 1096 | var target = this || global; 1097 | return global.zone.addEventListener.apply(target, arguments); 1098 | }; 1099 | 1100 | // This is required for the removeEventListener hook on the root zone. 1101 | obj[keys.common.removeEventListener] = obj.removeEventListener; 1102 | obj.removeEventListener = function (eventName, handler, useCapturing) { 1103 | var eventType = eventName + (useCapturing ? '$capturing' : '$bubbling'); 1104 | if (handler && handler[boundFnsKey] && handler[boundFnsKey][eventType]) { 1105 | var _bound = handler[boundFnsKey]; 1106 | arguments[1] = _bound[eventType]; 1107 | delete _bound[eventType]; 1108 | global.zone.dequeueTask(handler[originalFnKey]); 1109 | } 1110 | 1111 | // - Inside a Web Worker, `this` is undefined, the context is `global` 1112 | // - When `addEventListener` is called on the global context in strict mode, `this` is undefined 1113 | // see https://github.com/angular/zone.js/issues/190 1114 | var target = this || global; 1115 | var result = global.zone.removeEventListener.apply(target, arguments); 1116 | return result; 1117 | }; 1118 | }; 1119 | 1120 | var originalInstanceKey = keys.create('originalInstance'); 1121 | 1122 | // wrap some native API on `window` 1123 | function patchClass(className) { 1124 | var OriginalClass = global[className]; 1125 | if (!OriginalClass) return; 1126 | 1127 | global[className] = function () { 1128 | var a = bindArguments(arguments); 1129 | switch (a.length) { 1130 | case 0: this[originalInstanceKey] = new OriginalClass(); break; 1131 | case 1: this[originalInstanceKey] = new OriginalClass(a[0]); break; 1132 | case 2: this[originalInstanceKey] = new OriginalClass(a[0], a[1]); break; 1133 | case 3: this[originalInstanceKey] = new OriginalClass(a[0], a[1], a[2]); break; 1134 | case 4: this[originalInstanceKey] = new OriginalClass(a[0], a[1], a[2], a[3]); break; 1135 | default: throw new Error('what are you even doing?'); 1136 | } 1137 | }; 1138 | 1139 | var instance = new OriginalClass(); 1140 | 1141 | var prop; 1142 | for (prop in instance) { 1143 | (function (prop) { 1144 | if (typeof instance[prop] === 'function') { 1145 | global[className].prototype[prop] = function () { 1146 | return this[originalInstanceKey][prop].apply(this[originalInstanceKey], arguments); 1147 | }; 1148 | } else { 1149 | Object.defineProperty(global[className].prototype, prop, { 1150 | set: function (fn) { 1151 | if (typeof fn === 'function') { 1152 | this[originalInstanceKey][prop] = global.zone.bind(fn); 1153 | } else { 1154 | this[originalInstanceKey][prop] = fn; 1155 | } 1156 | }, 1157 | get: function () { 1158 | return this[originalInstanceKey][prop]; 1159 | } 1160 | }); 1161 | } 1162 | }(prop)); 1163 | } 1164 | 1165 | for (prop in OriginalClass) { 1166 | if (prop !== 'prototype' && OriginalClass.hasOwnProperty(prop)) { 1167 | global[className][prop] = OriginalClass[prop]; 1168 | } 1169 | } 1170 | }; 1171 | 1172 | module.exports = { 1173 | bindArguments: bindArguments, 1174 | bindArgumentsOnce: bindArgumentsOnce, 1175 | patchPrototype: patchPrototype, 1176 | patchProperty: patchProperty, 1177 | patchProperties: patchProperties, 1178 | patchEventTargetMethods: patchEventTargetMethods, 1179 | patchClass: patchClass, 1180 | isWebWorker: isWebWorker 1181 | }; 1182 | 1183 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 1184 | },{"./keys":3}],17:[function(require,module,exports){ 1185 | (function (process,global){ 1186 | /*! 1187 | * @overview es6-promise - a tiny implementation of Promises/A+. 1188 | * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) 1189 | * @license Licensed under MIT license 1190 | * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE 1191 | * @version 3.0.2 1192 | */ 1193 | 1194 | (function() { 1195 | "use strict"; 1196 | function lib$es6$promise$utils$$objectOrFunction(x) { 1197 | return typeof x === 'function' || (typeof x === 'object' && x !== null); 1198 | } 1199 | 1200 | function lib$es6$promise$utils$$isFunction(x) { 1201 | return typeof x === 'function'; 1202 | } 1203 | 1204 | function lib$es6$promise$utils$$isMaybeThenable(x) { 1205 | return typeof x === 'object' && x !== null; 1206 | } 1207 | 1208 | var lib$es6$promise$utils$$_isArray; 1209 | if (!Array.isArray) { 1210 | lib$es6$promise$utils$$_isArray = function (x) { 1211 | return Object.prototype.toString.call(x) === '[object Array]'; 1212 | }; 1213 | } else { 1214 | lib$es6$promise$utils$$_isArray = Array.isArray; 1215 | } 1216 | 1217 | var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray; 1218 | var lib$es6$promise$asap$$len = 0; 1219 | var lib$es6$promise$asap$$toString = {}.toString; 1220 | var lib$es6$promise$asap$$vertxNext; 1221 | var lib$es6$promise$asap$$customSchedulerFn; 1222 | 1223 | var lib$es6$promise$asap$$asap = function asap(callback, arg) { 1224 | lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback; 1225 | lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg; 1226 | lib$es6$promise$asap$$len += 2; 1227 | if (lib$es6$promise$asap$$len === 2) { 1228 | // If len is 2, that means that we need to schedule an async flush. 1229 | // If additional callbacks are queued before the queue is flushed, they 1230 | // will be processed by this flush that we are scheduling. 1231 | if (lib$es6$promise$asap$$customSchedulerFn) { 1232 | lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush); 1233 | } else { 1234 | lib$es6$promise$asap$$scheduleFlush(); 1235 | } 1236 | } 1237 | } 1238 | 1239 | function lib$es6$promise$asap$$setScheduler(scheduleFn) { 1240 | lib$es6$promise$asap$$customSchedulerFn = scheduleFn; 1241 | } 1242 | 1243 | function lib$es6$promise$asap$$setAsap(asapFn) { 1244 | lib$es6$promise$asap$$asap = asapFn; 1245 | } 1246 | 1247 | var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined; 1248 | var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {}; 1249 | var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver; 1250 | var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; 1251 | 1252 | // test for web worker but not in IE10 1253 | var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' && 1254 | typeof importScripts !== 'undefined' && 1255 | typeof MessageChannel !== 'undefined'; 1256 | 1257 | // node 1258 | function lib$es6$promise$asap$$useNextTick() { 1259 | // node version 0.10.x displays a deprecation warning when nextTick is used recursively 1260 | // see https://github.com/cujojs/when/issues/410 for details 1261 | return function() { 1262 | process.nextTick(lib$es6$promise$asap$$flush); 1263 | }; 1264 | } 1265 | 1266 | // vertx 1267 | function lib$es6$promise$asap$$useVertxTimer() { 1268 | return function() { 1269 | lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush); 1270 | }; 1271 | } 1272 | 1273 | function lib$es6$promise$asap$$useMutationObserver() { 1274 | var iterations = 0; 1275 | var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush); 1276 | var node = document.createTextNode(''); 1277 | observer.observe(node, { characterData: true }); 1278 | 1279 | return function() { 1280 | node.data = (iterations = ++iterations % 2); 1281 | }; 1282 | } 1283 | 1284 | // web worker 1285 | function lib$es6$promise$asap$$useMessageChannel() { 1286 | var channel = new MessageChannel(); 1287 | channel.port1.onmessage = lib$es6$promise$asap$$flush; 1288 | return function () { 1289 | channel.port2.postMessage(0); 1290 | }; 1291 | } 1292 | 1293 | function lib$es6$promise$asap$$useSetTimeout() { 1294 | return function() { 1295 | setTimeout(lib$es6$promise$asap$$flush, 1); 1296 | }; 1297 | } 1298 | 1299 | var lib$es6$promise$asap$$queue = new Array(1000); 1300 | function lib$es6$promise$asap$$flush() { 1301 | for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) { 1302 | var callback = lib$es6$promise$asap$$queue[i]; 1303 | var arg = lib$es6$promise$asap$$queue[i+1]; 1304 | 1305 | callback(arg); 1306 | 1307 | lib$es6$promise$asap$$queue[i] = undefined; 1308 | lib$es6$promise$asap$$queue[i+1] = undefined; 1309 | } 1310 | 1311 | lib$es6$promise$asap$$len = 0; 1312 | } 1313 | 1314 | function lib$es6$promise$asap$$attemptVertx() { 1315 | try { 1316 | var r = require; 1317 | var vertx = r('vertx'); 1318 | lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext; 1319 | return lib$es6$promise$asap$$useVertxTimer(); 1320 | } catch(e) { 1321 | return lib$es6$promise$asap$$useSetTimeout(); 1322 | } 1323 | } 1324 | 1325 | var lib$es6$promise$asap$$scheduleFlush; 1326 | // Decide what async method to use to triggering processing of queued callbacks: 1327 | if (lib$es6$promise$asap$$isNode) { 1328 | lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick(); 1329 | } else if (lib$es6$promise$asap$$BrowserMutationObserver) { 1330 | lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver(); 1331 | } else if (lib$es6$promise$asap$$isWorker) { 1332 | lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel(); 1333 | } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') { 1334 | lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertx(); 1335 | } else { 1336 | lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout(); 1337 | } 1338 | 1339 | function lib$es6$promise$$internal$$noop() {} 1340 | 1341 | var lib$es6$promise$$internal$$PENDING = void 0; 1342 | var lib$es6$promise$$internal$$FULFILLED = 1; 1343 | var lib$es6$promise$$internal$$REJECTED = 2; 1344 | 1345 | var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject(); 1346 | 1347 | function lib$es6$promise$$internal$$selfFulfillment() { 1348 | return new TypeError("You cannot resolve a promise with itself"); 1349 | } 1350 | 1351 | function lib$es6$promise$$internal$$cannotReturnOwn() { 1352 | return new TypeError('A promises callback cannot return that same promise.'); 1353 | } 1354 | 1355 | function lib$es6$promise$$internal$$getThen(promise) { 1356 | try { 1357 | return promise.then; 1358 | } catch(error) { 1359 | lib$es6$promise$$internal$$GET_THEN_ERROR.error = error; 1360 | return lib$es6$promise$$internal$$GET_THEN_ERROR; 1361 | } 1362 | } 1363 | 1364 | function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) { 1365 | try { 1366 | then.call(value, fulfillmentHandler, rejectionHandler); 1367 | } catch(e) { 1368 | return e; 1369 | } 1370 | } 1371 | 1372 | function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) { 1373 | lib$es6$promise$asap$$asap(function(promise) { 1374 | var sealed = false; 1375 | var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) { 1376 | if (sealed) { return; } 1377 | sealed = true; 1378 | if (thenable !== value) { 1379 | lib$es6$promise$$internal$$resolve(promise, value); 1380 | } else { 1381 | lib$es6$promise$$internal$$fulfill(promise, value); 1382 | } 1383 | }, function(reason) { 1384 | if (sealed) { return; } 1385 | sealed = true; 1386 | 1387 | lib$es6$promise$$internal$$reject(promise, reason); 1388 | }, 'Settle: ' + (promise._label || ' unknown promise')); 1389 | 1390 | if (!sealed && error) { 1391 | sealed = true; 1392 | lib$es6$promise$$internal$$reject(promise, error); 1393 | } 1394 | }, promise); 1395 | } 1396 | 1397 | function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) { 1398 | if (thenable._state === lib$es6$promise$$internal$$FULFILLED) { 1399 | lib$es6$promise$$internal$$fulfill(promise, thenable._result); 1400 | } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) { 1401 | lib$es6$promise$$internal$$reject(promise, thenable._result); 1402 | } else { 1403 | lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) { 1404 | lib$es6$promise$$internal$$resolve(promise, value); 1405 | }, function(reason) { 1406 | lib$es6$promise$$internal$$reject(promise, reason); 1407 | }); 1408 | } 1409 | } 1410 | 1411 | function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) { 1412 | if (maybeThenable.constructor === promise.constructor) { 1413 | lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable); 1414 | } else { 1415 | var then = lib$es6$promise$$internal$$getThen(maybeThenable); 1416 | 1417 | if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) { 1418 | lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error); 1419 | } else if (then === undefined) { 1420 | lib$es6$promise$$internal$$fulfill(promise, maybeThenable); 1421 | } else if (lib$es6$promise$utils$$isFunction(then)) { 1422 | lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then); 1423 | } else { 1424 | lib$es6$promise$$internal$$fulfill(promise, maybeThenable); 1425 | } 1426 | } 1427 | } 1428 | 1429 | function lib$es6$promise$$internal$$resolve(promise, value) { 1430 | if (promise === value) { 1431 | lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFulfillment()); 1432 | } else if (lib$es6$promise$utils$$objectOrFunction(value)) { 1433 | lib$es6$promise$$internal$$handleMaybeThenable(promise, value); 1434 | } else { 1435 | lib$es6$promise$$internal$$fulfill(promise, value); 1436 | } 1437 | } 1438 | 1439 | function lib$es6$promise$$internal$$publishRejection(promise) { 1440 | if (promise._onerror) { 1441 | promise._onerror(promise._result); 1442 | } 1443 | 1444 | lib$es6$promise$$internal$$publish(promise); 1445 | } 1446 | 1447 | function lib$es6$promise$$internal$$fulfill(promise, value) { 1448 | if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } 1449 | 1450 | promise._result = value; 1451 | promise._state = lib$es6$promise$$internal$$FULFILLED; 1452 | 1453 | if (promise._subscribers.length !== 0) { 1454 | lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise); 1455 | } 1456 | } 1457 | 1458 | function lib$es6$promise$$internal$$reject(promise, reason) { 1459 | if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } 1460 | promise._state = lib$es6$promise$$internal$$REJECTED; 1461 | promise._result = reason; 1462 | 1463 | lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise); 1464 | } 1465 | 1466 | function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) { 1467 | var subscribers = parent._subscribers; 1468 | var length = subscribers.length; 1469 | 1470 | parent._onerror = null; 1471 | 1472 | subscribers[length] = child; 1473 | subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment; 1474 | subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection; 1475 | 1476 | if (length === 0 && parent._state) { 1477 | lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent); 1478 | } 1479 | } 1480 | 1481 | function lib$es6$promise$$internal$$publish(promise) { 1482 | var subscribers = promise._subscribers; 1483 | var settled = promise._state; 1484 | 1485 | if (subscribers.length === 0) { return; } 1486 | 1487 | var child, callback, detail = promise._result; 1488 | 1489 | for (var i = 0; i < subscribers.length; i += 3) { 1490 | child = subscribers[i]; 1491 | callback = subscribers[i + settled]; 1492 | 1493 | if (child) { 1494 | lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail); 1495 | } else { 1496 | callback(detail); 1497 | } 1498 | } 1499 | 1500 | promise._subscribers.length = 0; 1501 | } 1502 | 1503 | function lib$es6$promise$$internal$$ErrorObject() { 1504 | this.error = null; 1505 | } 1506 | 1507 | var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject(); 1508 | 1509 | function lib$es6$promise$$internal$$tryCatch(callback, detail) { 1510 | try { 1511 | return callback(detail); 1512 | } catch(e) { 1513 | lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e; 1514 | return lib$es6$promise$$internal$$TRY_CATCH_ERROR; 1515 | } 1516 | } 1517 | 1518 | function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) { 1519 | var hasCallback = lib$es6$promise$utils$$isFunction(callback), 1520 | value, error, succeeded, failed; 1521 | 1522 | if (hasCallback) { 1523 | value = lib$es6$promise$$internal$$tryCatch(callback, detail); 1524 | 1525 | if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) { 1526 | failed = true; 1527 | error = value.error; 1528 | value = null; 1529 | } else { 1530 | succeeded = true; 1531 | } 1532 | 1533 | if (promise === value) { 1534 | lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn()); 1535 | return; 1536 | } 1537 | 1538 | } else { 1539 | value = detail; 1540 | succeeded = true; 1541 | } 1542 | 1543 | if (promise._state !== lib$es6$promise$$internal$$PENDING) { 1544 | // noop 1545 | } else if (hasCallback && succeeded) { 1546 | lib$es6$promise$$internal$$resolve(promise, value); 1547 | } else if (failed) { 1548 | lib$es6$promise$$internal$$reject(promise, error); 1549 | } else if (settled === lib$es6$promise$$internal$$FULFILLED) { 1550 | lib$es6$promise$$internal$$fulfill(promise, value); 1551 | } else if (settled === lib$es6$promise$$internal$$REJECTED) { 1552 | lib$es6$promise$$internal$$reject(promise, value); 1553 | } 1554 | } 1555 | 1556 | function lib$es6$promise$$internal$$initializePromise(promise, resolver) { 1557 | try { 1558 | resolver(function resolvePromise(value){ 1559 | lib$es6$promise$$internal$$resolve(promise, value); 1560 | }, function rejectPromise(reason) { 1561 | lib$es6$promise$$internal$$reject(promise, reason); 1562 | }); 1563 | } catch(e) { 1564 | lib$es6$promise$$internal$$reject(promise, e); 1565 | } 1566 | } 1567 | 1568 | function lib$es6$promise$enumerator$$Enumerator(Constructor, input) { 1569 | var enumerator = this; 1570 | 1571 | enumerator._instanceConstructor = Constructor; 1572 | enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop); 1573 | 1574 | if (enumerator._validateInput(input)) { 1575 | enumerator._input = input; 1576 | enumerator.length = input.length; 1577 | enumerator._remaining = input.length; 1578 | 1579 | enumerator._init(); 1580 | 1581 | if (enumerator.length === 0) { 1582 | lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); 1583 | } else { 1584 | enumerator.length = enumerator.length || 0; 1585 | enumerator._enumerate(); 1586 | if (enumerator._remaining === 0) { 1587 | lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); 1588 | } 1589 | } 1590 | } else { 1591 | lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError()); 1592 | } 1593 | } 1594 | 1595 | lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) { 1596 | return lib$es6$promise$utils$$isArray(input); 1597 | }; 1598 | 1599 | lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() { 1600 | return new Error('Array Methods must be provided an Array'); 1601 | }; 1602 | 1603 | lib$es6$promise$enumerator$$Enumerator.prototype._init = function() { 1604 | this._result = new Array(this.length); 1605 | }; 1606 | 1607 | var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator; 1608 | 1609 | lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() { 1610 | var enumerator = this; 1611 | 1612 | var length = enumerator.length; 1613 | var promise = enumerator.promise; 1614 | var input = enumerator._input; 1615 | 1616 | for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { 1617 | enumerator._eachEntry(input[i], i); 1618 | } 1619 | }; 1620 | 1621 | lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) { 1622 | var enumerator = this; 1623 | var c = enumerator._instanceConstructor; 1624 | 1625 | if (lib$es6$promise$utils$$isMaybeThenable(entry)) { 1626 | if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) { 1627 | entry._onerror = null; 1628 | enumerator._settledAt(entry._state, i, entry._result); 1629 | } else { 1630 | enumerator._willSettleAt(c.resolve(entry), i); 1631 | } 1632 | } else { 1633 | enumerator._remaining--; 1634 | enumerator._result[i] = entry; 1635 | } 1636 | }; 1637 | 1638 | lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) { 1639 | var enumerator = this; 1640 | var promise = enumerator.promise; 1641 | 1642 | if (promise._state === lib$es6$promise$$internal$$PENDING) { 1643 | enumerator._remaining--; 1644 | 1645 | if (state === lib$es6$promise$$internal$$REJECTED) { 1646 | lib$es6$promise$$internal$$reject(promise, value); 1647 | } else { 1648 | enumerator._result[i] = value; 1649 | } 1650 | } 1651 | 1652 | if (enumerator._remaining === 0) { 1653 | lib$es6$promise$$internal$$fulfill(promise, enumerator._result); 1654 | } 1655 | }; 1656 | 1657 | lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) { 1658 | var enumerator = this; 1659 | 1660 | lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) { 1661 | enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value); 1662 | }, function(reason) { 1663 | enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason); 1664 | }); 1665 | }; 1666 | function lib$es6$promise$promise$all$$all(entries) { 1667 | return new lib$es6$promise$enumerator$$default(this, entries).promise; 1668 | } 1669 | var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all; 1670 | function lib$es6$promise$promise$race$$race(entries) { 1671 | /*jshint validthis:true */ 1672 | var Constructor = this; 1673 | 1674 | var promise = new Constructor(lib$es6$promise$$internal$$noop); 1675 | 1676 | if (!lib$es6$promise$utils$$isArray(entries)) { 1677 | lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.')); 1678 | return promise; 1679 | } 1680 | 1681 | var length = entries.length; 1682 | 1683 | function onFulfillment(value) { 1684 | lib$es6$promise$$internal$$resolve(promise, value); 1685 | } 1686 | 1687 | function onRejection(reason) { 1688 | lib$es6$promise$$internal$$reject(promise, reason); 1689 | } 1690 | 1691 | for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { 1692 | lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); 1693 | } 1694 | 1695 | return promise; 1696 | } 1697 | var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race; 1698 | function lib$es6$promise$promise$resolve$$resolve(object) { 1699 | /*jshint validthis:true */ 1700 | var Constructor = this; 1701 | 1702 | if (object && typeof object === 'object' && object.constructor === Constructor) { 1703 | return object; 1704 | } 1705 | 1706 | var promise = new Constructor(lib$es6$promise$$internal$$noop); 1707 | lib$es6$promise$$internal$$resolve(promise, object); 1708 | return promise; 1709 | } 1710 | var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve; 1711 | function lib$es6$promise$promise$reject$$reject(reason) { 1712 | /*jshint validthis:true */ 1713 | var Constructor = this; 1714 | var promise = new Constructor(lib$es6$promise$$internal$$noop); 1715 | lib$es6$promise$$internal$$reject(promise, reason); 1716 | return promise; 1717 | } 1718 | var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject; 1719 | 1720 | var lib$es6$promise$promise$$counter = 0; 1721 | 1722 | function lib$es6$promise$promise$$needsResolver() { 1723 | throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); 1724 | } 1725 | 1726 | function lib$es6$promise$promise$$needsNew() { 1727 | throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); 1728 | } 1729 | 1730 | var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise; 1731 | /** 1732 | Promise objects represent the eventual result of an asynchronous operation. The 1733 | primary way of interacting with a promise is through its `then` method, which 1734 | registers callbacks to receive either a promise's eventual value or the reason 1735 | why the promise cannot be fulfilled. 1736 | 1737 | Terminology 1738 | ----------- 1739 | 1740 | - `promise` is an object or function with a `then` method whose behavior conforms to this specification. 1741 | - `thenable` is an object or function that defines a `then` method. 1742 | - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). 1743 | - `exception` is a value that is thrown using the throw statement. 1744 | - `reason` is a value that indicates why a promise was rejected. 1745 | - `settled` the final resting state of a promise, fulfilled or rejected. 1746 | 1747 | A promise can be in one of three states: pending, fulfilled, or rejected. 1748 | 1749 | Promises that are fulfilled have a fulfillment value and are in the fulfilled 1750 | state. Promises that are rejected have a rejection reason and are in the 1751 | rejected state. A fulfillment value is never a thenable. 1752 | 1753 | Promises can also be said to *resolve* a value. If this value is also a 1754 | promise, then the original promise's settled state will match the value's 1755 | settled state. So a promise that *resolves* a promise that rejects will 1756 | itself reject, and a promise that *resolves* a promise that fulfills will 1757 | itself fulfill. 1758 | 1759 | 1760 | Basic Usage: 1761 | ------------ 1762 | 1763 | ```js 1764 | var promise = new Promise(function(resolve, reject) { 1765 | // on success 1766 | resolve(value); 1767 | 1768 | // on failure 1769 | reject(reason); 1770 | }); 1771 | 1772 | promise.then(function(value) { 1773 | // on fulfillment 1774 | }, function(reason) { 1775 | // on rejection 1776 | }); 1777 | ``` 1778 | 1779 | Advanced Usage: 1780 | --------------- 1781 | 1782 | Promises shine when abstracting away asynchronous interactions such as 1783 | `XMLHttpRequest`s. 1784 | 1785 | ```js 1786 | function getJSON(url) { 1787 | return new Promise(function(resolve, reject){ 1788 | var xhr = new XMLHttpRequest(); 1789 | 1790 | xhr.open('GET', url); 1791 | xhr.onreadystatechange = handler; 1792 | xhr.responseType = 'json'; 1793 | xhr.setRequestHeader('Accept', 'application/json'); 1794 | xhr.send(); 1795 | 1796 | function handler() { 1797 | if (this.readyState === this.DONE) { 1798 | if (this.status === 200) { 1799 | resolve(this.response); 1800 | } else { 1801 | reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); 1802 | } 1803 | } 1804 | }; 1805 | }); 1806 | } 1807 | 1808 | getJSON('/posts.json').then(function(json) { 1809 | // on fulfillment 1810 | }, function(reason) { 1811 | // on rejection 1812 | }); 1813 | ``` 1814 | 1815 | Unlike callbacks, promises are great composable primitives. 1816 | 1817 | ```js 1818 | Promise.all([ 1819 | getJSON('/posts'), 1820 | getJSON('/comments') 1821 | ]).then(function(values){ 1822 | values[0] // => postsJSON 1823 | values[1] // => commentsJSON 1824 | 1825 | return values; 1826 | }); 1827 | ``` 1828 | 1829 | @class Promise 1830 | @param {function} resolver 1831 | Useful for tooling. 1832 | @constructor 1833 | */ 1834 | function lib$es6$promise$promise$$Promise(resolver) { 1835 | this._id = lib$es6$promise$promise$$counter++; 1836 | this._state = undefined; 1837 | this._result = undefined; 1838 | this._subscribers = []; 1839 | 1840 | if (lib$es6$promise$$internal$$noop !== resolver) { 1841 | if (!lib$es6$promise$utils$$isFunction(resolver)) { 1842 | lib$es6$promise$promise$$needsResolver(); 1843 | } 1844 | 1845 | if (!(this instanceof lib$es6$promise$promise$$Promise)) { 1846 | lib$es6$promise$promise$$needsNew(); 1847 | } 1848 | 1849 | lib$es6$promise$$internal$$initializePromise(this, resolver); 1850 | } 1851 | } 1852 | 1853 | lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default; 1854 | lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default; 1855 | lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default; 1856 | lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default; 1857 | lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler; 1858 | lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap; 1859 | lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap; 1860 | 1861 | lib$es6$promise$promise$$Promise.prototype = { 1862 | constructor: lib$es6$promise$promise$$Promise, 1863 | 1864 | /** 1865 | The primary way of interacting with a promise is through its `then` method, 1866 | which registers callbacks to receive either a promise's eventual value or the 1867 | reason why the promise cannot be fulfilled. 1868 | 1869 | ```js 1870 | findUser().then(function(user){ 1871 | // user is available 1872 | }, function(reason){ 1873 | // user is unavailable, and you are given the reason why 1874 | }); 1875 | ``` 1876 | 1877 | Chaining 1878 | -------- 1879 | 1880 | The return value of `then` is itself a promise. This second, 'downstream' 1881 | promise is resolved with the return value of the first promise's fulfillment 1882 | or rejection handler, or rejected if the handler throws an exception. 1883 | 1884 | ```js 1885 | findUser().then(function (user) { 1886 | return user.name; 1887 | }, function (reason) { 1888 | return 'default name'; 1889 | }).then(function (userName) { 1890 | // If `findUser` fulfilled, `userName` will be the user's name, otherwise it 1891 | // will be `'default name'` 1892 | }); 1893 | 1894 | findUser().then(function (user) { 1895 | throw new Error('Found user, but still unhappy'); 1896 | }, function (reason) { 1897 | throw new Error('`findUser` rejected and we're unhappy'); 1898 | }).then(function (value) { 1899 | // never reached 1900 | }, function (reason) { 1901 | // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. 1902 | // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. 1903 | }); 1904 | ``` 1905 | If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. 1906 | 1907 | ```js 1908 | findUser().then(function (user) { 1909 | throw new PedagogicalException('Upstream error'); 1910 | }).then(function (value) { 1911 | // never reached 1912 | }).then(function (value) { 1913 | // never reached 1914 | }, function (reason) { 1915 | // The `PedgagocialException` is propagated all the way down to here 1916 | }); 1917 | ``` 1918 | 1919 | Assimilation 1920 | ------------ 1921 | 1922 | Sometimes the value you want to propagate to a downstream promise can only be 1923 | retrieved asynchronously. This can be achieved by returning a promise in the 1924 | fulfillment or rejection handler. The downstream promise will then be pending 1925 | until the returned promise is settled. This is called *assimilation*. 1926 | 1927 | ```js 1928 | findUser().then(function (user) { 1929 | return findCommentsByAuthor(user); 1930 | }).then(function (comments) { 1931 | // The user's comments are now available 1932 | }); 1933 | ``` 1934 | 1935 | If the assimliated promise rejects, then the downstream promise will also reject. 1936 | 1937 | ```js 1938 | findUser().then(function (user) { 1939 | return findCommentsByAuthor(user); 1940 | }).then(function (comments) { 1941 | // If `findCommentsByAuthor` fulfills, we'll have the value here 1942 | }, function (reason) { 1943 | // If `findCommentsByAuthor` rejects, we'll have the reason here 1944 | }); 1945 | ``` 1946 | 1947 | Simple Example 1948 | -------------- 1949 | 1950 | Synchronous Example 1951 | 1952 | ```javascript 1953 | var result; 1954 | 1955 | try { 1956 | result = findResult(); 1957 | // success 1958 | } catch(reason) { 1959 | // failure 1960 | } 1961 | ``` 1962 | 1963 | Errback Example 1964 | 1965 | ```js 1966 | findResult(function(result, err){ 1967 | if (err) { 1968 | // failure 1969 | } else { 1970 | // success 1971 | } 1972 | }); 1973 | ``` 1974 | 1975 | Promise Example; 1976 | 1977 | ```javascript 1978 | findResult().then(function(result){ 1979 | // success 1980 | }, function(reason){ 1981 | // failure 1982 | }); 1983 | ``` 1984 | 1985 | Advanced Example 1986 | -------------- 1987 | 1988 | Synchronous Example 1989 | 1990 | ```javascript 1991 | var author, books; 1992 | 1993 | try { 1994 | author = findAuthor(); 1995 | books = findBooksByAuthor(author); 1996 | // success 1997 | } catch(reason) { 1998 | // failure 1999 | } 2000 | ``` 2001 | 2002 | Errback Example 2003 | 2004 | ```js 2005 | 2006 | function foundBooks(books) { 2007 | 2008 | } 2009 | 2010 | function failure(reason) { 2011 | 2012 | } 2013 | 2014 | findAuthor(function(author, err){ 2015 | if (err) { 2016 | failure(err); 2017 | // failure 2018 | } else { 2019 | try { 2020 | findBoooksByAuthor(author, function(books, err) { 2021 | if (err) { 2022 | failure(err); 2023 | } else { 2024 | try { 2025 | foundBooks(books); 2026 | } catch(reason) { 2027 | failure(reason); 2028 | } 2029 | } 2030 | }); 2031 | } catch(error) { 2032 | failure(err); 2033 | } 2034 | // success 2035 | } 2036 | }); 2037 | ``` 2038 | 2039 | Promise Example; 2040 | 2041 | ```javascript 2042 | findAuthor(). 2043 | then(findBooksByAuthor). 2044 | then(function(books){ 2045 | // found books 2046 | }).catch(function(reason){ 2047 | // something went wrong 2048 | }); 2049 | ``` 2050 | 2051 | @method then 2052 | @param {Function} onFulfilled 2053 | @param {Function} onRejected 2054 | Useful for tooling. 2055 | @return {Promise} 2056 | */ 2057 | then: function(onFulfillment, onRejection) { 2058 | var parent = this; 2059 | var state = parent._state; 2060 | 2061 | if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) { 2062 | return this; 2063 | } 2064 | 2065 | var child = new this.constructor(lib$es6$promise$$internal$$noop); 2066 | var result = parent._result; 2067 | 2068 | if (state) { 2069 | var callback = arguments[state - 1]; 2070 | lib$es6$promise$asap$$asap(function(){ 2071 | lib$es6$promise$$internal$$invokeCallback(state, child, callback, result); 2072 | }); 2073 | } else { 2074 | lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection); 2075 | } 2076 | 2077 | return child; 2078 | }, 2079 | 2080 | /** 2081 | `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same 2082 | as the catch block of a try/catch statement. 2083 | 2084 | ```js 2085 | function findAuthor(){ 2086 | throw new Error('couldn't find that author'); 2087 | } 2088 | 2089 | // synchronous 2090 | try { 2091 | findAuthor(); 2092 | } catch(reason) { 2093 | // something went wrong 2094 | } 2095 | 2096 | // async with promises 2097 | findAuthor().catch(function(reason){ 2098 | // something went wrong 2099 | }); 2100 | ``` 2101 | 2102 | @method catch 2103 | @param {Function} onRejection 2104 | Useful for tooling. 2105 | @return {Promise} 2106 | */ 2107 | 'catch': function(onRejection) { 2108 | return this.then(null, onRejection); 2109 | } 2110 | }; 2111 | function lib$es6$promise$polyfill$$polyfill() { 2112 | var local; 2113 | 2114 | if (typeof global !== 'undefined') { 2115 | local = global; 2116 | } else if (typeof self !== 'undefined') { 2117 | local = self; 2118 | } else { 2119 | try { 2120 | local = Function('return this')(); 2121 | } catch (e) { 2122 | throw new Error('polyfill failed because global object is unavailable in this environment'); 2123 | } 2124 | } 2125 | 2126 | var P = local.Promise; 2127 | 2128 | if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) { 2129 | return; 2130 | } 2131 | 2132 | local.Promise = lib$es6$promise$promise$$default; 2133 | } 2134 | var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill; 2135 | 2136 | var lib$es6$promise$umd$$ES6Promise = { 2137 | 'Promise': lib$es6$promise$promise$$default, 2138 | 'polyfill': lib$es6$promise$polyfill$$default 2139 | }; 2140 | 2141 | /* global define:true module:true window: true */ 2142 | if (typeof define === 'function' && define['amd']) { 2143 | define(function() { return lib$es6$promise$umd$$ES6Promise; }); 2144 | } else if (typeof module !== 'undefined' && module['exports']) { 2145 | module['exports'] = lib$es6$promise$umd$$ES6Promise; 2146 | } else if (typeof this !== 'undefined') { 2147 | this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise; 2148 | } 2149 | 2150 | lib$es6$promise$polyfill$$default(); 2151 | }).call(this); 2152 | 2153 | 2154 | }).call(this,{},typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 2155 | },{}]},{},[1]); 2156 | 2157 | (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); 2519 | * } 2520 | * 2521 | */ 2522 | function defineMetadata(metadataKey, metadataValue, target, targetKey) { 2523 | if (!IsObject(target)) { 2524 | throw new TypeError(); 2525 | } 2526 | else if (!IsUndefined(targetKey)) { 2527 | targetKey = ToPropertyKey(targetKey); 2528 | } 2529 | return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey); 2530 | } 2531 | Reflect.defineMetadata = defineMetadata; 2532 | /** 2533 | * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. 2534 | * @param metadataKey A key used to store and retrieve metadata. 2535 | * @param target The target object on which the metadata is defined. 2536 | * @param targetKey (Optional) The property key for the target. 2537 | * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. 2538 | * @example 2539 | * 2540 | * class C { 2541 | * // property declarations are not part of ES6, though they are valid in TypeScript: 2542 | * // static staticProperty; 2543 | * // property; 2544 | * 2545 | * constructor(p) { } 2546 | * static staticMethod(p) { } 2547 | * method(p) { } 2548 | * } 2549 | * 2550 | * // constructor 2551 | * result = Reflect.hasMetadata("custom:annotation", C); 2552 | * 2553 | * // property (on constructor) 2554 | * result = Reflect.hasMetadata("custom:annotation", C, "staticProperty"); 2555 | * 2556 | * // property (on prototype) 2557 | * result = Reflect.hasMetadata("custom:annotation", C.prototype, "property"); 2558 | * 2559 | * // method (on constructor) 2560 | * result = Reflect.hasMetadata("custom:annotation", C, "staticMethod"); 2561 | * 2562 | * // method (on prototype) 2563 | * result = Reflect.hasMetadata("custom:annotation", C.prototype, "method"); 2564 | * 2565 | */ 2566 | function hasMetadata(metadataKey, target, targetKey) { 2567 | if (!IsObject(target)) { 2568 | throw new TypeError(); 2569 | } 2570 | else if (!IsUndefined(targetKey)) { 2571 | targetKey = ToPropertyKey(targetKey); 2572 | } 2573 | return OrdinaryHasMetadata(metadataKey, target, targetKey); 2574 | } 2575 | Reflect.hasMetadata = hasMetadata; 2576 | /** 2577 | * Gets a value indicating whether the target object has the provided metadata key defined. 2578 | * @param metadataKey A key used to store and retrieve metadata. 2579 | * @param target The target object on which the metadata is defined. 2580 | * @param targetKey (Optional) The property key for the target. 2581 | * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. 2582 | * @example 2583 | * 2584 | * class C { 2585 | * // property declarations are not part of ES6, though they are valid in TypeScript: 2586 | * // static staticProperty; 2587 | * // property; 2588 | * 2589 | * constructor(p) { } 2590 | * static staticMethod(p) { } 2591 | * method(p) { } 2592 | * } 2593 | * 2594 | * // constructor 2595 | * result = Reflect.hasOwnMetadata("custom:annotation", C); 2596 | * 2597 | * // property (on constructor) 2598 | * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticProperty"); 2599 | * 2600 | * // property (on prototype) 2601 | * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "property"); 2602 | * 2603 | * // method (on constructor) 2604 | * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticMethod"); 2605 | * 2606 | * // method (on prototype) 2607 | * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "method"); 2608 | * 2609 | */ 2610 | function hasOwnMetadata(metadataKey, target, targetKey) { 2611 | if (!IsObject(target)) { 2612 | throw new TypeError(); 2613 | } 2614 | else if (!IsUndefined(targetKey)) { 2615 | targetKey = ToPropertyKey(targetKey); 2616 | } 2617 | return OrdinaryHasOwnMetadata(metadataKey, target, targetKey); 2618 | } 2619 | Reflect.hasOwnMetadata = hasOwnMetadata; 2620 | /** 2621 | * Gets the metadata value for the provided metadata key on the target object or its prototype chain. 2622 | * @param metadataKey A key used to store and retrieve metadata. 2623 | * @param target The target object on which the metadata is defined. 2624 | * @param targetKey (Optional) The property key for the target. 2625 | * @returns The metadata value for the metadata key if found; otherwise, `undefined`. 2626 | * @example 2627 | * 2628 | * class C { 2629 | * // property declarations are not part of ES6, though they are valid in TypeScript: 2630 | * // static staticProperty; 2631 | * // property; 2632 | * 2633 | * constructor(p) { } 2634 | * static staticMethod(p) { } 2635 | * method(p) { } 2636 | * } 2637 | * 2638 | * // constructor 2639 | * result = Reflect.getMetadata("custom:annotation", C); 2640 | * 2641 | * // property (on constructor) 2642 | * result = Reflect.getMetadata("custom:annotation", C, "staticProperty"); 2643 | * 2644 | * // property (on prototype) 2645 | * result = Reflect.getMetadata("custom:annotation", C.prototype, "property"); 2646 | * 2647 | * // method (on constructor) 2648 | * result = Reflect.getMetadata("custom:annotation", C, "staticMethod"); 2649 | * 2650 | * // method (on prototype) 2651 | * result = Reflect.getMetadata("custom:annotation", C.prototype, "method"); 2652 | * 2653 | */ 2654 | function getMetadata(metadataKey, target, targetKey) { 2655 | if (!IsObject(target)) { 2656 | throw new TypeError(); 2657 | } 2658 | else if (!IsUndefined(targetKey)) { 2659 | targetKey = ToPropertyKey(targetKey); 2660 | } 2661 | return OrdinaryGetMetadata(metadataKey, target, targetKey); 2662 | } 2663 | Reflect.getMetadata = getMetadata; 2664 | /** 2665 | * Gets the metadata value for the provided metadata key on the target object. 2666 | * @param metadataKey A key used to store and retrieve metadata. 2667 | * @param target The target object on which the metadata is defined. 2668 | * @param targetKey (Optional) The property key for the target. 2669 | * @returns The metadata value for the metadata key if found; otherwise, `undefined`. 2670 | * @example 2671 | * 2672 | * class C { 2673 | * // property declarations are not part of ES6, though they are valid in TypeScript: 2674 | * // static staticProperty; 2675 | * // property; 2676 | * 2677 | * constructor(p) { } 2678 | * static staticMethod(p) { } 2679 | * method(p) { } 2680 | * } 2681 | * 2682 | * // constructor 2683 | * result = Reflect.getOwnMetadata("custom:annotation", C); 2684 | * 2685 | * // property (on constructor) 2686 | * result = Reflect.getOwnMetadata("custom:annotation", C, "staticProperty"); 2687 | * 2688 | * // property (on prototype) 2689 | * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "property"); 2690 | * 2691 | * // method (on constructor) 2692 | * result = Reflect.getOwnMetadata("custom:annotation", C, "staticMethod"); 2693 | * 2694 | * // method (on prototype) 2695 | * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "method"); 2696 | * 2697 | */ 2698 | function getOwnMetadata(metadataKey, target, targetKey) { 2699 | if (!IsObject(target)) { 2700 | throw new TypeError(); 2701 | } 2702 | else if (!IsUndefined(targetKey)) { 2703 | targetKey = ToPropertyKey(targetKey); 2704 | } 2705 | return OrdinaryGetOwnMetadata(metadataKey, target, targetKey); 2706 | } 2707 | Reflect.getOwnMetadata = getOwnMetadata; 2708 | /** 2709 | * Gets the metadata keys defined on the target object or its prototype chain. 2710 | * @param target The target object on which the metadata is defined. 2711 | * @param targetKey (Optional) The property key for the target. 2712 | * @returns An array of unique metadata keys. 2713 | * @example 2714 | * 2715 | * class C { 2716 | * // property declarations are not part of ES6, though they are valid in TypeScript: 2717 | * // static staticProperty; 2718 | * // property; 2719 | * 2720 | * constructor(p) { } 2721 | * static staticMethod(p) { } 2722 | * method(p) { } 2723 | * } 2724 | * 2725 | * // constructor 2726 | * result = Reflect.getMetadataKeys(C); 2727 | * 2728 | * // property (on constructor) 2729 | * result = Reflect.getMetadataKeys(C, "staticProperty"); 2730 | * 2731 | * // property (on prototype) 2732 | * result = Reflect.getMetadataKeys(C.prototype, "property"); 2733 | * 2734 | * // method (on constructor) 2735 | * result = Reflect.getMetadataKeys(C, "staticMethod"); 2736 | * 2737 | * // method (on prototype) 2738 | * result = Reflect.getMetadataKeys(C.prototype, "method"); 2739 | * 2740 | */ 2741 | function getMetadataKeys(target, targetKey) { 2742 | if (!IsObject(target)) { 2743 | throw new TypeError(); 2744 | } 2745 | else if (!IsUndefined(targetKey)) { 2746 | targetKey = ToPropertyKey(targetKey); 2747 | } 2748 | return OrdinaryMetadataKeys(target, targetKey); 2749 | } 2750 | Reflect.getMetadataKeys = getMetadataKeys; 2751 | /** 2752 | * Gets the unique metadata keys defined on the target object. 2753 | * @param target The target object on which the metadata is defined. 2754 | * @param targetKey (Optional) The property key for the target. 2755 | * @returns An array of unique metadata keys. 2756 | * @example 2757 | * 2758 | * class C { 2759 | * // property declarations are not part of ES6, though they are valid in TypeScript: 2760 | * // static staticProperty; 2761 | * // property; 2762 | * 2763 | * constructor(p) { } 2764 | * static staticMethod(p) { } 2765 | * method(p) { } 2766 | * } 2767 | * 2768 | * // constructor 2769 | * result = Reflect.getOwnMetadataKeys(C); 2770 | * 2771 | * // property (on constructor) 2772 | * result = Reflect.getOwnMetadataKeys(C, "staticProperty"); 2773 | * 2774 | * // property (on prototype) 2775 | * result = Reflect.getOwnMetadataKeys(C.prototype, "property"); 2776 | * 2777 | * // method (on constructor) 2778 | * result = Reflect.getOwnMetadataKeys(C, "staticMethod"); 2779 | * 2780 | * // method (on prototype) 2781 | * result = Reflect.getOwnMetadataKeys(C.prototype, "method"); 2782 | * 2783 | */ 2784 | function getOwnMetadataKeys(target, targetKey) { 2785 | if (!IsObject(target)) { 2786 | throw new TypeError(); 2787 | } 2788 | else if (!IsUndefined(targetKey)) { 2789 | targetKey = ToPropertyKey(targetKey); 2790 | } 2791 | return OrdinaryOwnMetadataKeys(target, targetKey); 2792 | } 2793 | Reflect.getOwnMetadataKeys = getOwnMetadataKeys; 2794 | /** 2795 | * Deletes the metadata entry from the target object with the provided key. 2796 | * @param metadataKey A key used to store and retrieve metadata. 2797 | * @param target The target object on which the metadata is defined. 2798 | * @param targetKey (Optional) The property key for the target. 2799 | * @returns `true` if the metadata entry was found and deleted; otherwise, false. 2800 | * @example 2801 | * 2802 | * class C { 2803 | * // property declarations are not part of ES6, though they are valid in TypeScript: 2804 | * // static staticProperty; 2805 | * // property; 2806 | * 2807 | * constructor(p) { } 2808 | * static staticMethod(p) { } 2809 | * method(p) { } 2810 | * } 2811 | * 2812 | * // constructor 2813 | * result = Reflect.deleteMetadata("custom:annotation", C); 2814 | * 2815 | * // property (on constructor) 2816 | * result = Reflect.deleteMetadata("custom:annotation", C, "staticProperty"); 2817 | * 2818 | * // property (on prototype) 2819 | * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "property"); 2820 | * 2821 | * // method (on constructor) 2822 | * result = Reflect.deleteMetadata("custom:annotation", C, "staticMethod"); 2823 | * 2824 | * // method (on prototype) 2825 | * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "method"); 2826 | * 2827 | */ 2828 | function deleteMetadata(metadataKey, target, targetKey) { 2829 | if (!IsObject(target)) { 2830 | throw new TypeError(); 2831 | } 2832 | else if (!IsUndefined(targetKey)) { 2833 | targetKey = ToPropertyKey(targetKey); 2834 | } 2835 | // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#deletemetadata-metadatakey-p- 2836 | var metadataMap = GetOrCreateMetadataMap(target, targetKey, false); 2837 | if (IsUndefined(metadataMap)) { 2838 | return false; 2839 | } 2840 | if (!metadataMap.delete(metadataKey)) { 2841 | return false; 2842 | } 2843 | if (metadataMap.size > 0) { 2844 | return true; 2845 | } 2846 | var targetMetadata = __Metadata__.get(target); 2847 | targetMetadata.delete(targetKey); 2848 | if (targetMetadata.size > 0) { 2849 | return true; 2850 | } 2851 | __Metadata__.delete(target); 2852 | return true; 2853 | } 2854 | Reflect.deleteMetadata = deleteMetadata; 2855 | function DecorateConstructor(decorators, target) { 2856 | for (var i = decorators.length - 1; i >= 0; --i) { 2857 | var decorator = decorators[i]; 2858 | var decorated = decorator(target); 2859 | if (!IsUndefined(decorated)) { 2860 | if (!IsConstructor(decorated)) { 2861 | throw new TypeError(); 2862 | } 2863 | target = decorated; 2864 | } 2865 | } 2866 | return target; 2867 | } 2868 | function DecoratePropertyWithDescriptor(decorators, target, propertyKey, descriptor) { 2869 | for (var i = decorators.length - 1; i >= 0; --i) { 2870 | var decorator = decorators[i]; 2871 | var decorated = decorator(target, propertyKey, descriptor); 2872 | if (!IsUndefined(decorated)) { 2873 | if (!IsObject(decorated)) { 2874 | throw new TypeError(); 2875 | } 2876 | descriptor = decorated; 2877 | } 2878 | } 2879 | return descriptor; 2880 | } 2881 | function DecoratePropertyWithoutDescriptor(decorators, target, propertyKey) { 2882 | for (var i = decorators.length - 1; i >= 0; --i) { 2883 | var decorator = decorators[i]; 2884 | decorator(target, propertyKey); 2885 | } 2886 | } 2887 | // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#getorcreatemetadatamap--o-p-create- 2888 | function GetOrCreateMetadataMap(target, targetKey, create) { 2889 | var targetMetadata = __Metadata__.get(target); 2890 | if (!targetMetadata) { 2891 | if (!create) { 2892 | return undefined; 2893 | } 2894 | targetMetadata = new _Map(); 2895 | __Metadata__.set(target, targetMetadata); 2896 | } 2897 | var keyMetadata = targetMetadata.get(targetKey); 2898 | if (!keyMetadata) { 2899 | if (!create) { 2900 | return undefined; 2901 | } 2902 | keyMetadata = new _Map(); 2903 | targetMetadata.set(targetKey, keyMetadata); 2904 | } 2905 | return keyMetadata; 2906 | } 2907 | // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasmetadata--metadatakey-o-p- 2908 | function OrdinaryHasMetadata(MetadataKey, O, P) { 2909 | var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); 2910 | if (hasOwn) { 2911 | return true; 2912 | } 2913 | var parent = GetPrototypeOf(O); 2914 | if (parent !== null) { 2915 | return OrdinaryHasMetadata(MetadataKey, parent, P); 2916 | } 2917 | return false; 2918 | } 2919 | // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasownmetadata--metadatakey-o-p- 2920 | function OrdinaryHasOwnMetadata(MetadataKey, O, P) { 2921 | var metadataMap = GetOrCreateMetadataMap(O, P, false); 2922 | if (metadataMap === undefined) { 2923 | return false; 2924 | } 2925 | return Boolean(metadataMap.has(MetadataKey)); 2926 | } 2927 | // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetmetadata--metadatakey-o-p- 2928 | function OrdinaryGetMetadata(MetadataKey, O, P) { 2929 | var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); 2930 | if (hasOwn) { 2931 | return OrdinaryGetOwnMetadata(MetadataKey, O, P); 2932 | } 2933 | var parent = GetPrototypeOf(O); 2934 | if (parent !== null) { 2935 | return OrdinaryGetMetadata(MetadataKey, parent, P); 2936 | } 2937 | return undefined; 2938 | } 2939 | // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetownmetadata--metadatakey-o-p- 2940 | function OrdinaryGetOwnMetadata(MetadataKey, O, P) { 2941 | var metadataMap = GetOrCreateMetadataMap(O, P, false); 2942 | if (metadataMap === undefined) { 2943 | return undefined; 2944 | } 2945 | return metadataMap.get(MetadataKey); 2946 | } 2947 | // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarydefineownmetadata--metadatakey-metadatavalue-o-p- 2948 | function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { 2949 | var metadataMap = GetOrCreateMetadataMap(O, P, true); 2950 | metadataMap.set(MetadataKey, MetadataValue); 2951 | } 2952 | // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarymetadatakeys--o-p- 2953 | function OrdinaryMetadataKeys(O, P) { 2954 | var ownKeys = OrdinaryOwnMetadataKeys(O, P); 2955 | var parent = GetPrototypeOf(O); 2956 | if (parent === null) { 2957 | return ownKeys; 2958 | } 2959 | var parentKeys = OrdinaryMetadataKeys(parent, P); 2960 | if (parentKeys.length <= 0) { 2961 | return ownKeys; 2962 | } 2963 | if (ownKeys.length <= 0) { 2964 | return parentKeys; 2965 | } 2966 | var set = new _Set(); 2967 | var keys = []; 2968 | for (var _i = 0; _i < ownKeys.length; _i++) { 2969 | var key = ownKeys[_i]; 2970 | var hasKey = set.has(key); 2971 | if (!hasKey) { 2972 | set.add(key); 2973 | keys.push(key); 2974 | } 2975 | } 2976 | for (var _a = 0; _a < parentKeys.length; _a++) { 2977 | var key = parentKeys[_a]; 2978 | var hasKey = set.has(key); 2979 | if (!hasKey) { 2980 | set.add(key); 2981 | keys.push(key); 2982 | } 2983 | } 2984 | return keys; 2985 | } 2986 | // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryownmetadatakeys--o-p- 2987 | function OrdinaryOwnMetadataKeys(target, targetKey) { 2988 | var metadataMap = GetOrCreateMetadataMap(target, targetKey, false); 2989 | var keys = []; 2990 | if (metadataMap) { 2991 | metadataMap.forEach(function (_, key) { return keys.push(key); }); 2992 | } 2993 | return keys; 2994 | } 2995 | // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-undefined-type 2996 | function IsUndefined(x) { 2997 | return x === undefined; 2998 | } 2999 | // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isarray 3000 | function IsArray(x) { 3001 | return Array.isArray(x); 3002 | } 3003 | // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type 3004 | function IsObject(x) { 3005 | return typeof x === "object" ? x !== null : typeof x === "function"; 3006 | } 3007 | // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor 3008 | function IsConstructor(x) { 3009 | return typeof x === "function"; 3010 | } 3011 | // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-symbol-type 3012 | function IsSymbol(x) { 3013 | return typeof x === "symbol"; 3014 | } 3015 | // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey 3016 | function ToPropertyKey(value) { 3017 | if (IsSymbol(value)) { 3018 | return value; 3019 | } 3020 | return String(value); 3021 | } 3022 | function GetPrototypeOf(O) { 3023 | var proto = Object.getPrototypeOf(O); 3024 | if (typeof O !== "function" || O === functionPrototype) { 3025 | return proto; 3026 | } 3027 | // TypeScript doesn't set __proto__ in ES5, as it's non-standard. 3028 | // Try to determine the superclass constructor. Compatible implementations 3029 | // must either set __proto__ on a subclass constructor to the superclass constructor, 3030 | // or ensure each class has a valid `constructor` property on its prototype that 3031 | // points back to the constructor. 3032 | // If this is not the same as Function.[[Prototype]], then this is definately inherited. 3033 | // This is the case when in ES6 or when using __proto__ in a compatible browser. 3034 | if (proto !== functionPrototype) { 3035 | return proto; 3036 | } 3037 | // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage. 3038 | var prototype = O.prototype; 3039 | var prototypeProto = Object.getPrototypeOf(prototype); 3040 | if (prototypeProto == null || prototypeProto === Object.prototype) { 3041 | return proto; 3042 | } 3043 | // if the constructor was not a function, then we cannot determine the heritage. 3044 | var constructor = prototypeProto.constructor; 3045 | if (typeof constructor !== "function") { 3046 | return proto; 3047 | } 3048 | // if we have some kind of self-reference, then we cannot determine the heritage. 3049 | if (constructor === O) { 3050 | return proto; 3051 | } 3052 | // we have a pretty good guess at the heritage. 3053 | return constructor; 3054 | } 3055 | // naive Map shim 3056 | function CreateMapPolyfill() { 3057 | var cacheSentinel = {}; 3058 | function Map() { 3059 | this._keys = []; 3060 | this._values = []; 3061 | this._cache = cacheSentinel; 3062 | } 3063 | Map.prototype = { 3064 | get size() { 3065 | return this._keys.length; 3066 | }, 3067 | has: function (key) { 3068 | if (key === this._cache) { 3069 | return true; 3070 | } 3071 | if (this._find(key) >= 0) { 3072 | this._cache = key; 3073 | return true; 3074 | } 3075 | return false; 3076 | }, 3077 | get: function (key) { 3078 | var index = this._find(key); 3079 | if (index >= 0) { 3080 | this._cache = key; 3081 | return this._values[index]; 3082 | } 3083 | return undefined; 3084 | }, 3085 | set: function (key, value) { 3086 | this.delete(key); 3087 | this._keys.push(key); 3088 | this._values.push(value); 3089 | this._cache = key; 3090 | return this; 3091 | }, 3092 | delete: function (key) { 3093 | var index = this._find(key); 3094 | if (index >= 0) { 3095 | this._keys.splice(index, 1); 3096 | this._values.splice(index, 1); 3097 | this._cache = cacheSentinel; 3098 | return true; 3099 | } 3100 | return false; 3101 | }, 3102 | clear: function () { 3103 | this._keys.length = 0; 3104 | this._values.length = 0; 3105 | this._cache = cacheSentinel; 3106 | }, 3107 | forEach: function (callback, thisArg) { 3108 | var size = this.size; 3109 | for (var i = 0; i < size; ++i) { 3110 | var key = this._keys[i]; 3111 | var value = this._values[i]; 3112 | this._cache = key; 3113 | callback.call(this, value, key, this); 3114 | } 3115 | }, 3116 | _find: function (key) { 3117 | var keys = this._keys; 3118 | var size = keys.length; 3119 | for (var i = 0; i < size; ++i) { 3120 | if (keys[i] === key) { 3121 | return i; 3122 | } 3123 | } 3124 | return -1; 3125 | } 3126 | }; 3127 | return Map; 3128 | } 3129 | // naive Set shim 3130 | function CreateSetPolyfill() { 3131 | var cacheSentinel = {}; 3132 | function Set() { 3133 | this._map = new _Map(); 3134 | } 3135 | Set.prototype = { 3136 | get size() { 3137 | return this._map.length; 3138 | }, 3139 | has: function (value) { 3140 | return this._map.has(value); 3141 | }, 3142 | add: function (value) { 3143 | this._map.set(value, value); 3144 | return this; 3145 | }, 3146 | delete: function (value) { 3147 | return this._map.delete(value); 3148 | }, 3149 | clear: function () { 3150 | this._map.clear(); 3151 | }, 3152 | forEach: function (callback, thisArg) { 3153 | this._map.forEach(callback, thisArg); 3154 | } 3155 | }; 3156 | return Set; 3157 | } 3158 | // naive WeakMap shim 3159 | function CreateWeakMapPolyfill() { 3160 | var UUID_SIZE = 16; 3161 | var isNode = typeof global !== "undefined" && Object.prototype.toString.call(global.process) === '[object process]'; 3162 | var nodeCrypto = isNode && require("crypto"); 3163 | var hasOwn = Object.prototype.hasOwnProperty; 3164 | var keys = {}; 3165 | var rootKey = CreateUniqueKey(); 3166 | function WeakMap() { 3167 | this._key = CreateUniqueKey(); 3168 | } 3169 | WeakMap.prototype = { 3170 | has: function (target) { 3171 | var table = GetOrCreateWeakMapTable(target, false); 3172 | if (table) { 3173 | return this._key in table; 3174 | } 3175 | return false; 3176 | }, 3177 | get: function (target) { 3178 | var table = GetOrCreateWeakMapTable(target, false); 3179 | if (table) { 3180 | return table[this._key]; 3181 | } 3182 | return undefined; 3183 | }, 3184 | set: function (target, value) { 3185 | var table = GetOrCreateWeakMapTable(target, true); 3186 | table[this._key] = value; 3187 | return this; 3188 | }, 3189 | delete: function (target) { 3190 | var table = GetOrCreateWeakMapTable(target, false); 3191 | if (table && this._key in table) { 3192 | return delete table[this._key]; 3193 | } 3194 | return false; 3195 | }, 3196 | clear: function () { 3197 | // NOTE: not a real clear, just makes the previous data unreachable 3198 | this._key = CreateUniqueKey(); 3199 | } 3200 | }; 3201 | function FillRandomBytes(buffer, size) { 3202 | for (var i = 0; i < size; ++i) { 3203 | buffer[i] = Math.random() * 255 | 0; 3204 | } 3205 | } 3206 | function GenRandomBytes(size) { 3207 | if (nodeCrypto) { 3208 | var data = nodeCrypto.randomBytes(size); 3209 | return data; 3210 | } 3211 | else if (typeof Uint8Array === "function") { 3212 | var data = new Uint8Array(size); 3213 | if (typeof crypto !== "undefined") { 3214 | crypto.getRandomValues(data); 3215 | } 3216 | else if (typeof msCrypto !== "undefined") { 3217 | msCrypto.getRandomValues(data); 3218 | } 3219 | else { 3220 | FillRandomBytes(data, size); 3221 | } 3222 | return data; 3223 | } 3224 | else { 3225 | var data = new Array(size); 3226 | FillRandomBytes(data, size); 3227 | return data; 3228 | } 3229 | } 3230 | function CreateUUID() { 3231 | var data = GenRandomBytes(UUID_SIZE); 3232 | // mark as random - RFC 4122 § 4.4 3233 | data[6] = data[6] & 0x4f | 0x40; 3234 | data[8] = data[8] & 0xbf | 0x80; 3235 | var result = ""; 3236 | for (var offset = 0; offset < UUID_SIZE; ++offset) { 3237 | var byte = data[offset]; 3238 | if (offset === 4 || offset === 6 || offset === 8) { 3239 | result += "-"; 3240 | } 3241 | if (byte < 16) { 3242 | result += "0"; 3243 | } 3244 | result += byte.toString(16).toLowerCase(); 3245 | } 3246 | return result; 3247 | } 3248 | function CreateUniqueKey() { 3249 | var key; 3250 | do { 3251 | key = "@@WeakMap@@" + CreateUUID(); 3252 | } while (hasOwn.call(keys, key)); 3253 | keys[key] = true; 3254 | return key; 3255 | } 3256 | function GetOrCreateWeakMapTable(target, create) { 3257 | if (!hasOwn.call(target, rootKey)) { 3258 | if (!create) { 3259 | return undefined; 3260 | } 3261 | Object.defineProperty(target, rootKey, { value: Object.create(null) }); 3262 | } 3263 | return target[rootKey]; 3264 | } 3265 | return WeakMap; 3266 | } 3267 | // hook global Reflect 3268 | (function (__global) { 3269 | if (typeof __global.Reflect !== "undefined") { 3270 | if (__global.Reflect !== Reflect) { 3271 | for (var p in Reflect) { 3272 | __global.Reflect[p] = Reflect[p]; 3273 | } 3274 | } 3275 | } 3276 | else { 3277 | __global.Reflect = Reflect; 3278 | } 3279 | })(typeof window !== "undefined" ? window : 3280 | typeof WorkerGlobalScope !== "undefined" ? self : 3281 | typeof global !== "undefined" ? global : 3282 | Function("return this;")()); 3283 | })(Reflect || (Reflect = {})); 3284 | //# sourceMappingURLDisabled=Reflect.js.map -------------------------------------------------------------------------------- /builds/development/js/lib/angular2/es6-shim.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * https://github.com/paulmillr/es6-shim 3 | * @license es6-shim Copyright 2013-2015 by Paul Miller (http://paulmillr.com) 4 | * and contributors, MIT License 5 | * es6-shim: v0.33.13 6 | * see https://github.com/paulmillr/es6-shim/blob/0.33.13/LICENSE 7 | * Details and documentation: 8 | * https://github.com/paulmillr/es6-shim/ 9 | */ 10 | (function(e,t){if(typeof define==="function"&&define.amd){define(t)}else if(typeof exports==="object"){module.exports=t()}else{e.returnExports=t()}})(this,function(){"use strict";var e=Function.call.bind(Function.apply);var t=Function.call.bind(Function.call);var r=Array.isArray;var n=function notThunker(t){return function notThunk(){return!e(t,this,arguments)}};var o=function(e){try{e();return false}catch(t){return true}};var i=function valueOrFalseIfThrows(e){try{return e()}catch(t){return false}};var a=n(o);var u=function(){return!o(function(){Object.defineProperty({},"x",{get:function(){}})})};var s=!!Object.defineProperty&&u();var f=function foo(){}.name==="foo";var c=Function.call.bind(Array.prototype.forEach);var l=Function.call.bind(Array.prototype.reduce);var p=Function.call.bind(Array.prototype.filter);var v=Function.call.bind(Array.prototype.some);var y=function(e,t,r,n){if(!n&&t in e){return}if(s){Object.defineProperty(e,t,{configurable:true,enumerable:false,writable:true,value:r})}else{e[t]=r}};var h=function(e,t){c(Object.keys(t),function(r){var n=t[r];y(e,r,n,false)})};var g=Object.create||function(e,t){var r=function Prototype(){};r.prototype=e;var n=new r;if(typeof t!=="undefined"){Object.keys(t).forEach(function(e){U.defineByDescriptor(n,e,t[e])})}return n};var b=function(e,t){if(!Object.setPrototypeOf){return false}return i(function(){var r=function Subclass(t){var r=new e(t);Object.setPrototypeOf(r,Subclass.prototype);return r};Object.setPrototypeOf(r,e);r.prototype=g(e.prototype,{constructor:{value:r}});return t(r)})};var d=function(){if(typeof self!=="undefined"){return self}if(typeof window!=="undefined"){return window}if(typeof global!=="undefined"){return global}throw new Error("unable to locate global object")};var m=d();var O=m.isFinite;var w=Function.call.bind(String.prototype.indexOf);var j=Function.call.bind(Object.prototype.toString);var S=Function.call.bind(Array.prototype.concat);var T=Function.call.bind(String.prototype.slice);var I=Function.call.bind(Array.prototype.push);var E=Function.apply.bind(Array.prototype.push);var M=Function.call.bind(Array.prototype.shift);var P=Math.max;var x=Math.min;var N=Math.floor;var C=Math.abs;var A=Math.log;var k=Math.sqrt;var _=Function.call.bind(Object.prototype.hasOwnProperty);var R;var F=function(){};var D=m.Symbol||{};var z=D.species||"@@species";var L=Number.isNaN||function isNaN(e){return e!==e};var q=Number.isFinite||function isFinite(e){return typeof e==="number"&&O(e)};var G=function isArguments(e){return j(e)==="[object Arguments]"};var W=function isArguments(e){return e!==null&&typeof e==="object"&&typeof e.length==="number"&&e.length>=0&&j(e)!=="[object Array]"&&j(e.callee)==="[object Function]"};var H=G(arguments)?G:W;var B={primitive:function(e){return e===null||typeof e!=="function"&&typeof e!=="object"},object:function(e){return e!==null&&typeof e==="object"},string:function(e){return j(e)==="[object String]"},regex:function(e){return j(e)==="[object RegExp]"},symbol:function(e){return typeof m.Symbol==="function"&&typeof e==="symbol"}};var $=B.symbol(D.iterator)?D.iterator:"_es6-shim iterator_";if(m.Set&&typeof(new m.Set)["@@iterator"]==="function"){$="@@iterator"}if(!m.Reflect){y(m,"Reflect",{})}var V=m.Reflect;var J={Call:function Call(t,r){var n=arguments.length>2?arguments[2]:[];if(!J.IsCallable(t)){throw new TypeError(t+" is not a function")}return e(t,r,n)},RequireObjectCoercible:function(e,t){if(e==null){throw new TypeError(t||"Cannot call method on "+e)}},TypeIsObject:function(e){return e!=null&&Object(e)===e},ToObject:function(e,t){J.RequireObjectCoercible(e,t);return Object(e)},IsCallable:function(e){return typeof e==="function"&&j(e)==="[object Function]"},IsConstructor:function(e){return J.IsCallable(e)},ToInt32:function(e){return J.ToNumber(e)>>0},ToUint32:function(e){return J.ToNumber(e)>>>0},ToNumber:function(e){if(j(e)==="[object Symbol]"){throw new TypeError("Cannot convert a Symbol value to a number")}return+e},ToInteger:function(e){var t=J.ToNumber(e);if(L(t)){return 0}if(t===0||!q(t)){return t}return(t>0?1:-1)*N(C(t))},ToLength:function(e){var t=J.ToInteger(e);if(t<=0){return 0}if(t>Number.MAX_SAFE_INTEGER){return Number.MAX_SAFE_INTEGER}return t},SameValue:function(e,t){if(e===t){if(e===0){return 1/e===1/t}return true}return L(e)&&L(t)},SameValueZero:function(e,t){return e===t||L(e)&&L(t)},IsIterable:function(e){return J.TypeIsObject(e)&&(typeof e[$]!=="undefined"||H(e))},GetIterator:function(e){if(H(e)){return new R(e,"value")}var r=J.GetMethod(e,$);if(!J.IsCallable(r)){throw new TypeError("value is not an iterable")}var n=t(r,e);if(!J.TypeIsObject(n)){throw new TypeError("bad iterator")}return n},GetMethod:function(e,t){var r=J.ToObject(e)[t];if(r===void 0||r===null){return void 0}if(!J.IsCallable(r)){throw new TypeError("Method not callable: "+t)}return r},IteratorComplete:function(e){return!!e.done},IteratorClose:function(e,r){var n=J.GetMethod(e,"return");if(n===void 0){return}var o,i;try{o=t(n,e)}catch(a){i=a}if(r){return}if(i){throw i}if(!J.TypeIsObject(o)){throw new TypeError("Iterator's return method returned a non-object.")}},IteratorNext:function(e){var t=arguments.length>1?e.next(arguments[1]):e.next();if(!J.TypeIsObject(t)){throw new TypeError("bad iterator")}return t},IteratorStep:function(e){var t=J.IteratorNext(e);var r=J.IteratorComplete(t);return r?false:t},Construct:function(e,t,r,n){var o=typeof r==="undefined"?e:r;if(!n){return V.construct(e,t,o)}var i=o.prototype;if(!J.TypeIsObject(i)){i=Object.prototype}var a=g(i);var u=J.Call(e,a,t);return J.TypeIsObject(u)?u:a},SpeciesConstructor:function(e,t){var r=e.constructor;if(r===void 0){return t}if(!J.TypeIsObject(r)){throw new TypeError("Bad constructor")}var n=r[z];if(n===void 0||n===null){return t}if(!J.IsConstructor(n)){throw new TypeError("Bad @@species")}return n},CreateHTML:function(e,t,r,n){var o=String(e);var i="<"+t;if(r!==""){var a=String(n);var u=a.replace(/"/g,""");i+=" "+r+'="'+u+'"'}var s=i+">";var f=s+o;return f+""}};var U={getter:function(e,t,r){if(!s){throw new TypeError("getters require true ES5 support")}Object.defineProperty(e,t,{configurable:true,enumerable:false,get:r})},proxy:function(e,t,r){if(!s){throw new TypeError("getters require true ES5 support")}var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,{configurable:n.configurable,enumerable:n.enumerable,get:function getKey(){return e[t]},set:function setKey(r){e[t]=r}})},redefine:function(e,t,r){if(s){var n=Object.getOwnPropertyDescriptor(e,t);n.value=r;Object.defineProperty(e,t,n)}else{e[t]=r}},defineByDescriptor:function(e,t,r){if(s){Object.defineProperty(e,t,r)}else if("value"in r){e[t]=r.value}},preserveToString:function(e,t){if(t&&J.IsCallable(t.toString)){y(e,"toString",t.toString.bind(t),true)}}};var K=function wrapConstructor(e,t,r){U.preserveToString(t,e);if(Object.setPrototypeOf){Object.setPrototypeOf(e,t)}if(s){c(Object.getOwnPropertyNames(e),function(n){if(n in F||r[n]){return}U.proxy(e,n,t)})}else{c(Object.keys(e),function(n){if(n in F||r[n]){return}t[n]=e[n]})}t.prototype=e.prototype;U.redefine(e.prototype,"constructor",t)};var X=function(){return this};var Z=function(e){if(s&&!_(e,z)){U.getter(e,z,X)}};var Q=function overrideNative(e,t,r){var n=e[t];y(e,t,r,true);U.preserveToString(e[t],n)};var Y=function(e,t){var r=t||function iterator(){return this};y(e,$,r);if(!e[$]&&B.symbol($)){e[$]=r}};var ee=function createDataProperty(e,t,r){if(s){Object.defineProperty(e,t,{configurable:true,enumerable:true,writable:true,value:r})}else{e[t]=r}};var te=function createDataPropertyOrThrow(e,t,r){ee(e,t,r);if(!J.SameValue(e[t],r)){throw new TypeError("property is nonconfigurable")}};var re=function(e,t,r,n){if(!J.TypeIsObject(e)){throw new TypeError("Constructor requires `new`: "+t.name)}var o=t.prototype;if(!J.TypeIsObject(o)){o=r}var i=g(o);for(var a in n){if(_(n,a)){var u=n[a];y(i,a,u,true)}}return i};if(String.fromCodePoint&&String.fromCodePoint.length!==1){var ne=String.fromCodePoint;Q(String,"fromCodePoint",function fromCodePoint(t){return e(ne,this,arguments)})}var oe={fromCodePoint:function fromCodePoint(e){var t=[];var r;for(var n=0,o=arguments.length;n1114111){throw new RangeError("Invalid code point "+r)}if(r<65536){I(t,String.fromCharCode(r))}else{r-=65536;I(t,String.fromCharCode((r>>10)+55296));I(t,String.fromCharCode(r%1024+56320))}}return t.join("")},raw:function raw(e){var t=J.ToObject(e,"bad callSite");var r=J.ToObject(t.raw,"bad raw value");var n=r.length;var o=J.ToLength(n);if(o<=0){return""}var i=[];var a=0;var u,s,f,c;while(a=o){break}s=a+1=ae){throw new RangeError("repeat count must be less than infinity and not overflow maximum string size")}return ie(t,r)},startsWith:function startsWith(e){J.RequireObjectCoercible(this);var t=String(this);if(B.regex(e)){throw new TypeError('Cannot call method "startsWith" with a regex')}var r=String(e);var n=arguments.length>1?arguments[1]:void 0;var o=P(J.ToInteger(n),0);return T(t,o,o+r.length)===r},endsWith:function endsWith(e){J.RequireObjectCoercible(this);var t=String(this);if(B.regex(e)){throw new TypeError('Cannot call method "endsWith" with a regex')}var r=String(e);var n=t.length;var o=arguments.length>1?arguments[1]:void 0;var i=typeof o==="undefined"?n:J.ToInteger(o);var a=x(P(i,0),n);return T(t,a-r.length,a)===r},includes:function includes(e){if(B.regex(e)){throw new TypeError('"includes" does not accept a RegExp')}var t;if(arguments.length>1){t=arguments[1]}return w(this,e,t)!==-1},codePointAt:function codePointAt(e){J.RequireObjectCoercible(this);var t=String(this);var r=J.ToInteger(e);var n=t.length;if(r>=0&&r56319||i){return o}var a=t.charCodeAt(r+1);if(a<56320||a>57343){return o}return(o-55296)*1024+(a-56320)+65536}}};if(String.prototype.includes&&"a".includes("a",Infinity)!==false){Q(String.prototype,"includes",ue.includes)}if(String.prototype.startsWith&&String.prototype.endsWith){var se=o(function(){"/a/".startsWith(/a/)});var fe="abc".startsWith("a",Infinity)===false;if(!se||!fe){Q(String.prototype,"startsWith",ue.startsWith);Q(String.prototype,"endsWith",ue.endsWith)}}h(String.prototype,ue);var ce=[" \n\x0B\f\r \xa0\u1680\u180e\u2000\u2001\u2002\u2003","\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028","\u2029\ufeff"].join("");var le=new RegExp("(^["+ce+"]+)|(["+ce+"]+$)","g");var pe=function trim(){if(typeof this==="undefined"||this===null){throw new TypeError("can't convert "+this+" to object")}return String(this).replace(le,"")};var ve=["\x85","\u200b","\ufffe"].join("");var ye=new RegExp("["+ve+"]","g");var he=/^[\-+]0x[0-9a-f]+$/i;var ge=ve.trim().length!==ve.length;y(String.prototype,"trim",pe,ge);var be=function(e){J.RequireObjectCoercible(e);this._s=String(e);this._i=0};be.prototype.next=function(){var e=this._s,t=this._i;if(typeof e==="undefined"||t>=e.length){this._s=void 0;return{value:void 0,done:true}}var r=e.charCodeAt(t),n,o;if(r<55296||r>56319||t+1===e.length){o=1}else{n=e.charCodeAt(t+1);o=n<56320||n>57343?1:2}this._i=t+o;return{value:e.substr(t,o),done:false}};Y(be.prototype);Y(String.prototype,function(){return new be(this)});var de={from:function from(e){var r=this;var n=arguments.length>1?arguments[1]:void 0;var o,i;if(n===void 0){o=false}else{if(!J.IsCallable(n)){throw new TypeError("Array.from: when provided, the second argument must be a function")}i=arguments.length>2?arguments[2]:void 0;o=true}var a=typeof(H(e)||J.GetMethod(e,$))!=="undefined";var u,s,f;if(a){s=J.IsConstructor(r)?Object(new r):[];var c=J.GetIterator(e);var l,p;f=0;while(true){l=J.IteratorStep(c);if(l===false){break}p=l.value;try{if(o){p=i===undefined?n(p,f):t(n,i,p,f)}s[f]=p}catch(v){J.IteratorClose(c,true);throw v}f+=1}u=f}else{var y=J.ToObject(e);u=J.ToLength(y.length);s=J.IsConstructor(r)?Object(new r(u)):new Array(u);var h;for(f=0;f0){e=M(t);if(!(e in this.object)){continue}if(this.kind==="key"){return me(e)}else if(this.kind==="value"){return me(this.object[e])}else{return me([e,this.object[e]])}}return me()}});Y(we.prototype);var je=Array.of===de.of||function(){var e=function Foo(e){this.length=e};e.prototype=[];var t=Array.of.apply(e,[1,2]);return t instanceof e&&t.length===2}();if(!je){Q(Array,"of",de.of)}var Se={copyWithin:function copyWithin(e,t){var r=arguments[2];var n=J.ToObject(this);var o=J.ToLength(n.length);var i=J.ToInteger(e);var a=J.ToInteger(t);var u=i<0?P(o+i,0):x(i,o);var s=a<0?P(o+a,0):x(a,o);r=typeof r==="undefined"?o:J.ToInteger(r);var f=r<0?P(o+r,0):x(r,o);var c=x(f-s,o-u);var l=1;if(s0){if(_(n,s)){n[u]=n[s]}else{delete n[s]}s+=l;u+=l;c-=1}return n},fill:function fill(e){var t=arguments.length>1?arguments[1]:void 0;var r=arguments.length>2?arguments[2]:void 0;var n=J.ToObject(this);var o=J.ToLength(n.length);t=J.ToInteger(typeof t==="undefined"?0:t);r=J.ToInteger(typeof r==="undefined"?o:r);var i=t<0?P(o+t,0):x(t,o);var a=r<0?o+r:r;for(var u=i;u1?arguments[1]:null;for(var i=0,a;i1?arguments[1]:null;for(var i=0;i0&&typeof arguments[1]!=="undefined"){return e(Pe,this,arguments)}else{return t(Pe,this,r)}})}var xe=function(e,r){var n={length:-1};n[r?(-1>>>0)-1:0]=true;return i(function(){t(e,n,function(){throw new RangeError("should not reach here")},[])})};if(!xe(Array.prototype.forEach)){var Ne=Array.prototype.forEach;Q(Array.prototype,"forEach",function forEach(t){return e(Ne,this.length>=0?this:[],arguments)},true)}if(!xe(Array.prototype.map)){var Ce=Array.prototype.map;Q(Array.prototype,"map",function map(t){return e(Ce,this.length>=0?this:[],arguments)},true)}if(!xe(Array.prototype.filter)){var Ae=Array.prototype.filter;Q(Array.prototype,"filter",function filter(t){return e(Ae,this.length>=0?this:[],arguments)},true)}if(!xe(Array.prototype.some)){var ke=Array.prototype.some;Q(Array.prototype,"some",function some(t){return e(ke,this.length>=0?this:[],arguments)},true)}if(!xe(Array.prototype.every)){var _e=Array.prototype.every;Q(Array.prototype,"every",function every(t){return e(_e,this.length>=0?this:[],arguments)},true)}if(!xe(Array.prototype.reduce)){var Re=Array.prototype.reduce;Q(Array.prototype,"reduce",function reduce(t){return e(Re,this.length>=0?this:[],arguments)},true)}if(!xe(Array.prototype.reduceRight,true)){var Fe=Array.prototype.reduceRight;Q(Array.prototype,"reduceRight",function reduceRight(t){return e(Fe,this.length>=0?this:[],arguments)},true)}var De=Number("0o10")!==8;var ze=Number("0b10")!==2;var Le=v(ve,function(e){return Number(e+0+e)===0});if(De||ze||Le){var qe=Number;var Ge=/^0b[01]+$/i;var We=/^0o[0-7]+$/i;var He=Ge.test.bind(Ge);var Be=We.test.bind(We);var $e=function(e){var t;if(typeof e.valueOf==="function"){t=e.valueOf();if(B.primitive(t)){return t}}if(typeof e.toString==="function"){t=e.toString();if(B.primitive(t)){return t}}throw new TypeError("No default value")};var Ve=ye.test.bind(ye);var Je=he.test.bind(he);var Ue=function(){var e=function Number(r){var n;if(arguments.length>0){n=B.primitive(r)?r:$e(r,"number")}else{n=0}if(typeof n==="string"){n=t(pe,n);if(He(n)){n=parseInt(T(n,2),2)}else if(Be(n)){n=parseInt(T(n,2),8)}else if(Ve(n)||Je(n)){n=NaN}}var o=this;var a=i(function(){qe.prototype.valueOf.call(o);return true});if(o instanceof e&&!a){return new qe(n)}return qe(n)};return e}();K(qe,Ue,{});Number=Ue;U.redefine(m,"Number",Ue)}var Ke=Math.pow(2,53)-1;h(Number,{MAX_SAFE_INTEGER:Ke,MIN_SAFE_INTEGER:-Ke,EPSILON:2.220446049250313e-16,parseInt:m.parseInt,parseFloat:m.parseFloat,isFinite:q,isInteger:function isInteger(e){return q(e)&&J.ToInteger(e)===e},isSafeInteger:function isSafeInteger(e){return Number.isInteger(e)&&C(e)<=Number.MAX_SAFE_INTEGER},isNaN:L});y(Number,"parseInt",m.parseInt,Number.parseInt!==m.parseInt);if(![,1].find(function(e,t){return t===0})){Q(Array.prototype,"find",Se.find)}if([,1].findIndex(function(e,t){return t===0})!==0){Q(Array.prototype,"findIndex",Se.findIndex)}var Xe=Function.bind.call(Function.bind,Object.prototype.propertyIsEnumerable);var Ze=function sliceArgs(){var e=Number(this);var t=arguments.length;var r=t-e;var n=new Array(r<0?0:r);for(var o=e;o1){return NaN}if(t===-1){return-Infinity}if(t===1){return Infinity}if(t===0){return t}return.5*A((1+t)/(1-t))},cbrt:function cbrt(e){var t=Number(e);if(t===0){return t}var r=t<0,n;if(r){t=-t}if(t===Infinity){n=Infinity}else{n=Math.exp(A(t)/3);n=(t/(n*n)+2*n)/3}return r?-n:n},clz32:function clz32(e){var r=Number(e);var n=J.ToUint32(r);if(n===0){return 32}return Rt?t(Rt,n):31-N(A(n+.5)*Math.LOG2E)},cosh:function cosh(e){var t=Number(e);if(t===0){return 1}if(Number.isNaN(t)){return NaN}if(!O(t)){return Infinity}if(t<0){t=-t}if(t>21){return Math.exp(t)/2}return(Math.exp(t)+Math.exp(-t))/2},expm1:function expm1(e){var t=Number(e);if(t===-Infinity){return-1}if(!O(t)||t===0){return t}if(C(t)>.5){return Math.exp(t)-1}var r=t;var n=0;var o=1;while(n+r!==n){n+=r;o+=1;r*=t/o}return n},hypot:function hypot(e,t){var r=0;var n=0;for(var o=0;o0?i/n*(i/n):i}}return n===Infinity?Infinity:n*k(r)},log2:function log2(e){return A(e)*Math.LOG2E},log10:function log10(e){return A(e)*Math.LOG10E},log1p:function log1p(e){var t=Number(e);if(t<-1||Number.isNaN(t)){return NaN}if(t===0||t===Infinity){return t}if(t===-1){return-Infinity}return 1+t-1===0?t:t*(A(1+t)/(1+t-1))},sign:function sign(e){var t=Number(e);if(t===0){return t}if(Number.isNaN(t)){return t}return t<0?-1:1},sinh:function sinh(e){var t=Number(e);if(!O(t)||t===0){return t}if(C(t)<1){return(Math.expm1(t)-Math.expm1(-t))/2}return(Math.exp(t-1)-Math.exp(-t-1))*Math.E/2},tanh:function tanh(e){var t=Number(e);if(Number.isNaN(t)||t===0){return t}if(t===Infinity){return 1}if(t===-Infinity){return-1}var r=Math.expm1(t);var n=Math.expm1(-t);if(r===Infinity){return 1}if(n===Infinity){return-1}return(r-n)/(Math.exp(t)+Math.exp(-t))},trunc:function trunc(e){var t=Number(e);return t<0?-N(-t):N(t)},imul:function imul(e,t){var r=J.ToUint32(e);var n=J.ToUint32(t);var o=r>>>16&65535;var i=r&65535;var a=n>>>16&65535;var u=n&65535;return i*u+(o*u+i*a<<16>>>0)|0},fround:function fround(e){var t=Number(e);if(t===0||t===Infinity||t===-Infinity||L(t)){return t}var r=Math.sign(t);var n=C(t);if(n<_t){return r*Ct(n/_t/At)*_t*At}var o=(1+At/Number.EPSILON)*n;var i=o-(o-n);if(i>kt||L(i)){return r*Infinity}return r*i}};h(Math,Ft);y(Math,"log1p",Ft.log1p,Math.log1p(-1e-17)!==-1e-17);y(Math,"asinh",Ft.asinh,Math.asinh(-1e7)!==-Math.asinh(1e7));y(Math,"tanh",Ft.tanh,Math.tanh(-2e-17)!==-2e-17);y(Math,"acosh",Ft.acosh,Math.acosh(Number.MAX_VALUE)===Infinity);y(Math,"cbrt",Ft.cbrt,Math.abs(1-Math.cbrt(1e-300)/1e-100)/Number.EPSILON>8);y(Math,"sinh",Ft.sinh,Math.sinh(-2e-17)!==-2e-17);var Dt=Math.expm1(10);y(Math,"expm1",Ft.expm1,Dt>22025.465794806718||Dt<22025.465794806718);var zt=Math.round;var Lt=Math.round(.5-Number.EPSILON/4)===0&&Math.round(-.5+Number.EPSILON/3.99)===1;var qt=Nt+1;var Gt=2*Nt-1;var Wt=[qt,Gt].every(function(e){return Math.round(e)===e});y(Math,"round",function round(e){var t=N(e);var r=t===-1?-0:t+1;return e-t<.5?t:r},!Lt||!Wt);U.preserveToString(Math.round,zt);var Ht=Math.imul;if(Math.imul(4294967295,5)!==-5){Math.imul=Ft.imul;U.preserveToString(Math.imul,Ht)}if(Math.imul.length!==2){Q(Math,"imul",function imul(t,r){return e(Ht,Math,arguments)})}var Bt=function(){var e=m.setTimeout;if(typeof e!=="function"&&typeof e!=="object"){return}J.IsPromise=function(e){if(!J.TypeIsObject(e)){return false}if(typeof e._promise==="undefined"){return false}return true};var r=function(e){if(!J.IsConstructor(e)){throw new TypeError("Bad promise constructor")}var t=this;var r=function(e,r){if(t.resolve!==void 0||t.reject!==void 0){throw new TypeError("Bad Promise implementation!")}t.resolve=e;t.reject=r};t.promise=new e(r);if(!(J.IsCallable(t.resolve)&&J.IsCallable(t.reject))){throw new TypeError("Bad promise constructor")}};var n;if(typeof window!=="undefined"&&J.IsCallable(window.postMessage)){n=function(){var e=[];var t="zero-timeout-message";var r=function(r){I(e,r);window.postMessage(t,"*")};var n=function(r){if(r.source===window&&r.data===t){r.stopPropagation();if(e.length===0){return}var n=M(e);n()}};window.addEventListener("message",n,true);return r}}var o=function(){var e=m.Promise;return e&&e.resolve&&function(t){return e.resolve().then(t)}};var i=J.IsCallable(m.setImmediate)?m.setImmediate.bind(m):typeof process==="object"&&process.nextTick?process.nextTick:o()||(J.IsCallable(n)?n():function(t){e(t,0)});var a=1;var u=2;var s=3;var f=4;var l=5;var p=function(e,t){var r=e.capabilities;var n=e.handler;var o,i=false,s;if(n===a){o=t}else if(n===u){o=t;i=true}else{try{o=n(t)}catch(f){o=f;i=true}}s=i?r.reject:r.resolve;s(o)};var v=function(e,t){c(e,function(e){i(function(){p(e,t)})})};var y=function(e,t){var r=e._promise;var n=r.fulfillReactions;r.result=t;r.fulfillReactions=void 0;r.rejectReactions=void 0;r.state=f;v(n,t)};var g=function(e,t){var r=e._promise;var n=r.rejectReactions;r.result=t;r.fulfillReactions=void 0;r.rejectReactions=void 0;r.state=l;v(n,t)};var b=function(e){var t=false;var r=function(r){var n;if(t){return}t=true;if(r===e){return g(e,new TypeError("Self resolution"))}if(!J.TypeIsObject(r)){return y(e,r)}try{n=r.then}catch(o){return g(e,o)}if(!J.IsCallable(n)){return y(e,r)}i(function(){d(e,r,n)})};var n=function(r){if(t){return}t=true;return g(e,r)};return{resolve:r,reject:n}};var d=function(e,r,n){var o=b(e);var i=o.resolve;var a=o.reject;try{t(n,r,i,a)}catch(u){a(u)}};var O=function(e){if(!J.TypeIsObject(e)){throw new TypeError("Promise is not object")}var t=e[z];if(t!==void 0&&t!==null){return t}return e};var w;var j=function(){var e=function Promise(t){if(!(this instanceof e)){throw new TypeError('Constructor Promise requires "new"')}if(this&&this._promise){throw new TypeError("Bad construction")}if(!J.IsCallable(t)){throw new TypeError("not a valid resolver")}var r=re(this,e,w,{_promise:{result:void 0,state:s,fulfillReactions:[],rejectReactions:[]}});var n=b(r);var o=n.reject;try{t(n.resolve,o)}catch(i){o(i)}return r};return e}();w=j.prototype;var S=function(e,t,r,n){var o=false;return function(i){if(o){return}o=true;t[e]=i;if(--n.count===0){var a=r.resolve;a(t)}}};var T=function(e,t,r){var n=e.iterator;var o=[],i={count:1},a,u;var s=0;while(true){try{a=J.IteratorStep(n);if(a===false){e.done=true;break}u=a.value}catch(f){e.done=true;throw f}o[s]=void 0;var c=t.resolve(u);var l=S(s,o,r,i);i.count+=1;c.then(l,r.reject);s+=1}if(--i.count===0){var p=r.resolve;p(o)}return r.promise};var E=function(e,t,r){var n=e.iterator,o,i,a;while(true){try{o=J.IteratorStep(n);if(o===false){e.done=true;break}i=o.value}catch(u){e.done=true;throw u}a=t.resolve(i);a.then(r.resolve,r.reject)}return r.promise};h(j,{all:function all(e){var t=O(this);var n=new r(t);var o,i;try{o=J.GetIterator(e);i={iterator:o,done:false};return T(i,t,n)}catch(a){var u=a;if(i&&!i.done){try{J.IteratorClose(o,true)}catch(s){u=s}}var f=n.reject;f(u);return n.promise}},race:function race(e){var t=O(this);var n=new r(t);var o,i;try{o=J.GetIterator(e);i={iterator:o,done:false};return E(i,t,n)}catch(a){var u=a;if(i&&!i.done){try{J.IteratorClose(o,true)}catch(s){u=s}}var f=n.reject;f(u);return n.promise}},reject:function reject(e){ 11 | var t=this;var n=new r(t);var o=n.reject;o(e);return n.promise},resolve:function resolve(e){var t=this;if(J.IsPromise(e)){var n=e.constructor;if(n===t){return e}}var o=new r(t);var i=o.resolve;i(e);return o.promise}});h(w,{"catch":function(e){return this.then(void 0,e)},then:function then(e,t){var n=this;if(!J.IsPromise(n)){throw new TypeError("not a promise")}var o=J.SpeciesConstructor(n,j);var c=new r(o);var v={capabilities:c,handler:J.IsCallable(e)?e:a};var y={capabilities:c,handler:J.IsCallable(t)?t:u};var h=n._promise;var g;if(h.state===s){I(h.fulfillReactions,v);I(h.rejectReactions,y)}else if(h.state===f){g=h.result;i(function(){p(v,g)})}else if(h.state===l){g=h.result;i(function(){p(y,g)})}else{throw new TypeError("unexpected Promise state")}return c.promise}});return j}();if(m.Promise){delete m.Promise.accept;delete m.Promise.defer;delete m.Promise.prototype.chain}if(typeof Bt==="function"){h(m,{Promise:Bt});var $t=b(m.Promise,function(e){return e.resolve(42).then(function(){})instanceof e});var Vt=!o(function(){m.Promise.reject(42).then(null,5).then(null,F)});var Jt=o(function(){m.Promise.call(3,F)});var Ut=function(e){var t=e.resolve(5);t.constructor={};var r=e.resolve(t);return t===r}(m.Promise);if(!$t||!Vt||!Jt||Ut){Promise=Bt;Q(m,"Promise",Bt)}Z(Promise)}var Kt=function(e){var t=Object.keys(l(e,function(e,t){e[t]=true;return e},{}));return e.join(":")===t.join(":")};var Xt=Kt(["z","a","bb"]);var Zt=Kt(["z",1,"a","3",2]);if(s){var Qt=function fastkey(e){if(!Xt){return null}var t=typeof e;if(t==="undefined"||e===null){return"^"+String(e)}else if(t==="string"){return"$"+e}else if(t==="number"){if(!Zt){return"n"+e}return e}else if(t==="boolean"){return"b"+e}return null};var Yt=function emptyObject(){return Object.create?Object.create(null):{}};var er=function addIterableToMap(e,n,o){if(r(o)||B.string(o)){c(o,function(e){n.set(e[0],e[1])})}else if(o instanceof e){t(e.prototype.forEach,o,function(e,t){n.set(t,e)})}else{var i,a;if(o!==null&&typeof o!=="undefined"){a=n.set;if(!J.IsCallable(a)){throw new TypeError("bad map")}i=J.GetIterator(o)}if(typeof i!=="undefined"){while(true){var u=J.IteratorStep(i);if(u===false){break}var s=u.value;try{if(!J.TypeIsObject(s)){throw new TypeError("expected iterable of pairs")}t(a,n,s[0],s[1])}catch(f){J.IteratorClose(i,true);throw f}}}}};var tr=function addIterableToSet(e,n,o){if(r(o)||B.string(o)){c(o,function(e){n.add(e)})}else if(o instanceof e){t(e.prototype.forEach,o,function(e){n.add(e)})}else{var i,a;if(o!==null&&typeof o!=="undefined"){a=n.add;if(!J.IsCallable(a)){throw new TypeError("bad set")}i=J.GetIterator(o)}if(typeof i!=="undefined"){while(true){var u=J.IteratorStep(i);if(u===false){break}var s=u.value;try{t(a,n,s)}catch(f){J.IteratorClose(i,true);throw f}}}}};var rr={Map:function(){var e={};var r=function MapEntry(e,t){this.key=e;this.value=t;this.next=null;this.prev=null};r.prototype.isRemoved=function isRemoved(){return this.key===e};var n=function isMap(e){return!!e._es6map};var o=function requireMapSlot(e,t){if(!J.TypeIsObject(e)||!n(e)){throw new TypeError("Method Map.prototype."+t+" called on incompatible receiver "+String(e))}};var i=function MapIterator(e,t){o(e,"[[MapIterator]]");this.head=e._head;this.i=this.head;this.kind=t};i.prototype={next:function next(){var e=this.i,t=this.kind,r=this.head,n;if(typeof this.i==="undefined"){return{value:void 0,done:true}}while(e.isRemoved()&&e!==r){e=e.prev}while(e.next!==r){e=e.next;if(!e.isRemoved()){if(t==="key"){n=e.key}else if(t==="value"){n=e.value}else{n=[e.key,e.value]}this.i=e;return{value:n,done:false}}}this.i=void 0;return{value:void 0,done:true}}};Y(i.prototype);var a;var u=function Map(){if(!(this instanceof Map)){throw new TypeError('Constructor Map requires "new"')}if(this&&this._es6map){throw new TypeError("Bad construction")}var e=re(this,Map,a,{_es6map:true,_head:null,_storage:Yt(),_size:0});var t=new r(null,null);t.next=t.prev=t;e._head=t;if(arguments.length>0){er(Map,e,arguments[0])}return e};a=u.prototype;U.getter(a,"size",function(){if(typeof this._size==="undefined"){throw new TypeError("size method called on incompatible Map")}return this._size});h(a,{get:function get(e){o(this,"get");var t=Qt(e);if(t!==null){var r=this._storage[t];if(r){return r.value}else{return}}var n=this._head,i=n;while((i=i.next)!==n){if(J.SameValueZero(i.key,e)){return i.value}}},has:function has(e){o(this,"has");var t=Qt(e);if(t!==null){return typeof this._storage[t]!=="undefined"}var r=this._head,n=r;while((n=n.next)!==r){if(J.SameValueZero(n.key,e)){return true}}return false},set:function set(e,t){o(this,"set");var n=this._head,i=n,a;var u=Qt(e);if(u!==null){if(typeof this._storage[u]!=="undefined"){this._storage[u].value=t;return this}else{a=this._storage[u]=new r(e,t);i=n.prev}}while((i=i.next)!==n){if(J.SameValueZero(i.key,e)){i.value=t;return this}}a=a||new r(e,t);if(J.SameValue(-0,e)){a.key=+0}a.next=this._head;a.prev=this._head.prev;a.prev.next=a;a.next.prev=a;this._size+=1;return this},"delete":function(t){o(this,"delete");var r=this._head,n=r;var i=Qt(t);if(i!==null){if(typeof this._storage[i]==="undefined"){return false}n=this._storage[i].prev;delete this._storage[i]}while((n=n.next)!==r){if(J.SameValueZero(n.key,t)){n.key=n.value=e;n.prev.next=n.next;n.next.prev=n.prev;this._size-=1;return true}}return false},clear:function clear(){o(this,"clear");this._size=0;this._storage=Yt();var t=this._head,r=t,n=r.next;while((r=n)!==t){r.key=r.value=e;n=r.next;r.next=r.prev=t}t.next=t.prev=t},keys:function keys(){o(this,"keys");return new i(this,"key")},values:function values(){o(this,"values");return new i(this,"value")},entries:function entries(){o(this,"entries");return new i(this,"key+value")},forEach:function forEach(e){o(this,"forEach");var r=arguments.length>1?arguments[1]:null;var n=this.entries();for(var i=n.next();!i.done;i=n.next()){if(r){t(e,r,i.value[1],i.value[0],this)}else{e(i.value[1],i.value[0],this)}}}});Y(a,a.entries);return u}(),Set:function(){var e=function isSet(e){return e._es6set&&typeof e._storage!=="undefined"};var r=function requireSetSlot(t,r){if(!J.TypeIsObject(t)||!e(t)){throw new TypeError("Set.prototype."+r+" called on incompatible receiver "+String(t))}};var n;var o=function Set(){if(!(this instanceof Set)){throw new TypeError('Constructor Set requires "new"')}if(this&&this._es6set){throw new TypeError("Bad construction")}var e=re(this,Set,n,{_es6set:true,"[[SetData]]":null,_storage:Yt()});if(!e._es6set){throw new TypeError("bad set")}if(arguments.length>0){tr(Set,e,arguments[0])}return e};n=o.prototype;var i=function ensureMap(e){if(!e["[[SetData]]"]){var t=e["[[SetData]]"]=new rr.Map;c(Object.keys(e._storage),function(e){var r=e;if(r==="^null"){r=null}else if(r==="^undefined"){r=void 0}else{var n=r.charAt(0);if(n==="$"){r=T(r,1)}else if(n==="n"){r=+T(r,1)}else if(n==="b"){r=r==="btrue"}else{r=+r}}t.set(r,r)});e._storage=null}};U.getter(o.prototype,"size",function(){r(this,"size");i(this);return this["[[SetData]]"].size});h(o.prototype,{has:function has(e){r(this,"has");var t;if(this._storage&&(t=Qt(e))!==null){return!!this._storage[t]}i(this);return this["[[SetData]]"].has(e)},add:function add(e){r(this,"add");var t;if(this._storage&&(t=Qt(e))!==null){this._storage[t]=true;return this}i(this);this["[[SetData]]"].set(e,e);return this},"delete":function(e){r(this,"delete");var t;if(this._storage&&(t=Qt(e))!==null){var n=_(this._storage,t);return delete this._storage[t]&&n}i(this);return this["[[SetData]]"]["delete"](e)},clear:function clear(){r(this,"clear");if(this._storage){this._storage=Yt()}else{this["[[SetData]]"].clear()}},values:function values(){r(this,"values");i(this);return this["[[SetData]]"].values()},entries:function entries(){r(this,"entries");i(this);return this["[[SetData]]"].entries()},forEach:function forEach(e){r(this,"forEach");var n=arguments.length>1?arguments[1]:null;var o=this;i(o);this["[[SetData]]"].forEach(function(r,i){if(n){t(e,n,i,i,o)}else{e(i,i,o)}})}});y(o.prototype,"keys",o.prototype.values,true);Y(o.prototype,o.prototype.values);return o}()};if(m.Map||m.Set){var nr=i(function(){return new Map([[1,2]]).get(1)===2});if(!nr){var or=m.Map;m.Map=function Map(){if(!(this instanceof Map)){throw new TypeError('Constructor Map requires "new"')}var e=new or;if(arguments.length>0){er(Map,e,arguments[0])}Object.setPrototypeOf(e,m.Map.prototype);y(e,"constructor",Map,true);return e};m.Map.prototype=g(or.prototype);U.preserveToString(m.Map,or)}var ir=new Map;var ar=function(e){e["delete"](0);e["delete"](-0);e.set(0,3);e.get(-0,4);return e.get(0)===3&&e.get(-0)===4}(ir);var ur=ir.set(1,2)===ir;if(!ar||!ur){var sr=Map.prototype.set;Q(Map.prototype,"set",function set(e,r){t(sr,this,e===0?0:e,r);return this})}if(!ar){var fr=Map.prototype.get;var cr=Map.prototype.has;h(Map.prototype,{get:function get(e){return t(fr,this,e===0?0:e)},has:function has(e){return t(cr,this,e===0?0:e)}},true);U.preserveToString(Map.prototype.get,fr);U.preserveToString(Map.prototype.has,cr)}var lr=new Set;var pr=function(e){e["delete"](0);e.add(-0);return!e.has(0)}(lr);var vr=lr.add(1)===lr;if(!pr||!vr){var yr=Set.prototype.add;Set.prototype.add=function add(e){t(yr,this,e===0?0:e);return this};U.preserveToString(Set.prototype.add,yr)}if(!pr){var hr=Set.prototype.has;Set.prototype.has=function has(e){return t(hr,this,e===0?0:e)};U.preserveToString(Set.prototype.has,hr);var gr=Set.prototype["delete"];Set.prototype["delete"]=function SetDelete(e){return t(gr,this,e===0?0:e)};U.preserveToString(Set.prototype["delete"],gr)}var br=b(m.Map,function(e){var t=new e([]);t.set(42,42);return t instanceof e});var dr=Object.setPrototypeOf&&!br;var mr=function(){try{return!(m.Map()instanceof m.Map)}catch(e){return e instanceof TypeError}}();if(m.Map.length!==0||dr||!mr){var Or=m.Map;m.Map=function Map(){if(!(this instanceof Map)){throw new TypeError('Constructor Map requires "new"')}var e=new Or;if(arguments.length>0){er(Map,e,arguments[0])}Object.setPrototypeOf(e,Map.prototype);y(e,"constructor",Map,true);return e};m.Map.prototype=Or.prototype;U.preserveToString(m.Map,Or)}var wr=b(m.Set,function(e){var t=new e([]);t.add(42,42);return t instanceof e});var jr=Object.setPrototypeOf&&!wr;var Sr=function(){try{return!(m.Set()instanceof m.Set)}catch(e){return e instanceof TypeError}}();if(m.Set.length!==0||jr||!Sr){var Tr=m.Set;m.Set=function Set(){if(!(this instanceof Set)){throw new TypeError('Constructor Set requires "new"')}var e=new Tr;if(arguments.length>0){tr(Set,e,arguments[0])}Object.setPrototypeOf(e,Set.prototype);y(e,"constructor",Set,true);return e};m.Set.prototype=Tr.prototype;U.preserveToString(m.Set,Tr)}var Ir=!i(function(){return(new Map).keys().next().done});if(typeof m.Map.prototype.clear!=="function"||(new m.Set).size!==0||(new m.Map).size!==0||typeof m.Map.prototype.keys!=="function"||typeof m.Set.prototype.keys!=="function"||typeof m.Map.prototype.forEach!=="function"||typeof m.Set.prototype.forEach!=="function"||a(m.Map)||a(m.Set)||typeof(new m.Map).keys().next!=="function"||Ir||!br){delete m.Map;delete m.Set;h(m,{Map:rr.Map,Set:rr.Set},true)}if(m.Set.prototype.keys!==m.Set.prototype.values){y(m.Set.prototype,"keys",m.Set.prototype.values,true)}Y(Object.getPrototypeOf((new m.Map).keys()));Y(Object.getPrototypeOf((new m.Set).keys()));if(f&&m.Set.prototype.has.name!=="has"){var Er=m.Set.prototype.has;Q(m.Set.prototype,"has",function has(e){return t(Er,this,e)})}}h(m,rr);Z(m.Map);Z(m.Set)}var Mr=function throwUnlessTargetIsObject(e){if(!J.TypeIsObject(e)){throw new TypeError("target must be an object")}};var Pr={apply:function apply(){return e(J.Call,null,arguments)},construct:function construct(e,t){if(!J.IsConstructor(e)){throw new TypeError("First argument must be a constructor.")}var r=arguments.length<3?e:arguments[2];if(!J.IsConstructor(r)){throw new TypeError("new.target must be a constructor.")}return J.Construct(e,t,r,"internal")},deleteProperty:function deleteProperty(e,t){Mr(e);if(s){var r=Object.getOwnPropertyDescriptor(e,t);if(r&&!r.configurable){return false}}return delete e[t]},enumerate:function enumerate(e){Mr(e);return new we(e,"key")},has:function has(e,t){Mr(e);return t in e}};if(Object.getOwnPropertyNames){Object.assign(Pr,{ownKeys:function ownKeys(e){Mr(e);var t=Object.getOwnPropertyNames(e);if(J.IsCallable(Object.getOwnPropertySymbols)){E(t,Object.getOwnPropertySymbols(e))}return t}})}var xr=function ConvertExceptionToBoolean(e){return!o(e)};if(Object.preventExtensions){Object.assign(Pr,{isExtensible:function isExtensible(e){Mr(e);return Object.isExtensible(e)},preventExtensions:function preventExtensions(e){Mr(e);return xr(function(){Object.preventExtensions(e)})}})}if(s){var Nr=function get(e,r,n){var o=Object.getOwnPropertyDescriptor(e,r);if(!o){var i=Object.getPrototypeOf(e);if(i===null){return undefined}return Nr(i,r,n)}if("value"in o){return o.value}if(o.get){return t(o.get,n)}return undefined};var Cr=function set(e,r,n,o){var i=Object.getOwnPropertyDescriptor(e,r);if(!i){var a=Object.getPrototypeOf(e);if(a!==null){return Cr(a,r,n,o)}i={value:void 0,writable:true,enumerable:true,configurable:true}}if("value"in i){if(!i.writable){return false}if(!J.TypeIsObject(o)){return false}var u=Object.getOwnPropertyDescriptor(o,r);if(u){return V.defineProperty(o,r,{value:n})}else{return V.defineProperty(o,r,{value:n,writable:true,enumerable:true,configurable:true})}}if(i.set){t(i.set,o,n);return true}return false};Object.assign(Pr,{defineProperty:function defineProperty(e,t,r){Mr(e);return xr(function(){Object.defineProperty(e,t,r)})},getOwnPropertyDescriptor:function getOwnPropertyDescriptor(e,t){Mr(e);return Object.getOwnPropertyDescriptor(e,t)},get:function get(e,t){Mr(e);var r=arguments.length>2?arguments[2]:e;return Nr(e,t,r)},set:function set(e,t,r){Mr(e);var n=arguments.length>3?arguments[3]:e;return Cr(e,t,r,n)}})}if(Object.getPrototypeOf){var Ar=Object.getPrototypeOf;Pr.getPrototypeOf=function getPrototypeOf(e){Mr(e);return Ar(e)}}if(Object.setPrototypeOf&&Pr.getPrototypeOf){var kr=function(e,t){var r=t;while(r){if(e===r){return true}r=Pr.getPrototypeOf(r)}return false};Object.assign(Pr,{setPrototypeOf:function setPrototypeOf(e,t){Mr(e);if(t!==null&&!J.TypeIsObject(t)){throw new TypeError("proto must be an object or null")}if(t===V.getPrototypeOf(e)){return true}if(V.isExtensible&&!V.isExtensible(e)){return false}if(kr(e,t)){return false}Object.setPrototypeOf(e,t);return true}})}var _r=function(e,t){if(!J.IsCallable(m.Reflect[e])){y(m.Reflect,e,t)}else{var r=i(function(){m.Reflect[e](1);m.Reflect[e](NaN);m.Reflect[e](true);return true});if(r){Q(m.Reflect,e,t)}}};Object.keys(Pr).forEach(function(e){_r(e,Pr[e])});if(f&&m.Reflect.getPrototypeOf.name!=="getPrototypeOf"){var Rr=m.Reflect.getPrototypeOf;Q(m.Reflect,"getPrototypeOf",function getPrototypeOf(e){return t(Rr,m.Reflect,e)})}if(m.Reflect.setPrototypeOf){if(i(function(){m.Reflect.setPrototypeOf(1,{});return true})){Q(m.Reflect,"setPrototypeOf",Pr.setPrototypeOf)}}if(m.Reflect.defineProperty){if(!i(function(){var e=!m.Reflect.defineProperty(1,"test",{value:1});var t=typeof Object.preventExtensions!=="function"||!m.Reflect.defineProperty(Object.preventExtensions({}),"test",{});return e&&t})){Q(m.Reflect,"defineProperty",Pr.defineProperty)}}if(m.Reflect.construct){if(!i(function(){var e=function F(){};return m.Reflect.construct(function(){},[],e)instanceof e})){Q(m.Reflect,"construct",Pr.construct)}}if(String(new Date(NaN))!=="Invalid Date"){var Fr=Date.prototype.toString;var Dr=function toString(){var e=+this;if(e!==e){return"Invalid Date"}return t(Fr,this)};Q(Date.prototype,"toString",Dr)}var zr={anchor:function anchor(e){return J.CreateHTML(this,"a","name",e)},big:function big(){return J.CreateHTML(this,"big","","")},blink:function blink(){return J.CreateHTML(this,"blink","","")},bold:function bold(){return J.CreateHTML(this,"b","","")},fixed:function fixed(){return J.CreateHTML(this,"tt","","")},fontcolor:function fontcolor(e){return J.CreateHTML(this,"font","color",e)},fontsize:function fontsize(e){return J.CreateHTML(this,"font","size",e)},italics:function italics(){return J.CreateHTML(this,"i","","")},link:function link(e){return J.CreateHTML(this,"a","href",e)},small:function small(){return J.CreateHTML(this,"small","","")},strike:function strike(){return J.CreateHTML(this,"strike","","")},sub:function sub(){return J.CreateHTML(this,"sub","","")},sup:function sub(){return J.CreateHTML(this,"sup","","")}};c(Object.keys(zr),function(e){var r=String.prototype[e];var n=false;if(J.IsCallable(r)){var o=t(r,"",' " ');var i=S([],o.match(/"/g)).length;n=o!==o.toLowerCase()||i>2}else{n=true}if(n){Q(String.prototype,e,zr[e])}});var Lr=function(){if(!B.symbol(D.iterator)){return false}var e=typeof JSON==="object"&&typeof JSON.stringify==="function"?JSON.stringify:null;if(!e){return false}if(typeof e(D())!=="undefined"){return true}if(e([D()])!=="[null]"){return true}var t={a:D()};t[D()]=true;if(e(t)!=="{}"){return true}return false}();var qr=i(function(){if(!B.symbol(D.iterator)){return true}return JSON.stringify(Object(D()))==="{}"&&JSON.stringify([Object(D())])==="[{}]"});if(Lr||!qr){var Gr=JSON.stringify;Q(JSON,"stringify",function stringify(e){if(typeof e==="symbol"){return}var n;if(arguments.length>1){n=arguments[1]}var o=[e];if(!r(n)){var i=J.IsCallable(n)?n:null;var a=function(e,r){var o=n?t(n,this,e,r):r;if(typeof o!=="symbol"){if(B.symbol(o)){return Qe({})(o)}else{return o}}};o.push(a)}else{o.push(n)}if(arguments.length>2){o.push(arguments[2])}return Gr.apply(this,o)})}return m}); 12 | //# sourceMappingURL=es6-shim.map 13 | -------------------------------------------------------------------------------- /builds/development/js/lib/angular2/system-polyfills.js: -------------------------------------------------------------------------------- 1 | /* 2 | * SystemJS Polyfills for URL and Promise providing IE8+ Support 3 | */ 4 | !function(t){!function(t){function e(t,n){if("string"!=typeof t)throw new TypeError("URL must be a string");var o=String(t).replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);if(!o)throw new RangeError;var r=o[1]||"",i=o[2]||"",u=o[3]||"",c=o[4]||"",s=o[5]||"",f=o[6]||"",a=o[7]||"",h=o[8]||"",p=o[9]||"";if(void 0!==n){var l=n instanceof e?n:new e(n),d=""===r&&""===c&&""===i;d&&""===a&&""===h&&(h=l.search),d&&"/"!==a.charAt(0)&&(a=""!==a?(""===l.host&&""===l.username||""!==l.pathname?"":"/")+l.pathname.slice(0,l.pathname.lastIndexOf("/")+1)+a:l.pathname);var y=[];a.replace(/^(\.\.?(\/|$))+/,"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(t){"/.."===t?y.pop():y.push(t)}),a=y.join("").replace(/^\//,"/"===a.charAt(0)?"/":""),d&&(f=l.port,s=l.hostname,c=l.host,u=l.password,i=l.username),""===r&&(r=l.protocol)}"file:"==r&&(a=a.replace(/\\/g,"/")),this.origin=r+(""!==r||""!==c?"//":"")+c,this.href=r+(""!==r||""!==c?"//":"")+(""!==i?i+(""!==u?":"+u:"")+"@":"")+c+a+h+p,this.protocol=r,this.username=i,this.password=u,this.host=c,this.hostname=s,this.port=f,this.pathname=a,this.search=h,this.hash=p}t.URLPolyfill=e}("undefined"!=typeof self?self:global),!function(e){"object"==typeof exports?module.exports=e():"function"==typeof t&&t.amd?t(e):"undefined"!=typeof window?window.Promise=e():"undefined"!=typeof global?global.Promise=e():"undefined"!=typeof self&&(self.Promise=e())}(function(){var t;return function e(t,n,o){function r(u,c){if(!n[u]){if(!t[u]){var s="function"==typeof require&&require;if(!c&&s)return s(u,!0);if(i)return i(u,!0);throw new Error("Cannot find module '"+u+"'")}var f=n[u]={exports:{}};t[u][0].call(f.exports,function(e){var n=t[u][1][e];return r(n?n:e)},f,f.exports,e,t,n,o)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u=0&&(l.splice(e,1),h("Handled previous rejection ["+t.id+"] "+r.formatObject(t.value)))}function c(t,e){p.push(t,e),null===d&&(d=o(s,0))}function s(){for(d=null;p.length>0;)p.shift()(p.shift())}var f,a=n,h=n;"undefined"!=typeof console&&(f=console,a="undefined"!=typeof f.error?function(t){f.error(t)}:function(t){f.log(t)},h="undefined"!=typeof f.info?function(t){f.info(t)}:function(t){f.log(t)}),t.onPotentiallyUnhandledRejection=function(t){c(i,t)},t.onPotentiallyUnhandledRejectionHandled=function(t){c(u,t)},t.onFatalRejection=function(t){c(e,t.value)};var p=[],l=[],d=null;return t}})}("function"==typeof t&&t.amd?t:function(t){n.exports=t(e)})},{"../env":5,"../format":6}],5:[function(e,n,o){!function(t){"use strict";t(function(t){function e(){return"undefined"!=typeof process&&null!==process&&"function"==typeof process.nextTick}function n(){return"function"==typeof MutationObserver&&MutationObserver||"function"==typeof WebKitMutationObserver&&WebKitMutationObserver}function o(t){function e(){var t=n;n=void 0,t()}var n,o=document.createTextNode(""),r=new t(e);r.observe(o,{characterData:!0});var i=0;return function(t){n=t,o.data=i^=1}}var r,i="undefined"!=typeof setTimeout&&setTimeout,u=function(t,e){return setTimeout(t,e)},c=function(t){return clearTimeout(t)},s=function(t){return i(t,0)};if(e())s=function(t){return process.nextTick(t)};else if(r=n())s=o(r);else if(!i){var f=t,a=f("vertx");u=function(t,e){return a.setTimer(e,t)},c=a.cancelTimer,s=a.runOnLoop||a.runOnContext}return{setTimer:u,clearTimer:c,asap:s}})}("function"==typeof t&&t.amd?t:function(t){n.exports=t(e)})},{}],6:[function(e,n,o){!function(t){"use strict";t(function(){function t(t){var n="object"==typeof t&&null!==t&&t.stack?t.stack:e(t);return t instanceof Error?n:n+" (WARNING: non-Error used)"}function e(t){var e=String(t);return"[object Object]"===e&&"undefined"!=typeof JSON&&(e=n(t,e)),e}function n(t,e){try{return JSON.stringify(t)}catch(n){return e}}return{formatError:t,formatObject:e,tryStringify:n}})}("function"==typeof t&&t.amd?t:function(t){n.exports=t()})},{}],7:[function(e,n,o){!function(t){"use strict";t(function(){return function(t){function e(t,e){this._handler=t===j?e:n(t)}function n(t){function e(t){r.resolve(t)}function n(t){r.reject(t)}function o(t){r.notify(t)}var r=new b;try{t(e,n,o)}catch(i){n(i)}return r}function o(t){return k(t)?t:new e(j,new x(v(t)))}function r(t){return new e(j,new x(new q(t)))}function i(){return Z}function u(){return new e(j,new b)}function c(t,e){var n=new b(t.receiver,t.join().context);return new e(j,n)}function s(t){return a(z,null,t)}function f(t,e){return a(J,t,e)}function a(t,n,o){function r(e,r,u){u.resolved||h(o,i,e,t(n,r,e),u)}function i(t,e,n){a[t]=e,0===--f&&n.become(new R(a))}for(var u,c="function"==typeof n?r:i,s=new b,f=o.length>>>0,a=new Array(f),p=0;p0?e(n,i.value,r):(r.become(i),p(t,n+1,i))}else e(n,o,r)}function p(t,e,n){for(var o=e;on&&t._unreport()}}function d(t){return"object"!=typeof t||null===t?r(new TypeError("non-iterable passed to race()")):0===t.length?i():1===t.length?o(t[0]):y(t)}function y(t){var n,o,r,i=new b;for(n=0;n0||"function"!=typeof e&&0>r)return new this.constructor(j,o);var i=this._beget(),u=i._handler;return o.chain(u,o.receiver,t,e,n),i},e.prototype["catch"]=function(t){return this.then(void 0,t)},e.prototype._beget=function(){return c(this._handler,this.constructor)},e.all=s,e.race=d,e._traverse=f,e._visitRemaining=p,j.prototype.when=j.prototype.become=j.prototype.notify=j.prototype.fail=j.prototype._unreport=j.prototype._report=B,j.prototype._state=0,j.prototype.state=function(){return this._state},j.prototype.join=function(){for(var t=this;void 0!==t.handler;)t=t.handler;return t},j.prototype.chain=function(t,e,n,o,r){this.when({resolver:t,receiver:e,fulfilled:n,rejected:o,progress:r})},j.prototype.visit=function(t,e,n,o){this.chain(V,t,e,n,o)},j.prototype.fold=function(t,e,n,o){this.when(new S(t,e,n,o))},W(j,_),_.prototype.become=function(t){t.fail()};var V=new _;W(j,b),b.prototype._state=0,b.prototype.resolve=function(t){this.become(v(t))},b.prototype.reject=function(t){this.resolved||this.become(new q(t))},b.prototype.join=function(){if(!this.resolved)return this;for(var t=this;void 0!==t.handler;)if(t=t.handler,t===this)return this.handler=T();return t},b.prototype.run=function(){var t=this.consumers,e=this.handler;this.handler=this.handler.join(),this.consumers=void 0;for(var n=0;n 3 |
{{Message}}
4 | 5 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'), 2 | webserver = require('gulp-webserver'), 3 | typescript = require('gulp-typescript'), 4 | sourcemaps = require('gulp-sourcemaps'), 5 | tscConfig = require('./tsconfig.json'); 6 | 7 | var appSrc = 'builds/development/', 8 | tsSrc = 'process/typescript/'; 9 | 10 | gulp.task('html', function() { 11 | gulp.src(appSrc + '**/*.html'); 12 | }); 13 | 14 | gulp.task('css', function() { 15 | gulp.src(appSrc + '**/*.css'); 16 | }); 17 | 18 | gulp.task('copylibs', function() { 19 | return gulp 20 | .src([ 21 | 'node_modules/es6-shim/es6-shim.min.js', 22 | 'node_modules/systemjs/dist/system-polyfills.js', 23 | 'node_modules/angular2/bundles/angular2-polyfills.js', 24 | 'node_modules/systemjs/dist/system.src.js', 25 | 'node_modules/rxjs/bundles/Rx.js', 26 | 'node_modules/angular2/bundles/angular2.dev.js' 27 | ]) 28 | .pipe(gulp.dest(appSrc + 'js/lib/angular2')); 29 | }); 30 | 31 | gulp.task('typescript', function () { 32 | return gulp 33 | .src(tsSrc + '**/*.ts') 34 | .pipe(sourcemaps.init()) 35 | .pipe(typescript(tscConfig.compilerOptions)) 36 | .pipe(sourcemaps.write('.')) 37 | .pipe(gulp.dest(appSrc + 'js/')); 38 | }); 39 | 40 | gulp.task('watch', function() { 41 | gulp.watch(tsSrc + '**/*.ts', ['typescript']); 42 | gulp.watch(appSrc + 'css/*.css', ['css']); 43 | gulp.watch(appSrc + '**/*.html', ['html']); 44 | }); 45 | 46 | gulp.task('webserver', function() { 47 | gulp.src(appSrc) 48 | .pipe(webserver({ 49 | livereload: true, 50 | open: true 51 | })); 52 | }); 53 | 54 | gulp.task('default', ['copylibs', 'typescript', 'watch', 'webserver']); 55 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "AngularJS2", 3 | "version": "1.0.0", 4 | "author": "Alruabye", 5 | "description": "AngularJS2 basic learn", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/hussien89aa/angular2.git" 9 | }, 10 | "devDependencies": { 11 | "angular2": "2.0.0-beta.2", 12 | "systemjs": "0.19.6", 13 | "es6-promise": "^3.0.2", 14 | "es6-shim": "^0.33.3", 15 | "reflect-metadata": "0.1.2", 16 | "rxjs": "5.0.0-beta.0", 17 | "zone.js": "0.5.10", 18 | "gulp": "^3.9.0", 19 | "gulp-sourcemaps": "^1.6.0", 20 | "gulp-typescript": "^2.10.0", 21 | "gulp-webserver": "^0.9.1" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /process/typescript/app.component.ts: -------------------------------------------------------------------------------- 1 | import {Component} from 'angular2/core'; 2 | 3 | @Component({ 4 | selector: 'my-app', 5 | // template: '

Welcome to Angualr 2

' 6 | templateUrl:'views/app.component.html' 7 | }) 8 | 9 | export class AppComponent { 10 | Message:string= "Angular2" 11 | 12 | } 13 | -------------------------------------------------------------------------------- /process/typescript/boot.ts: -------------------------------------------------------------------------------- 1 | import {bootstrap} from 'angular2/platform/browser'; 2 | import {AppComponent} from './app.component'; 3 | 4 | bootstrap(AppComponent); 5 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "system", 5 | "moduleResolution": "node", 6 | "sourceMap": true, 7 | "emitDecoratorMetadata": true, 8 | "experimentalDecorators": true, 9 | "removeComments": false, 10 | "noImplicitAny": false 11 | }, 12 | "exclude": [ 13 | "node_modules" 14 | ] 15 | } 16 | --------------------------------------------------------------------------------