{"version":3,"file":"upgrade.umd.min.js","sources":["../../../../packages/upgrade/src/common/angular1.ts","../../../../packages/upgrade/src/common/constants.ts","../../../../packages/upgrade/src/common/component_info.ts","../../../../packages/upgrade/src/common/util.ts","../../../../packages/upgrade/src/common/downgrade_component_adapter.ts","../../../../packages/upgrade/src/common/downgrade_component.ts","../../../../packages/upgrade/src/common/upgrade_helper.ts","../../../../packages/upgrade/src/dynamic/upgrade_ng1_adapter.ts","../../../../packages/upgrade/src/dynamic/upgrade_adapter.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport type Ng1Token = string;\n\nexport type Ng1Expression = string | Function;\n\nexport interface IAnnotatedFunction extends Function { $inject?: Ng1Token[]; }\n\nexport type IInjectable = (Ng1Token | Function)[] | IAnnotatedFunction;\n\nexport type SingleOrListOrMap = T | T[] | {[key: string]: T};\n\nexport interface IModule {\n name: string;\n requires: (string|IInjectable)[];\n config(fn: IInjectable): IModule;\n directive(selector: string, factory: IInjectable): IModule;\n component(selector: string, component: IComponent): IModule;\n controller(name: string, type: IInjectable): IModule;\n factory(key: Ng1Token, factoryFn: IInjectable): IModule;\n value(key: Ng1Token, value: any): IModule;\n constant(token: Ng1Token, value: any): IModule;\n run(a: IInjectable): IModule;\n}\nexport interface ICompileService {\n (element: Element|NodeList|Node[]|string, transclude?: Function): ILinkFn;\n}\nexport interface ILinkFn {\n (scope: IScope, cloneAttachFn?: ICloneAttachFunction, options?: ILinkFnOptions): IAugmentedJQuery;\n $$slots?: {[slotName: string]: ILinkFn};\n}\nexport interface ILinkFnOptions {\n parentBoundTranscludeFn?: Function;\n transcludeControllers?: {[key: string]: any};\n futureParentElement?: Node;\n}\nexport interface IRootScopeService {\n $new(isolate?: boolean): IScope;\n $id: string;\n $parent: IScope;\n $root: IScope;\n $watch(exp: Ng1Expression, fn?: (a1?: any, a2?: any) => void): Function;\n $on(event: string, fn?: (event?: any, ...args: any[]) => void): Function;\n $destroy(): any;\n $apply(exp?: Ng1Expression): any;\n $digest(): any;\n $evalAsync(exp: Ng1Expression, locals?: any): void;\n $on(event: string, fn?: (event?: any, ...args: any[]) => void): Function;\n $$childTail: IScope;\n $$childHead: IScope;\n $$nextSibling: IScope;\n [key: string]: any;\n}\nexport interface IScope extends IRootScopeService {}\n\nexport interface IAngularBootstrapConfig { strictDi?: boolean; }\nexport interface IDirective {\n compile?: IDirectiveCompileFn;\n controller?: IController;\n controllerAs?: string;\n bindToController?: boolean|{[key: string]: string};\n link?: IDirectiveLinkFn|IDirectivePrePost;\n name?: string;\n priority?: number;\n replace?: boolean;\n require?: DirectiveRequireProperty;\n restrict?: string;\n scope?: boolean|{[key: string]: string};\n template?: string|Function;\n templateUrl?: string|Function;\n templateNamespace?: string;\n terminal?: boolean;\n transclude?: DirectiveTranscludeProperty;\n}\nexport type DirectiveRequireProperty = SingleOrListOrMap;\nexport type DirectiveTranscludeProperty = boolean | 'element' | {[key: string]: string};\nexport interface IDirectiveCompileFn {\n (templateElement: IAugmentedJQuery, templateAttributes: IAttributes,\n transclude: ITranscludeFunction): IDirectivePrePost;\n}\nexport interface IDirectivePrePost {\n pre?: IDirectiveLinkFn;\n post?: IDirectiveLinkFn;\n}\nexport interface IDirectiveLinkFn {\n (scope: IScope, instanceElement: IAugmentedJQuery, instanceAttributes: IAttributes,\n controller: any, transclude: ITranscludeFunction): void;\n}\nexport interface IComponent {\n bindings?: {[key: string]: string};\n controller?: string|IInjectable;\n controllerAs?: string;\n require?: DirectiveRequireProperty;\n template?: string|Function;\n templateUrl?: string|Function;\n transclude?: DirectiveTranscludeProperty;\n}\nexport interface IAttributes {\n $observe(attr: string, fn: (v: string) => void): void;\n [key: string]: any;\n}\nexport interface ITranscludeFunction {\n // If the scope is provided, then the cloneAttachFn must be as well.\n (scope: IScope, cloneAttachFn: ICloneAttachFunction): IAugmentedJQuery;\n // If one argument is provided, then it's assumed to be the cloneAttachFn.\n (cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery;\n}\nexport interface ICloneAttachFunction {\n // Let's hint but not force cloneAttachFn's signature\n (clonedElement?: IAugmentedJQuery, scope?: IScope): any;\n}\nexport type IAugmentedJQuery = Node[] & {\n bind?: (name: string, fn: () => void) => void;\n data?: (name: string, value?: any) => any;\n text?: () => string;\n inheritedData?: (name: string, value?: any) => any;\n contents?: () => IAugmentedJQuery;\n parent?: () => IAugmentedJQuery;\n empty?: () => void;\n append?: (content: IAugmentedJQuery | string) => IAugmentedJQuery;\n controller?: (name: string) => any;\n isolateScope?: () => IScope;\n injector?: () => IInjectorService;\n};\nexport interface IProvider { $get: IInjectable; }\nexport interface IProvideService {\n provider(token: Ng1Token, provider: IProvider): IProvider;\n factory(token: Ng1Token, factory: IInjectable): IProvider;\n service(token: Ng1Token, type: IInjectable): IProvider;\n value(token: Ng1Token, value: any): IProvider;\n constant(token: Ng1Token, value: any): void;\n decorator(token: Ng1Token, factory: IInjectable): void;\n}\nexport interface IParseService { (expression: string): ICompiledExpression; }\nexport interface ICompiledExpression {\n (context: any, locals: any): any;\n assign?: (context: any, value: any) => any;\n}\nexport interface IHttpBackendService {\n (method: string, url: string, post?: any, callback?: Function, headers?: any, timeout?: number,\n withCredentials?: boolean): void;\n}\nexport interface ICacheObject {\n put(key: string, value?: T): T;\n get(key: string): any;\n}\nexport interface ITemplateCacheService extends ICacheObject {}\nexport interface ITemplateRequestService {\n (template: string|any /* TrustedResourceUrl */, ignoreRequestError?: boolean): Promise;\n totalPendingRequests: number;\n}\nexport type IController = string | IInjectable;\nexport interface IControllerService {\n (controllerConstructor: IController, locals?: any, later?: any, ident?: any): any;\n (controllerName: string, locals?: any): any;\n}\n\nexport interface IInjectorService {\n get(key: string): any;\n has(key: string): boolean;\n}\n\nexport interface IIntervalService {\n (func: Function, delay: number, count?: number, invokeApply?: boolean,\n ...args: any[]): Promise;\n cancel(promise: Promise): boolean;\n}\n\nexport interface ITestabilityService {\n findBindings(element: Element, expression: string, opt_exactMatch?: boolean): Element[];\n findModels(element: Element, expression: string, opt_exactMatch?: boolean): Element[];\n getLocation(): string;\n setLocation(url: string): void;\n whenStable(callback: Function): void;\n}\n\nexport interface INgModelController {\n $render(): void;\n $isEmpty(value: any): boolean;\n $setValidity(validationErrorKey: string, isValid: boolean): void;\n $setPristine(): void;\n $setDirty(): void;\n $setUntouched(): void;\n $setTouched(): void;\n $rollbackViewValue(): void;\n $validate(): void;\n $commitViewValue(): void;\n $setViewValue(value: any, trigger: string): void;\n\n $viewValue: any;\n $modelValue: any;\n $parsers: Function[];\n $formatters: Function[];\n $validators: {[key: string]: Function};\n $asyncValidators: {[key: string]: Function};\n $viewChangeListeners: Function[];\n $error: Object;\n $pending: Object;\n $untouched: boolean;\n $touched: boolean;\n $pristine: boolean;\n $dirty: boolean;\n $valid: boolean;\n $invalid: boolean;\n $name: string;\n}\n/**\n * @return {?}\n */\nfunction noNg() {\n throw new Error('AngularJS v1.x is not loaded!');\n}\n\n\nlet /** @type {?} */ angular: {\n bootstrap: (e: Element, modules: (string | IInjectable)[], config?: IAngularBootstrapConfig) =>\n IInjectorService,\n module: (prefix: string, dependencies?: string[]) => IModule,\n element: (e: Element | string) => IAugmentedJQuery,\n version: {major: number},\n resumeBootstrap: () => void,\n getTestability: (e: Element) => ITestabilityService\n} = /** @type {?} */(( {\n bootstrap: noNg,\n module: noNg,\n element: noNg,\n version: noNg,\n resumeBootstrap: noNg,\n getTestability: noNg\n}));\n\ntry {\n if (window.hasOwnProperty('angular')) {\n angular = ( /** @type {?} */((window))).angular;\n }\n} catch ( /** @type {?} */e) {\n // ignore in CJS mode.\n}\n/**\n * Resets the AngularJS library.\n * \n * Used when angularjs is loaded lazily, and not available on `window`.\n * \n * \\@stable\n * @param {?} ng\n * @return {?}\n */\nexport function setAngularLib(ng: any): void {\n angular = ng;\n}\n/**\n * Returns the current version of the AngularJS library.\n * \n * \\@stable\n * @return {?}\n */\nexport function getAngularLib(): any {\n return angular;\n}\n\nexport const /** @type {?} */ bootstrap =\n (e: Element, modules: (string | IInjectable)[], config?: IAngularBootstrapConfig) =>\n angular.bootstrap(e, modules, config);\n\nexport const /** @type {?} */ module = (prefix: string, dependencies?: string[]) =>\n angular.module(prefix, dependencies);\n\nexport const /** @type {?} */ element = (e: Element | string) => angular.element(e);\n\nexport const /** @type {?} */ resumeBootstrap = () => angular.resumeBootstrap();\n\nexport const /** @type {?} */ getTestability = (e: Element) => angular.getTestability(e);\n\nexport const /** @type {?} */ version = angular.version;\n","\n/**\n * @license \n * Copyright Google Inc. All Rights Reserved.\n * \n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nexport const $COMPILE = '$compile';\nexport const /** @type {?} */ $CONTROLLER = '$controller';\nexport const /** @type {?} */ $DELEGATE = '$delegate';\nexport const /** @type {?} */ $HTTP_BACKEND = '$httpBackend';\nexport const /** @type {?} */ $INJECTOR = '$injector';\nexport const /** @type {?} */ $INTERVAL = '$interval';\nexport const /** @type {?} */ $PARSE = '$parse';\nexport const /** @type {?} */ $PROVIDE = '$provide';\nexport const /** @type {?} */ $ROOT_SCOPE = '$rootScope';\nexport const /** @type {?} */ $SCOPE = '$scope';\nexport const /** @type {?} */ $TEMPLATE_CACHE = '$templateCache';\nexport const /** @type {?} */ $TEMPLATE_REQUEST = '$templateRequest';\n\nexport const /** @type {?} */ $$TESTABILITY = '$$testability';\n\nexport const /** @type {?} */ COMPILER_KEY = '$$angularCompiler';\nexport const /** @type {?} */ GROUP_PROJECTABLE_NODES_KEY = '$$angularGroupProjectableNodes';\nexport const /** @type {?} */ INJECTOR_KEY = '$$angularInjector';\nexport const /** @type {?} */ NG_ZONE_KEY = '$$angularNgZone';\n\nexport const /** @type {?} */ REQUIRE_INJECTOR = '?^^' + INJECTOR_KEY;\nexport const /** @type {?} */ REQUIRE_NG_MODEL = '?ngModel';\n\nexport const /** @type {?} */ UPGRADE_MODULE_NAME = '$$UpgradeModule';\n","\n/**\n * A `PropertyBinding` represents a mapping between a property name\n * and an attribute name. It is parsed from a string of the form\n * `\"prop: attr\"`; or simply `\"propAndAttr\" where the property\n * and attribute have the same identifier.\n */\nexport class PropertyBinding {\n bracketAttr: string;\n bracketParenAttr: string;\n parenAttr: string;\n onAttr: string;\n bindAttr: string;\n bindonAttr: string;\n/**\n * @param {?} prop\n * @param {?} attr\n */\nconstructor(public prop: string,\npublic attr: string) { this.parseBinding(); }\n/**\n * @return {?}\n */\nprivate parseBinding() {\n this.bracketAttr = `[${this.attr}]`;\n this.parenAttr = `(${this.attr})`;\n this.bracketParenAttr = `[(${this.attr})]`;\n const /** @type {?} */ capitalAttr = this.attr.charAt(0).toUpperCase() + this.attr.substr(1);\n this.onAttr = `on${capitalAttr}`;\n this.bindAttr = `bind${capitalAttr}`;\n this.bindonAttr = `bindon${capitalAttr}`;\n }\n}\n\nfunction PropertyBinding_tsickle_Closure_declarations() {\n/** @type {?} */\nPropertyBinding.prototype.bracketAttr;\n/** @type {?} */\nPropertyBinding.prototype.bracketParenAttr;\n/** @type {?} */\nPropertyBinding.prototype.parenAttr;\n/** @type {?} */\nPropertyBinding.prototype.onAttr;\n/** @type {?} */\nPropertyBinding.prototype.bindAttr;\n/** @type {?} */\nPropertyBinding.prototype.bindonAttr;\n/** @type {?} */\nPropertyBinding.prototype.prop;\n/** @type {?} */\nPropertyBinding.prototype.attr;\n}\n\n","/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n\nimport {Type} from '@angular/core';\nimport * as angular from './angular1';\n\nconst /** @type {?} */ DIRECTIVE_PREFIX_REGEXP = /^(?:x|data)[:\\-_]/i;\nconst /** @type {?} */ DIRECTIVE_SPECIAL_CHARS_REGEXP = /[:\\-_]+(.)/g;\n/**\n * @param {?} e\n * @return {?}\n */\nexport function onError(e: any) {\n // TODO: (misko): We seem to not have a stack trace here!\n if (console.error) {\n console.error(e, e.stack);\n } else {\n // tslint:disable-next-line:no-console\n console.log(e, e.stack);\n }\n throw e;\n}\n/**\n * @param {?} name\n * @return {?}\n */\nexport function controllerKey(name: string): string {\n return '$' + name + 'Controller';\n}\n/**\n * @param {?} name\n * @return {?}\n */\nexport function directiveNormalize(name: string): string {\n return name.replace(DIRECTIVE_PREFIX_REGEXP, '')\n .replace(DIRECTIVE_SPECIAL_CHARS_REGEXP, (_, letter) => letter.toUpperCase());\n}\n/**\n * @param {?} node\n * @return {?}\n */\nexport function getAttributesAsArray(node: Node): [string, string][] {\n const /** @type {?} */ attributes = node.attributes;\n let /** @type {?} */ asArray: [string, string][] = /** @type {?} */(( undefined));\n if (attributes) {\n let /** @type {?} */ attrLen = attributes.length;\n asArray = new Array(attrLen);\n for (let /** @type {?} */ i = 0; i < attrLen; i++) {\n asArray[i] = [attributes[i].nodeName, /** @type {?} */(( attributes[i].nodeValue))];\n }\n }\n return asArray || [];\n}\n/**\n * @param {?} component\n * @return {?}\n */\nexport function getComponentName(component: Type): string {\n // Return the name of the component or the first line of its stringified version.\n return ( /** @type {?} */((component as any))).overriddenName || component.name || component.toString().split('\\n')[0];\n}\n/**\n * @param {?} value\n * @return {?}\n */\nexport function isFunction(value: any): value is Function {\n return typeof value === 'function';\n}\nexport class Deferred {\n promise: Promise;\n resolve: (value?: R|PromiseLike) => void;\n reject: (error?: any) => void;\nconstructor() {\n this.promise = new Promise((res, rej) => {\n this.resolve = res;\n this.reject = rej;\n });\n }\n}\n\nfunction Deferred_tsickle_Closure_declarations() {\n/** @type {?} */\nDeferred.prototype.promise;\n/** @type {?} */\nDeferred.prototype.resolve;\n/** @type {?} */\nDeferred.prototype.reject;\n}\n\n/**\n * @param {?} component\n * @return {?} Whether the passed-in component implements the subset of the\n * `ControlValueAccessor` interface needed for AngularJS `ng-model`\n * compatibility.\n */\nfunction supportsNgModel(component: any) {\n return typeof component.writeValue === 'function' &&\n typeof component.registerOnChange === 'function';\n}\n/**\n * Glue the AngularJS `NgModelController` (if it exists) to the component\n * (if it implements the needed subset of the `ControlValueAccessor` interface).\n * @param {?} ngModel\n * @param {?} component\n * @return {?}\n */\nexport function hookupNgModel(ngModel: angular.INgModelController, component: any) {\n if (ngModel && supportsNgModel(component)) {\n ngModel.$render = () => { component.writeValue(ngModel.$viewValue); };\n component.registerOnChange(ngModel.$setViewValue.bind(ngModel));\n }\n}\n/**\n * Test two values for strict equality, accounting for the fact that `NaN !== NaN`.\n * @param {?} val1\n * @param {?} val2\n * @return {?}\n */\nexport function strictEquals(val1: any, val2: any): boolean {\n return val1 === val2 || (val1 !== val1 && val2 !== val2);\n}\n","/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n\nimport {ChangeDetectorRef, ComponentFactory, ComponentRef, EventEmitter, Injector, OnChanges, ReflectiveInjector, SimpleChange, SimpleChanges, Type} from '@angular/core';\n\nimport * as angular from './angular1';\nimport {PropertyBinding} from './component_info';\nimport {$SCOPE} from './constants';\nimport {getAttributesAsArray, getComponentName, hookupNgModel, strictEquals} from './util';\n\nconst /** @type {?} */ INITIAL_VALUE = {\n __UNINITIALIZED__: true\n};\nexport class DowngradeComponentAdapter {\nprivate inputChangeCount: number = 0;\nprivate inputChanges: SimpleChanges|null = null;\nprivate componentScope: angular.IScope;\nprivate componentRef: ComponentRef|null = null;\nprivate component: any = null;\nprivate changeDetector: ChangeDetectorRef|null = null;\n/**\n * @param {?} element\n * @param {?} attrs\n * @param {?} scope\n * @param {?} ngModel\n * @param {?} parentInjector\n * @param {?} $injector\n * @param {?} $compile\n * @param {?} $parse\n * @param {?} componentFactory\n */\nconstructor(\nprivate element: angular.IAugmentedJQuery,\nprivate attrs: angular.IAttributes,\nprivate scope: angular.IScope,\nprivate ngModel: angular.INgModelController,\nprivate parentInjector: Injector,\nprivate $injector: angular.IInjectorService,\nprivate $compile: angular.ICompileService,\nprivate $parse: angular.IParseService,\nprivate componentFactory: ComponentFactory) {\n this.componentScope = scope.$new();\n }\n/**\n * @return {?}\n */\ncompileContents(): Node[][] {\n const /** @type {?} */ compiledProjectableNodes: Node[][] = [];\n const /** @type {?} */ projectableNodes: Node[][] = this.groupProjectableNodes();\n const /** @type {?} */ linkFns = projectableNodes.map(nodes => this.$compile(nodes)); /** @type {?} */((\n\n this.element.empty))();\n\n linkFns.forEach(linkFn => {\n linkFn(this.scope, (clone: Node[]) => {\n compiledProjectableNodes.push(clone); /** @type {?} */((\n this.element.append))(clone);\n });\n });\n\n return compiledProjectableNodes;\n }\n/**\n * @param {?} projectableNodes\n * @return {?}\n */\ncreateComponent(projectableNodes: Node[][]) {\n const /** @type {?} */ childInjector = ReflectiveInjector.resolveAndCreate(\n [{provide: $SCOPE, useValue: this.componentScope}], this.parentInjector);\n\n this.componentRef =\n this.componentFactory.create(childInjector, projectableNodes, this.element[0]);\n this.changeDetector = this.componentRef.changeDetectorRef;\n this.component = this.componentRef.instance;\n\n hookupNgModel(this.ngModel, this.component);\n }\n/**\n * @return {?}\n */\nsetupInputs(): void {\n const /** @type {?} */ attrs = this.attrs;\n const /** @type {?} */ inputs = this.componentFactory.inputs || [];\n for (let /** @type {?} */ i = 0; i < inputs.length; i++) {\n const /** @type {?} */ input = new PropertyBinding(inputs[i].propName, inputs[i].templateName);\n let /** @type {?} */ expr: string|null = null;\n\n if (attrs.hasOwnProperty(input.attr)) {\n const /** @type {?} */ observeFn = (prop => {\n let /** @type {?} */ prevValue = INITIAL_VALUE;\n return (currValue: any) => {\n // Initially, both `$observe()` and `$watch()` will call this function.\n if (!strictEquals(prevValue, currValue)) {\n if (prevValue === INITIAL_VALUE) {\n prevValue = currValue;\n }\n\n this.updateInput(prop, prevValue, currValue);\n prevValue = currValue;\n }\n };\n })(input.prop);\n attrs.$observe(input.attr, observeFn);\n\n // Use `$watch()` (in addition to `$observe()`) in order to initialize the input in time\n // for `ngOnChanges()`. This is necessary if we are already in a `$digest`, which means that\n // `ngOnChanges()` (which is called by a watcher) will run before the `$observe()` callback.\n let /** @type {?} */ unwatch: Function|null = this.componentScope.$watch(() => { /** @type {?} */((\n unwatch))();\n unwatch = null;\n observeFn(attrs[input.attr]);\n });\n\n } else if (attrs.hasOwnProperty(input.bindAttr)) {\n expr = attrs[input.bindAttr];\n } else if (attrs.hasOwnProperty(input.bracketAttr)) {\n expr = attrs[input.bracketAttr];\n } else if (attrs.hasOwnProperty(input.bindonAttr)) {\n expr = attrs[input.bindonAttr];\n } else if (attrs.hasOwnProperty(input.bracketParenAttr)) {\n expr = attrs[input.bracketParenAttr];\n }\n if (expr != null) {\n const /** @type {?} */ watchFn =\n (prop => (currValue: any, prevValue: any) =>\n this.updateInput(prop, prevValue, currValue))(input.prop);\n this.componentScope.$watch(expr, watchFn);\n }\n }\n\n const /** @type {?} */ prototype = this.componentFactory.componentType.prototype;\n if (prototype && ( /** @type {?} */((prototype))).ngOnChanges) {\n // Detect: OnChanges interface\n this.inputChanges = {};\n this.componentScope.$watch(() => this.inputChangeCount, () => {\n const /** @type {?} */ inputChanges = this.inputChanges;\n this.inputChanges = {};\n ( /** @type {?} */((this.component))).ngOnChanges( /** @type {?} */((inputChanges)));\n });\n }\n this.componentScope.$watch(() => this.changeDetector && this.changeDetector.detectChanges());\n }\n/**\n * @return {?}\n */\nsetupOutputs() {\n const /** @type {?} */ attrs = this.attrs;\n const /** @type {?} */ outputs = this.componentFactory.outputs || [];\n for (let /** @type {?} */ j = 0; j < outputs.length; j++) {\n const /** @type {?} */ output = new PropertyBinding(outputs[j].propName, outputs[j].templateName);\n let /** @type {?} */ expr: string|null = null;\n let /** @type {?} */ assignExpr = false;\n\n const /** @type {?} */ bindonAttr = output.bindonAttr.substring(0, output.bindonAttr.length - 6);\n const /** @type {?} */ bracketParenAttr =\n `[(${output.bracketParenAttr.substring(2, output.bracketParenAttr.length - 8)})]`;\n\n if (attrs.hasOwnProperty(output.onAttr)) {\n expr = attrs[output.onAttr];\n } else if (attrs.hasOwnProperty(output.parenAttr)) {\n expr = attrs[output.parenAttr];\n } else if (attrs.hasOwnProperty(bindonAttr)) {\n expr = attrs[bindonAttr];\n assignExpr = true;\n } else if (attrs.hasOwnProperty(bracketParenAttr)) {\n expr = attrs[bracketParenAttr];\n assignExpr = true;\n }\n\n if (expr != null && assignExpr != null) {\n const /** @type {?} */ getter = this.$parse(expr);\n const /** @type {?} */ setter = getter.assign;\n if (assignExpr && !setter) {\n throw new Error(`Expression '${expr}' is not assignable!`);\n }\n const /** @type {?} */ emitter = /** @type {?} */(( this.component[output.prop] as EventEmitter));\n if (emitter) {\n emitter.subscribe({\n next: assignExpr ? (v: any) => /** @type {?} */(( setter))(this.scope, v) :\n (v: any) => getter(this.scope, {'$event': v})\n });\n } else {\n throw new Error(\n `Missing emitter '${output.prop}' on component '${getComponentName(this.componentFactory.componentType)}'!`);\n }\n }\n }\n }\n/**\n * @return {?}\n */\nregisterCleanup() { /** @type {?} */((\n this.element.bind))('$destroy', () => {\n this.componentScope.$destroy(); /** @type {?} */((\n this.componentRef)).destroy();\n });\n }\n/**\n * @return {?}\n */\ngetInjector(): Injector { return /** @type {?} */(( this.componentRef)) && /** @type {?} */(( this.componentRef)).injector; }\n/**\n * @param {?} prop\n * @param {?} prevValue\n * @param {?} currValue\n * @return {?}\n */\nprivate updateInput(prop: string, prevValue: any, currValue: any) {\n if (this.inputChanges) {\n this.inputChangeCount++;\n this.inputChanges[prop] = new SimpleChange(prevValue, currValue, prevValue === currValue);\n }\n\n this.component[prop] = currValue;\n }\n/**\n * @return {?}\n */\ngroupProjectableNodes() {\n let /** @type {?} */ ngContentSelectors = this.componentFactory.ngContentSelectors;\n return groupNodesBySelector(ngContentSelectors, /** @type {?} */(( this.element.contents))());\n }\n}\n\nfunction DowngradeComponentAdapter_tsickle_Closure_declarations() {\n/** @type {?} */\nDowngradeComponentAdapter.prototype.inputChangeCount;\n/** @type {?} */\nDowngradeComponentAdapter.prototype.inputChanges;\n/** @type {?} */\nDowngradeComponentAdapter.prototype.componentScope;\n/** @type {?} */\nDowngradeComponentAdapter.prototype.componentRef;\n/** @type {?} */\nDowngradeComponentAdapter.prototype.component;\n/** @type {?} */\nDowngradeComponentAdapter.prototype.changeDetector;\n/** @type {?} */\nDowngradeComponentAdapter.prototype.element;\n/** @type {?} */\nDowngradeComponentAdapter.prototype.attrs;\n/** @type {?} */\nDowngradeComponentAdapter.prototype.scope;\n/** @type {?} */\nDowngradeComponentAdapter.prototype.ngModel;\n/** @type {?} */\nDowngradeComponentAdapter.prototype.parentInjector;\n/** @type {?} */\nDowngradeComponentAdapter.prototype.$injector;\n/** @type {?} */\nDowngradeComponentAdapter.prototype.$compile;\n/** @type {?} */\nDowngradeComponentAdapter.prototype.$parse;\n/** @type {?} */\nDowngradeComponentAdapter.prototype.componentFactory;\n}\n\n/**\n * Group a set of DOM nodes into `ngContent` groups, based on the given content selectors.\n * @param {?} ngContentSelectors\n * @param {?} nodes\n * @return {?}\n */\nexport function groupNodesBySelector(ngContentSelectors: string[], nodes: Node[]): Node[][] {\n const /** @type {?} */ projectableNodes: Node[][] = [];\n let /** @type {?} */ wildcardNgContentIndex: number;\n\n for (let /** @type {?} */ i = 0, /** @type {?} */ ii = ngContentSelectors.length; i < ii; ++i) {\n projectableNodes[i] = [];\n }\n\n for (let /** @type {?} */ j = 0, /** @type {?} */ jj = nodes.length; j < jj; ++j) {\n const /** @type {?} */ node = nodes[j];\n const /** @type {?} */ ngContentIndex = findMatchingNgContentIndex(node, ngContentSelectors);\n if (ngContentIndex != null) {\n projectableNodes[ngContentIndex].push(node);\n }\n }\n\n return projectableNodes;\n}\n/**\n * @param {?} element\n * @param {?} ngContentSelectors\n * @return {?}\n */\nfunction findMatchingNgContentIndex(element: any, ngContentSelectors: string[]): number|null {\n const /** @type {?} */ ngContentIndices: number[] = [];\n let /** @type {?} */ wildcardNgContentIndex: number = -1;\n for (let /** @type {?} */ i = 0; i < ngContentSelectors.length; i++) {\n const /** @type {?} */ selector = ngContentSelectors[i];\n if (selector === '*') {\n wildcardNgContentIndex = i;\n } else {\n if (matchesSelector(element, selector)) {\n ngContentIndices.push(i);\n }\n }\n }\n ngContentIndices.sort();\n\n if (wildcardNgContentIndex !== -1) {\n ngContentIndices.push(wildcardNgContentIndex);\n }\n return ngContentIndices.length ? ngContentIndices[0] : null;\n}\n\nlet /** @type {?} */ _matches: (this: any, selector: string) => boolean;\n/**\n * @param {?} el\n * @param {?} selector\n * @return {?}\n */\nfunction matchesSelector(el: any, selector: string): boolean {\n if (!_matches) {\n const /** @type {?} */ elProto = /** @type {?} */(( Element.prototype));\n _matches = elProto.matches || elProto.matchesSelector || elProto.mozMatchesSelector ||\n elProto.msMatchesSelector || elProto.oMatchesSelector || elProto.webkitMatchesSelector;\n }\n return el.nodeType === Node.ELEMENT_NODE ? _matches.call(el, selector) : false;\n}\n","/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n\nimport {ComponentFactory, ComponentFactoryResolver, Injector, Type} from '@angular/core';\n\nimport * as angular from './angular1';\nimport {$COMPILE, $INJECTOR, $PARSE, INJECTOR_KEY, REQUIRE_INJECTOR, REQUIRE_NG_MODEL} from './constants';\nimport {DowngradeComponentAdapter} from './downgrade_component_adapter';\nimport {controllerKey, getComponentName} from './util';\n/**\n * \\@whatItDoes \n * \n * *Part of the [upgrade/static](api?query=upgrade%2Fstatic)\n * library for hybrid upgrade apps that support AoT compilation*\n * \n * Allows an Angular component to be used from AngularJS.\n * \n * \\@howToUse \n * \n * Let's assume that you have an Angular component called `ng2Heroes` that needs\n * to be made available in AngularJS templates.\n * \n * {\\@example upgrade/static/ts/module.ts region=\"ng2-heroes\"}\n * \n * We must create an AngularJS [directive](https://docs.angularjs.org/guide/directive)\n * that will make this Angular component available inside AngularJS templates.\n * The `downgradeComponent()` function returns a factory function that we\n * can use to define the AngularJS directive that wraps the \"downgraded\" component.\n * \n * {\\@example upgrade/static/ts/module.ts region=\"ng2-heroes-wrapper\"}\n * \n * \\@description \n * \n * A helper function that returns a factory function to be used for registering an\n * AngularJS wrapper directive for \"downgrading\" an Angular component.\n * \n * The parameter contains information about the Component that is being downgraded:\n * \n * * `component: Type`: The type of the Component that will be downgraded\n * \n * \\@experimental\n * @param {?} info\n * @return {?}\n */\nexport function downgradeComponent(info: {\n component: Type;\n /** @deprecated since v4. This parameter is no longer used */\n inputs?: string[];\n /** @deprecated since v4. This parameter is no longer used */\n outputs?: string[];\n /** @deprecated since v4. This parameter is no longer used */\n selectors?: string[];\n}): any /* angular.IInjectable */ {\n const /** @type {?} */ directiveFactory:\n angular.IAnnotatedFunction = function(\n $compile: angular.ICompileService,\n $injector: angular.IInjectorService,\n $parse: angular.IParseService): angular.IDirective {\n\n return {\n restrict: 'E',\n terminal: true,\n require: [REQUIRE_INJECTOR, REQUIRE_NG_MODEL],\n link: (scope: angular.IScope, element: angular.IAugmentedJQuery, attrs: angular.IAttributes,\n required: any[]) => {\n // We might have to compile the contents asynchronously, because this might have been\n // triggered by `UpgradeNg1ComponentAdapterBuilder`, before the Angular templates have\n // been compiled.\n\n const /** @type {?} */ parentInjector: Injector|ParentInjectorPromise =\n required[0] || $injector.get(INJECTOR_KEY);\n const /** @type {?} */ ngModel: angular.INgModelController = required[1];\n\n const /** @type {?} */ downgradeFn = (injector: Injector) => {\n const /** @type {?} */ componentFactoryResolver: ComponentFactoryResolver =\n injector.get(ComponentFactoryResolver);\n const /** @type {?} */ componentFactory: ComponentFactory = /** @type {?} */((\n componentFactoryResolver.resolveComponentFactory(info.component)));\n\n if (!componentFactory) {\n throw new Error('Expecting ComponentFactory for: ' + getComponentName(info.component));\n }\n\n const /** @type {?} */ injectorPromise = new ParentInjectorPromise(element);\n const /** @type {?} */ facade = new DowngradeComponentAdapter(\n element, attrs, scope, ngModel, injector, $injector, $compile, $parse,\n componentFactory);\n\n const /** @type {?} */ projectableNodes = facade.compileContents();\n facade.createComponent(projectableNodes);\n facade.setupInputs();\n facade.setupOutputs();\n facade.registerCleanup();\n\n injectorPromise.resolve(facade.getInjector());\n };\n\n if (parentInjector instanceof ParentInjectorPromise) {\n parentInjector.then(downgradeFn);\n } else {\n downgradeFn(parentInjector);\n }\n }\n };\n };\n\n // bracket-notation because of closure - see #14441\n directiveFactory['$inject'] = [$COMPILE, $INJECTOR, $PARSE];\n return directiveFactory;\n}\n/**\n * Synchronous promise-like object to wrap parent injectors,\n * to preserve the synchronous nature of Angular 1's $compile.\n */\nclass ParentInjectorPromise {\nprivate injector: Injector;\nprivate injectorKey: string = controllerKey(INJECTOR_KEY);\nprivate callbacks: ((injector: Injector) => any)[] = [];\n/**\n * @param {?} element\n */\nconstructor(private element: angular.IAugmentedJQuery) {\n // Store the promise on the element.\n element.data !(this.injectorKey, this);\n }\n/**\n * @param {?} callback\n * @return {?}\n */\nthen(callback: (injector: Injector) => any) {\n if (this.injector) {\n callback(this.injector);\n } else {\n this.callbacks.push(callback);\n }\n }\n/**\n * @param {?} injector\n * @return {?}\n */\nresolve(injector: Injector) {\n this.injector = injector; /** @type {?} */((\n\n // Store the real injector on the element.\n this.element.data))(this.injectorKey, injector);\n\n // Release the element to prevent memory leaks.\n this.element = /** @type {?} */(( null));\n\n // Run the queued callbacks.\n this.callbacks.forEach(callback => callback(injector));\n this.callbacks.length = 0;\n }\n}\n\nfunction ParentInjectorPromise_tsickle_Closure_declarations() {\n/** @type {?} */\nParentInjectorPromise.prototype.injector;\n/** @type {?} */\nParentInjectorPromise.prototype.injectorKey;\n/** @type {?} */\nParentInjectorPromise.prototype.callbacks;\n/** @type {?} */\nParentInjectorPromise.prototype.element;\n}\n\n","/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n\nimport {ElementRef, Injector, SimpleChanges} from '@angular/core';\n\nimport * as angular from './angular1';\nimport {$COMPILE, $CONTROLLER, $HTTP_BACKEND, $INJECTOR, $TEMPLATE_CACHE} from './constants';\nimport {controllerKey, directiveNormalize, isFunction} from './util';\n\n\n// Constants\nconst /** @type {?} */ REQUIRE_PREFIX_RE = /^(\\^\\^?)?(\\?)?(\\^\\^?)?/;\n\n// Interfaces\nexport interface IBindingDestination {\n [key: string]: any;\n $onChanges?: (changes: SimpleChanges) => void;\n}\n\nexport interface IControllerInstance extends IBindingDestination {\n $doCheck?: () => void;\n $onDestroy?: () => void;\n $onInit?: () => void;\n $postLink?: () => void;\n}\nexport class UpgradeHelper {\npublic readonly $injector: angular.IInjectorService;\npublic readonly element: Element;\npublic readonly $element: angular.IAugmentedJQuery;\npublic readonly directive: angular.IDirective;\nprivate readonly $compile: angular.ICompileService;\nprivate readonly $controller: angular.IControllerService;\n/**\n * @param {?} injector\n * @param {?} name\n * @param {?} elementRef\n * @param {?=} directive\n */\nconstructor(\nprivate injector: Injector,\nprivate name: string, elementRef: ElementRef,\n directive?: angular.IDirective) {\n this.$injector = injector.get($INJECTOR);\n this.$compile = this.$injector.get($COMPILE);\n this.$controller = this.$injector.get($CONTROLLER);\n\n this.element = elementRef.nativeElement;\n this.$element = angular.element(this.element);\n\n this.directive = directive || UpgradeHelper.getDirective(this.$injector, name);\n }\n/**\n * @param {?} $injector\n * @param {?} name\n * @return {?}\n */\nstatic getDirective($injector: angular.IInjectorService, name: string): angular.IDirective {\n const /** @type {?} */ directives: angular.IDirective[] = $injector.get(name + 'Directive');\n if (directives.length > 1) {\n throw new Error(`Only support single directive definition for: ${name}`);\n }\n\n const /** @type {?} */ directive = directives[0];\n\n // AngularJS will transform `link: xyz` to `compile: () => xyz`. So we can only tell there was a\n // user-defined `compile` if there is no `link`. In other cases, we will just ignore `compile`.\n if (directive.compile && !directive.link) notSupported(name, 'compile');\n if (directive.replace) notSupported(name, 'replace');\n if (directive.terminal) notSupported(name, 'terminal');\n\n return directive;\n }\n/**\n * @param {?} $injector\n * @param {?} directive\n * @param {?=} fetchRemoteTemplate\n * @return {?}\n */\nstatic getTemplate(\n $injector: angular.IInjectorService, directive: angular.IDirective,\n fetchRemoteTemplate = false): string|Promise {\n if (directive.template !== undefined) {\n return getOrCall(directive.template);\n } else if (directive.templateUrl) {\n const /** @type {?} */ $templateCache = /** @type {?} */(( $injector.get($TEMPLATE_CACHE) as angular.ITemplateCacheService));\n const /** @type {?} */ url = getOrCall(directive.templateUrl);\n const /** @type {?} */ template = $templateCache.get(url);\n\n if (template !== undefined) {\n return template;\n } else if (!fetchRemoteTemplate) {\n throw new Error('loading directive templates asynchronously is not supported');\n }\n\n return new Promise((resolve, reject) => {\n const /** @type {?} */ $httpBackend = /** @type {?} */(( $injector.get($HTTP_BACKEND) as angular.IHttpBackendService));\n $httpBackend('GET', url, null, (status: number, response: string) => {\n if (status === 200) {\n resolve($templateCache.put(url, response));\n } else {\n reject(`GET component template from '${url}' returned '${status}: ${response}'`);\n }\n });\n });\n } else {\n throw new Error(`Directive '${directive.name}' is not a component, it is missing template.`);\n }\n }\n/**\n * @param {?} controllerType\n * @param {?} $scope\n * @return {?}\n */\nbuildController(controllerType: angular.IController, $scope: angular.IScope) {\n // TODO: Document that we do not pre-assign bindings on the controller instance.\n // Quoted properties below so that this code can be optimized with Closure Compiler.\n const /** @type {?} */ locals = {'$scope': $scope, '$element': this.$element};\n const /** @type {?} */ controller = this.$controller(controllerType, locals, null, this.directive.controllerAs); /** @type {?} */((\n\n this.$element.data))(controllerKey( /** @type {?} */((this.directive.name))), controller);\n\n return controller;\n }\n/**\n * @param {?=} template\n * @return {?}\n */\ncompileTemplate(template?: string): angular.ILinkFn {\n if (template === undefined) {\n template = /** @type {?} */(( UpgradeHelper.getTemplate(this.$injector, this.directive) as string));\n }\n\n return this.compileHtml(template);\n }\n/**\n * @return {?}\n */\nprepareTransclusion(): angular.ILinkFn|undefined {\n const /** @type {?} */ transclude = this.directive.transclude;\n const /** @type {?} */ contentChildNodes = this.extractChildNodes();\n let /** @type {?} */ $template = contentChildNodes;\n let /** @type {?} */ attachChildrenFn: angular.ILinkFn|undefined = (scope, cloneAttach) => /** @type {?} */((\n cloneAttach))($template, scope);\n\n if (transclude) {\n const /** @type {?} */ slots = Object.create(null);\n\n if (typeof transclude === 'object') {\n $template = [];\n\n const /** @type {?} */ slotMap = Object.create(null);\n const /** @type {?} */ filledSlots = Object.create(null);\n\n // Parse the element selectors.\n Object.keys(transclude).forEach(slotName => {\n let /** @type {?} */ selector = transclude[slotName];\n const /** @type {?} */ optional = selector.charAt(0) === '?';\n selector = optional ? selector.substring(1) : selector;\n\n slotMap[selector] = slotName;\n slots[slotName] = null; // `null`: Defined but not yet filled.\n filledSlots[slotName] = optional; // Consider optional slots as filled.\n });\n\n // Add the matching elements into their slot.\n contentChildNodes.forEach(node => {\n const /** @type {?} */ slotName = slotMap[directiveNormalize(node.nodeName.toLowerCase())];\n if (slotName) {\n filledSlots[slotName] = true;\n slots[slotName] = slots[slotName] || [];\n slots[slotName].push(node);\n } else {\n $template.push(node);\n }\n });\n\n // Check for required slots that were not filled.\n Object.keys(filledSlots).forEach(slotName => {\n if (!filledSlots[slotName]) {\n throw new Error(`Required transclusion slot '${slotName}' on directive: ${this.name}`);\n }\n });\n\n Object.keys(slots).filter(slotName => slots[slotName]).forEach(slotName => {\n const /** @type {?} */ nodes = slots[slotName];\n slots[slotName] = (scope: angular.IScope, cloneAttach: angular.ICloneAttachFunction) => /** @type {?} */((\n cloneAttach))(nodes, scope);\n });\n }\n\n // Attach `$$slots` to default slot transclude fn.\n attachChildrenFn.$$slots = slots;\n\n // AngularJS v1.6+ ignores empty or whitespace-only transcluded text nodes. But Angular\n // removes all text content after the first interpolation and updates it later, after\n // evaluating the expressions. This would result in AngularJS failing to recognize text\n // nodes that start with an interpolation as transcluded content and use the fallback\n // content instead.\n // To avoid this issue, we add a\n // [zero-width non-joiner character](https://en.wikipedia.org/wiki/Zero-width_non-joiner)\n // to empty text nodes (which can only be a result of Angular removing their initial content).\n // NOTE: Transcluded text content that starts with whitespace followed by an interpolation\n // will still fail to be detected by AngularJS v1.6+\n $template.forEach(node => {\n if (node.nodeType === Node.TEXT_NODE && !node.nodeValue) {\n node.nodeValue = '\\u200C';\n }\n });\n }\n\n return attachChildrenFn;\n }\n/**\n * @param {?} controllerInstance\n * @return {?}\n */\nresolveAndBindRequiredControllers(controllerInstance: IControllerInstance|null) {\n const /** @type {?} */ directiveRequire = this.getDirectiveRequire();\n const /** @type {?} */ requiredControllers = this.resolveRequire(directiveRequire);\n\n if (controllerInstance && this.directive.bindToController && isMap(directiveRequire)) {\n const /** @type {?} */ requiredControllersMap = /** @type {?} */(( requiredControllers as{[key: string]: IControllerInstance}));\n Object.keys(requiredControllersMap).forEach(key => {\n controllerInstance[key] = requiredControllersMap[key];\n });\n }\n\n return requiredControllers;\n }\n/**\n * @param {?} html\n * @return {?}\n */\nprivate compileHtml(html: string): angular.ILinkFn {\n this.element.innerHTML = html;\n return this.$compile(this.element.childNodes);\n }\n/**\n * @return {?}\n */\nprivate extractChildNodes(): Node[] {\n const /** @type {?} */ childNodes: Node[] = [];\n let /** @type {?} */ childNode: Node|null;\n\n while (childNode = this.element.firstChild) {\n this.element.removeChild(childNode);\n childNodes.push(childNode);\n }\n\n return childNodes;\n }\n/**\n * @return {?}\n */\nprivate getDirectiveRequire(): angular.DirectiveRequireProperty {\n const /** @type {?} */ require = this.directive.require || /** @type {?} */(( (this.directive.controller && this.directive.name)));\n\n if (isMap(require)) {\n Object.keys(require).forEach(key => {\n const /** @type {?} */ value = require[key];\n const /** @type {?} */ match = /** @type {?} */(( value.match(REQUIRE_PREFIX_RE)));\n const /** @type {?} */ name = value.substring(match[0].length);\n\n if (!name) {\n require[key] = match[0] + key;\n }\n });\n }\n\n return require;\n }\n/**\n * @param {?} require\n * @param {?=} controllerInstance\n * @return {?}\n */\nprivate resolveRequire(require: angular.DirectiveRequireProperty, controllerInstance?: any):\n angular.SingleOrListOrMap|null {\n if (!require) {\n return null;\n } else if (Array.isArray(require)) {\n return require.map(req => this.resolveRequire(req));\n } else if (typeof require === 'object') {\n const /** @type {?} */ value: {[key: string]: IControllerInstance} = {};\n Object.keys(require).forEach(key => value[key] = /** @type {?} */(( this.resolveRequire(require[key]))));\n return value;\n } else if (typeof require === 'string') {\n const /** @type {?} */ match = /** @type {?} */(( require.match(REQUIRE_PREFIX_RE)));\n const /** @type {?} */ inheritType = match[1] || match[3];\n\n const /** @type {?} */ name = require.substring(match[0].length);\n const /** @type {?} */ isOptional = !!match[2];\n const /** @type {?} */ searchParents = !!inheritType;\n const /** @type {?} */ startOnParent = inheritType === '^^';\n\n const /** @type {?} */ ctrlKey = controllerKey(name);\n const /** @type {?} */ elem = startOnParent ? /** @type {?} */(( this.$element.parent))() : this.$element;\n const /** @type {?} */ value = searchParents ? /** @type {?} */(( elem.inheritedData))(ctrlKey) : /** @type {?} */(( elem.data))(ctrlKey);\n\n if (!value && !isOptional) {\n throw new Error(\n `Unable to find required '${require}' in upgraded directive '${this.name}'.`);\n }\n\n return value;\n } else {\n throw new Error(\n `Unrecognized 'require' syntax on upgraded directive '${this.name}': ${require}`);\n }\n }\n}\n\nfunction UpgradeHelper_tsickle_Closure_declarations() {\n/** @type {?} */\nUpgradeHelper.prototype.$injector;\n/** @type {?} */\nUpgradeHelper.prototype.element;\n/** @type {?} */\nUpgradeHelper.prototype.$element;\n/** @type {?} */\nUpgradeHelper.prototype.directive;\n/** @type {?} */\nUpgradeHelper.prototype.$compile;\n/** @type {?} */\nUpgradeHelper.prototype.$controller;\n/** @type {?} */\nUpgradeHelper.prototype.injector;\n/** @type {?} */\nUpgradeHelper.prototype.name;\n}\n\n/**\n * @template T\n * @param {?} property\n * @return {?}\n */\nfunction getOrCall(property: T | Function): T {\n return isFunction(property) ? property() : property;\n}\n/**\n * @template T\n * @param {?} value\n * @return {?}\n */\nfunction isMap(value: angular.SingleOrListOrMap): value is {[key: string]: T} {\n return value && !Array.isArray(value) && typeof value === 'object';\n}\n/**\n * @param {?} name\n * @param {?} feature\n * @return {?}\n */\nfunction notSupported(name: string, feature: string) {\n throw new Error(`Upgraded directive '${name}' contains unsupported feature: '${feature}'.`);\n}\n","/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n\nimport {Directive, DoCheck, ElementRef, EventEmitter, Inject, Injector, OnChanges, OnInit, SimpleChange, SimpleChanges, Type} from '@angular/core';\n\nimport * as angular from '../common/angular1';\nimport {$SCOPE} from '../common/constants';\nimport {IBindingDestination, IControllerInstance, UpgradeHelper} from '../common/upgrade_helper';\nimport {isFunction, strictEquals} from '../common/util';\n\n\nconst /** @type {?} */ CAMEL_CASE = /([A-Z])/g;\nconst /** @type {?} */ INITIAL_VALUE = {\n __UNINITIALIZED__: true\n};\nconst /** @type {?} */ NOT_SUPPORTED: any = 'NOT_SUPPORTED';\nexport class UpgradeNg1ComponentAdapterBuilder {\n type: Type;\n inputs: string[] = [];\n inputsRename: string[] = [];\n outputs: string[] = [];\n outputsRename: string[] = [];\n propertyOutputs: string[] = [];\n checkProperties: string[] = [];\n propertyMap: {[name: string]: string} = {};\n directive: angular.IDirective|null = null;\n template: string;\n/**\n * @param {?} name\n */\nconstructor(public name: string) {\n const selector =\n name.replace(CAMEL_CASE, (all: string, next: string) => '-' + next.toLowerCase());\n const self = this;\n\n this.type =\n Directive({selector: selector, inputs: this.inputsRename, outputs: this.outputsRename})\n .Class({\n constructor: [\n new Inject($SCOPE), Injector, ElementRef,\n function(scope: angular.IScope, injector: Injector, elementRef: ElementRef) {\n const helper = new UpgradeHelper(injector, name, elementRef, this.directive);\n return new UpgradeNg1ComponentAdapter(\n helper, scope, self.template, self.inputs, self.outputs, self.propertyOutputs,\n self.checkProperties, self.propertyMap);\n }\n ],\n ngOnInit: function() { /* needs to be here for ng2 to properly detect it */ },\n ngOnChanges: function() { /* needs to be here for ng2 to properly detect it */ },\n ngDoCheck: function() { /* needs to be here for ng2 to properly detect it */ },\n ngOnDestroy: function() { /* needs to be here for ng2 to properly detect it */ },\n });\n }\n/**\n * @return {?}\n */\nextractBindings() {\n const /** @type {?} */ btcIsObject = typeof /** @type {?} */(( this.directive)).bindToController === 'object';\n if (btcIsObject && Object.keys( /** @type {?} */((this.directive)).scope).length) {\n throw new Error(\n `Binding definitions on scope and controller at the same time are not supported.`);\n }\n\n const /** @type {?} */ context = (btcIsObject) ? /** @type {?} */(( this.directive)).bindToController : /** @type {?} */(( this.directive)).scope;\n\n if (typeof context == 'object') {\n Object.keys(context).forEach(propName => {\n const /** @type {?} */ definition = context[propName];\n const /** @type {?} */ bindingType = definition.charAt(0);\n const /** @type {?} */ bindingOptions = definition.charAt(1);\n const /** @type {?} */ attrName = definition.substring(bindingOptions === '?' ? 2 : 1) || propName;\n\n // QUESTION: What about `=*`? Ignore? Throw? Support?\n\n const /** @type {?} */ inputName = `input_${attrName}`;\n const /** @type {?} */ inputNameRename = `${inputName}: ${attrName}`;\n const /** @type {?} */ outputName = `output_${attrName}`;\n const /** @type {?} */ outputNameRename = `${outputName}: ${attrName}`;\n const /** @type {?} */ outputNameRenameChange = `${outputNameRename}Change`;\n\n switch (bindingType) {\n case '@':\n case '<':\n this.inputs.push(inputName);\n this.inputsRename.push(inputNameRename);\n this.propertyMap[inputName] = propName;\n break;\n case '=':\n this.inputs.push(inputName);\n this.inputsRename.push(inputNameRename);\n this.propertyMap[inputName] = propName;\n\n this.outputs.push(outputName);\n this.outputsRename.push(outputNameRenameChange);\n this.propertyMap[outputName] = propName;\n\n this.checkProperties.push(propName);\n this.propertyOutputs.push(outputName);\n break;\n case '&':\n this.outputs.push(outputName);\n this.outputsRename.push(outputNameRename);\n this.propertyMap[outputName] = propName;\n break;\n default:\n let /** @type {?} */ json = JSON.stringify(context);\n throw new Error(\n `Unexpected mapping '${bindingType}' in '${json}' in '${this.name}' directive.`);\n }\n });\n }\n }\n/**\n * Upgrade ng1 components into Angular.\n * @param {?} exportedComponents\n * @param {?} $injector\n * @return {?}\n */\nstatic resolve(\n exportedComponents: {[name: string]: UpgradeNg1ComponentAdapterBuilder},\n $injector: angular.IInjectorService): Promise {\n const /** @type {?} */ promises = Object.keys(exportedComponents).map(name => {\n const /** @type {?} */ exportedComponent = exportedComponents[name];\n exportedComponent.directive = UpgradeHelper.getDirective($injector, name);\n exportedComponent.extractBindings();\n\n return Promise\n .resolve(UpgradeHelper.getTemplate($injector, exportedComponent.directive, true))\n .then(template => exportedComponent.template = template);\n });\n\n return Promise.all(promises);\n }\n}\n\nfunction UpgradeNg1ComponentAdapterBuilder_tsickle_Closure_declarations() {\n/** @type {?} */\nUpgradeNg1ComponentAdapterBuilder.prototype.type;\n/** @type {?} */\nUpgradeNg1ComponentAdapterBuilder.prototype.inputs;\n/** @type {?} */\nUpgradeNg1ComponentAdapterBuilder.prototype.inputsRename;\n/** @type {?} */\nUpgradeNg1ComponentAdapterBuilder.prototype.outputs;\n/** @type {?} */\nUpgradeNg1ComponentAdapterBuilder.prototype.outputsRename;\n/** @type {?} */\nUpgradeNg1ComponentAdapterBuilder.prototype.propertyOutputs;\n/** @type {?} */\nUpgradeNg1ComponentAdapterBuilder.prototype.checkProperties;\n/** @type {?} */\nUpgradeNg1ComponentAdapterBuilder.prototype.propertyMap;\n/** @type {?} */\nUpgradeNg1ComponentAdapterBuilder.prototype.directive;\n/** @type {?} */\nUpgradeNg1ComponentAdapterBuilder.prototype.template;\n/** @type {?} */\nUpgradeNg1ComponentAdapterBuilder.prototype.name;\n}\n\nclass UpgradeNg1ComponentAdapter implements OnInit, OnChanges, DoCheck {\nprivate controllerInstance: IControllerInstance|null = null;\n destinationObj: IBindingDestination|null = null;\n checkLastValues: any[] = [];\nprivate directive: angular.IDirective;\n element: Element;\n $element: any = null;\n componentScope: angular.IScope;\n/**\n * @param {?} helper\n * @param {?} scope\n * @param {?} template\n * @param {?} inputs\n * @param {?} outputs\n * @param {?} propOuts\n * @param {?} checkProperties\n * @param {?} propertyMap\n */\nconstructor(\nprivate helper: UpgradeHelper, scope: angular.IScope,\nprivate template: string,\nprivate inputs: string[],\nprivate outputs: string[],\nprivate propOuts: string[],\nprivate checkProperties: string[],\nprivate propertyMap: {[key: string]: string}) {\n this.directive = helper.directive;\n this.element = helper.element;\n this.$element = helper.$element;\n this.componentScope = scope.$new(!!this.directive.scope);\n\n const controllerType = this.directive.controller;\n\n if (this.directive.bindToController && controllerType) {\n this.controllerInstance = this.helper.buildController(controllerType, this.componentScope);\n this.destinationObj = this.controllerInstance;\n } else {\n this.destinationObj = this.componentScope;\n }\n\n for (let i = 0; i < inputs.length; i++) {\n (this as any)[inputs[i]] = null;\n }\n for (let j = 0; j < outputs.length; j++) {\n const emitter = (this as any)[outputs[j]] = new EventEmitter();\n this.setComponentProperty(\n outputs[j], (emitter => (value: any) => emitter.emit(value))(emitter));\n }\n for (let k = 0; k < propOuts.length; k++) {\n this.checkLastValues.push(INITIAL_VALUE);\n }\n }\n/**\n * @return {?}\n */\nngOnInit() {\n // Collect contents, insert and compile template\n const /** @type {?} */ attachChildNodes: angular.ILinkFn|undefined = this.helper.prepareTransclusion();\n const /** @type {?} */ linkFn = this.helper.compileTemplate(this.template);\n\n // Instantiate controller (if not already done so)\n const /** @type {?} */ controllerType = this.directive.controller;\n const /** @type {?} */ bindToController = this.directive.bindToController;\n if (controllerType && !bindToController) {\n this.controllerInstance = this.helper.buildController(controllerType, this.componentScope);\n }\n\n // Require other controllers\n const /** @type {?} */ requiredControllers =\n this.helper.resolveAndBindRequiredControllers(this.controllerInstance);\n\n // Hook: $onInit\n if (this.controllerInstance && isFunction(this.controllerInstance.$onInit)) {\n this.controllerInstance.$onInit();\n }\n\n // Linking\n const /** @type {?} */ link = this.directive.link;\n const /** @type {?} */ preLink = (typeof link == 'object') && ( /** @type {?} */((link as angular.IDirectivePrePost))).pre;\n const /** @type {?} */ postLink = (typeof link == 'object') ? ( /** @type {?} */((link as angular.IDirectivePrePost))).post : link;\n const /** @type {?} */ attrs: angular.IAttributes = NOT_SUPPORTED;\n const /** @type {?} */ transcludeFn: angular.ITranscludeFunction = NOT_SUPPORTED;\n if (preLink) {\n preLink(this.componentScope, this.$element, attrs, requiredControllers, transcludeFn);\n }\n\n linkFn(this.componentScope, /** @type {?} */(( null)), {parentBoundTranscludeFn: attachChildNodes});\n\n if (postLink) {\n postLink(this.componentScope, this.$element, attrs, requiredControllers, transcludeFn);\n }\n\n // Hook: $postLink\n if (this.controllerInstance && isFunction(this.controllerInstance.$postLink)) {\n this.controllerInstance.$postLink();\n }\n }\n/**\n * @param {?} changes\n * @return {?}\n */\nngOnChanges(changes: SimpleChanges) {\n const /** @type {?} */ ng1Changes: any = {};\n Object.keys(changes).forEach(name => {\n const /** @type {?} */ change: SimpleChange = changes[name];\n this.setComponentProperty(name, change.currentValue);\n ng1Changes[this.propertyMap[name]] = change;\n });\n\n if (isFunction( /** @type {?} */((this.destinationObj)).$onChanges)) { /** @type {?} */(( /** @type {?} */((\n this.destinationObj)).$onChanges))(ng1Changes);\n }\n }\n/**\n * @return {?}\n */\nngDoCheck() {\n const /** @type {?} */ destinationObj = this.destinationObj;\n const /** @type {?} */ lastValues = this.checkLastValues;\n const /** @type {?} */ checkProperties = this.checkProperties;\n const /** @type {?} */ propOuts = this.propOuts;\n checkProperties.forEach((propName, i) => {\n const /** @type {?} */ value = /** @type {?} */(( destinationObj))[propName];\n const /** @type {?} */ last = lastValues[i];\n if (!strictEquals(last, value)) {\n const /** @type {?} */ eventEmitter: EventEmitter = ( /** @type {?} */((this as any)))[propOuts[i]];\n eventEmitter.emit(lastValues[i] = value);\n }\n });\n\n if (this.controllerInstance && isFunction(this.controllerInstance.$doCheck)) {\n this.controllerInstance.$doCheck();\n }\n }\n/**\n * @return {?}\n */\nngOnDestroy() {\n if (this.controllerInstance && isFunction(this.controllerInstance.$onDestroy)) {\n this.controllerInstance.$onDestroy();\n }\n }\n/**\n * @param {?} name\n * @param {?} value\n * @return {?}\n */\nsetComponentProperty(name: string, value: any) { /** @type {?} */((\n this.destinationObj))[this.propertyMap[name]] = value;\n }\n}\n\nfunction UpgradeNg1ComponentAdapter_tsickle_Closure_declarations() {\n/** @type {?} */\nUpgradeNg1ComponentAdapter.prototype.controllerInstance;\n/** @type {?} */\nUpgradeNg1ComponentAdapter.prototype.destinationObj;\n/** @type {?} */\nUpgradeNg1ComponentAdapter.prototype.checkLastValues;\n/** @type {?} */\nUpgradeNg1ComponentAdapter.prototype.directive;\n/** @type {?} */\nUpgradeNg1ComponentAdapter.prototype.element;\n/** @type {?} */\nUpgradeNg1ComponentAdapter.prototype.$element;\n/** @type {?} */\nUpgradeNg1ComponentAdapter.prototype.componentScope;\n/** @type {?} */\nUpgradeNg1ComponentAdapter.prototype.helper;\n/** @type {?} */\nUpgradeNg1ComponentAdapter.prototype.template;\n/** @type {?} */\nUpgradeNg1ComponentAdapter.prototype.inputs;\n/** @type {?} */\nUpgradeNg1ComponentAdapter.prototype.outputs;\n/** @type {?} */\nUpgradeNg1ComponentAdapter.prototype.propOuts;\n/** @type {?} */\nUpgradeNg1ComponentAdapter.prototype.checkProperties;\n/** @type {?} */\nUpgradeNg1ComponentAdapter.prototype.propertyMap;\n}\n\n","/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n\nimport {Compiler, CompilerOptions, Directive, Injector, NgModule, NgModuleRef, NgZone, Provider, Testability, Type} from '@angular/core';\nimport {platformBrowserDynamic} from '@angular/platform-browser-dynamic';\n\nimport * as angular from '../common/angular1';\nimport {$$TESTABILITY, $COMPILE, $INJECTOR, $ROOT_SCOPE, COMPILER_KEY, INJECTOR_KEY, NG_ZONE_KEY} from '../common/constants';\nimport {downgradeComponent} from '../common/downgrade_component';\nimport {downgradeInjectable} from '../common/downgrade_injectable';\nimport {Deferred, controllerKey, onError} from '../common/util';\n\nimport {UpgradeNg1ComponentAdapterBuilder} from './upgrade_ng1_adapter';\n\nlet /** @type {?} */ upgradeCount: number = 0;\n/**\n * Use `UpgradeAdapter` to allow AngularJS and Angular to coexist in a single application.\n * \n * The `UpgradeAdapter` allows:\n * 1. creation of Angular component from AngularJS component directive\n * (See [UpgradeAdapter#upgradeNg1Component()])\n * 2. creation of AngularJS directive from Angular component.\n * (See [UpgradeAdapter#downgradeNg2Component()])\n * 3. Bootstrapping of a hybrid Angular application which contains both of the frameworks\n * coexisting in a single application.\n * \n * ## Mental Model\n * \n * When reasoning about how a hybrid application works it is useful to have a mental model which\n * describes what is happening and explains what is happening at the lowest level.\n * \n * 1. There are two independent frameworks running in a single application, each framework treats\n * the other as a black box.\n * 2. Each DOM element on the page is owned exactly by one framework. Whichever framework\n * instantiated the element is the owner. Each framework only updates/interacts with its own\n * DOM elements and ignores others.\n * 3. AngularJS directives always execute inside AngularJS framework codebase regardless of\n * where they are instantiated.\n * 4. Angular components always execute inside Angular framework codebase regardless of\n * where they are instantiated.\n * 5. An AngularJS component can be upgraded to an Angular component. This creates an\n * Angular directive, which bootstraps the AngularJS component directive in that location.\n * 6. An Angular component can be downgraded to an AngularJS component directive. This creates\n * an AngularJS directive, which bootstraps the Angular component in that location.\n * 7. Whenever an adapter component is instantiated the host element is owned by the framework\n * doing the instantiation. The other framework then instantiates and owns the view for that\n * component. This implies that component bindings will always follow the semantics of the\n * instantiation framework. The syntax is always that of Angular syntax.\n * 8. AngularJS is always bootstrapped first and owns the bottom most view.\n * 9. The new application is running in Angular zone, and therefore it no longer needs calls to\n * `$apply()`.\n * \n * ### Example\n * \n * ```\n * const adapter = new UpgradeAdapter(forwardRef(() => MyNg2Module), myCompilerOptions);\n * const module = angular.module('myExample', []);\n * module.directive('ng2Comp', adapter.downgradeNg2Component(Ng2Component));\n * \n * module.directive('ng1Hello', function() {\n * return {\n * scope: { title: '=' },\n * template: 'ng1[Hello {{title}}!]()'\n * };\n * });\n * \n * \n * \\@Component({ \n * selector: 'ng2-comp',\n * inputs: ['name'],\n * template: 'ng2[transclude]()',\n * directives:\n * })\n * class Ng2Component {\n * }\n * \n * \\@NgModule({ \n * declarations: [Ng2Component, adapter.upgradeNg1Component('ng1Hello')],\n * imports: [BrowserModule]\n * })\n * class MyNg2Module {}\n * \n * \n * document.body.innerHTML = 'project';\n * \n * adapter.bootstrap(document.body, ['myExample']).ready(function() {\n * expect(document.body.textContent).toEqual(\n * \"ng2[ng1[Hello World!](transclude)](project)\");\n * });\n * \n * ```\n * \n * \\@stable\n */\nexport class UpgradeAdapter {\nprivate idPrefix: string = `NG2_UPGRADE_${upgradeCount++}_`;\nprivate downgradedComponents: Type[] = [];\n/**\n * An internal map of ng1 components which need to up upgraded to ng2.\n * \n * We can't upgrade until injector is instantiated and we can retrieve the component metadata.\n * For this reason we keep a list of components to upgrade until ng1 injector is bootstrapped.\n * \n * \\@internal\n */\nprivate ng1ComponentsToBeUpgraded: {[name: string]: UpgradeNg1ComponentAdapterBuilder} = {};\nprivate upgradedProviders: Provider[] = [];\nprivate ngZone: NgZone;\nprivate ng1Module: angular.IModule;\nprivate moduleRef: NgModuleRef|null = null;\nprivate ng2BootstrapDeferred: Deferred;\n/**\n * @param {?} ng2AppModule\n * @param {?=} compilerOptions\n */\nconstructor(private ng2AppModule: Type,\nprivate compilerOptions?: CompilerOptions) {\n if (!ng2AppModule) {\n throw new Error(\n 'UpgradeAdapter cannot be instantiated without an NgModule of the Angular app.');\n }\n }\n/**\n * Allows Angular Component to be used from AngularJS.\n * \n * Use `downgradeNg2Component` to create an AngularJS Directive Definition Factory from\n * Angular Component. The adapter will bootstrap Angular component from within the\n * AngularJS template.\n * \n * ## Mental Model\n * \n * 1. The component is instantiated by being listed in AngularJS template. This means that the\n * host element is controlled by AngularJS, but the component's view will be controlled by\n * Angular.\n * 2. Even thought the component is instantiated in AngularJS, it will be using Angular\n * syntax. This has to be done, this way because we must follow Angular components do not\n * declare how the attributes should be interpreted.\n * 3. `ng-model` is controlled by AngularJS and communicates with the downgraded Angular component\n * by way of the `ControlValueAccessor` interface from \\@angular/forms. Only components that\n * implement this interface are eligible.\n * \n * ## Supported Features\n * \n * - Bindings:\n * - Attribute: ``\n * - Interpolation: ``\n * - Expression: ``\n * - Event: ``\n * - ng-model: ``\n * - Content projection: yes\n * \n * ### Example\n * \n * ```\n * const adapter = new UpgradeAdapter(forwardRef(() => MyNg2Module));\n * const module = angular.module('myExample', []);\n * module.directive('greet', adapter.downgradeNg2Component(Greeter));\n * \n * \\@Component({ \n * selector: 'greet',\n * template: '{{salutation}} {{name}}! - '\n * })\n * class Greeter {\n * \\@Input() salutation: string;\n * \\@Input() name: string;\n * }\n * \n * \\@NgModule({ \n * declarations: [Greeter],\n * imports: [BrowserModule]\n * })\n * class MyNg2Module {}\n * \n * document.body.innerHTML =\n * 'ng1 template: text';\n * \n * adapter.bootstrap(document.body, ['myExample']).ready(function() {\n * expect(document.body.textContent).toEqual(\"ng1 template: Hello world! - text\");\n * });\n * ```\n * @param {?} component\n * @return {?}\n */\ndowngradeNg2Component(component: Type): Function {\n this.downgradedComponents.push(component);\n\n return downgradeComponent({component});\n }\n/**\n * Allows AngularJS Component to be used from Angular.\n * \n * Use `upgradeNg1Component` to create an Angular component from AngularJS Component\n * directive. The adapter will bootstrap AngularJS component from within the Angular\n * template.\n * \n * ## Mental Model\n * \n * 1. The component is instantiated by being listed in Angular template. This means that the\n * host element is controlled by Angular, but the component's view will be controlled by\n * AngularJS.\n * \n * ## Supported Features\n * \n * - Bindings:\n * - Attribute: ``\n * - Interpolation: ``\n * - Expression: ``\n * - Event: ``\n * - Transclusion: yes\n * - Only some of the features of\n * [Directive Definition Object](https://docs.angularjs.org/api/ng/service/$compile) are\n * supported:\n * - `compile`: not supported because the host element is owned by Angular, which does\n * not allow modifying DOM structure during compilation.\n * - `controller`: supported. (NOTE: injection of `$attrs` and `$transclude` is not supported.)\n * - `controllerAs`: supported.\n * - `bindToController`: supported.\n * - `link`: supported. (NOTE: only pre-link function is supported.)\n * - `name`: supported.\n * - `priority`: ignored.\n * - `replace`: not supported.\n * - `require`: supported.\n * - `restrict`: must be set to 'E'.\n * - `scope`: supported.\n * - `template`: supported.\n * - `templateUrl`: supported.\n * - `terminal`: ignored.\n * - `transclude`: supported.\n * \n * \n * ### Example\n * \n * ```\n * const adapter = new UpgradeAdapter(forwardRef(() => MyNg2Module));\n * const module = angular.module('myExample', []);\n * \n * module.directive('greet', function() {\n * return {\n * scope: {salutation: '=', name: '=' },\n * template: '{{salutation}} {{name}}! - '\n * };\n * });\n * \n * module.directive('ng2', adapter.downgradeNg2Component(Ng2Component));\n * \n * \\@Component({ \n * selector: 'ng2',\n * template: 'ng2 template: text'\n * })\n * class Ng2Component {\n * }\n * \n * \\@NgModule({ \n * declarations: [Ng2Component, adapter.upgradeNg1Component('greet')],\n * imports: [BrowserModule]\n * })\n * class MyNg2Module {}\n * \n * document.body.innerHTML = '';\n * \n * adapter.bootstrap(document.body, ['myExample']).ready(function() {\n * expect(document.body.textContent).toEqual(\"ng2 template: Hello world! - text\");\n * });\n * ```\n * @param {?} name\n * @return {?}\n */\nupgradeNg1Component(name: string): Type {\n if (( /** @type {?} */((this.ng1ComponentsToBeUpgraded))).hasOwnProperty(name)) {\n return this.ng1ComponentsToBeUpgraded[name].type;\n } else {\n return (this.ng1ComponentsToBeUpgraded[name] = new UpgradeNg1ComponentAdapterBuilder(name))\n .type;\n }\n }\n/**\n * Registers the adapter's AngularJS upgrade module for unit testing in AngularJS.\n * Use this instead of `angular.mock.module()` to load the upgrade module into\n * the AngularJS testing injector.\n * \n * ### Example\n * \n * ```\n * const upgradeAdapter = new UpgradeAdapter(MyNg2Module);\n * \n * // configure the adapter with upgrade/downgrade components and services\n * upgradeAdapter.downgradeNg2Component(MyComponent);\n * \n * let upgradeAdapterRef: UpgradeAdapterRef;\n * let $compile, $rootScope;\n * \n * // We must register the adapter before any calls to `inject()`\n * beforeEach(() => {\n * upgradeAdapterRef = upgradeAdapter.registerForNg1Tests(['heroApp']);\n * });\n * \n * beforeEach(inject((_$compile_, _$rootScope_) => {\n * $compile = _$compile_;\n * $rootScope = _$rootScope_;\n * }));\n * \n * it(\"says hello\", (done) => {\n * upgradeAdapterRef.ready(() => {\n * const element = $compile(\"\")($rootScope);\n * $rootScope.$apply();\n * expect(element.html()).toContain(\"Hello World\");\n * done();\n * })\n * });\n * \n * ```\n * \n * @param {?=} modules any AngularJS modules that the upgrade module should depend upon\n * @return {?} an {\\@link UpgradeAdapterRef}, which lets you register a `ready()` callback to\n * run assertions once the Angular components are ready to test through AngularJS.\n */\nregisterForNg1Tests(modules?: string[]): UpgradeAdapterRef {\n const /** @type {?} */ windowNgMock = ( /** @type {?} */((window as any)))['angular'].mock;\n if (!windowNgMock || !windowNgMock.module) {\n throw new Error('Failed to find \\'angular.mock.module\\'.');\n }\n this.declareNg1Module(modules);\n windowNgMock.module(this.ng1Module.name);\n const /** @type {?} */ upgrade = new UpgradeAdapterRef();\n this.ng2BootstrapDeferred.promise.then(\n (ng1Injector) => { ( /** @type {?} */((upgrade)))._bootstrapDone(this.moduleRef, ng1Injector); }, onError);\n return upgrade;\n }\n/**\n * Bootstrap a hybrid AngularJS / Angular application.\n * \n * This `bootstrap` method is a direct replacement (takes same arguments) for AngularJS\n * [`bootstrap`](https://docs.angularjs.org/api/ng/function/angular.bootstrap) method. Unlike\n * AngularJS, this bootstrap is asynchronous.\n * \n * ### Example\n * \n * ```\n * const adapter = new UpgradeAdapter(MyNg2Module);\n * const module = angular.module('myExample', []);\n * module.directive('ng2', adapter.downgradeNg2Component(Ng2));\n * \n * module.directive('ng1', function() {\n * return {\n * scope: { title: '=' },\n * template: 'ng1[Hello {{title}}!]()'\n * };\n * });\n * \n * \n * \\@Component({ \n * selector: 'ng2',\n * inputs: ['name'],\n * template: 'ng2[transclude]()'\n * })\n * class Ng2 {\n * }\n * \n * \\@NgModule({ \n * declarations: [Ng2, adapter.upgradeNg1Component('ng1')],\n * imports: [BrowserModule]\n * })\n * class MyNg2Module {}\n * \n * document.body.innerHTML = 'project';\n * \n * adapter.bootstrap(document.body, ['myExample']).ready(function() {\n * expect(document.body.textContent).toEqual(\n * \"ng2[ng1[Hello World!](transclude)](project)\");\n * });\n * ```\n * @param {?} element\n * @param {?=} modules\n * @param {?=} config\n * @return {?}\n */\nbootstrap(element: Element, modules?: any[], config?: angular.IAngularBootstrapConfig):\n UpgradeAdapterRef {\n this.declareNg1Module(modules);\n\n const /** @type {?} */ upgrade = new UpgradeAdapterRef();\n\n // Make sure resumeBootstrap() only exists if the current bootstrap is deferred\n const /** @type {?} */ windowAngular = ( /** @type {?} */((window as any)) /** TODO #???? */)['angular'];\n windowAngular.resumeBootstrap = undefined;\n\n this.ngZone.run(() => { angular.bootstrap(element, [this.ng1Module.name], /** @type {?} */(( config))); });\n const /** @type {?} */ ng1BootstrapPromise = new Promise((resolve) => {\n if (windowAngular.resumeBootstrap) {\n const /** @type {?} */ originalResumeBootstrap: () => void = windowAngular.resumeBootstrap;\n windowAngular.resumeBootstrap = function() {\n windowAngular.resumeBootstrap = originalResumeBootstrap;\n windowAngular.resumeBootstrap.apply(this, arguments);\n resolve();\n };\n } else {\n resolve();\n }\n });\n\n Promise.all([this.ng2BootstrapDeferred.promise, ng1BootstrapPromise]).then(([ng1Injector]) => { /** @type {?} */((\n angular.element(element).data))(controllerKey(INJECTOR_KEY), /** @type {?} */(( this.moduleRef)).injector); /** @type {?} */((\n this.moduleRef)).injector.get(NgZone).run(\n () => { ( /** @type {?} */((upgrade)))._bootstrapDone(this.moduleRef, ng1Injector); });\n }, onError);\n return upgrade;\n }\n/**\n * Allows AngularJS service to be accessible from Angular.\n * \n * \n * ### Example\n * \n * ```\n * class Login { ... }\n * class Server { ... }\n * \n * \\@Injectable() \n * class Example {\n * constructor(\\@Inject('server') server, login: Login) {\n * ...\n * }\n * }\n * \n * const module = angular.module('myExample', []);\n * module.service('server', Server);\n * module.service('login', Login);\n * \n * const adapter = new UpgradeAdapter(MyNg2Module);\n * adapter.upgradeNg1Provider('server');\n * adapter.upgradeNg1Provider('login', {asToken: Login});\n * \n * adapter.bootstrap(document.body, ['myExample']).ready((ref) => {\n * const example: Example = ref.ng2Injector.get(Example);\n * });\n * \n * ```\n * @param {?} name\n * @param {?=} options\n * @return {?}\n */\nupgradeNg1Provider(name: string, options?: {asToken: any}) {\n const /** @type {?} */ token = options && options.asToken || name;\n this.upgradedProviders.push({\n provide: token,\n useFactory: ($injector: angular.IInjectorService) => $injector.get(name),\n deps: [$INJECTOR]\n });\n }\n/**\n * Allows Angular service to be accessible from AngularJS.\n * \n * \n * ### Example\n * \n * ```\n * class Example {\n * }\n * \n * const adapter = new UpgradeAdapter(MyNg2Module);\n * \n * const module = angular.module('myExample', []);\n * module.factory('example', adapter.downgradeNg2Provider(Example));\n * \n * adapter.bootstrap(document.body, ['myExample']).ready((ref) => {\n * const example: Example = ref.ng1Injector.get('example');\n * });\n * \n * ```\n * @param {?} token\n * @return {?}\n */\ndowngradeNg2Provider(token: any): Function { return downgradeInjectable(token); }\n/**\n * Declare the AngularJS upgrade module for this adapter without bootstrapping the whole\n * hybrid application.\n * \n * This method is automatically called by `bootstrap()` and `registerForNg1Tests()`.\n * \n * @param {?=} modules The AngularJS modules that this upgrade module should depend upon.\n * @return {?} The AngularJS upgrade module that is declared by this method\n * \n * ### Example\n * \n * ```\n * const upgradeAdapter = new UpgradeAdapter(MyNg2Module);\n * upgradeAdapter.declareNg1Module(['heroApp']);\n * ```\n */\nprivate declareNg1Module(modules: string[] = []): angular.IModule {\n const /** @type {?} */ delayApplyExps: Function[] = [];\n let /** @type {?} */ original$applyFn: Function;\n let /** @type {?} */ rootScopePrototype: any;\n let /** @type {?} */ rootScope: angular.IRootScopeService;\n const /** @type {?} */ upgradeAdapter = this;\n const /** @type {?} */ ng1Module = this.ng1Module = angular.module(this.idPrefix, modules);\n const /** @type {?} */ platformRef = platformBrowserDynamic();\n\n this.ngZone = new NgZone({enableLongStackTrace: Zone.hasOwnProperty('longStackTraceZoneSpec')});\n this.ng2BootstrapDeferred = new Deferred();\n ng1Module.factory(INJECTOR_KEY, () => /** @type {?} */(( this.moduleRef)).injector.get(Injector))\n .constant(NG_ZONE_KEY, this.ngZone)\n .factory(COMPILER_KEY, () => /** @type {?} */(( this.moduleRef)).injector.get(Compiler))\n .config([\n '$provide', '$injector',\n (provide: angular.IProvideService, ng1Injector: angular.IInjectorService) => {\n provide.decorator($ROOT_SCOPE, [\n '$delegate',\n function(rootScopeDelegate: angular.IRootScopeService) {\n // Capture the root apply so that we can delay first call to $apply until we\n // bootstrap Angular and then we replay and restore the $apply.\n rootScopePrototype = rootScopeDelegate.constructor.prototype;\n if (rootScopePrototype.hasOwnProperty('$apply')) {\n original$applyFn = rootScopePrototype.$apply;\n rootScopePrototype.$apply = (exp: any) => delayApplyExps.push(exp);\n } else {\n throw new Error('Failed to find \\'$apply\\' on \\'$rootScope\\'!');\n }\n return rootScope = rootScopeDelegate;\n }\n ]);\n if (ng1Injector.has($$TESTABILITY)) {\n provide.decorator($$TESTABILITY, [\n '$delegate',\n function(testabilityDelegate: angular.ITestabilityService) {\n const /** @type {?} */ originalWhenStable: Function = testabilityDelegate.whenStable;\n // Cannot use arrow function below because we need the context\n const /** @type {?} */ newWhenStable = function(callback: Function) {\n originalWhenStable.call(this, function() {\n const /** @type {?} */ ng2Testability: Testability = /** @type {?} */((\n upgradeAdapter.moduleRef)).injector.get(Testability);\n if (ng2Testability.isStable()) {\n callback.apply(this, arguments);\n } else {\n ng2Testability.whenStable(newWhenStable.bind(this, callback));\n }\n });\n };\n\n testabilityDelegate.whenStable = newWhenStable;\n return testabilityDelegate;\n }\n ]);\n }\n }\n ]);\n\n ng1Module.run([\n '$injector', '$rootScope',\n (ng1Injector: angular.IInjectorService, rootScope: angular.IRootScopeService) => {\n UpgradeNg1ComponentAdapterBuilder.resolve(this.ng1ComponentsToBeUpgraded, ng1Injector)\n .then(() => {\n // At this point we have ng1 injector and we have prepared\n // ng1 components to be upgraded, we now can bootstrap ng2.\n const /** @type {?} */ DynamicNgUpgradeModule =\n NgModule({\n providers: [\n {provide: $INJECTOR, useFactory: () => ng1Injector},\n {provide: $COMPILE, useFactory: () => ng1Injector.get($COMPILE)},\n this.upgradedProviders\n ],\n imports: [this.ng2AppModule],\n entryComponents: this.downgradedComponents\n }).Class({\n constructor: function DynamicNgUpgradeModule() {},\n ngDoBootstrap: function() {}\n });\n ( /** @type {?} */((platformRef as any)))\n ._bootstrapModuleWithZone(\n DynamicNgUpgradeModule, this.compilerOptions, this.ngZone)\n .then((ref: NgModuleRef) => {\n this.moduleRef = ref;\n this.ngZone.run(() => {\n if (rootScopePrototype) {\n rootScopePrototype.$apply = original$applyFn; // restore original $apply\n while (delayApplyExps.length) {\n rootScope.$apply(delayApplyExps.shift());\n }\n rootScopePrototype = null;\n }\n });\n })\n .then(() => this.ng2BootstrapDeferred.resolve(ng1Injector), onError)\n .then(() => {\n let /** @type {?} */ subscription =\n this.ngZone.onMicrotaskEmpty.subscribe({next: () => rootScope.$digest()});\n rootScope.$on('$destroy', () => { subscription.unsubscribe(); });\n });\n })\n .catch((e) => this.ng2BootstrapDeferred.reject(e));\n }\n ]);\n\n return ng1Module;\n }\n}\n\nfunction UpgradeAdapter_tsickle_Closure_declarations() {\n/** @type {?} */\nUpgradeAdapter.prototype.idPrefix;\n/** @type {?} */\nUpgradeAdapter.prototype.downgradedComponents;\n/**\n * An internal map of ng1 components which need to up upgraded to ng2.\n * \n * We can't upgrade until injector is instantiated and we can retrieve the component metadata.\n * For this reason we keep a list of components to upgrade until ng1 injector is bootstrapped.\n * \n * \\@internal\n * @type {?}\n */\nUpgradeAdapter.prototype.ng1ComponentsToBeUpgraded;\n/** @type {?} */\nUpgradeAdapter.prototype.upgradedProviders;\n/** @type {?} */\nUpgradeAdapter.prototype.ngZone;\n/** @type {?} */\nUpgradeAdapter.prototype.ng1Module;\n/** @type {?} */\nUpgradeAdapter.prototype.moduleRef;\n/** @type {?} */\nUpgradeAdapter.prototype.ng2BootstrapDeferred;\n/** @type {?} */\nUpgradeAdapter.prototype.ng2AppModule;\n/** @type {?} */\nUpgradeAdapter.prototype.compilerOptions;\n}\n\n/**\n * Synchronous promise-like object to wrap parent injectors,\n * to preserve the synchronous nature of AngularJS's $compile.\n */\nclass ParentInjectorPromise {\nprivate injector: Injector;\nprivate callbacks: ((injector: Injector) => any)[] = [];\n/**\n * @param {?} element\n */\nconstructor(private element: angular.IAugmentedJQuery) {\n // store the promise on the element\n element.data !(controllerKey(INJECTOR_KEY), this);\n }\n/**\n * @param {?} callback\n * @return {?}\n */\nthen(callback: (injector: Injector) => any) {\n if (this.injector) {\n callback(this.injector);\n } else {\n this.callbacks.push(callback);\n }\n }\n/**\n * @param {?} injector\n * @return {?}\n */\nresolve(injector: Injector) {\n this.injector = injector; /** @type {?} */((\n\n // reset the element data to point to the real injector\n this.element.data))(controllerKey(INJECTOR_KEY), injector);\n\n // clean out the element to prevent memory leaks\n this.element = /** @type {?} */(( null));\n\n // run all the queued callbacks\n this.callbacks.forEach((callback) => callback(injector));\n this.callbacks.length = 0;\n }\n}\n\nfunction ParentInjectorPromise_tsickle_Closure_declarations() {\n/** @type {?} */\nParentInjectorPromise.prototype.injector;\n/** @type {?} */\nParentInjectorPromise.prototype.callbacks;\n/** @type {?} */\nParentInjectorPromise.prototype.element;\n}\n\n/**\n * Use `UpgradeAdapterRef` to control a hybrid AngularJS / Angular application.\n * \n * \\@stable\n */\nexport class UpgradeAdapterRef {\nprivate _readyFn: ((upgradeAdapterRef?: UpgradeAdapterRef) => void)|null = null;\npublic ng1RootScope: angular.IRootScopeService = /** @type {?} */(( null));\npublic ng1Injector: angular.IInjectorService = /** @type {?} */(( null));\npublic ng2ModuleRef: NgModuleRef = /** @type {?} */(( null));\npublic ng2Injector: Injector = /** @type {?} */(( null));\n/**\n * @param {?} ngModuleRef\n * @param {?} ng1Injector\n * @return {?}\n */\nprivate _bootstrapDone(ngModuleRef: NgModuleRef, ng1Injector: angular.IInjectorService) {\n this.ng2ModuleRef = ngModuleRef;\n this.ng2Injector = ngModuleRef.injector;\n this.ng1Injector = ng1Injector;\n this.ng1RootScope = ng1Injector.get($ROOT_SCOPE);\n this._readyFn && this._readyFn(this);\n }\n/**\n * Register a callback function which is notified upon successful hybrid AngularJS / Angular\n * application has been bootstrapped.\n * \n * The `ready` callback function is invoked inside the Angular zone, therefore it does not\n * require a call to `$apply()`.\n * @param {?} fn\n * @return {?}\n */\npublic ready(fn: (upgradeAdapterRef: UpgradeAdapterRef) => void) { this._readyFn = fn; }\n/**\n * Dispose of running hybrid AngularJS / Angular application.\n * @return {?}\n */\npublic dispose() { /** @type {?} */((\n this.ng1Injector)).get($ROOT_SCOPE).$destroy(); /** @type {?} */((\n this.ng2ModuleRef)).destroy();\n }\n}\n\nfunction UpgradeAdapterRef_tsickle_Closure_declarations() {\n/** @type {?} */\nUpgradeAdapterRef.prototype._readyFn;\n/** @type {?} */\nUpgradeAdapterRef.prototype.ng1RootScope;\n/** @type {?} */\nUpgradeAdapterRef.prototype.ng1Injector;\n/** @type {?} */\nUpgradeAdapterRef.prototype.ng2ModuleRef;\n/** @type {?} */\nUpgradeAdapterRef.prototype.ng2Injector;\n}\n\n"],"names":["angular","bootstrap","noNg","module","element","resumeBootstrap","$COMPILE","$CONTROLLER","$INJECTOR","$PARSE","this","parseBinding","bracketAttr","attr","onAttr","capitalAttr","DIRECTIVE_SPECIAL_CHARS_REGEXP","_this","resolve","res","DowngradeComponentAdapter","attrs","scope","ngModel","parentInjector","$injector","$compile","$parse","componentFactory","inputChangeCount","inputChanges","componentScope","$new","prototype","compileContents","compiledProjectableNodes","projectableNodes","groupProjectableNodes","push","clone","childInjector","_angular_core","ReflectiveInjector","resolveAndCreate","provide","$SCOPE","useValue","componentRef","hookupNgModel","component","setupInputs","inputs","this_1","i","input","PropertyBinding","propName","templateName","hasOwnProperty","observeFn_1","prop","prevValue","INITIAL_VALUE","currValue","updateInput","$observe","unwatch_1","$watch","bindAttr","expr","bindonAttr","bracketParenAttr","watchFn","componentType","ngOnChanges","changeDetector","detectChanges","setupOutputs","outputs","j","output","assignExpr","substring","length","parenAttr","getter_1","this_2","setter_1","assign","Error","emitter","getComponentName","subscribe","registerCleanup","ParentInjectorPromise$1","callback","injector","UpgradeHelper","getDirective","name","directive","directives","getTemplate","fetchRemoteTemplate","undefined","template","getOrCall","templateUrl","$templateCache_1","get","url_1","Promise","reject","status","response","put","compileTemplate","compileHtml","prepareTransclusion","contentChildNodes","extractChildNodes","$template","attachChildrenFn","cloneAttach","transclude","slotMap_1","Object","create","keys","forEach","slotName","selector","optional","charAt","slots_1","filledSlots_1","node","nodeValue","resolveAndBindRequiredControllers","controllerInstance","requiredControllersMap_1","key","childNodes","childNode","firstChild","getDirectiveRequire","require","controller","isMap","resolveRequire","Array","isArray","map","req","value_1","match","REQUIRE_PREFIX_RE","inheritType","isOptional","searchParents","startOnParent","ctrlKey","controllerKey","elem","$element","value","CAMEL_CASE","UpgradeNg1ComponentAdapterBuilder","inputsRename","outputsRename","propertyOutputs","checkProperties","Directive","replace","all","next","toLowerCase","self","type","Class","constructor","Inject","Injector","ElementRef","elementRef","ngOnInit","extractBindings","btcIsObject","bindToController","context","definition","bindingType","bindingOptions","attrName","inputName","inputNameRename","outputName","outputNameRename","outputNameRenameChange","propertyMap","exportedComponents","promises","exportedComponent","then","UpgradeNg1ComponentAdapter","helper","propOuts","destinationObj","checkLastValues","controllerType","buildController","EventEmitter","linkFn","isFunction","$onInit","link","preLink","pre","requiredControllers","changes","setComponentProperty","change","currentValue","ng1Changes","ngDoCheck","lastValues","emit","UpgradeAdapter","registerForNg1Tests","modules","element$$1","config","declareNg1Module","upgrade","UpgradeAdapterRef","windowAngular","ngZone","run","ng1Module","ng1BootstrapPromise","originalResumeBootstrap_1","apply","arguments","original$applyFn","rootScopePrototype","rootScope","delayApplyExps","upgradeAdapter","module$1","idPrefix","platformRef","_angular_platformBrowserDynamic","platformBrowserDynamic","NgZone","enableLongStackTrace","Zone","constant","factory","Compiler","decorator","rootScopeDelegate","$apply","exp","testabilityDelegate","originalWhenStable","whenStable","newWhenStable","call","ng2Testability","Testability","isStable","bind","ng1Injector","ng1ComponentsToBeUpgraded","DynamicNgUpgradeModule","NgModule","providers","useFactory","upgradedProviders","imports","ng2AppModule","entryComponents","downgradedComponents","ngDoBootstrap","_bootstrapModuleWithZone","compilerOptions","ref","moduleRef","shift","ng2BootstrapDeferred","onError","subscription","onMicrotaskEmpty","$digest","dispose","downgradeComponent","info","directiveFactory","REQUIRE_INJECTOR","REQUIRE_NG_MODEL","required","INJECTOR_KEY","downgradeFn","componentFactoryResolver","ComponentFactoryResolver","resolveComponentFactory","injectorPromise","facade","createComponent","getInjector","e","groupNodesBySelector","ngContentSelectors","nodes","ii","findMatchingNgContentIndex","ngContentIndices","wildcardNgContentIndex","matchesSelector"],"mappings":";;;;;;;;;;;;AA2OA,QAAAE,QAAI,KAAJ,IAAAuF,OAAA,iCGhNA,QAAAyM,SAAAoB,saAwDA,QAAAjG,YAAAhD,OACA,MAAA,kBAAAA,4aCqMA,QAAAkJ,sBAAAC,mBAAAC,OAIA,IAAA,GAHArR,qBAGAiB,EAAA,EAAAqQ,GAAAF,mBAAArO,OAAA9B,EAAAqQ,KAAArQ,EACAjB,iBAAAiB,2NAeA,QAAAsQ,4BAAAvT,QAAAoT,oBAGA,IAAA,GAFAI,qBACAC,wBAAA,EACAxQ,EAAA,EAAAA,EAAAmQ,mBAAArO,OAAA9B,IAAA,CACA,GAAA8E,UAAAqL,mBAAAnQ,EAEA,OAAA8E,SACA0L,uBAAAxQ,EAGAyQ,gBAAA1T,QAAA+H,WAxEAyL,iBAAAtR,KAAAe;;;;;;;ACpKA,QAAAkP,oBAAAC,MAEA,GAAAC,kBAAA,SAAA/Q,SAAAD,UAAAE,wCAQAuH,SAAAwJ,iBAAAC,kBACApF,KAAA,SAAAjM,MAAAlB,QAAAiB,MAAAuR,UAQA,GAAApR,gBAAAoR,SAAA,IAAAnR,UAAAoF,IAAAgM,cACAtR,QAAAqR,SAAA,GACAE,YAAA,SAAA9M,UACU,GAAV+M,0BAAA/M,SAAAa,IAAApE,cAAAuQ,0BACApR,iBAAAmR,yBAAAE,wBAA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