{"ast":null,"code":"/**\n * @license Angular v13.1.1\n * (c) 2010-2021 Google LLC. https://angular.io/\n * License: MIT\n */\nimport * as i0 from '@angular/core';\nimport { ɵNG_MOD_DEF, Injector, ChangeDetectorRef, Testability, TestabilityRegistry, ApplicationRef, SimpleChange, NgZone, ComponentFactoryResolver, Version, ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, PlatformRef, EventEmitter, Directive, NgModule } from '@angular/core';\nimport { platformBrowser } from '@angular/platform-browser';\n/**\n * @license\n * Copyright Google LLC 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\nfunction noNg() {\n  throw new Error('AngularJS v1.x is not loaded!');\n}\n\nconst noNgElement = () => noNg();\n\nnoNgElement.cleanData = noNg;\nlet angular = {\n  bootstrap: noNg,\n  module: noNg,\n  element: noNgElement,\n  injector: noNg,\n  version: undefined,\n  resumeBootstrap: noNg,\n  getTestability: noNg\n};\n\ntry {\n  if (window.hasOwnProperty('angular')) {\n    angular = window.angular;\n  }\n} catch (_a) {// ignore in CJS mode.\n}\n/**\n * @deprecated Use `setAngularJSGlobal` instead.\n *\n * @publicApi\n */\n\n\nfunction setAngularLib(ng) {\n  setAngularJSGlobal(ng);\n}\n/**\n * @deprecated Use `getAngularJSGlobal` instead.\n *\n * @publicApi\n */\n\n\nfunction getAngularLib() {\n  return getAngularJSGlobal();\n}\n/**\n * Resets the AngularJS global.\n *\n * Used when AngularJS is loaded lazily, and not available on `window`.\n *\n * @publicApi\n */\n\n\nfunction setAngularJSGlobal(ng) {\n  angular = ng;\n}\n/**\n * Returns the current AngularJS global.\n *\n * @publicApi\n */\n\n\nfunction getAngularJSGlobal() {\n  return angular;\n}\n\nconst bootstrap = (e, modules, config) => angular.bootstrap(e, modules, config); // Do not declare as `module` to avoid webpack bug\n// (see https://github.com/angular/angular/issues/30050).\n\n\nconst module_ = (prefix, dependencies) => angular.module(prefix, dependencies);\n\nconst element = e => angular.element(e);\n\nelement.cleanData = nodes => angular.element.cleanData(nodes);\n\nconst injector = (modules, strictDi) => angular.injector(modules, strictDi);\n\nconst resumeBootstrap = () => angular.resumeBootstrap();\n\nconst getTestability = e => angular.getTestability(e);\n/**\n * @license\n * Copyright Google LLC 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\nconst $COMPILE = '$compile';\nconst $CONTROLLER = '$controller';\nconst $DELEGATE = '$delegate';\nconst $EXCEPTION_HANDLER = '$exceptionHandler';\nconst $HTTP_BACKEND = '$httpBackend';\nconst $INJECTOR = '$injector';\nconst $INTERVAL = '$interval';\nconst $PARSE = '$parse';\nconst $PROVIDE = '$provide';\nconst $ROOT_ELEMENT = '$rootElement';\nconst $ROOT_SCOPE = '$rootScope';\nconst $SCOPE = '$scope';\nconst $TEMPLATE_CACHE = '$templateCache';\nconst $TEMPLATE_REQUEST = '$templateRequest';\nconst $$TESTABILITY = '$$testability';\nconst COMPILER_KEY = '$$angularCompiler';\nconst DOWNGRADED_MODULE_COUNT_KEY = '$$angularDowngradedModuleCount';\nconst GROUP_PROJECTABLE_NODES_KEY = '$$angularGroupProjectableNodes';\nconst INJECTOR_KEY = '$$angularInjector';\nconst LAZY_MODULE_REF = '$$angularLazyModuleRef';\nconst NG_ZONE_KEY = '$$angularNgZone';\nconst UPGRADE_APP_TYPE_KEY = '$$angularUpgradeAppType';\nconst REQUIRE_INJECTOR = '?^^' + INJECTOR_KEY;\nconst REQUIRE_NG_MODEL = '?ngModel';\nconst UPGRADE_MODULE_NAME = '$$UpgradeModule';\n/**\n * @license\n * Copyright Google LLC 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/**\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 */\n\nclass PropertyBinding {\n  constructor(prop, attr) {\n    this.prop = prop;\n    this.attr = attr;\n    this.parseBinding();\n  }\n\n  parseBinding() {\n    this.bracketAttr = `[${this.attr}]`;\n    this.parenAttr = `(${this.attr})`;\n    this.bracketParenAttr = `[(${this.attr})]`;\n    const 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}\n/**\n * @license\n * Copyright Google LLC 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\nconst DIRECTIVE_PREFIX_REGEXP = /^(?:x|data)[:\\-_]/i;\nconst DIRECTIVE_SPECIAL_CHARS_REGEXP = /[:\\-_]+(.)/g;\n\nfunction onError(e) {\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\n  throw e;\n}\n/**\n * Clean the jqLite/jQuery data on the element and all its descendants.\n * Equivalent to how jqLite/jQuery invoke `cleanData()` on an Element when removed:\n *   https://github.com/angular/angular.js/blob/2e72ea13fa98bebf6ed4b5e3c45eaf5f990ed16f/src/jqLite.js#L349-L355\n *   https://github.com/jquery/jquery/blob/6984d1747623dbc5e87fd6c261a5b6b1628c107c/src/manipulation.js#L182\n *\n * NOTE:\n * `cleanData()` will also invoke the AngularJS `$destroy` DOM event on the element:\n *   https://github.com/angular/angular.js/blob/2e72ea13fa98bebf6ed4b5e3c45eaf5f990ed16f/src/Angular.js#L1932-L1945\n *\n * @param node The DOM node whose data needs to be cleaned.\n */\n\n\nfunction cleanData(node) {\n  element.cleanData([node]);\n\n  if (isParentNode(node)) {\n    element.cleanData(node.querySelectorAll('*'));\n  }\n}\n\nfunction controllerKey(name) {\n  return '$' + name + 'Controller';\n}\n/**\n * Destroy an AngularJS app given the app `$injector`.\n *\n * NOTE: Destroying an app is not officially supported by AngularJS, but try to do our best by\n *       destroying `$rootScope` and clean the jqLite/jQuery data on `$rootElement` and all\n *       descendants.\n *\n * @param $injector The `$injector` of the AngularJS app to destroy.\n */\n\n\nfunction destroyApp($injector) {\n  const $rootElement = $injector.get($ROOT_ELEMENT);\n  const $rootScope = $injector.get($ROOT_SCOPE);\n  $rootScope.$destroy();\n  cleanData($rootElement[0]);\n}\n\nfunction directiveNormalize(name) {\n  return name.replace(DIRECTIVE_PREFIX_REGEXP, '').replace(DIRECTIVE_SPECIAL_CHARS_REGEXP, (_, letter) => letter.toUpperCase());\n}\n\nfunction getTypeName(type) {\n  // Return the name of the type or the first line of its stringified version.\n  return type.overriddenName || type.name || type.toString().split('\\n')[0];\n}\n\nfunction getDowngradedModuleCount($injector) {\n  return $injector.has(DOWNGRADED_MODULE_COUNT_KEY) ? $injector.get(DOWNGRADED_MODULE_COUNT_KEY) : 0;\n}\n\nfunction getUpgradeAppType($injector) {\n  return $injector.has(UPGRADE_APP_TYPE_KEY) ? $injector.get(UPGRADE_APP_TYPE_KEY) : 0\n  /* None */\n  ;\n}\n\nfunction isFunction(value) {\n  return typeof value === 'function';\n}\n\nfunction isNgModuleType(value) {\n  // NgModule class should have the `ɵmod` static property attached by AOT or JIT compiler.\n  return isFunction(value) && !!value[ɵNG_MOD_DEF];\n}\n\nfunction isParentNode(node) {\n  return isFunction(node.querySelectorAll);\n}\n\nfunction validateInjectionKey($injector, downgradedModule, injectionKey, attemptedAction) {\n  const upgradeAppType = getUpgradeAppType($injector);\n  const downgradedModuleCount = getDowngradedModuleCount($injector); // Check for common errors.\n\n  switch (upgradeAppType) {\n    case 1\n    /* Dynamic */\n    :\n    case 2\n    /* Static */\n    :\n      if (downgradedModule) {\n        throw new Error(`Error while ${attemptedAction}: 'downgradedModule' unexpectedly specified.\\n` + 'You should not specify a value for \\'downgradedModule\\', unless you are downgrading ' + 'more than one Angular module (via \\'downgradeModule()\\').');\n      }\n\n      break;\n\n    case 3\n    /* Lite */\n    :\n      if (!downgradedModule && downgradedModuleCount >= 2) {\n        throw new Error(`Error while ${attemptedAction}: 'downgradedModule' not specified.\\n` + 'This application contains more than one downgraded Angular module, thus you need to ' + 'always specify \\'downgradedModule\\' when downgrading components and injectables.');\n      }\n\n      if (!$injector.has(injectionKey)) {\n        throw new Error(`Error while ${attemptedAction}: Unable to find the specified downgraded module.\\n` + 'Did you forget to downgrade an Angular module or include it in the AngularJS ' + 'application?');\n      }\n\n      break;\n\n    default:\n      throw new Error(`Error while ${attemptedAction}: Not a valid '@angular/upgrade' application.\\n` + 'Did you forget to downgrade an Angular module or include it in the AngularJS ' + 'application?');\n  }\n}\n\nclass Deferred {\n  constructor() {\n    this.promise = new Promise((res, rej) => {\n      this.resolve = res;\n      this.reject = rej;\n    });\n  }\n\n}\n/**\n * @return Whether the passed-in component implements the subset of the\n *     `ControlValueAccessor` interface needed for AngularJS `ng-model`\n *     compatibility.\n */\n\n\nfunction supportsNgModel(component) {\n  return typeof component.writeValue === 'function' && 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 */\n\n\nfunction hookupNgModel(ngModel, component) {\n  if (ngModel && supportsNgModel(component)) {\n    ngModel.$render = () => {\n      component.writeValue(ngModel.$viewValue);\n    };\n\n    component.registerOnChange(ngModel.$setViewValue.bind(ngModel));\n\n    if (typeof component.registerOnTouched === 'function') {\n      component.registerOnTouched(ngModel.$setTouched.bind(ngModel));\n    }\n  }\n}\n/**\n * Test two values for strict equality, accounting for the fact that `NaN !== NaN`.\n */\n\n\nfunction strictEquals(val1, val2) {\n  return val1 === val2 || val1 !== val1 && val2 !== val2;\n}\n/**\n * @license\n * Copyright Google LLC 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\nconst INITIAL_VALUE$1 = {\n  __UNINITIALIZED__: true\n};\n\nclass DowngradeComponentAdapter {\n  constructor(element, attrs, scope, ngModel, parentInjector, $compile, $parse, componentFactory, wrapCallback) {\n    this.element = element;\n    this.attrs = attrs;\n    this.scope = scope;\n    this.ngModel = ngModel;\n    this.parentInjector = parentInjector;\n    this.$compile = $compile;\n    this.$parse = $parse;\n    this.componentFactory = componentFactory;\n    this.wrapCallback = wrapCallback;\n    this.implementsOnChanges = false;\n    this.inputChangeCount = 0;\n    this.inputChanges = {};\n    this.componentScope = scope.$new();\n  }\n\n  compileContents() {\n    const compiledProjectableNodes = [];\n    const projectableNodes = this.groupProjectableNodes();\n    const linkFns = projectableNodes.map(nodes => this.$compile(nodes));\n    this.element.empty();\n    linkFns.forEach(linkFn => {\n      linkFn(this.scope, clone => {\n        compiledProjectableNodes.push(clone);\n        this.element.append(clone);\n      });\n    });\n    return compiledProjectableNodes;\n  }\n\n  createComponent(projectableNodes) {\n    const providers = [{\n      provide: $SCOPE,\n      useValue: this.componentScope\n    }];\n    const childInjector = Injector.create({\n      providers: providers,\n      parent: this.parentInjector,\n      name: 'DowngradeComponentAdapter'\n    });\n    this.componentRef = this.componentFactory.create(childInjector, projectableNodes, this.element[0]);\n    this.viewChangeDetector = this.componentRef.injector.get(ChangeDetectorRef);\n    this.changeDetector = this.componentRef.changeDetectorRef;\n    this.component = this.componentRef.instance; // testability hook is commonly added during component bootstrap in\n    // packages/core/src/application_ref.bootstrap()\n    // in downgraded application, component creation will take place here as well as adding the\n    // testability hook.\n\n    const testability = this.componentRef.injector.get(Testability, null);\n\n    if (testability) {\n      this.componentRef.injector.get(TestabilityRegistry).registerApplication(this.componentRef.location.nativeElement, testability);\n    }\n\n    hookupNgModel(this.ngModel, this.component);\n  }\n\n  setupInputs(manuallyAttachView, propagateDigest = true) {\n    const attrs = this.attrs;\n    const inputs = this.componentFactory.inputs || [];\n\n    for (let i = 0; i < inputs.length; i++) {\n      const input = new PropertyBinding(inputs[i].propName, inputs[i].templateName);\n      let expr = null;\n\n      if (attrs.hasOwnProperty(input.attr)) {\n        const observeFn = (prop => {\n          let prevValue = INITIAL_VALUE$1;\n          return currValue => {\n            // Initially, both `$observe()` and `$watch()` will call this function.\n            if (!strictEquals(prevValue, currValue)) {\n              if (prevValue === INITIAL_VALUE$1) {\n                prevValue = currValue;\n              }\n\n              this.updateInput(prop, prevValue, currValue);\n              prevValue = currValue;\n            }\n          };\n        })(input.prop);\n\n        attrs.$observe(input.attr, observeFn); // 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\n        let unwatch = this.componentScope.$watch(() => {\n          unwatch();\n          unwatch = null;\n          observeFn(attrs[input.attr]);\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\n      if (expr != null) {\n        const watchFn = (prop => (currValue, prevValue) => this.updateInput(prop, prevValue, currValue))(input.prop);\n\n        this.componentScope.$watch(expr, watchFn);\n      }\n    } // Invoke `ngOnChanges()` and Change Detection (when necessary)\n\n\n    const detectChanges = () => this.changeDetector.detectChanges();\n\n    const prototype = this.componentFactory.componentType.prototype;\n    this.implementsOnChanges = !!(prototype && prototype.ngOnChanges);\n    this.componentScope.$watch(() => this.inputChangeCount, this.wrapCallback(() => {\n      // Invoke `ngOnChanges()`\n      if (this.implementsOnChanges) {\n        const inputChanges = this.inputChanges;\n        this.inputChanges = {};\n        this.component.ngOnChanges(inputChanges);\n      }\n\n      this.viewChangeDetector.markForCheck(); // If opted out of propagating digests, invoke change detection when inputs change.\n\n      if (!propagateDigest) {\n        detectChanges();\n      }\n    })); // If not opted out of propagating digests, invoke change detection on every digest\n\n    if (propagateDigest) {\n      this.componentScope.$watch(this.wrapCallback(detectChanges));\n    } // If necessary, attach the view so that it will be dirty-checked.\n    // (Allow time for the initial input values to be set and `ngOnChanges()` to be called.)\n\n\n    if (manuallyAttachView || !propagateDigest) {\n      let unwatch = this.componentScope.$watch(() => {\n        unwatch();\n        unwatch = null;\n        const appRef = this.parentInjector.get(ApplicationRef);\n        appRef.attachView(this.componentRef.hostView);\n      });\n    }\n  }\n\n  setupOutputs() {\n    const attrs = this.attrs;\n    const outputs = this.componentFactory.outputs || [];\n\n    for (let j = 0; j < outputs.length; j++) {\n      const output = new PropertyBinding(outputs[j].propName, outputs[j].templateName);\n      const bindonAttr = output.bindonAttr.substring(0, output.bindonAttr.length - 6);\n      const bracketParenAttr = `[(${output.bracketParenAttr.substring(2, output.bracketParenAttr.length - 8)})]`; // order below is important - first update bindings then evaluate expressions\n\n      if (attrs.hasOwnProperty(bindonAttr)) {\n        this.subscribeToOutput(output, attrs[bindonAttr], true);\n      }\n\n      if (attrs.hasOwnProperty(bracketParenAttr)) {\n        this.subscribeToOutput(output, attrs[bracketParenAttr], true);\n      }\n\n      if (attrs.hasOwnProperty(output.onAttr)) {\n        this.subscribeToOutput(output, attrs[output.onAttr]);\n      }\n\n      if (attrs.hasOwnProperty(output.parenAttr)) {\n        this.subscribeToOutput(output, attrs[output.parenAttr]);\n      }\n    }\n  }\n\n  subscribeToOutput(output, expr, isAssignment = false) {\n    const getter = this.$parse(expr);\n    const setter = getter.assign;\n\n    if (isAssignment && !setter) {\n      throw new Error(`Expression '${expr}' is not assignable!`);\n    }\n\n    const emitter = this.component[output.prop];\n\n    if (emitter) {\n      emitter.subscribe({\n        next: isAssignment ? v => setter(this.scope, v) : v => getter(this.scope, {\n          '$event': v\n        })\n      });\n    } else {\n      throw new Error(`Missing emitter '${output.prop}' on component '${getTypeName(this.componentFactory.componentType)}'!`);\n    }\n  }\n\n  registerCleanup() {\n    const testabilityRegistry = this.componentRef.injector.get(TestabilityRegistry);\n    const destroyComponentRef = this.wrapCallback(() => this.componentRef.destroy());\n    let destroyed = false;\n    this.element.on('$destroy', () => {\n      // The `$destroy` event may have been triggered by the `cleanData()` call in the\n      // `componentScope` `$destroy` handler below. In that case, we don't want to call\n      // `componentScope.$destroy()` again.\n      if (!destroyed) this.componentScope.$destroy();\n    });\n    this.componentScope.$on('$destroy', () => {\n      if (!destroyed) {\n        destroyed = true;\n        testabilityRegistry.unregisterApplication(this.componentRef.location.nativeElement); // The `componentScope` might be getting destroyed, because an ancestor element is being\n        // removed/destroyed. If that is the case, jqLite/jQuery would normally invoke `cleanData()`\n        // on the removed element and all descendants.\n        //   https://github.com/angular/angular.js/blob/2e72ea13fa98bebf6ed4b5e3c45eaf5f990ed16f/src/jqLite.js#L349-L355\n        //   https://github.com/jquery/jquery/blob/6984d1747623dbc5e87fd6c261a5b6b1628c107c/src/manipulation.js#L182\n        //\n        // Here, however, `destroyComponentRef()` may under some circumstances remove the element\n        // from the DOM and therefore it will no longer be a descendant of the removed element when\n        // `cleanData()` is called. This would result in a memory leak, because the element's data\n        // and event handlers (and all objects directly or indirectly referenced by them) would be\n        // retained.\n        //\n        // To ensure the element is always properly cleaned up, we manually call `cleanData()` on\n        // this element and its descendants before destroying the `ComponentRef`.\n\n        cleanData(this.element[0]);\n        destroyComponentRef();\n      }\n    });\n  }\n\n  getInjector() {\n    return this.componentRef.injector;\n  }\n\n  updateInput(prop, prevValue, currValue) {\n    if (this.implementsOnChanges) {\n      this.inputChanges[prop] = new SimpleChange(prevValue, currValue, prevValue === currValue);\n    }\n\n    this.inputChangeCount++;\n    this.component[prop] = currValue;\n  }\n\n  groupProjectableNodes() {\n    let ngContentSelectors = this.componentFactory.ngContentSelectors;\n    return groupNodesBySelector(ngContentSelectors, this.element.contents());\n  }\n\n}\n/**\n * Group a set of DOM nodes into `ngContent` groups, based on the given content selectors.\n */\n\n\nfunction groupNodesBySelector(ngContentSelectors, nodes) {\n  const projectableNodes = [];\n\n  for (let i = 0, ii = ngContentSelectors.length; i < ii; ++i) {\n    projectableNodes[i] = [];\n  }\n\n  for (let j = 0, jj = nodes.length; j < jj; ++j) {\n    const node = nodes[j];\n    const ngContentIndex = findMatchingNgContentIndex(node, ngContentSelectors);\n\n    if (ngContentIndex != null) {\n      projectableNodes[ngContentIndex].push(node);\n    }\n  }\n\n  return projectableNodes;\n}\n\nfunction findMatchingNgContentIndex(element, ngContentSelectors) {\n  const ngContentIndices = [];\n  let wildcardNgContentIndex = -1;\n\n  for (let i = 0; i < ngContentSelectors.length; i++) {\n    const selector = ngContentSelectors[i];\n\n    if (selector === '*') {\n      wildcardNgContentIndex = i;\n    } else {\n      if (matchesSelector(element, selector)) {\n        ngContentIndices.push(i);\n      }\n    }\n  }\n\n  ngContentIndices.sort();\n\n  if (wildcardNgContentIndex !== -1) {\n    ngContentIndices.push(wildcardNgContentIndex);\n  }\n\n  return ngContentIndices.length ? ngContentIndices[0] : null;\n}\n\nlet _matches;\n\nfunction matchesSelector(el, selector) {\n  if (!_matches) {\n    const elProto = Element.prototype;\n    _matches = elProto.matches || elProto.matchesSelector || elProto.mozMatchesSelector || elProto.msMatchesSelector || elProto.oMatchesSelector || elProto.webkitMatchesSelector;\n  }\n\n  return el.nodeType === Node.ELEMENT_NODE ? _matches.call(el, selector) : false;\n}\n/**\n * @license\n * Copyright Google LLC 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\nfunction isThenable(obj) {\n  return !!obj && isFunction(obj.then);\n}\n/**\n * Synchronous, promise-like object.\n */\n\n\nclass SyncPromise {\n  constructor() {\n    this.resolved = false;\n    this.callbacks = [];\n  }\n\n  static all(valuesOrPromises) {\n    const aggrPromise = new SyncPromise();\n    let resolvedCount = 0;\n    const results = [];\n\n    const resolve = (idx, value) => {\n      results[idx] = value;\n      if (++resolvedCount === valuesOrPromises.length) aggrPromise.resolve(results);\n    };\n\n    valuesOrPromises.forEach((p, idx) => {\n      if (isThenable(p)) {\n        p.then(v => resolve(idx, v));\n      } else {\n        resolve(idx, p);\n      }\n    });\n    return aggrPromise;\n  }\n\n  resolve(value) {\n    // Do nothing, if already resolved.\n    if (this.resolved) return;\n    this.value = value;\n    this.resolved = true; // Run the queued callbacks.\n\n    this.callbacks.forEach(callback => callback(value));\n    this.callbacks.length = 0;\n  }\n\n  then(callback) {\n    if (this.resolved) {\n      callback(this.value);\n    } else {\n      this.callbacks.push(callback);\n    }\n  }\n\n}\n/**\n * @license\n * Copyright Google LLC 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/**\n * @description\n *\n * A helper function that allows an Angular component to be used from AngularJS.\n *\n * *Part of the [upgrade/static](api?query=upgrade%2Fstatic)\n * library for hybrid upgrade apps that support AOT compilation*\n *\n * This helper function returns a factory function to be used for registering\n * an AngularJS wrapper directive for \"downgrading\" an Angular component.\n *\n * @usageNotes\n * ### Examples\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/full/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/full/module.ts region=\"ng2-heroes-wrapper\"}\n *\n * For more details and examples on downgrading Angular components to AngularJS components please\n * visit the [Upgrade guide](guide/upgrade#using-angular-components-from-angularjs-code).\n *\n * @param info contains information about the Component that is being downgraded:\n *\n * - `component: Type<any>`: The type of the Component that will be downgraded\n * - `downgradedModule?: string`: The name of the downgraded module (if any) that the component\n *   \"belongs to\", as returned by a call to `downgradeModule()`. It is the module, whose\n *   corresponding Angular module will be bootstrapped, when the component needs to be instantiated.\n *   <br />\n *   (This option is only necessary when using `downgradeModule()` to downgrade more than one\n *   Angular module.)\n * - `propagateDigest?: boolean`: Whether to perform {@link ChangeDetectorRef#detectChanges\n *   change detection} on the component on every\n *   [$digest](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest). If set to `false`,\n *   change detection will still be performed when any of the component's inputs changes.\n *   (Default: true)\n *\n * @returns a factory function that can be used to register the component in an\n * AngularJS module.\n *\n * @publicApi\n */\n\n\nfunction downgradeComponent(info) {\n  const directiveFactory = function ($compile, $injector, $parse) {\n    // When using `downgradeModule()`, we need to handle certain things specially. For example:\n    // - We always need to attach the component view to the `ApplicationRef` for it to be\n    //   dirty-checked.\n    // - We need to ensure callbacks to Angular APIs (e.g. change detection) are run inside the\n    //   Angular zone.\n    //   NOTE: This is not needed, when using `UpgradeModule`, because `$digest()` will be run\n    //         inside the Angular zone (except if explicitly escaped, in which case we shouldn't\n    //         force it back in).\n    const isNgUpgradeLite = getUpgradeAppType($injector) === 3\n    /* Lite */\n    ;\n    const wrapCallback = !isNgUpgradeLite ? cb => cb : cb => () => NgZone.isInAngularZone() ? cb() : ngZone.run(cb);\n    let ngZone; // When downgrading multiple modules, special handling is needed wrt injectors.\n\n    const hasMultipleDowngradedModules = isNgUpgradeLite && getDowngradedModuleCount($injector) > 1;\n    return {\n      restrict: 'E',\n      terminal: true,\n      require: [REQUIRE_INJECTOR, REQUIRE_NG_MODEL],\n      link: (scope, element, attrs, required) => {\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        const ngModel = required[1];\n        const parentInjector = required[0];\n        let moduleInjector = undefined;\n        let ranAsync = false;\n\n        if (!parentInjector || hasMultipleDowngradedModules) {\n          const downgradedModule = info.downgradedModule || '';\n          const lazyModuleRefKey = `${LAZY_MODULE_REF}${downgradedModule}`;\n          const attemptedAction = `instantiating component '${getTypeName(info.component)}'`;\n          validateInjectionKey($injector, downgradedModule, lazyModuleRefKey, attemptedAction);\n          const lazyModuleRef = $injector.get(lazyModuleRefKey);\n          moduleInjector = lazyModuleRef.injector || lazyModuleRef.promise;\n        } // Notes:\n        //\n        // There are two injectors: `finalModuleInjector` and `finalParentInjector` (they might be\n        // the same instance, but that is irrelevant):\n        // - `finalModuleInjector` is used to retrieve `ComponentFactoryResolver`, thus it must be\n        //   on the same tree as the `NgModule` that declares this downgraded component.\n        // - `finalParentInjector` is used for all other injection purposes.\n        //   (Note that Angular knows to only traverse the component-tree part of that injector,\n        //   when looking for an injectable and then switch to the module injector.)\n        //\n        // There are basically three cases:\n        // - If there is no parent component (thus no `parentInjector`), we bootstrap the downgraded\n        //   `NgModule` and use its injector as both `finalModuleInjector` and\n        //   `finalParentInjector`.\n        // - If there is a parent component (and thus a `parentInjector`) and we are sure that it\n        //   belongs to the same `NgModule` as this downgraded component (e.g. because there is only\n        //   one downgraded module, we use that `parentInjector` as both `finalModuleInjector` and\n        //   `finalParentInjector`.\n        // - If there is a parent component, but it may belong to a different `NgModule`, then we\n        //   use the `parentInjector` as `finalParentInjector` and this downgraded component's\n        //   declaring `NgModule`'s injector as `finalModuleInjector`.\n        //   Note 1: If the `NgModule` is already bootstrapped, we just get its injector (we don't\n        //           bootstrap again).\n        //   Note 2: It is possible that (while there are multiple downgraded modules) this\n        //           downgraded component and its parent component both belong to the same NgModule.\n        //           In that case, we could have used the `parentInjector` as both\n        //           `finalModuleInjector` and `finalParentInjector`, but (for simplicity) we are\n        //           treating this case as if they belong to different `NgModule`s. That doesn't\n        //           really affect anything, since `parentInjector` has `moduleInjector` as ancestor\n        //           and trying to resolve `ComponentFactoryResolver` from either one will return\n        //           the same instance.\n        // If there is a parent component, use its injector as parent injector.\n        // If this is a \"top-level\" Angular component, use the module injector.\n\n\n        const finalParentInjector = parentInjector || moduleInjector; // If this is a \"top-level\" Angular component or the parent component may belong to a\n        // different `NgModule`, use the module injector for module-specific dependencies.\n        // If there is a parent component that belongs to the same `NgModule`, use its injector.\n\n        const finalModuleInjector = moduleInjector || parentInjector;\n\n        const doDowngrade = (injector, moduleInjector) => {\n          // Retrieve `ComponentFactoryResolver` from the injector tied to the `NgModule` this\n          // component belongs to.\n          const componentFactoryResolver = moduleInjector.get(ComponentFactoryResolver);\n          const componentFactory = componentFactoryResolver.resolveComponentFactory(info.component);\n\n          if (!componentFactory) {\n            throw new Error(`Expecting ComponentFactory for: ${getTypeName(info.component)}`);\n          }\n\n          const injectorPromise = new ParentInjectorPromise(element);\n          const facade = new DowngradeComponentAdapter(element, attrs, scope, ngModel, injector, $compile, $parse, componentFactory, wrapCallback);\n          const projectableNodes = facade.compileContents();\n          facade.createComponent(projectableNodes);\n          facade.setupInputs(isNgUpgradeLite, info.propagateDigest);\n          facade.setupOutputs();\n          facade.registerCleanup();\n          injectorPromise.resolve(facade.getInjector());\n\n          if (ranAsync) {\n            // If this is run async, it is possible that it is not run inside a\n            // digest and initial input values will not be detected.\n            scope.$evalAsync(() => {});\n          }\n        };\n\n        const downgradeFn = !isNgUpgradeLite ? doDowngrade : (pInjector, mInjector) => {\n          if (!ngZone) {\n            ngZone = pInjector.get(NgZone);\n          }\n\n          wrapCallback(() => doDowngrade(pInjector, mInjector))();\n        }; // NOTE:\n        // Not using `ParentInjectorPromise.all()` (which is inherited from `SyncPromise`), because\n        // Closure Compiler (or some related tool) complains:\n        // `TypeError: ...$src$downgrade_component_ParentInjectorPromise.all is not a function`\n\n        SyncPromise.all([finalParentInjector, finalModuleInjector]).then(([pInjector, mInjector]) => downgradeFn(pInjector, mInjector));\n        ranAsync = true;\n      }\n    };\n  }; // bracket-notation because of closure - see #14441\n\n\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 AngularJS's `$compile`.\n */\n\n\nclass ParentInjectorPromise extends SyncPromise {\n  constructor(element) {\n    super();\n    this.element = element;\n    this.injectorKey = controllerKey(INJECTOR_KEY); // Store the promise on the element.\n\n    element.data(this.injectorKey, this);\n  }\n\n  resolve(injector) {\n    // Store the real injector on the element.\n    this.element.data(this.injectorKey, injector); // Release the element to prevent memory leaks.\n\n    this.element = null; // Resolve the promise.\n\n    super.resolve(injector);\n  }\n\n}\n/**\n * @license\n * Copyright Google LLC 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/**\n * @description\n *\n * A helper function to allow an Angular service to be accessible from AngularJS.\n *\n * *Part of the [upgrade/static](api?query=upgrade%2Fstatic)\n * library for hybrid upgrade apps that support AOT compilation*\n *\n * This helper function returns a factory function that provides access to the Angular\n * service identified by the `token` parameter.\n *\n * @usageNotes\n * ### Examples\n *\n * First ensure that the service to be downgraded is provided in an `NgModule`\n * that will be part of the upgrade application. For example, let's assume we have\n * defined `HeroesService`\n *\n * {@example upgrade/static/ts/full/module.ts region=\"ng2-heroes-service\"}\n *\n * and that we have included this in our upgrade app `NgModule`\n *\n * {@example upgrade/static/ts/full/module.ts region=\"ng2-module\"}\n *\n * Now we can register the `downgradeInjectable` factory function for the service\n * on an AngularJS module.\n *\n * {@example upgrade/static/ts/full/module.ts region=\"downgrade-ng2-heroes-service\"}\n *\n * Inside an AngularJS component's controller we can get hold of the\n * downgraded service via the name we gave when downgrading.\n *\n * {@example upgrade/static/ts/full/module.ts region=\"example-app\"}\n *\n * <div class=\"alert is-important\">\n *\n *   When using `downgradeModule()`, downgraded injectables will not be available until the Angular\n *   module that provides them is instantiated. In order to be safe, you need to ensure that the\n *   downgraded injectables are not used anywhere _outside_ the part of the app where it is\n *   guaranteed that their module has been instantiated.\n *\n *   For example, it is _OK_ to use a downgraded service in an upgraded component that is only used\n *   from a downgraded Angular component provided by the same Angular module as the injectable, but\n *   it is _not OK_ to use it in an AngularJS component that may be used independently of Angular or\n *   use it in a downgraded Angular component from a different module.\n *\n * </div>\n *\n * @param token an `InjectionToken` that identifies a service provided from Angular.\n * @param downgradedModule the name of the downgraded module (if any) that the injectable\n * \"belongs to\", as returned by a call to `downgradeModule()`. It is the module, whose injector will\n * be used for instantiating the injectable.<br />\n * (This option is only necessary when using `downgradeModule()` to downgrade more than one Angular\n * module.)\n *\n * @returns a [factory function](https://docs.angularjs.org/guide/di) that can be\n * used to register the service on an AngularJS module.\n *\n * @publicApi\n */\n\n\nfunction downgradeInjectable(token, downgradedModule = '') {\n  const factory = function ($injector) {\n    const injectorKey = `${INJECTOR_KEY}${downgradedModule}`;\n    const injectableName = isFunction(token) ? getTypeName(token) : String(token);\n    const attemptedAction = `instantiating injectable '${injectableName}'`;\n    validateInjectionKey($injector, downgradedModule, injectorKey, attemptedAction);\n\n    try {\n      const injector = $injector.get(injectorKey);\n      return injector.get(token);\n    } catch (err) {\n      throw new Error(`Error while ${attemptedAction}: ${err.message || err}`);\n    }\n  };\n\n  factory['$inject'] = [$INJECTOR];\n  return factory;\n}\n/**\n * @license\n * Copyright Google LLC 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/**\n * @publicApi\n */\n\n\nconst VERSION = new Version('13.1.1');\n/**\n * @license\n * Copyright Google LLC 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// We have to do a little dance to get the ng1 injector into the module injector.\n// We store the ng1 injector so that the provider in the module injector can access it\n// Then we \"get\" the ng1 injector from the module injector, which triggers the provider to read\n// the stored injector and release the reference to it.\n\nlet tempInjectorRef = null;\n\nfunction setTempInjectorRef(injector) {\n  tempInjectorRef = injector;\n}\n\nfunction injectorFactory() {\n  if (!tempInjectorRef) {\n    throw new Error('Trying to get the AngularJS injector before it being set.');\n  }\n\n  const injector = tempInjectorRef;\n  tempInjectorRef = null; // clear the value to prevent memory leaks\n\n  return injector;\n}\n\nfunction rootScopeFactory(i) {\n  return i.get('$rootScope');\n}\n\nfunction compileFactory(i) {\n  return i.get('$compile');\n}\n\nfunction parseFactory(i) {\n  return i.get('$parse');\n}\n\nconst angular1Providers = [// We must use exported named functions for the ng2 factories to keep the compiler happy:\n// > Metadata collected contains an error that will be reported at runtime:\n// >   Function calls are not supported.\n// >   Consider replacing the function or lambda with a reference to an exported function\n{\n  provide: '$injector',\n  useFactory: injectorFactory,\n  deps: []\n}, {\n  provide: '$rootScope',\n  useFactory: rootScopeFactory,\n  deps: ['$injector']\n}, {\n  provide: '$compile',\n  useFactory: compileFactory,\n  deps: ['$injector']\n}, {\n  provide: '$parse',\n  useFactory: parseFactory,\n  deps: ['$injector']\n}];\n/**\n * @license\n * Copyright Google LLC 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\nclass NgAdapterInjector {\n  constructor(modInjector) {\n    this.modInjector = modInjector;\n  } // When Angular locate a service in the component injector tree, the not found value is set to\n  // `NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR`. In such a case we should not walk up to the module\n  // injector.\n  // AngularJS only supports a single tree and should always check the module injector.\n\n\n  get(token, notFoundValue) {\n    if (notFoundValue === ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {\n      return notFoundValue;\n    }\n\n    return this.modInjector.get(token, notFoundValue);\n  }\n\n}\n/**\n * @license\n * Copyright Google LLC 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\nlet moduleUid = 0;\n/**\n * @description\n *\n * A helper function for creating an AngularJS module that can bootstrap an Angular module\n * \"on-demand\" (possibly lazily) when a {@link downgradeComponent downgraded component} needs to be\n * instantiated.\n *\n * *Part of the [upgrade/static](api?query=upgrade/static) library for hybrid upgrade apps that\n * support AOT compilation.*\n *\n * It allows loading/bootstrapping the Angular part of a hybrid application lazily and not having to\n * pay the cost up-front. For example, you can have an AngularJS application that uses Angular for\n * specific routes and only instantiate the Angular modules if/when the user visits one of these\n * routes.\n *\n * The Angular module will be bootstrapped once (when requested for the first time) and the same\n * reference will be used from that point onwards.\n *\n * `downgradeModule()` requires either an `NgModuleFactory`, `NgModule` class or a function:\n * - `NgModuleFactory`: If you pass an `NgModuleFactory`, it will be used to instantiate a module\n *   using `platformBrowser`'s {@link PlatformRef#bootstrapModuleFactory bootstrapModuleFactory()}.\n *   NOTE: this type of the argument is deprecated. Please either provide an `NgModule` class or a\n *   bootstrap function instead.\n * - `NgModule` class: If you pass an NgModule class, it will be used to instantiate a module\n *   using `platformBrowser`'s {@link PlatformRef#bootstrapModule bootstrapModule()}.\n * - `Function`: If you pass a function, it is expected to return a promise resolving to an\n *   `NgModuleRef`. The function is called with an array of extra {@link StaticProvider Providers}\n *   that are expected to be available from the returned `NgModuleRef`'s `Injector`.\n *\n * `downgradeModule()` returns the name of the created AngularJS wrapper module. You can use it to\n * declare a dependency in your main AngularJS module.\n *\n * {@example upgrade/static/ts/lite/module.ts region=\"basic-how-to\"}\n *\n * For more details on how to use `downgradeModule()` see\n * [Upgrading for Performance](guide/upgrade-performance).\n *\n * @usageNotes\n *\n * Apart from `UpgradeModule`, you can use the rest of the `upgrade/static` helpers as usual to\n * build a hybrid application. Note that the Angular pieces (e.g. downgraded services) will not be\n * available until the downgraded module has been bootstrapped, i.e. by instantiating a downgraded\n * component.\n *\n * <div class=\"alert is-important\">\n *\n *   You cannot use `downgradeModule()` and `UpgradeModule` in the same hybrid application.<br />\n *   Use one or the other.\n *\n * </div>\n *\n * ### Differences with `UpgradeModule`\n *\n * Besides their different API, there are two important internal differences between\n * `downgradeModule()` and `UpgradeModule` that affect the behavior of hybrid applications:\n *\n * 1. Unlike `UpgradeModule`, `downgradeModule()` does not bootstrap the main AngularJS module\n *    inside the {@link NgZone Angular zone}.\n * 2. Unlike `UpgradeModule`, `downgradeModule()` does not automatically run a\n *    [$digest()](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest) when changes are\n *    detected in the Angular part of the application.\n *\n * What this means is that applications using `UpgradeModule` will run change detection more\n * frequently in order to ensure that both frameworks are properly notified about possible changes.\n * This will inevitably result in more change detection runs than necessary.\n *\n * `downgradeModule()`, on the other side, does not try to tie the two change detection systems as\n * tightly, restricting the explicit change detection runs only to cases where it knows it is\n * necessary (e.g. when the inputs of a downgraded component change). This improves performance,\n * especially in change-detection-heavy applications, but leaves it up to the developer to manually\n * notify each framework as needed.\n *\n * For a more detailed discussion of the differences and their implications, see\n * [Upgrading for Performance](guide/upgrade-performance).\n *\n * <div class=\"alert is-helpful\">\n *\n *   You can manually trigger a change detection run in AngularJS using\n *   [scope.$apply(...)](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$apply) or\n *   [$rootScope.$digest()](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest).\n *\n *   You can manually trigger a change detection run in Angular using {@link NgZone#run\n *   ngZone.run(...)}.\n *\n * </div>\n *\n * ### Downgrading multiple modules\n *\n * It is possible to downgrade multiple modules and include them in an AngularJS application. In\n * that case, each downgraded module will be bootstrapped when an associated downgraded component or\n * injectable needs to be instantiated.\n *\n * Things to keep in mind, when downgrading multiple modules:\n *\n * - Each downgraded component/injectable needs to be explicitly associated with a downgraded\n *   module. See `downgradeComponent()` and `downgradeInjectable()` for more details.\n *\n * - If you want some injectables to be shared among all downgraded modules, you can provide them as\n *   `StaticProvider`s, when creating the `PlatformRef` (e.g. via `platformBrowser` or\n *   `platformBrowserDynamic`).\n *\n * - When using {@link PlatformRef#bootstrapmodule `bootstrapModule()`} or\n *   {@link PlatformRef#bootstrapmodulefactory `bootstrapModuleFactory()`} to bootstrap the\n *   downgraded modules, each one is considered a \"root\" module. As a consequence, a new instance\n *   will be created for every injectable provided in `\"root\"` (via\n *   {@link Injectable#providedIn `providedIn`}).\n *   If this is not your intention, you can have a shared module (that will act as act as the \"root\"\n *   module) and create all downgraded modules using that module's injector:\n *\n *   {@example upgrade/static/ts/lite-multi-shared/module.ts region=\"shared-root-module\"}\n *\n * @publicApi\n */\n\nfunction downgradeModule(moduleOrBootstrapFn) {\n  const lazyModuleName = `${UPGRADE_MODULE_NAME}.lazy${++moduleUid}`;\n  const lazyModuleRefKey = `${LAZY_MODULE_REF}${lazyModuleName}`;\n  const lazyInjectorKey = `${INJECTOR_KEY}${lazyModuleName}`;\n  let bootstrapFn;\n\n  if (isNgModuleType(moduleOrBootstrapFn)) {\n    // NgModule class\n    bootstrapFn = extraProviders => platformBrowser(extraProviders).bootstrapModule(moduleOrBootstrapFn);\n  } else if (!isFunction(moduleOrBootstrapFn)) {\n    // NgModule factory\n    bootstrapFn = extraProviders => platformBrowser(extraProviders).bootstrapModuleFactory(moduleOrBootstrapFn);\n  } else {\n    // bootstrap function\n    bootstrapFn = moduleOrBootstrapFn;\n  }\n\n  let injector; // Create an ng1 module to bootstrap.\n\n  module_(lazyModuleName, []).constant(UPGRADE_APP_TYPE_KEY, 3\n  /* Lite */\n  ).factory(INJECTOR_KEY, [lazyInjectorKey, identity]).factory(lazyInjectorKey, () => {\n    if (!injector) {\n      throw new Error('Trying to get the Angular injector before bootstrapping the corresponding ' + 'Angular module.');\n    }\n\n    return injector;\n  }).factory(LAZY_MODULE_REF, [lazyModuleRefKey, identity]).factory(lazyModuleRefKey, [$INJECTOR, $injector => {\n    setTempInjectorRef($injector);\n    const result = {\n      promise: bootstrapFn(angular1Providers).then(ref => {\n        injector = result.injector = new NgAdapterInjector(ref.injector);\n        injector.get($INJECTOR); // Destroy the AngularJS app once the Angular `PlatformRef` is destroyed.\n        // This does not happen in a typical SPA scenario, but it might be useful for\n        // other use-cases where disposing of an Angular/AngularJS app is necessary\n        // (such as Hot Module Replacement (HMR)).\n        // See https://github.com/angular/angular/issues/39935.\n\n        injector.get(PlatformRef).onDestroy(() => destroyApp($injector));\n        return injector;\n      })\n    };\n    return result;\n  }]).config([$INJECTOR, $PROVIDE, ($injector, $provide) => {\n    $provide.constant(DOWNGRADED_MODULE_COUNT_KEY, getDowngradedModuleCount($injector) + 1);\n  }]);\n  return lazyModuleName;\n}\n\nfunction identity(x) {\n  return x;\n}\n/**\n * @license\n * Copyright Google LLC 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// Constants\n\n\nconst REQUIRE_PREFIX_RE = /^(\\^\\^?)?(\\?)?(\\^\\^?)?/; // Classes\n\nclass UpgradeHelper {\n  constructor(injector, name, elementRef, directive) {\n    this.name = name;\n    this.$injector = injector.get($INJECTOR);\n    this.$compile = this.$injector.get($COMPILE);\n    this.$controller = this.$injector.get($CONTROLLER);\n    this.element = elementRef.nativeElement;\n    this.$element = element(this.element);\n    this.directive = directive || UpgradeHelper.getDirective(this.$injector, name);\n  }\n\n  static getDirective($injector, name) {\n    const directives = $injector.get(name + 'Directive');\n\n    if (directives.length > 1) {\n      throw new Error(`Only support single directive definition for: ${name}`);\n    }\n\n    const directive = directives[0]; // 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\n    if (directive.compile && !directive.link) notSupported(name, 'compile');\n    if (directive.replace) notSupported(name, 'replace');\n    if (directive.terminal) notSupported(name, 'terminal');\n    return directive;\n  }\n\n  static getTemplate($injector, directive, fetchRemoteTemplate = false, $element) {\n    if (directive.template !== undefined) {\n      return getOrCall(directive.template, $element);\n    } else if (directive.templateUrl) {\n      const $templateCache = $injector.get($TEMPLATE_CACHE);\n      const url = getOrCall(directive.templateUrl, $element);\n      const 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 $httpBackend = $injector.get($HTTP_BACKEND);\n        $httpBackend('GET', url, null, (status, response) => {\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  buildController(controllerType, $scope) {\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 locals = {\n      '$scope': $scope,\n      '$element': this.$element\n    };\n    const controller = this.$controller(controllerType, locals, null, this.directive.controllerAs);\n    this.$element.data(controllerKey(this.directive.name), controller);\n    return controller;\n  }\n\n  compileTemplate(template) {\n    if (template === undefined) {\n      template = UpgradeHelper.getTemplate(this.$injector, this.directive, false, this.$element);\n    }\n\n    return this.compileHtml(template);\n  }\n\n  onDestroy($scope, controllerInstance) {\n    if (controllerInstance && isFunction(controllerInstance.$onDestroy)) {\n      controllerInstance.$onDestroy();\n    }\n\n    $scope.$destroy();\n    cleanData(this.element);\n  }\n\n  prepareTransclusion() {\n    const transclude = this.directive.transclude;\n    const contentChildNodes = this.extractChildNodes();\n\n    const attachChildrenFn = (scope, cloneAttachFn) => {\n      // Since AngularJS v1.5.8, `cloneAttachFn` will try to destroy the transclusion scope if\n      // `$template` is empty. Since the transcluded content comes from Angular, not AngularJS,\n      // there will be no transclusion scope here.\n      // Provide a dummy `scope.$destroy()` method to prevent `cloneAttachFn` from throwing.\n      scope = scope || {\n        $destroy: () => undefined\n      };\n      return cloneAttachFn($template, scope);\n    };\n\n    let $template = contentChildNodes;\n\n    if (transclude) {\n      const slots = Object.create(null);\n\n      if (typeof transclude === 'object') {\n        $template = [];\n        const slotMap = Object.create(null);\n        const filledSlots = Object.create(null); // Parse the element selectors.\n\n        Object.keys(transclude).forEach(slotName => {\n          let selector = transclude[slotName];\n          const optional = selector.charAt(0) === '?';\n          selector = optional ? selector.substring(1) : selector;\n          slotMap[selector] = slotName;\n          slots[slotName] = null; // `null`: Defined but not yet filled.\n\n          filledSlots[slotName] = optional; // Consider optional slots as filled.\n        }); // Add the matching elements into their slot.\n\n        contentChildNodes.forEach(node => {\n          const slotName = slotMap[directiveNormalize(node.nodeName.toLowerCase())];\n\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        }); // Check for required slots that were not filled.\n\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        Object.keys(slots).filter(slotName => slots[slotName]).forEach(slotName => {\n          const nodes = slots[slotName];\n\n          slots[slotName] = (scope, cloneAttach) => {\n            return cloneAttach(nodes, scope);\n          };\n        });\n      } // Attach `$$slots` to default slot transclude fn.\n\n\n      attachChildrenFn.$$slots = slots; // 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\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  resolveAndBindRequiredControllers(controllerInstance) {\n    const directiveRequire = this.getDirectiveRequire();\n    const requiredControllers = this.resolveRequire(directiveRequire);\n\n    if (controllerInstance && this.directive.bindToController && isMap(directiveRequire)) {\n      const requiredControllersMap = requiredControllers;\n      Object.keys(requiredControllersMap).forEach(key => {\n        controllerInstance[key] = requiredControllersMap[key];\n      });\n    }\n\n    return requiredControllers;\n  }\n\n  compileHtml(html) {\n    this.element.innerHTML = html;\n    return this.$compile(this.element.childNodes);\n  }\n\n  extractChildNodes() {\n    const childNodes = [];\n    let childNode;\n\n    while (childNode = this.element.firstChild) {\n      this.element.removeChild(childNode);\n      childNodes.push(childNode);\n    }\n\n    return childNodes;\n  }\n\n  getDirectiveRequire() {\n    const require = this.directive.require || this.directive.controller && this.directive.name;\n\n    if (isMap(require)) {\n      Object.keys(require).forEach(key => {\n        const value = require[key];\n        const match = value.match(REQUIRE_PREFIX_RE);\n        const 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  resolveRequire(require, controllerInstance) {\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 value = {};\n      Object.keys(require).forEach(key => value[key] = this.resolveRequire(require[key]));\n      return value;\n    } else if (typeof require === 'string') {\n      const match = require.match(REQUIRE_PREFIX_RE);\n\n      const inheritType = match[1] || match[3];\n\n      const name = require.substring(match[0].length);\n\n      const isOptional = !!match[2];\n      const searchParents = !!inheritType;\n      const startOnParent = inheritType === '^^';\n      const ctrlKey = controllerKey(name);\n      const elem = startOnParent ? this.$element.parent() : this.$element;\n      const value = searchParents ? elem.inheritedData(ctrlKey) : elem.data(ctrlKey);\n\n      if (!value && !isOptional) {\n        throw new Error(`Unable to find required '${require}' in upgraded directive '${this.name}'.`);\n      }\n\n      return value;\n    } else {\n      throw new Error(`Unrecognized 'require' syntax on upgraded directive '${this.name}': ${require}`);\n    }\n  }\n\n}\n\nfunction getOrCall(property, ...args) {\n  return isFunction(property) ? property(...args) : property;\n} // NOTE: Only works for `typeof T !== 'object'`.\n\n\nfunction isMap(value) {\n  return value && !Array.isArray(value) && typeof value === 'object';\n}\n\nfunction notSupported(name, feature) {\n  throw new Error(`Upgraded directive '${name}' contains unsupported feature: '${feature}'.`);\n}\n/**\n * @license\n * Copyright Google LLC 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\nconst NOT_SUPPORTED = 'NOT_SUPPORTED';\nconst INITIAL_VALUE = {\n  __UNINITIALIZED__: true\n};\n\nclass Bindings {\n  constructor() {\n    this.twoWayBoundProperties = [];\n    this.twoWayBoundLastValues = [];\n    this.expressionBoundProperties = [];\n    this.propertyToOutputMap = {};\n  }\n\n}\n/**\n * @description\n *\n * A helper class that allows an AngularJS component to be used from Angular.\n *\n * *Part of the [upgrade/static](api?query=upgrade%2Fstatic)\n * library for hybrid upgrade apps that support AOT compilation.*\n *\n * This helper class should be used as a base class for creating Angular directives\n * that wrap AngularJS components that need to be \"upgraded\".\n *\n * @usageNotes\n * ### Examples\n *\n * Let's assume that you have an AngularJS component called `ng1Hero` that needs\n * to be made available in Angular templates.\n *\n * {@example upgrade/static/ts/full/module.ts region=\"ng1-hero\"}\n *\n * We must create a `Directive` that will make this AngularJS component\n * available inside Angular templates.\n *\n * {@example upgrade/static/ts/full/module.ts region=\"ng1-hero-wrapper\"}\n *\n * In this example you can see that we must derive from the `UpgradeComponent`\n * base class but also provide an {@link Directive `@Directive`} decorator. This is\n * because the AOT compiler requires that this information is statically available at\n * compile time.\n *\n * Note that we must do the following:\n * * specify the directive's selector (`ng1-hero`)\n * * specify all inputs and outputs that the AngularJS component expects\n * * derive from `UpgradeComponent`\n * * call the base class from the constructor, passing\n *   * the AngularJS name of the component (`ng1Hero`)\n *   * the `ElementRef` and `Injector` for the component wrapper\n *\n * @publicApi\n * @extensible\n */\n\n\nclass UpgradeComponent {\n  /**\n   * Create a new `UpgradeComponent` instance. You should not normally need to do this.\n   * Instead you should derive a new class from this one and call the super constructor\n   * from the base class.\n   *\n   * {@example upgrade/static/ts/full/module.ts region=\"ng1-hero-wrapper\" }\n   *\n   * * The `name` parameter should be the name of the AngularJS directive.\n   * * The `elementRef` and `injector` parameters should be acquired from Angular by dependency\n   *   injection into the base class constructor.\n   */\n  constructor(name, elementRef, injector) {\n    this.name = name;\n    this.elementRef = elementRef;\n    this.injector = injector;\n    this.helper = new UpgradeHelper(injector, name, elementRef);\n    this.$injector = this.helper.$injector;\n    this.element = this.helper.element;\n    this.$element = this.helper.$element;\n    this.directive = this.helper.directive;\n    this.bindings = this.initializeBindings(this.directive); // We ask for the AngularJS scope from the Angular injector, since\n    // we will put the new component scope onto the new injector for each component\n\n    const $parentScope = injector.get($SCOPE); // QUESTION 1: Should we create an isolated scope if the scope is only true?\n    // QUESTION 2: Should we make the scope accessible through `$element.scope()/isolateScope()`?\n\n    this.$componentScope = $parentScope.$new(!!this.directive.scope);\n    this.initializeOutputs();\n  }\n\n  ngOnInit() {\n    // Collect contents, insert and compile template\n    const attachChildNodes = this.helper.prepareTransclusion();\n    const linkFn = this.helper.compileTemplate(); // Instantiate controller\n\n    const controllerType = this.directive.controller;\n    const bindToController = this.directive.bindToController;\n\n    if (controllerType) {\n      this.controllerInstance = this.helper.buildController(controllerType, this.$componentScope);\n    } else if (bindToController) {\n      throw new Error(`Upgraded directive '${this.directive.name}' specifies 'bindToController' but no controller.`);\n    } // Set up outputs\n\n\n    this.bindingDestination = bindToController ? this.controllerInstance : this.$componentScope;\n    this.bindOutputs(); // Require other controllers\n\n    const requiredControllers = this.helper.resolveAndBindRequiredControllers(this.controllerInstance); // Hook: $onChanges\n\n    if (this.pendingChanges) {\n      this.forwardChanges(this.pendingChanges);\n      this.pendingChanges = null;\n    } // Hook: $onInit\n\n\n    if (this.controllerInstance && isFunction(this.controllerInstance.$onInit)) {\n      this.controllerInstance.$onInit();\n    } // Hook: $doCheck\n\n\n    if (this.controllerInstance && isFunction(this.controllerInstance.$doCheck)) {\n      const callDoCheck = () => this.controllerInstance.$doCheck();\n\n      this.unregisterDoCheckWatcher = this.$componentScope.$parent.$watch(callDoCheck);\n      callDoCheck();\n    } // Linking\n\n\n    const link = this.directive.link;\n    const preLink = typeof link == 'object' && link.pre;\n    const postLink = typeof link == 'object' ? link.post : link;\n    const attrs = NOT_SUPPORTED;\n    const transcludeFn = NOT_SUPPORTED;\n\n    if (preLink) {\n      preLink(this.$componentScope, this.$element, attrs, requiredControllers, transcludeFn);\n    }\n\n    linkFn(this.$componentScope, null, {\n      parentBoundTranscludeFn: attachChildNodes\n    });\n\n    if (postLink) {\n      postLink(this.$componentScope, this.$element, attrs, requiredControllers, transcludeFn);\n    } // Hook: $postLink\n\n\n    if (this.controllerInstance && isFunction(this.controllerInstance.$postLink)) {\n      this.controllerInstance.$postLink();\n    }\n  }\n\n  ngOnChanges(changes) {\n    if (!this.bindingDestination) {\n      this.pendingChanges = changes;\n    } else {\n      this.forwardChanges(changes);\n    }\n  }\n\n  ngDoCheck() {\n    const twoWayBoundProperties = this.bindings.twoWayBoundProperties;\n    const twoWayBoundLastValues = this.bindings.twoWayBoundLastValues;\n    const propertyToOutputMap = this.bindings.propertyToOutputMap;\n    twoWayBoundProperties.forEach((propName, idx) => {\n      const newValue = this.bindingDestination[propName];\n      const oldValue = twoWayBoundLastValues[idx];\n\n      if (!Object.is(newValue, oldValue)) {\n        const outputName = propertyToOutputMap[propName];\n        const eventEmitter = this[outputName];\n        eventEmitter.emit(newValue);\n        twoWayBoundLastValues[idx] = newValue;\n      }\n    });\n  }\n\n  ngOnDestroy() {\n    if (isFunction(this.unregisterDoCheckWatcher)) {\n      this.unregisterDoCheckWatcher();\n    }\n\n    this.helper.onDestroy(this.$componentScope, this.controllerInstance);\n  }\n\n  initializeBindings(directive) {\n    const btcIsObject = typeof directive.bindToController === 'object';\n\n    if (btcIsObject && Object.keys(directive.scope).length) {\n      throw new Error(`Binding definitions on scope and controller at the same time is not supported.`);\n    }\n\n    const context = btcIsObject ? directive.bindToController : directive.scope;\n    const bindings = new Bindings();\n\n    if (typeof context == 'object') {\n      Object.keys(context).forEach(propName => {\n        const definition = context[propName];\n        const bindingType = definition.charAt(0); // QUESTION: What about `=*`? Ignore? Throw? Support?\n\n        switch (bindingType) {\n          case '@':\n          case '<':\n            // We don't need to do anything special. They will be defined as inputs on the\n            // upgraded component facade and the change propagation will be handled by\n            // `ngOnChanges()`.\n            break;\n\n          case '=':\n            bindings.twoWayBoundProperties.push(propName);\n            bindings.twoWayBoundLastValues.push(INITIAL_VALUE);\n            bindings.propertyToOutputMap[propName] = propName + 'Change';\n            break;\n\n          case '&':\n            bindings.expressionBoundProperties.push(propName);\n            bindings.propertyToOutputMap[propName] = propName;\n            break;\n\n          default:\n            let json = JSON.stringify(context);\n            throw new Error(`Unexpected mapping '${bindingType}' in '${json}' in '${this.name}' directive.`);\n        }\n      });\n    }\n\n    return bindings;\n  }\n\n  initializeOutputs() {\n    // Initialize the outputs for `=` and `&` bindings\n    this.bindings.twoWayBoundProperties.concat(this.bindings.expressionBoundProperties).forEach(propName => {\n      const outputName = this.bindings.propertyToOutputMap[propName];\n      this[outputName] = new EventEmitter();\n    });\n  }\n\n  bindOutputs() {\n    // Bind `&` bindings to the corresponding outputs\n    this.bindings.expressionBoundProperties.forEach(propName => {\n      const outputName = this.bindings.propertyToOutputMap[propName];\n      const emitter = this[outputName];\n\n      this.bindingDestination[propName] = value => emitter.emit(value);\n    });\n  }\n\n  forwardChanges(changes) {\n    // Forward input changes to `bindingDestination`\n    Object.keys(changes).forEach(propName => this.bindingDestination[propName] = changes[propName].currentValue);\n\n    if (isFunction(this.bindingDestination.$onChanges)) {\n      this.bindingDestination.$onChanges(changes);\n    }\n  }\n\n}\n\nUpgradeComponent.ɵfac = function UpgradeComponent_Factory(t) {\n  i0.ɵɵinvalidFactory();\n};\n\nUpgradeComponent.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n  type: UpgradeComponent,\n  features: [i0.ɵɵNgOnChangesFeature]\n});\n\n(function () {\n  (typeof ngDevMode === \"undefined\" || ngDevMode) && i0.ɵsetClassMetadata(UpgradeComponent, [{\n    type: Directive\n  }], function () {\n    return [{\n      type: undefined\n    }, {\n      type: i0.ElementRef\n    }, {\n      type: i0.Injector\n    }];\n  }, null);\n})();\n/**\n * @license\n * Copyright Google LLC 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/**\n * @description\n *\n * An `NgModule`, which you import to provide AngularJS core services,\n * and has an instance method used to bootstrap the hybrid upgrade application.\n *\n * *Part of the [upgrade/static](api?query=upgrade/static)\n * library for hybrid upgrade apps that support AOT compilation*\n *\n * The `upgrade/static` package contains helpers that allow AngularJS and Angular components\n * to be used together inside a hybrid upgrade application, which supports AOT compilation.\n *\n * Specifically, the classes and functions in the `upgrade/static` module allow the following:\n *\n * 1. Creation of an Angular directive that wraps and exposes an AngularJS component so\n *    that it can be used in an Angular template. See `UpgradeComponent`.\n * 2. Creation of an AngularJS directive that wraps and exposes an Angular component so\n *    that it can be used in an AngularJS template. See `downgradeComponent`.\n * 3. Creation of an Angular root injector provider that wraps and exposes an AngularJS\n *    service so that it can be injected into an Angular context. See\n *    {@link UpgradeModule#upgrading-an-angular-1-service Upgrading an AngularJS service} below.\n * 4. Creation of an AngularJS service that wraps and exposes an Angular injectable\n *    so that it can be injected into an AngularJS context. See `downgradeInjectable`.\n * 3. Bootstrapping of a hybrid Angular application which contains both of the frameworks\n *    coexisting in a single application.\n *\n * @usageNotes\n *\n * ```ts\n * import {UpgradeModule} from '@angular/upgrade/static';\n * ```\n *\n * See also the {@link UpgradeModule#examples examples} below.\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 the AngularJS framework codebase regardless of\n *    where they are instantiated.\n * 4. Angular components always execute inside the Angular framework codebase regardless of\n *    where they are instantiated.\n * 5. An AngularJS component can be \"upgraded\"\" to an Angular component. This is achieved by\n *    defining an Angular directive, which bootstraps the AngularJS component at its location\n *    in the DOM. See `UpgradeComponent`.\n * 6. An Angular component can be \"downgraded\" to an AngularJS component. This is achieved by\n *    defining an AngularJS directive, which bootstraps the Angular component at its location\n *    in the DOM. See `downgradeComponent`.\n * 7. Whenever an \"upgraded\"/\"downgraded\" component is instantiated the host element is owned by\n *    the framework doing the instantiation. The other framework then instantiates and owns the\n *    view for that component.\n *    1. This implies that the component bindings will always follow the semantics of the\n *       instantiation framework.\n *    2. The DOM attributes are parsed by the framework that owns the current template. So\n *       attributes in AngularJS templates must use kebab-case, while AngularJS templates must use\n *       camelCase.\n *    3. However the template binding syntax will always use the Angular style, e.g. square\n *       brackets (`[...]`) for property binding.\n * 8. Angular is bootstrapped first; AngularJS is bootstrapped second. AngularJS always owns the\n *    root component of the application.\n * 9. The new application is running in an Angular zone, and therefore it no longer needs calls to\n *    `$apply()`.\n *\n * ### The `UpgradeModule` class\n *\n * This class is an `NgModule`, which you import to provide AngularJS core services,\n * and has an instance method used to bootstrap the hybrid upgrade application.\n *\n * * Core AngularJS services\n *   Importing this `NgModule` will add providers for the core\n *   [AngularJS services](https://docs.angularjs.org/api/ng/service) to the root injector.\n *\n * * Bootstrap\n *   The runtime instance of this class contains a {@link UpgradeModule#bootstrap `bootstrap()`}\n *   method, which you use to bootstrap the top level AngularJS module onto an element in the\n *   DOM for the hybrid upgrade app.\n *\n *   It also contains properties to access the {@link UpgradeModule#injector root injector}, the\n *   bootstrap `NgZone` and the\n *   [AngularJS $injector](https://docs.angularjs.org/api/auto/service/$injector).\n *\n * ### Examples\n *\n * Import the `UpgradeModule` into your top level {@link NgModule Angular `NgModule`}.\n *\n * {@example upgrade/static/ts/full/module.ts region='ng2-module'}\n *\n * Then inject `UpgradeModule` into your Angular `NgModule` and use it to bootstrap the top level\n * [AngularJS module](https://docs.angularjs.org/api/ng/type/angular.Module) in the\n * `ngDoBootstrap()` method.\n *\n * {@example upgrade/static/ts/full/module.ts region='bootstrap-ng1'}\n *\n * Finally, kick off the whole process, by bootstrapping your top level Angular `NgModule`.\n *\n * {@example upgrade/static/ts/full/module.ts region='bootstrap-ng2'}\n *\n * {@a upgrading-an-angular-1-service}\n * ### Upgrading an AngularJS service\n *\n * There is no specific API for upgrading an AngularJS service. Instead you should just follow the\n * following recipe:\n *\n * Let's say you have an AngularJS service:\n *\n * {@example upgrade/static/ts/full/module.ts region=\"ng1-text-formatter-service\"}\n *\n * Then you should define an Angular provider to be included in your `NgModule` `providers`\n * property.\n *\n * {@example upgrade/static/ts/full/module.ts region=\"upgrade-ng1-service\"}\n *\n * Then you can use the \"upgraded\" AngularJS service by injecting it into an Angular component\n * or service.\n *\n * {@example upgrade/static/ts/full/module.ts region=\"use-ng1-upgraded-service\"}\n *\n * @publicApi\n */\n\n\nclass UpgradeModule {\n  constructor(\n  /** The root `Injector` for the upgrade application. */\n  injector,\n  /** The bootstrap zone for the upgrade application */\n  ngZone,\n  /**\n   * The owning `NgModuleRef`s `PlatformRef` instance.\n   * This is used to tie the lifecycle of the bootstrapped AngularJS apps to that of the Angular\n   * `PlatformRef`.\n   */\n  platformRef) {\n    this.ngZone = ngZone;\n    this.platformRef = platformRef;\n    this.injector = new NgAdapterInjector(injector);\n  }\n  /**\n   * Bootstrap an AngularJS application from this NgModule\n   * @param element the element on which to bootstrap the AngularJS application\n   * @param [modules] the AngularJS modules to bootstrap for this application\n   * @param [config] optional extra AngularJS bootstrap configuration\n   */\n\n\n  bootstrap(element$1, modules = [], config\n  /*angular.IAngularBootstrapConfig*/\n  ) {\n    const INIT_MODULE_NAME = UPGRADE_MODULE_NAME + '.init'; // Create an ng1 module to bootstrap\n\n    module_(INIT_MODULE_NAME, []).constant(UPGRADE_APP_TYPE_KEY, 2\n    /* Static */\n    ).value(INJECTOR_KEY, this.injector).factory(LAZY_MODULE_REF, [INJECTOR_KEY, injector => ({\n      injector\n    })]).config([$PROVIDE, $INJECTOR, ($provide, $injector) => {\n      if ($injector.has($$TESTABILITY)) {\n        $provide.decorator($$TESTABILITY, [$DELEGATE, testabilityDelegate => {\n          const originalWhenStable = testabilityDelegate.whenStable;\n          const injector = this.injector; // Cannot use arrow function below because we need the context\n\n          const newWhenStable = function (callback) {\n            originalWhenStable.call(testabilityDelegate, function () {\n              const ng2Testability = injector.get(Testability);\n\n              if (ng2Testability.isStable()) {\n                callback();\n              } else {\n                ng2Testability.whenStable(newWhenStable.bind(testabilityDelegate, callback));\n              }\n            });\n          };\n\n          testabilityDelegate.whenStable = newWhenStable;\n          return testabilityDelegate;\n        }]);\n      }\n\n      if ($injector.has($INTERVAL)) {\n        $provide.decorator($INTERVAL, [$DELEGATE, intervalDelegate => {\n          // Wrap the $interval service so that setInterval is called outside NgZone,\n          // but the callback is still invoked within it. This is so that $interval\n          // won't block stability, which preserves the behavior from AngularJS.\n          let wrappedInterval = (fn, delay, count, invokeApply, ...pass) => {\n            return this.ngZone.runOutsideAngular(() => {\n              return intervalDelegate((...args) => {\n                // Run callback in the next VM turn - $interval calls\n                // $rootScope.$apply, and running the callback in NgZone will\n                // cause a '$digest already in progress' error if it's in the\n                // same vm turn.\n                setTimeout(() => {\n                  this.ngZone.run(() => fn(...args));\n                });\n              }, delay, count, invokeApply, ...pass);\n            });\n          };\n\n          Object.keys(intervalDelegate).forEach(prop => wrappedInterval[prop] = intervalDelegate[prop]); // the `flush` method will be present when ngMocks is used\n\n          if (intervalDelegate.hasOwnProperty('flush')) {\n            wrappedInterval['flush'] = () => {\n              intervalDelegate['flush']();\n              return wrappedInterval;\n            };\n          }\n\n          return wrappedInterval;\n        }]);\n      }\n    }]).run([$INJECTOR, $injector => {\n      this.$injector = $injector;\n      const $rootScope = $injector.get('$rootScope'); // Initialize the ng1 $injector provider\n\n      setTempInjectorRef($injector);\n      this.injector.get($INJECTOR); // Put the injector on the DOM, so that it can be \"required\"\n\n      element(element$1).data(controllerKey(INJECTOR_KEY), this.injector); // Destroy the AngularJS app once the Angular `PlatformRef` is destroyed.\n      // This does not happen in a typical SPA scenario, but it might be useful for\n      // other use-cases where disposing of an Angular/AngularJS app is necessary\n      // (such as Hot Module Replacement (HMR)).\n      // See https://github.com/angular/angular/issues/39935.\n\n      this.platformRef.onDestroy(() => destroyApp($injector)); // Wire up the ng1 rootScope to run a digest cycle whenever the zone settles\n      // We need to do this in the next tick so that we don't prevent the bootup stabilizing\n\n      setTimeout(() => {\n        const subscription = this.ngZone.onMicrotaskEmpty.subscribe(() => {\n          if ($rootScope.$$phase) {\n            if (typeof ngDevMode === 'undefined' || ngDevMode) {\n              console.warn('A digest was triggered while one was already in progress. This may mean that something is triggering digests outside the Angular zone.');\n            }\n\n            return $rootScope.$evalAsync();\n          }\n\n          return $rootScope.$digest();\n        });\n        $rootScope.$on('$destroy', () => {\n          subscription.unsubscribe();\n        });\n      }, 0);\n    }]);\n    const upgradeModule = module_(UPGRADE_MODULE_NAME, [INIT_MODULE_NAME].concat(modules)); // Make sure resumeBootstrap() only exists if the current bootstrap is deferred\n\n    const windowAngular = window['angular'];\n    windowAngular.resumeBootstrap = undefined; // Bootstrap the AngularJS application inside our zone\n\n    this.ngZone.run(() => {\n      bootstrap(element$1, [upgradeModule.name], config);\n    }); // Patch resumeBootstrap() to run inside the ngZone\n\n    if (windowAngular.resumeBootstrap) {\n      const originalResumeBootstrap = windowAngular.resumeBootstrap;\n      const ngZone = this.ngZone;\n\n      windowAngular.resumeBootstrap = function () {\n        let args = arguments;\n        windowAngular.resumeBootstrap = originalResumeBootstrap;\n        return ngZone.run(() => windowAngular.resumeBootstrap.apply(this, args));\n      };\n    }\n  }\n\n}\n\nUpgradeModule.ɵfac = function UpgradeModule_Factory(t) {\n  return new (t || UpgradeModule)(i0.ɵɵinject(i0.Injector), i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i0.PlatformRef));\n};\n\nUpgradeModule.ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n  type: UpgradeModule\n});\nUpgradeModule.ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({\n  providers: [angular1Providers]\n});\n\n(function () {\n  (typeof ngDevMode === \"undefined\" || ngDevMode) && i0.ɵsetClassMetadata(UpgradeModule, [{\n    type: NgModule,\n    args: [{\n      providers: [angular1Providers]\n    }]\n  }], function () {\n    return [{\n      type: i0.Injector\n    }, {\n      type: i0.NgZone\n    }, {\n      type: i0.PlatformRef\n    }];\n  }, null);\n})();\n/**\n * @license\n * Copyright Google LLC 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// This file only re-exports items to appear in the public api. Keep it that way.\n\n/**\n * @license\n * Copyright Google LLC 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/**\n * Generated bundle index. Do not edit.\n */\n\n\nexport { UpgradeComponent, UpgradeModule, VERSION, downgradeComponent, downgradeInjectable, downgradeModule, getAngularJSGlobal, getAngularLib, setAngularJSGlobal, setAngularLib };","map":{"version":3,"sources":["D:/Development/Work/CENOS/cenos-ui/node_modules/@angular/upgrade/fesm2015/static.mjs"],"names":["i0","ɵNG_MOD_DEF","Injector","ChangeDetectorRef","Testability","TestabilityRegistry","ApplicationRef","SimpleChange","NgZone","ComponentFactoryResolver","Version","ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR","PlatformRef","EventEmitter","Directive","NgModule","platformBrowser","noNg","Error","noNgElement","cleanData","angular","bootstrap","module","element","injector","version","undefined","resumeBootstrap","getTestability","window","hasOwnProperty","_a","setAngularLib","ng","setAngularJSGlobal","getAngularLib","getAngularJSGlobal","e","modules","config","module_","prefix","dependencies","nodes","strictDi","$COMPILE","$CONTROLLER","$DELEGATE","$EXCEPTION_HANDLER","$HTTP_BACKEND","$INJECTOR","$INTERVAL","$PARSE","$PROVIDE","$ROOT_ELEMENT","$ROOT_SCOPE","$SCOPE","$TEMPLATE_CACHE","$TEMPLATE_REQUEST","$$TESTABILITY","COMPILER_KEY","DOWNGRADED_MODULE_COUNT_KEY","GROUP_PROJECTABLE_NODES_KEY","INJECTOR_KEY","LAZY_MODULE_REF","NG_ZONE_KEY","UPGRADE_APP_TYPE_KEY","REQUIRE_INJECTOR","REQUIRE_NG_MODEL","UPGRADE_MODULE_NAME","PropertyBinding","constructor","prop","attr","parseBinding","bracketAttr","parenAttr","bracketParenAttr","capitalAttr","charAt","toUpperCase","substr","onAttr","bindAttr","bindonAttr","DIRECTIVE_PREFIX_REGEXP","DIRECTIVE_SPECIAL_CHARS_REGEXP","onError","console","error","stack","log","node","isParentNode","querySelectorAll","controllerKey","name","destroyApp","$injector","$rootElement","get","$rootScope","$destroy","directiveNormalize","replace","_","letter","getTypeName","type","overriddenName","toString","split","getDowngradedModuleCount","has","getUpgradeAppType","isFunction","value","isNgModuleType","validateInjectionKey","downgradedModule","injectionKey","attemptedAction","upgradeAppType","downgradedModuleCount","Deferred","promise","Promise","res","rej","resolve","reject","supportsNgModel","component","writeValue","registerOnChange","hookupNgModel","ngModel","$render","$viewValue","$setViewValue","bind","registerOnTouched","$setTouched","strictEquals","val1","val2","INITIAL_VALUE$1","__UNINITIALIZED__","DowngradeComponentAdapter","attrs","scope","parentInjector","$compile","$parse","componentFactory","wrapCallback","implementsOnChanges","inputChangeCount","inputChanges","componentScope","$new","compileContents","compiledProjectableNodes","projectableNodes","groupProjectableNodes","linkFns","map","empty","forEach","linkFn","clone","push","append","createComponent","providers","provide","useValue","childInjector","create","parent","componentRef","viewChangeDetector","changeDetector","changeDetectorRef","instance","testability","registerApplication","location","nativeElement","setupInputs","manuallyAttachView","propagateDigest","inputs","i","length","input","propName","templateName","expr","observeFn","prevValue","currValue","updateInput","$observe","unwatch","$watch","watchFn","detectChanges","prototype","componentType","ngOnChanges","markForCheck","appRef","attachView","hostView","setupOutputs","outputs","j","output","substring","subscribeToOutput","isAssignment","getter","setter","assign","emitter","subscribe","next","v","registerCleanup","testabilityRegistry","destroyComponentRef","destroy","destroyed","on","$on","unregisterApplication","getInjector","ngContentSelectors","groupNodesBySelector","contents","ii","jj","ngContentIndex","findMatchingNgContentIndex","ngContentIndices","wildcardNgContentIndex","selector","matchesSelector","sort","_matches","el","elProto","Element","matches","mozMatchesSelector","msMatchesSelector","oMatchesSelector","webkitMatchesSelector","nodeType","Node","ELEMENT_NODE","call","isThenable","obj","then","SyncPromise","resolved","callbacks","all","valuesOrPromises","aggrPromise","resolvedCount","results","idx","p","callback","downgradeComponent","info","directiveFactory","isNgUpgradeLite","cb","isInAngularZone","ngZone","run","hasMultipleDowngradedModules","restrict","terminal","require","link","required","moduleInjector","ranAsync","lazyModuleRefKey","lazyModuleRef","finalParentInjector","finalModuleInjector","doDowngrade","componentFactoryResolver","resolveComponentFactory","injectorPromise","ParentInjectorPromise","facade","$evalAsync","downgradeFn","pInjector","mInjector","injectorKey","data","downgradeInjectable","token","factory","injectableName","String","err","message","VERSION","tempInjectorRef","setTempInjectorRef","injectorFactory","rootScopeFactory","compileFactory","parseFactory","angular1Providers","useFactory","deps","NgAdapterInjector","modInjector","notFoundValue","moduleUid","downgradeModule","moduleOrBootstrapFn","lazyModuleName","lazyInjectorKey","bootstrapFn","extraProviders","bootstrapModule","bootstrapModuleFactory","constant","identity","result","ref","onDestroy","$provide","x","REQUIRE_PREFIX_RE","UpgradeHelper","elementRef","directive","$controller","$element","getDirective","directives","compile","notSupported","getTemplate","fetchRemoteTemplate","template","getOrCall","templateUrl","$templateCache","url","$httpBackend","status","response","put","buildController","controllerType","$scope","locals","controller","controllerAs","compileTemplate","compileHtml","controllerInstance","$onDestroy","prepareTransclusion","transclude","contentChildNodes","extractChildNodes","attachChildrenFn","cloneAttachFn","$template","slots","Object","slotMap","filledSlots","keys","slotName","optional","nodeName","toLowerCase","filter","cloneAttach","$$slots","TEXT_NODE","nodeValue","resolveAndBindRequiredControllers","directiveRequire","getDirectiveRequire","requiredControllers","resolveRequire","bindToController","isMap","requiredControllersMap","key","html","innerHTML","childNodes","childNode","firstChild","removeChild","match","Array","isArray","req","inheritType","isOptional","searchParents","startOnParent","ctrlKey","elem","inheritedData","property","args","feature","NOT_SUPPORTED","INITIAL_VALUE","Bindings","twoWayBoundProperties","twoWayBoundLastValues","expressionBoundProperties","propertyToOutputMap","UpgradeComponent","helper","bindings","initializeBindings","$parentScope","$componentScope","initializeOutputs","ngOnInit","attachChildNodes","bindingDestination","bindOutputs","pendingChanges","forwardChanges","$onInit","$doCheck","callDoCheck","unregisterDoCheckWatcher","$parent","preLink","pre","postLink","post","transcludeFn","parentBoundTranscludeFn","$postLink","changes","ngDoCheck","newValue","oldValue","is","outputName","eventEmitter","emit","ngOnDestroy","btcIsObject","context","definition","bindingType","json","JSON","stringify","concat","currentValue","$onChanges","ɵfac","ɵdir","ElementRef","UpgradeModule","platformRef","element$1","INIT_MODULE_NAME","decorator","testabilityDelegate","originalWhenStable","whenStable","newWhenStable","ng2Testability","isStable","intervalDelegate","wrappedInterval","fn","delay","count","invokeApply","pass","runOutsideAngular","setTimeout","subscription","onMicrotaskEmpty","$$phase","ngDevMode","warn","$digest","unsubscribe","upgradeModule","windowAngular","originalResumeBootstrap","arguments","apply","ɵmod","ɵinj"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AAEA,OAAO,KAAKA,EAAZ,MAAoB,eAApB;AACA,SAASC,WAAT,EAAsBC,QAAtB,EAAgCC,iBAAhC,EAAmDC,WAAnD,EAAgEC,mBAAhE,EAAqFC,cAArF,EAAqGC,YAArG,EAAmHC,MAAnH,EAA2HC,wBAA3H,EAAqJC,OAArJ,EAA8JC,sCAA9J,EAAsMC,WAAtM,EAAmNC,YAAnN,EAAiOC,SAAjO,EAA4OC,QAA5O,QAA4P,eAA5P;AACA,SAASC,eAAT,QAAgC,2BAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,IAAT,GAAgB;AACZ,QAAM,IAAIC,KAAJ,CAAU,+BAAV,CAAN;AACH;;AACD,MAAMC,WAAW,GAAI,MAAMF,IAAI,EAA/B;;AACAE,WAAW,CAACC,SAAZ,GAAwBH,IAAxB;AACA,IAAII,OAAO,GAAG;AACVC,EAAAA,SAAS,EAAEL,IADD;AAEVM,EAAAA,MAAM,EAAEN,IAFE;AAGVO,EAAAA,OAAO,EAAEL,WAHC;AAIVM,EAAAA,QAAQ,EAAER,IAJA;AAKVS,EAAAA,OAAO,EAAEC,SALC;AAMVC,EAAAA,eAAe,EAAEX,IANP;AAOVY,EAAAA,cAAc,EAAEZ;AAPN,CAAd;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AqBkN,KAArB,EAA4BkB,aAA5B,CAAP;AACH;;AAbmB;AAgBxB;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,IAAIC,SAAS,GAAG,CAAhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,eAAT,CAAyBC,mBAAzB,EAA8C;AAC1C,QAAMC,cAAc,GAAI,GAAEvQ,mBAAoB,QAAO,EAAEoQ,SAAU,EAAjE;AACA,QAAMpC,gBAAgB,GAAI,GAAErO,eAAgB,GAAE4Q,cAAe,EAA7D;AACA,QAAMC,eAAe,GAAI,GAAE9Q,YAAa,GAAE6Q,cAAe,EAAzD;AACA,MAAIE,WAAJ;;AACA,MAAIzN,cAAc,CAACsN,mBAAD,CAAlB,EAAyC;AACrC;AACAG,IAAAA,WAAW,GAAIC,cAAD,IAAoBhU,eAAe,CAACgU,cAAD,CAAf,CAAgCC,eAAhC,CAAgDL,mBAAhD,CAAlC;AACH,GAHD,MAIK,IAAI,CAACxN,UAAU,CAACwN,mBAAD,CAAf,EAAsC;AACvC;AACAG,IAAAA,WAAW,GAAIC,cAAD,IAAoBhU,eAAe,CAACgU,cAAD,CAAf,CAAgC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A/F;;AACA,QAAIxW,UAAU,CAAC,KAAKuU,kBAAL,CAAwBkC,UAAzB,CAAd,EAAoD;AAChD,WAAKlC,kBAAL,CAAwBkC,UAAxB,CAAmClB,OAAnC;AACH;AACJ;;AAxKkB;;AA0KvBzB,gBAAgB,CAAC4C,IAAjB;AAAmG9d,EAAAA,EAAnG;AAAA;;AACAkb,gBAAgB,CAAC6C,IAAjB,kBADmG/d,EACnG;AAAA,QAAiGkb,gBAAjG;AAAA,aADmGlb,EACnG;AAAA;;AACA;AAAA,qDAFmGA,EAEnG,mBAA2Fkb,gBAA3F,EAAyH,CAAC;AAC9GrU,IAAAA,IAAI,EAAE/F;AADwG,GAAD,CAAzH,EAE4B,YAAY;AAAE,WAAO,CAAC;AAAE+F,MAAAA,IAAI,EAAElF;AAAR,KAAD,EAAsB;AAAEkF,MAAAA,IAAI,EAAE7G,EAAE,CAACge;AAAX,KAAtB,EAA+C;AAAEnX,MAAAA,IAAI,EAAE7G,EAAE,CAACE;AAAX,KAA/C,CAAP;AAA+E,GAFzH;AAAA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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AA,QAA2Gie;AAA3G;AACAA,aAAa,CAACiC,IAAd,kBA5RmGlgB,EA4RnG;AAAA,aAAqI,CAACoU,iBAAD;AAArI;;AACA;AAAA,qDA7RmGpU,EA6RnG,mBAA2Fie,aAA3F,EAAsH,CAAC;AAC3GpX,IAAAA,IAAI,EAAE9F,QADqG;AAE3G0Z,IAAAA,IAAI,EAAE,CAAC;AAAE1P,MAAAA,SAAS,EAAE,CAACqJ,iBAAD;AAAb,KAAD;AAFqG,GAAD,CAAtH,EAG4B,YAAY;AAAE,WAAO,CAAC;AAAEvN,MAAAA,IAAI,EAAE7G,EAAE,CAACE;AAAX,KAAD,EAAwB;AAAE2G,MAAAA,IAAI,EAAE7G,EAAE,CAACQ;AAAX,KAAxB,EAA6C;AAAEqG,MAAAA,IAAI,EAAE7G,EAAE,CAACY;AAAX,KAA7C,CAAP;AAAgF,GAH1H;AAAA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAEA,SAASsa,gBAAT,EAA2B+C,aAA3B,EAA0CpK,OAA1C,EAAmDvC,kBAAnD,EAAuEgC,mBAAvE,EAA4FqB,eAA5F,EAA6GtS,kBAA7G,EAAiID,aAAjI,EAAgJD,kBAAhJ,EAAoKF,aAApK","sourcesContent":["/**\n * @license Angular v13.1.1\n * (c) 2010-2021 Google LLC. https://angular.io/\n * License: MIT\n */\n\nimport * as i0 from '@angular/core';\nimport { ɵNG_MOD_DEF, Injector, ChangeDetectorRef, Testability, TestabilityRegistry, ApplicationRef, SimpleChange, NgZone, ComponentFactoryResolver, Version, ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, PlatformRef, EventEmitter, Directive, NgModule } from '@angular/core';\nimport { platformBrowser } from '@angular/platform-browser';\n\n/**\n * @license\n * Copyright Google LLC 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 */\nfunction noNg() {\n    throw new Error('AngularJS v1.x is not loaded!');\n}\nconst noNgElement = (() => noNg());\nnoNgElement.cleanData = noNg;\nlet angular = {\n    bootstrap: noNg,\n    module: noNg,\n    element: noNgElement,\n    injector: noNg,\n    version: undefined,\n    resumeBootstrap: noNg,\n    getTestability: noNg\n};\ntry {\n    if (window.hasOwnProperty('angular')) {\n        angular = window.angular;\n    }\n}\ncatch (_a) {\n    // ignore in CJS mode.\n}\n/**\n * @deprecated Use `setAngularJSGlobal` instead.\n *\n * @publicApi\n */\nfunction setAngularLib(ng) {\n    setAngularJSGlobal(ng);\n}\n/**\n * @deprecated Use `getAngularJSGlobal` instead.\n *\n * @publicApi\n */\nfunction getAngularLib() {\n    return getAngularJSGlobal();\n}\n/**\n * Resets the AngularJS global.\n *\n * Used when AngularJS is loaded lazily, and not available on `window`.\n *\n * @publicApi\n */\nfunction setAngularJSGlobal(ng) {\n    angular = ng;\n}\n/**\n * Returns the current AngularJS global.\n *\n * @publicApi\n */\nfunction getAngularJSGlobal() {\n    return angular;\n}\nconst bootstrap = (e, modules, config) => angular.bootstrap(e, modules, config);\n// Do not declare as `module` to avoid webpack bug\n// (see https://github.com/angular/angular/issues/30050).\nconst module_ = (prefix, dependencies) => angular.module(prefix, dependencies);\nconst element = (e => angular.element(e));\nelement.cleanData = nodes => angular.element.cleanData(nodes);\nconst injector = (modules, strictDi) => angular.injector(modules, strictDi);\nconst resumeBootstrap = () => angular.resumeBootstrap();\nconst getTestability = e => angular.getTestability(e);\n\n/**\n * @license\n * Copyright Google LLC 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 */\nconst $COMPILE = '$compile';\nconst $CONTROLLER = '$controller';\nconst $DELEGATE = '$delegate';\nconst $EXCEPTION_HANDLER = '$exceptionHandler';\nconst $HTTP_BACKEND = '$httpBackend';\nconst $INJECTOR = '$injector';\nconst $INTERVAL = '$interval';\nconst $PARSE = '$parse';\nconst $PROVIDE = '$provide';\nconst $ROOT_ELEMENT = '$rootElement';\nconst $ROOT_SCOPE = '$rootScope';\nconst $SCOPE = '$scope';\nconst $TEMPLATE_CACHE = '$templateCache';\nconst $TEMPLATE_REQUEST = '$templateRequest';\nconst $$TESTABILITY = '$$testability';\nconst COMPILER_KEY = '$$angularCompiler';\nconst DOWNGRADED_MODULE_COUNT_KEY = '$$angularDowngradedModuleCount';\nconst GROUP_PROJECTABLE_NODES_KEY = '$$angularGroupProjectableNodes';\nconst INJECTOR_KEY = '$$angularInjector';\nconst LAZY_MODULE_REF = '$$angularLazyModuleRef';\nconst NG_ZONE_KEY = '$$angularNgZone';\nconst UPGRADE_APP_TYPE_KEY = '$$angularUpgradeAppType';\nconst REQUIRE_INJECTOR = '?^^' + INJECTOR_KEY;\nconst REQUIRE_NG_MODEL = '?ngModel';\nconst UPGRADE_MODULE_NAME = '$$UpgradeModule';\n\n/**\n * @license\n * Copyright Google LLC 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 * 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 */\nclass PropertyBinding {\n    constructor(prop, attr) {\n        this.prop = prop;\n        this.attr = attr;\n        this.parseBinding();\n    }\n    parseBinding() {\n        this.bracketAttr = `[${this.attr}]`;\n        this.parenAttr = `(${this.attr})`;\n        this.bracketParenAttr = `[(${this.attr})]`;\n        const 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\n/**\n * @license\n * Copyright Google LLC 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 */\nconst DIRECTIVE_PREFIX_REGEXP = /^(?:x|data)[:\\-_]/i;\nconst DIRECTIVE_SPECIAL_CHARS_REGEXP = /[:\\-_]+(.)/g;\nfunction onError(e) {\n    // TODO: (misko): We seem to not have a stack trace here!\n    if (console.error) {\n        console.error(e, e.stack);\n    }\n    else {\n        // tslint:disable-next-line:no-console\n        console.log(e, e.stack);\n    }\n    throw e;\n}\n/**\n * Clean the jqLite/jQuery data on the element and all its descendants.\n * Equivalent to how jqLite/jQuery invoke `cleanData()` on an Element when removed:\n *   https://github.com/angular/angular.js/blob/2e72ea13fa98bebf6ed4b5e3c45eaf5f990ed16f/src/jqLite.js#L349-L355\n *   https://github.com/jquery/jquery/blob/6984d1747623dbc5e87fd6c261a5b6b1628c107c/src/manipulation.js#L182\n *\n * NOTE:\n * `cleanData()` will also invoke the AngularJS `$destroy` DOM event on the element:\n *   https://github.com/angular/angular.js/blob/2e72ea13fa98bebf6ed4b5e3c45eaf5f990ed16f/src/Angular.js#L1932-L1945\n *\n * @param node The DOM node whose data needs to be cleaned.\n */\nfunction cleanData(node) {\n    element.cleanData([node]);\n    if (isParentNode(node)) {\n        element.cleanData(node.querySelectorAll('*'));\n    }\n}\nfunction controllerKey(name) {\n    return '$' + name + 'Controller';\n}\n/**\n * Destroy an AngularJS app given the app `$injector`.\n *\n * NOTE: Destroying an app is not officially supported by AngularJS, but try to do our best by\n *       destroying `$rootScope` and clean the jqLite/jQuery data on `$rootElement` and all\n *       descendants.\n *\n * @param $injector The `$injector` of the AngularJS app to destroy.\n */\nfunction destroyApp($injector) {\n    const $rootElement = $injector.get($ROOT_ELEMENT);\n    const $rootScope = $injector.get($ROOT_SCOPE);\n    $rootScope.$destroy();\n    cleanData($rootElement[0]);\n}\nfunction directiveNormalize(name) {\n    return name.replace(DIRECTIVE_PREFIX_REGEXP, '')\n        .replace(DIRECTIVE_SPECIAL_CHARS_REGEXP, (_, letter) => letter.toUpperCase());\n}\nfunction getTypeName(type) {\n    // Return the name of the type or the first line of its stringified version.\n    return type.overriddenName || type.name || type.toString().split('\\n')[0];\n}\nfunction getDowngradedModuleCount($injector) {\n    return $injector.has(DOWNGRADED_MODULE_COUNT_KEY) ? $injector.get(DOWNGRADED_MODULE_COUNT_KEY) :\n        0;\n}\nfunction getUpgradeAppType($injector) {\n    return $injector.has(UPGRADE_APP_TYPE_KEY) ? $injector.get(UPGRADE_APP_TYPE_KEY) :\n        0 /* None */;\n}\nfunction isFunction(value) {\n    return typeof value === 'function';\n}\nfunction isNgModuleType(value) {\n    // NgModule class should have the `ɵmod` static property attached by AOT or JIT compiler.\n    return isFunction(value) && !!value[ɵNG_MOD_DEF];\n}\nfunction isParentNode(node) {\n    return isFunction(node.querySelectorAll);\n}\nfunction validateInjectionKey($injector, downgradedModule, injectionKey, attemptedAction) {\n    const upgradeAppType = getUpgradeAppType($injector);\n    const downgradedModuleCount = getDowngradedModuleCount($injector);\n    // Check for common errors.\n    switch (upgradeAppType) {\n        case 1 /* Dynamic */:\n        case 2 /* Static */:\n            if (downgradedModule) {\n                throw new Error(`Error while ${attemptedAction}: 'downgradedModule' unexpectedly specified.\\n` +\n                    'You should not specify a value for \\'downgradedModule\\', unless you are downgrading ' +\n                    'more than one Angular module (via \\'downgradeModule()\\').');\n            }\n            break;\n        case 3 /* Lite */:\n            if (!downgradedModule && (downgradedModuleCount >= 2)) {\n                throw new Error(`Error while ${attemptedAction}: 'downgradedModule' not specified.\\n` +\n                    'This application contains more than one downgraded Angular module, thus you need to ' +\n                    'always specify \\'downgradedModule\\' when downgrading components and injectables.');\n            }\n            if (!$injector.has(injectionKey)) {\n                throw new Error(`Error while ${attemptedAction}: Unable to find the specified downgraded module.\\n` +\n                    'Did you forget to downgrade an Angular module or include it in the AngularJS ' +\n                    'application?');\n            }\n            break;\n        default:\n            throw new Error(`Error while ${attemptedAction}: Not a valid '@angular/upgrade' application.\\n` +\n                'Did you forget to downgrade an Angular module or include it in the AngularJS ' +\n                'application?');\n    }\n}\nclass Deferred {\n    constructor() {\n        this.promise = new Promise((res, rej) => {\n            this.resolve = res;\n            this.reject = rej;\n        });\n    }\n}\n/**\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) {\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 */\nfunction hookupNgModel(ngModel, component) {\n    if (ngModel && supportsNgModel(component)) {\n        ngModel.$render = () => {\n            component.writeValue(ngModel.$viewValue);\n        };\n        component.registerOnChange(ngModel.$setViewValue.bind(ngModel));\n        if (typeof component.registerOnTouched === 'function') {\n            component.registerOnTouched(ngModel.$setTouched.bind(ngModel));\n        }\n    }\n}\n/**\n * Test two values for strict equality, accounting for the fact that `NaN !== NaN`.\n */\nfunction strictEquals(val1, val2) {\n    return val1 === val2 || (val1 !== val1 && val2 !== val2);\n}\n\n/**\n * @license\n * Copyright Google LLC 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 */\nconst INITIAL_VALUE$1 = {\n    __UNINITIALIZED__: true\n};\nclass DowngradeComponentAdapter {\n    constructor(element, attrs, scope, ngModel, parentInjector, $compile, $parse, componentFactory, wrapCallback) {\n        this.element = element;\n        this.attrs = attrs;\n        this.scope = scope;\n        this.ngModel = ngModel;\n        this.parentInjector = parentInjector;\n        this.$compile = $compile;\n        this.$parse = $parse;\n        this.componentFactory = componentFactory;\n        this.wrapCallback = wrapCallback;\n        this.implementsOnChanges = false;\n        this.inputChangeCount = 0;\n        this.inputChanges = {};\n        this.componentScope = scope.$new();\n    }\n    compileContents() {\n        const compiledProjectableNodes = [];\n        const projectableNodes = this.groupProjectableNodes();\n        const linkFns = projectableNodes.map(nodes => this.$compile(nodes));\n        this.element.empty();\n        linkFns.forEach(linkFn => {\n            linkFn(this.scope, (clone) => {\n                compiledProjectableNodes.push(clone);\n                this.element.append(clone);\n            });\n        });\n        return compiledProjectableNodes;\n    }\n    createComponent(projectableNodes) {\n        const providers = [{ provide: $SCOPE, useValue: this.componentScope }];\n        const childInjector = Injector.create({ providers: providers, parent: this.parentInjector, name: 'DowngradeComponentAdapter' });\n        this.componentRef =\n            this.componentFactory.create(childInjector, projectableNodes, this.element[0]);\n        this.viewChangeDetector = this.componentRef.injector.get(ChangeDetectorRef);\n        this.changeDetector = this.componentRef.changeDetectorRef;\n        this.component = this.componentRef.instance;\n        // testability hook is commonly added during component bootstrap in\n        // packages/core/src/application_ref.bootstrap()\n        // in downgraded application, component creation will take place here as well as adding the\n        // testability hook.\n        const testability = this.componentRef.injector.get(Testability, null);\n        if (testability) {\n            this.componentRef.injector.get(TestabilityRegistry)\n                .registerApplication(this.componentRef.location.nativeElement, testability);\n        }\n        hookupNgModel(this.ngModel, this.component);\n    }\n    setupInputs(manuallyAttachView, propagateDigest = true) {\n        const attrs = this.attrs;\n        const inputs = this.componentFactory.inputs || [];\n        for (let i = 0; i < inputs.length; i++) {\n            const input = new PropertyBinding(inputs[i].propName, inputs[i].templateName);\n            let expr = null;\n            if (attrs.hasOwnProperty(input.attr)) {\n                const observeFn = (prop => {\n                    let prevValue = INITIAL_VALUE$1;\n                    return (currValue) => {\n                        // Initially, both `$observe()` and `$watch()` will call this function.\n                        if (!strictEquals(prevValue, currValue)) {\n                            if (prevValue === INITIAL_VALUE$1) {\n                                prevValue = currValue;\n                            }\n                            this.updateInput(prop, prevValue, currValue);\n                            prevValue = currValue;\n                        }\n                    };\n                })(input.prop);\n                attrs.$observe(input.attr, observeFn);\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 unwatch = this.componentScope.$watch(() => {\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            }\n            else if (attrs.hasOwnProperty(input.bracketAttr)) {\n                expr = attrs[input.bracketAttr];\n            }\n            else if (attrs.hasOwnProperty(input.bindonAttr)) {\n                expr = attrs[input.bindonAttr];\n            }\n            else if (attrs.hasOwnProperty(input.bracketParenAttr)) {\n                expr = attrs[input.bracketParenAttr];\n            }\n            if (expr != null) {\n                const watchFn = (prop => (currValue, prevValue) => this.updateInput(prop, prevValue, currValue))(input.prop);\n                this.componentScope.$watch(expr, watchFn);\n            }\n        }\n        // Invoke `ngOnChanges()` and Change Detection (when necessary)\n        const detectChanges = () => this.changeDetector.detectChanges();\n        const prototype = this.componentFactory.componentType.prototype;\n        this.implementsOnChanges = !!(prototype && prototype.ngOnChanges);\n        this.componentScope.$watch(() => this.inputChangeCount, this.wrapCallback(() => {\n            // Invoke `ngOnChanges()`\n            if (this.implementsOnChanges) {\n                const inputChanges = this.inputChanges;\n                this.inputChanges = {};\n                this.component.ngOnChanges(inputChanges);\n            }\n            this.viewChangeDetector.markForCheck();\n            // If opted out of propagating digests, invoke change detection when inputs change.\n            if (!propagateDigest) {\n                detectChanges();\n            }\n        }));\n        // If not opted out of propagating digests, invoke change detection on every digest\n        if (propagateDigest) {\n            this.componentScope.$watch(this.wrapCallback(detectChanges));\n        }\n        // If necessary, attach the view so that it will be dirty-checked.\n        // (Allow time for the initial input values to be set and `ngOnChanges()` to be called.)\n        if (manuallyAttachView || !propagateDigest) {\n            let unwatch = this.componentScope.$watch(() => {\n                unwatch();\n                unwatch = null;\n                const appRef = this.parentInjector.get(ApplicationRef);\n                appRef.attachView(this.componentRef.hostView);\n            });\n        }\n    }\n    setupOutputs() {\n        const attrs = this.attrs;\n        const outputs = this.componentFactory.outputs || [];\n        for (let j = 0; j < outputs.length; j++) {\n            const output = new PropertyBinding(outputs[j].propName, outputs[j].templateName);\n            const bindonAttr = output.bindonAttr.substring(0, output.bindonAttr.length - 6);\n            const bracketParenAttr = `[(${output.bracketParenAttr.substring(2, output.bracketParenAttr.length - 8)})]`;\n            // order below is important - first update bindings then evaluate expressions\n            if (attrs.hasOwnProperty(bindonAttr)) {\n                this.subscribeToOutput(output, attrs[bindonAttr], true);\n            }\n            if (attrs.hasOwnProperty(bracketParenAttr)) {\n                this.subscribeToOutput(output, attrs[bracketParenAttr], true);\n            }\n            if (attrs.hasOwnProperty(output.onAttr)) {\n                this.subscribeToOutput(output, attrs[output.onAttr]);\n            }\n            if (attrs.hasOwnProperty(output.parenAttr)) {\n                this.subscribeToOutput(output, attrs[output.parenAttr]);\n            }\n        }\n    }\n    subscribeToOutput(output, expr, isAssignment = false) {\n        const getter = this.$parse(expr);\n        const setter = getter.assign;\n        if (isAssignment && !setter) {\n            throw new Error(`Expression '${expr}' is not assignable!`);\n        }\n        const emitter = this.component[output.prop];\n        if (emitter) {\n            emitter.subscribe({\n                next: isAssignment ? (v) => setter(this.scope, v) :\n                    (v) => getter(this.scope, { '$event': v })\n            });\n        }\n        else {\n            throw new Error(`Missing emitter '${output.prop}' on component '${getTypeName(this.componentFactory.componentType)}'!`);\n        }\n    }\n    registerCleanup() {\n        const testabilityRegistry = this.componentRef.injector.get(TestabilityRegistry);\n        const destroyComponentRef = this.wrapCallback(() => this.componentRef.destroy());\n        let destroyed = false;\n        this.element.on('$destroy', () => {\n            // The `$destroy` event may have been triggered by the `cleanData()` call in the\n            // `componentScope` `$destroy` handler below. In that case, we don't want to call\n            // `componentScope.$destroy()` again.\n            if (!destroyed)\n                this.componentScope.$destroy();\n        });\n        this.componentScope.$on('$destroy', () => {\n            if (!destroyed) {\n                destroyed = true;\n                testabilityRegistry.unregisterApplication(this.componentRef.location.nativeElement);\n                // The `componentScope` might be getting destroyed, because an ancestor element is being\n                // removed/destroyed. If that is the case, jqLite/jQuery would normally invoke `cleanData()`\n                // on the removed element and all descendants.\n                //   https://github.com/angular/angular.js/blob/2e72ea13fa98bebf6ed4b5e3c45eaf5f990ed16f/src/jqLite.js#L349-L355\n                //   https://github.com/jquery/jquery/blob/6984d1747623dbc5e87fd6c261a5b6b1628c107c/src/manipulation.js#L182\n                //\n                // Here, however, `destroyComponentRef()` may under some circumstances remove the element\n                // from the DOM and therefore it will no longer be a descendant of the removed element when\n                // `cleanData()` is called. This would result in a memory leak, because the element's data\n                // and event handlers (and all objects directly or indirectly referenced by them) would be\n                // retained.\n                //\n                // To ensure the element is always properly cleaned up, we manually call `cleanData()` on\n                // this element and its descendants before destroying the `ComponentRef`.\n                cleanData(this.element[0]);\n                destroyComponentRef();\n            }\n        });\n    }\n    getInjector() {\n        return this.componentRef.injector;\n    }\n    updateInput(prop, prevValue, currValue) {\n        if (this.implementsOnChanges) {\n            this.inputChanges[prop] = new SimpleChange(prevValue, currValue, prevValue === currValue);\n        }\n        this.inputChangeCount++;\n        this.component[prop] = currValue;\n    }\n    groupProjectableNodes() {\n        let ngContentSelectors = this.componentFactory.ngContentSelectors;\n        return groupNodesBySelector(ngContentSelectors, this.element.contents());\n    }\n}\n/**\n * Group a set of DOM nodes into `ngContent` groups, based on the given content selectors.\n */\nfunction groupNodesBySelector(ngContentSelectors, nodes) {\n    const projectableNodes = [];\n    for (let i = 0, ii = ngContentSelectors.length; i < ii; ++i) {\n        projectableNodes[i] = [];\n    }\n    for (let j = 0, jj = nodes.length; j < jj; ++j) {\n        const node = nodes[j];\n        const ngContentIndex = findMatchingNgContentIndex(node, ngContentSelectors);\n        if (ngContentIndex != null) {\n            projectableNodes[ngContentIndex].push(node);\n        }\n    }\n    return projectableNodes;\n}\nfunction findMatchingNgContentIndex(element, ngContentSelectors) {\n    const ngContentIndices = [];\n    let wildcardNgContentIndex = -1;\n    for (let i = 0; i < ngContentSelectors.length; i++) {\n        const selector = ngContentSelectors[i];\n        if (selector === '*') {\n            wildcardNgContentIndex = i;\n        }\n        else {\n            if (matchesSelector(element, selector)) {\n                ngContentIndices.push(i);\n            }\n        }\n    }\n    ngContentIndices.sort();\n    if (wildcardNgContentIndex !== -1) {\n        ngContentIndices.push(wildcardNgContentIndex);\n    }\n    return ngContentIndices.length ? ngContentIndices[0] : null;\n}\nlet _matches;\nfunction matchesSelector(el, selector) {\n    if (!_matches) {\n        const elProto = 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/**\n * @license\n * Copyright Google LLC 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 */\nfunction isThenable(obj) {\n    return !!obj && isFunction(obj.then);\n}\n/**\n * Synchronous, promise-like object.\n */\nclass SyncPromise {\n    constructor() {\n        this.resolved = false;\n        this.callbacks = [];\n    }\n    static all(valuesOrPromises) {\n        const aggrPromise = new SyncPromise();\n        let resolvedCount = 0;\n        const results = [];\n        const resolve = (idx, value) => {\n            results[idx] = value;\n            if (++resolvedCount === valuesOrPromises.length)\n                aggrPromise.resolve(results);\n        };\n        valuesOrPromises.forEach((p, idx) => {\n            if (isThenable(p)) {\n                p.then(v => resolve(idx, v));\n            }\n            else {\n                resolve(idx, p);\n            }\n        });\n        return aggrPromise;\n    }\n    resolve(value) {\n        // Do nothing, if already resolved.\n        if (this.resolved)\n            return;\n        this.value = value;\n        this.resolved = true;\n        // Run the queued callbacks.\n        this.callbacks.forEach(callback => callback(value));\n        this.callbacks.length = 0;\n    }\n    then(callback) {\n        if (this.resolved) {\n            callback(this.value);\n        }\n        else {\n            this.callbacks.push(callback);\n        }\n    }\n}\n\n/**\n * @license\n * Copyright Google LLC 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 * @description\n *\n * A helper function that allows an Angular component to be used from AngularJS.\n *\n * *Part of the [upgrade/static](api?query=upgrade%2Fstatic)\n * library for hybrid upgrade apps that support AOT compilation*\n *\n * This helper function returns a factory function to be used for registering\n * an AngularJS wrapper directive for \"downgrading\" an Angular component.\n *\n * @usageNotes\n * ### Examples\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/full/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/full/module.ts region=\"ng2-heroes-wrapper\"}\n *\n * For more details and examples on downgrading Angular components to AngularJS components please\n * visit the [Upgrade guide](guide/upgrade#using-angular-components-from-angularjs-code).\n *\n * @param info contains information about the Component that is being downgraded:\n *\n * - `component: Type<any>`: The type of the Component that will be downgraded\n * - `downgradedModule?: string`: The name of the downgraded module (if any) that the component\n *   \"belongs to\", as returned by a call to `downgradeModule()`. It is the module, whose\n *   corresponding Angular module will be bootstrapped, when the component needs to be instantiated.\n *   <br />\n *   (This option is only necessary when using `downgradeModule()` to downgrade more than one\n *   Angular module.)\n * - `propagateDigest?: boolean`: Whether to perform {@link ChangeDetectorRef#detectChanges\n *   change detection} on the component on every\n *   [$digest](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest). If set to `false`,\n *   change detection will still be performed when any of the component's inputs changes.\n *   (Default: true)\n *\n * @returns a factory function that can be used to register the component in an\n * AngularJS module.\n *\n * @publicApi\n */\nfunction downgradeComponent(info) {\n    const directiveFactory = function ($compile, $injector, $parse) {\n        // When using `downgradeModule()`, we need to handle certain things specially. For example:\n        // - We always need to attach the component view to the `ApplicationRef` for it to be\n        //   dirty-checked.\n        // - We need to ensure callbacks to Angular APIs (e.g. change detection) are run inside the\n        //   Angular zone.\n        //   NOTE: This is not needed, when using `UpgradeModule`, because `$digest()` will be run\n        //         inside the Angular zone (except if explicitly escaped, in which case we shouldn't\n        //         force it back in).\n        const isNgUpgradeLite = getUpgradeAppType($injector) === 3 /* Lite */;\n        const wrapCallback = !isNgUpgradeLite ? cb => cb : cb => () => NgZone.isInAngularZone() ? cb() : ngZone.run(cb);\n        let ngZone;\n        // When downgrading multiple modules, special handling is needed wrt injectors.\n        const hasMultipleDowngradedModules = isNgUpgradeLite && (getDowngradedModuleCount($injector) > 1);\n        return {\n            restrict: 'E',\n            terminal: true,\n            require: [REQUIRE_INJECTOR, REQUIRE_NG_MODEL],\n            link: (scope, element, attrs, required) => {\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                const ngModel = required[1];\n                const parentInjector = required[0];\n                let moduleInjector = undefined;\n                let ranAsync = false;\n                if (!parentInjector || hasMultipleDowngradedModules) {\n                    const downgradedModule = info.downgradedModule || '';\n                    const lazyModuleRefKey = `${LAZY_MODULE_REF}${downgradedModule}`;\n                    const attemptedAction = `instantiating component '${getTypeName(info.component)}'`;\n                    validateInjectionKey($injector, downgradedModule, lazyModuleRefKey, attemptedAction);\n                    const lazyModuleRef = $injector.get(lazyModuleRefKey);\n                    moduleInjector = lazyModuleRef.injector || lazyModuleRef.promise;\n                }\n                // Notes:\n                //\n                // There are two injectors: `finalModuleInjector` and `finalParentInjector` (they might be\n                // the same instance, but that is irrelevant):\n                // - `finalModuleInjector` is used to retrieve `ComponentFactoryResolver`, thus it must be\n                //   on the same tree as the `NgModule` that declares this downgraded component.\n                // - `finalParentInjector` is used for all other injection purposes.\n                //   (Note that Angular knows to only traverse the component-tree part of that injector,\n                //   when looking for an injectable and then switch to the module injector.)\n                //\n                // There are basically three cases:\n                // - If there is no parent component (thus no `parentInjector`), we bootstrap the downgraded\n                //   `NgModule` and use its injector as both `finalModuleInjector` and\n                //   `finalParentInjector`.\n                // - If there is a parent component (and thus a `parentInjector`) and we are sure that it\n                //   belongs to the same `NgModule` as this downgraded component (e.g. because there is only\n                //   one downgraded module, we use that `parentInjector` as both `finalModuleInjector` and\n                //   `finalParentInjector`.\n                // - If there is a parent component, but it may belong to a different `NgModule`, then we\n                //   use the `parentInjector` as `finalParentInjector` and this downgraded component's\n                //   declaring `NgModule`'s injector as `finalModuleInjector`.\n                //   Note 1: If the `NgModule` is already bootstrapped, we just get its injector (we don't\n                //           bootstrap again).\n                //   Note 2: It is possible that (while there are multiple downgraded modules) this\n                //           downgraded component and its parent component both belong to the same NgModule.\n                //           In that case, we could have used the `parentInjector` as both\n                //           `finalModuleInjector` and `finalParentInjector`, but (for simplicity) we are\n                //           treating this case as if they belong to different `NgModule`s. That doesn't\n                //           really affect anything, since `parentInjector` has `moduleInjector` as ancestor\n                //           and trying to resolve `ComponentFactoryResolver` from either one will return\n                //           the same instance.\n                // If there is a parent component, use its injector as parent injector.\n                // If this is a \"top-level\" Angular component, use the module injector.\n                const finalParentInjector = parentInjector || moduleInjector;\n                // If this is a \"top-level\" Angular component or the parent component may belong to a\n                // different `NgModule`, use the module injector for module-specific dependencies.\n                // If there is a parent component that belongs to the same `NgModule`, use its injector.\n                const finalModuleInjector = moduleInjector || parentInjector;\n                const doDowngrade = (injector, moduleInjector) => {\n                    // Retrieve `ComponentFactoryResolver` from the injector tied to the `NgModule` this\n                    // component belongs to.\n                    const componentFactoryResolver = moduleInjector.get(ComponentFactoryResolver);\n                    const componentFactory = componentFactoryResolver.resolveComponentFactory(info.component);\n                    if (!componentFactory) {\n                        throw new Error(`Expecting ComponentFactory for: ${getTypeName(info.component)}`);\n                    }\n                    const injectorPromise = new ParentInjectorPromise(element);\n                    const facade = new DowngradeComponentAdapter(element, attrs, scope, ngModel, injector, $compile, $parse, componentFactory, wrapCallback);\n                    const projectableNodes = facade.compileContents();\n                    facade.createComponent(projectableNodes);\n                    facade.setupInputs(isNgUpgradeLite, info.propagateDigest);\n                    facade.setupOutputs();\n                    facade.registerCleanup();\n                    injectorPromise.resolve(facade.getInjector());\n                    if (ranAsync) {\n                        // If this is run async, it is possible that it is not run inside a\n                        // digest and initial input values will not be detected.\n                        scope.$evalAsync(() => { });\n                    }\n                };\n                const downgradeFn = !isNgUpgradeLite ? doDowngrade : (pInjector, mInjector) => {\n                    if (!ngZone) {\n                        ngZone = pInjector.get(NgZone);\n                    }\n                    wrapCallback(() => doDowngrade(pInjector, mInjector))();\n                };\n                // NOTE:\n                // Not using `ParentInjectorPromise.all()` (which is inherited from `SyncPromise`), because\n                // Closure Compiler (or some related tool) complains:\n                // `TypeError: ...$src$downgrade_component_ParentInjectorPromise.all is not a function`\n                SyncPromise.all([finalParentInjector, finalModuleInjector])\n                    .then(([pInjector, mInjector]) => downgradeFn(pInjector, mInjector));\n                ranAsync = true;\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 AngularJS's `$compile`.\n */\nclass ParentInjectorPromise extends SyncPromise {\n    constructor(element) {\n        super();\n        this.element = element;\n        this.injectorKey = controllerKey(INJECTOR_KEY);\n        // Store the promise on the element.\n        element.data(this.injectorKey, this);\n    }\n    resolve(injector) {\n        // Store the real injector on the element.\n        this.element.data(this.injectorKey, injector);\n        // Release the element to prevent memory leaks.\n        this.element = null;\n        // Resolve the promise.\n        super.resolve(injector);\n    }\n}\n\n/**\n * @license\n * Copyright Google LLC 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 * @description\n *\n * A helper function to allow an Angular service to be accessible from AngularJS.\n *\n * *Part of the [upgrade/static](api?query=upgrade%2Fstatic)\n * library for hybrid upgrade apps that support AOT compilation*\n *\n * This helper function returns a factory function that provides access to the Angular\n * service identified by the `token` parameter.\n *\n * @usageNotes\n * ### Examples\n *\n * First ensure that the service to be downgraded is provided in an `NgModule`\n * that will be part of the upgrade application. For example, let's assume we have\n * defined `HeroesService`\n *\n * {@example upgrade/static/ts/full/module.ts region=\"ng2-heroes-service\"}\n *\n * and that we have included this in our upgrade app `NgModule`\n *\n * {@example upgrade/static/ts/full/module.ts region=\"ng2-module\"}\n *\n * Now we can register the `downgradeInjectable` factory function for the service\n * on an AngularJS module.\n *\n * {@example upgrade/static/ts/full/module.ts region=\"downgrade-ng2-heroes-service\"}\n *\n * Inside an AngularJS component's controller we can get hold of the\n * downgraded service via the name we gave when downgrading.\n *\n * {@example upgrade/static/ts/full/module.ts region=\"example-app\"}\n *\n * <div class=\"alert is-important\">\n *\n *   When using `downgradeModule()`, downgraded injectables will not be available until the Angular\n *   module that provides them is instantiated. In order to be safe, you need to ensure that the\n *   downgraded injectables are not used anywhere _outside_ the part of the app where it is\n *   guaranteed that their module has been instantiated.\n *\n *   For example, it is _OK_ to use a downgraded service in an upgraded component that is only used\n *   from a downgraded Angular component provided by the same Angular module as the injectable, but\n *   it is _not OK_ to use it in an AngularJS component that may be used independently of Angular or\n *   use it in a downgraded Angular component from a different module.\n *\n * </div>\n *\n * @param token an `InjectionToken` that identifies a service provided from Angular.\n * @param downgradedModule the name of the downgraded module (if any) that the injectable\n * \"belongs to\", as returned by a call to `downgradeModule()`. It is the module, whose injector will\n * be used for instantiating the injectable.<br />\n * (This option is only necessary when using `downgradeModule()` to downgrade more than one Angular\n * module.)\n *\n * @returns a [factory function](https://docs.angularjs.org/guide/di) that can be\n * used to register the service on an AngularJS module.\n *\n * @publicApi\n */\nfunction downgradeInjectable(token, downgradedModule = '') {\n    const factory = function ($injector) {\n        const injectorKey = `${INJECTOR_KEY}${downgradedModule}`;\n        const injectableName = isFunction(token) ? getTypeName(token) : String(token);\n        const attemptedAction = `instantiating injectable '${injectableName}'`;\n        validateInjectionKey($injector, downgradedModule, injectorKey, attemptedAction);\n        try {\n            const injector = $injector.get(injectorKey);\n            return injector.get(token);\n        }\n        catch (err) {\n            throw new Error(`Error while ${attemptedAction}: ${err.message || err}`);\n        }\n    };\n    factory['$inject'] = [$INJECTOR];\n    return factory;\n}\n\n/**\n * @license\n * Copyright Google LLC 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 * @publicApi\n */\nconst VERSION = new Version('13.1.1');\n\n/**\n * @license\n * Copyright Google LLC 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// We have to do a little dance to get the ng1 injector into the module injector.\n// We store the ng1 injector so that the provider in the module injector can access it\n// Then we \"get\" the ng1 injector from the module injector, which triggers the provider to read\n// the stored injector and release the reference to it.\nlet tempInjectorRef = null;\nfunction setTempInjectorRef(injector) {\n    tempInjectorRef = injector;\n}\nfunction injectorFactory() {\n    if (!tempInjectorRef) {\n        throw new Error('Trying to get the AngularJS injector before it being set.');\n    }\n    const injector = tempInjectorRef;\n    tempInjectorRef = null; // clear the value to prevent memory leaks\n    return injector;\n}\nfunction rootScopeFactory(i) {\n    return i.get('$rootScope');\n}\nfunction compileFactory(i) {\n    return i.get('$compile');\n}\nfunction parseFactory(i) {\n    return i.get('$parse');\n}\nconst angular1Providers = [\n    // We must use exported named functions for the ng2 factories to keep the compiler happy:\n    // > Metadata collected contains an error that will be reported at runtime:\n    // >   Function calls are not supported.\n    // >   Consider replacing the function or lambda with a reference to an exported function\n    { provide: '$injector', useFactory: injectorFactory, deps: [] },\n    { provide: '$rootScope', useFactory: rootScopeFactory, deps: ['$injector'] },\n    { provide: '$compile', useFactory: compileFactory, deps: ['$injector'] },\n    { provide: '$parse', useFactory: parseFactory, deps: ['$injector'] }\n];\n\n/**\n * @license\n * Copyright Google LLC 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 */\nclass NgAdapterInjector {\n    constructor(modInjector) {\n        this.modInjector = modInjector;\n    }\n    // When Angular locate a service in the component injector tree, the not found value is set to\n    // `NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR`. In such a case we should not walk up to the module\n    // injector.\n    // AngularJS only supports a single tree and should always check the module injector.\n    get(token, notFoundValue) {\n        if (notFoundValue === ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {\n            return notFoundValue;\n        }\n        return this.modInjector.get(token, notFoundValue);\n    }\n}\n\n/**\n * @license\n * Copyright Google LLC 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 */\nlet moduleUid = 0;\n/**\n * @description\n *\n * A helper function for creating an AngularJS module that can bootstrap an Angular module\n * \"on-demand\" (possibly lazily) when a {@link downgradeComponent downgraded component} needs to be\n * instantiated.\n *\n * *Part of the [upgrade/static](api?query=upgrade/static) library for hybrid upgrade apps that\n * support AOT compilation.*\n *\n * It allows loading/bootstrapping the Angular part of a hybrid application lazily and not having to\n * pay the cost up-front. For example, you can have an AngularJS application that uses Angular for\n * specific routes and only instantiate the Angular modules if/when the user visits one of these\n * routes.\n *\n * The Angular module will be bootstrapped once (when requested for the first time) and the same\n * reference will be used from that point onwards.\n *\n * `downgradeModule()` requires either an `NgModuleFactory`, `NgModule` class or a function:\n * - `NgModuleFactory`: If you pass an `NgModuleFactory`, it will be used to instantiate a module\n *   using `platformBrowser`'s {@link PlatformRef#bootstrapModuleFactory bootstrapModuleFactory()}.\n *   NOTE: this type of the argument is deprecated. Please either provide an `NgModule` class or a\n *   bootstrap function instead.\n * - `NgModule` class: If you pass an NgModule class, it will be used to instantiate a module\n *   using `platformBrowser`'s {@link PlatformRef#bootstrapModule bootstrapModule()}.\n * - `Function`: If you pass a function, it is expected to return a promise resolving to an\n *   `NgModuleRef`. The function is called with an array of extra {@link StaticProvider Providers}\n *   that are expected to be available from the returned `NgModuleRef`'s `Injector`.\n *\n * `downgradeModule()` returns the name of the created AngularJS wrapper module. You can use it to\n * declare a dependency in your main AngularJS module.\n *\n * {@example upgrade/static/ts/lite/module.ts region=\"basic-how-to\"}\n *\n * For more details on how to use `downgradeModule()` see\n * [Upgrading for Performance](guide/upgrade-performance).\n *\n * @usageNotes\n *\n * Apart from `UpgradeModule`, you can use the rest of the `upgrade/static` helpers as usual to\n * build a hybrid application. Note that the Angular pieces (e.g. downgraded services) will not be\n * available until the downgraded module has been bootstrapped, i.e. by instantiating a downgraded\n * component.\n *\n * <div class=\"alert is-important\">\n *\n *   You cannot use `downgradeModule()` and `UpgradeModule` in the same hybrid application.<br />\n *   Use one or the other.\n *\n * </div>\n *\n * ### Differences with `UpgradeModule`\n *\n * Besides their different API, there are two important internal differences between\n * `downgradeModule()` and `UpgradeModule` that affect the behavior of hybrid applications:\n *\n * 1. Unlike `UpgradeModule`, `downgradeModule()` does not bootstrap the main AngularJS module\n *    inside the {@link NgZone Angular zone}.\n * 2. Unlike `UpgradeModule`, `downgradeModule()` does not automatically run a\n *    [$digest()](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest) when changes are\n *    detected in the Angular part of the application.\n *\n * What this means is that applications using `UpgradeModule` will run change detection more\n * frequently in order to ensure that both frameworks are properly notified about possible changes.\n * This will inevitably result in more change detection runs than necessary.\n *\n * `downgradeModule()`, on the other side, does not try to tie the two change detection systems as\n * tightly, restricting the explicit change detection runs only to cases where it knows it is\n * necessary (e.g. when the inputs of a downgraded component change). This improves performance,\n * especially in change-detection-heavy applications, but leaves it up to the developer to manually\n * notify each framework as needed.\n *\n * For a more detailed discussion of the differences and their implications, see\n * [Upgrading for Performance](guide/upgrade-performance).\n *\n * <div class=\"alert is-helpful\">\n *\n *   You can manually trigger a change detection run in AngularJS using\n *   [scope.$apply(...)](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$apply) or\n *   [$rootScope.$digest()](https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$digest).\n *\n *   You can manually trigger a change detection run in Angular using {@link NgZone#run\n *   ngZone.run(...)}.\n *\n * </div>\n *\n * ### Downgrading multiple modules\n *\n * It is possible to downgrade multiple modules and include them in an AngularJS application. In\n * that case, each downgraded module will be bootstrapped when an associated downgraded component or\n * injectable needs to be instantiated.\n *\n * Things to keep in mind, when downgrading multiple modules:\n *\n * - Each downgraded component/injectable needs to be explicitly associated with a downgraded\n *   module. See `downgradeComponent()` and `downgradeInjectable()` for more details.\n *\n * - If you want some injectables to be shared among all downgraded modules, you can provide them as\n *   `StaticProvider`s, when creating the `PlatformRef` (e.g. via `platformBrowser` or\n *   `platformBrowserDynamic`).\n *\n * - When using {@link PlatformRef#bootstrapmodule `bootstrapModule()`} or\n *   {@link PlatformRef#bootstrapmodulefactory `bootstrapModuleFactory()`} to bootstrap the\n *   downgraded modules, each one is considered a \"root\" module. As a consequence, a new instance\n *   will be created for every injectable provided in `\"root\"` (via\n *   {@link Injectable#providedIn `providedIn`}).\n *   If this is not your intention, you can have a shared module (that will act as act as the \"root\"\n *   module) and create all downgraded modules using that module's injector:\n *\n *   {@example upgrade/static/ts/lite-multi-shared/module.ts region=\"shared-root-module\"}\n *\n * @publicApi\n */\nfunction downgradeModule(moduleOrBootstrapFn) {\n    const lazyModuleName = `${UPGRADE_MODULE_NAME}.lazy${++moduleUid}`;\n    const lazyModuleRefKey = `${LAZY_MODULE_REF}${lazyModuleName}`;\n    const lazyInjectorKey = `${INJECTOR_KEY}${lazyModuleName}`;\n    let bootstrapFn;\n    if (isNgModuleType(moduleOrBootstrapFn)) {\n        // NgModule class\n        bootstrapFn = (extraProviders) => platformBrowser(extraProviders).bootstrapModule(moduleOrBootstrapFn);\n    }\n    else if (!isFunction(moduleOrBootstrapFn)) {\n        // NgModule factory\n        bootstrapFn = (extraProviders) => platformBrowser(extraProviders).bootstrapModuleFactory(moduleOrBootstrapFn);\n    }\n    else {\n        // bootstrap function\n        bootstrapFn = moduleOrBootstrapFn;\n    }\n    let injector;\n    // Create an ng1 module to bootstrap.\n    module_(lazyModuleName, [])\n        .constant(UPGRADE_APP_TYPE_KEY, 3 /* Lite */)\n        .factory(INJECTOR_KEY, [lazyInjectorKey, identity])\n        .factory(lazyInjectorKey, () => {\n        if (!injector) {\n            throw new Error('Trying to get the Angular injector before bootstrapping the corresponding ' +\n                'Angular module.');\n        }\n        return injector;\n    })\n        .factory(LAZY_MODULE_REF, [lazyModuleRefKey, identity])\n        .factory(lazyModuleRefKey, [\n        $INJECTOR,\n        ($injector) => {\n            setTempInjectorRef($injector);\n            const result = {\n                promise: bootstrapFn(angular1Providers).then(ref => {\n                    injector = result.injector = new NgAdapterInjector(ref.injector);\n                    injector.get($INJECTOR);\n                    // Destroy the AngularJS app once the Angular `PlatformRef` is destroyed.\n                    // This does not happen in a typical SPA scenario, but it might be useful for\n                    // other use-cases where disposing of an Angular/AngularJS app is necessary\n                    // (such as Hot Module Replacement (HMR)).\n                    // See https://github.com/angular/angular/issues/39935.\n                    injector.get(PlatformRef).onDestroy(() => destroyApp($injector));\n                    return injector;\n                })\n            };\n            return result;\n        }\n    ])\n        .config([\n        $INJECTOR, $PROVIDE,\n        ($injector, $provide) => {\n            $provide.constant(DOWNGRADED_MODULE_COUNT_KEY, getDowngradedModuleCount($injector) + 1);\n        }\n    ]);\n    return lazyModuleName;\n}\nfunction identity(x) {\n    return x;\n}\n\n/**\n * @license\n * Copyright Google LLC 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// Constants\nconst REQUIRE_PREFIX_RE = /^(\\^\\^?)?(\\?)?(\\^\\^?)?/;\n// Classes\nclass UpgradeHelper {\n    constructor(injector, name, elementRef, directive) {\n        this.name = name;\n        this.$injector = injector.get($INJECTOR);\n        this.$compile = this.$injector.get($COMPILE);\n        this.$controller = this.$injector.get($CONTROLLER);\n        this.element = elementRef.nativeElement;\n        this.$element = element(this.element);\n        this.directive = directive || UpgradeHelper.getDirective(this.$injector, name);\n    }\n    static getDirective($injector, name) {\n        const directives = $injector.get(name + 'Directive');\n        if (directives.length > 1) {\n            throw new Error(`Only support single directive definition for: ${name}`);\n        }\n        const directive = directives[0];\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)\n            notSupported(name, 'compile');\n        if (directive.replace)\n            notSupported(name, 'replace');\n        if (directive.terminal)\n            notSupported(name, 'terminal');\n        return directive;\n    }\n    static getTemplate($injector, directive, fetchRemoteTemplate = false, $element) {\n        if (directive.template !== undefined) {\n            return getOrCall(directive.template, $element);\n        }\n        else if (directive.templateUrl) {\n            const $templateCache = $injector.get($TEMPLATE_CACHE);\n            const url = getOrCall(directive.templateUrl, $element);\n            const template = $templateCache.get(url);\n            if (template !== undefined) {\n                return template;\n            }\n            else if (!fetchRemoteTemplate) {\n                throw new Error('loading directive templates asynchronously is not supported');\n            }\n            return new Promise((resolve, reject) => {\n                const $httpBackend = $injector.get($HTTP_BACKEND);\n                $httpBackend('GET', url, null, (status, response) => {\n                    if (status === 200) {\n                        resolve($templateCache.put(url, response));\n                    }\n                    else {\n                        reject(`GET component template from '${url}' returned '${status}: ${response}'`);\n                    }\n                });\n            });\n        }\n        else {\n            throw new Error(`Directive '${directive.name}' is not a component, it is missing template.`);\n        }\n    }\n    buildController(controllerType, $scope) {\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 locals = { '$scope': $scope, '$element': this.$element };\n        const controller = this.$controller(controllerType, locals, null, this.directive.controllerAs);\n        this.$element.data(controllerKey(this.directive.name), controller);\n        return controller;\n    }\n    compileTemplate(template) {\n        if (template === undefined) {\n            template =\n                UpgradeHelper.getTemplate(this.$injector, this.directive, false, this.$element);\n        }\n        return this.compileHtml(template);\n    }\n    onDestroy($scope, controllerInstance) {\n        if (controllerInstance && isFunction(controllerInstance.$onDestroy)) {\n            controllerInstance.$onDestroy();\n        }\n        $scope.$destroy();\n        cleanData(this.element);\n    }\n    prepareTransclusion() {\n        const transclude = this.directive.transclude;\n        const contentChildNodes = this.extractChildNodes();\n        const attachChildrenFn = (scope, cloneAttachFn) => {\n            // Since AngularJS v1.5.8, `cloneAttachFn` will try to destroy the transclusion scope if\n            // `$template` is empty. Since the transcluded content comes from Angular, not AngularJS,\n            // there will be no transclusion scope here.\n            // Provide a dummy `scope.$destroy()` method to prevent `cloneAttachFn` from throwing.\n            scope = scope || { $destroy: () => undefined };\n            return cloneAttachFn($template, scope);\n        };\n        let $template = contentChildNodes;\n        if (transclude) {\n            const slots = Object.create(null);\n            if (typeof transclude === 'object') {\n                $template = [];\n                const slotMap = Object.create(null);\n                const filledSlots = Object.create(null);\n                // Parse the element selectors.\n                Object.keys(transclude).forEach(slotName => {\n                    let selector = transclude[slotName];\n                    const optional = selector.charAt(0) === '?';\n                    selector = optional ? selector.substring(1) : selector;\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                // Add the matching elements into their slot.\n                contentChildNodes.forEach(node => {\n                    const slotName = slotMap[directiveNormalize(node.nodeName.toLowerCase())];\n                    if (slotName) {\n                        filledSlots[slotName] = true;\n                        slots[slotName] = slots[slotName] || [];\n                        slots[slotName].push(node);\n                    }\n                    else {\n                        $template.push(node);\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                Object.keys(slots).filter(slotName => slots[slotName]).forEach(slotName => {\n                    const nodes = slots[slotName];\n                    slots[slotName] = (scope, cloneAttach) => {\n                        return cloneAttach(nodes, scope);\n                    };\n                });\n            }\n            // Attach `$$slots` to default slot transclude fn.\n            attachChildrenFn.$$slots = slots;\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        return attachChildrenFn;\n    }\n    resolveAndBindRequiredControllers(controllerInstance) {\n        const directiveRequire = this.getDirectiveRequire();\n        const requiredControllers = this.resolveRequire(directiveRequire);\n        if (controllerInstance && this.directive.bindToController && isMap(directiveRequire)) {\n            const requiredControllersMap = requiredControllers;\n            Object.keys(requiredControllersMap).forEach(key => {\n                controllerInstance[key] = requiredControllersMap[key];\n            });\n        }\n        return requiredControllers;\n    }\n    compileHtml(html) {\n        this.element.innerHTML = html;\n        return this.$compile(this.element.childNodes);\n    }\n    extractChildNodes() {\n        const childNodes = [];\n        let childNode;\n        while (childNode = this.element.firstChild) {\n            this.element.removeChild(childNode);\n            childNodes.push(childNode);\n        }\n        return childNodes;\n    }\n    getDirectiveRequire() {\n        const require = this.directive.require || (this.directive.controller && this.directive.name);\n        if (isMap(require)) {\n            Object.keys(require).forEach(key => {\n                const value = require[key];\n                const match = value.match(REQUIRE_PREFIX_RE);\n                const name = value.substring(match[0].length);\n                if (!name) {\n                    require[key] = match[0] + key;\n                }\n            });\n        }\n        return require;\n    }\n    resolveRequire(require, controllerInstance) {\n        if (!require) {\n            return null;\n        }\n        else if (Array.isArray(require)) {\n            return require.map(req => this.resolveRequire(req));\n        }\n        else if (typeof require === 'object') {\n            const value = {};\n            Object.keys(require).forEach(key => value[key] = this.resolveRequire(require[key]));\n            return value;\n        }\n        else if (typeof require === 'string') {\n            const match = require.match(REQUIRE_PREFIX_RE);\n            const inheritType = match[1] || match[3];\n            const name = require.substring(match[0].length);\n            const isOptional = !!match[2];\n            const searchParents = !!inheritType;\n            const startOnParent = inheritType === '^^';\n            const ctrlKey = controllerKey(name);\n            const elem = startOnParent ? this.$element.parent() : this.$element;\n            const value = searchParents ? elem.inheritedData(ctrlKey) : elem.data(ctrlKey);\n            if (!value && !isOptional) {\n                throw new Error(`Unable to find required '${require}' in upgraded directive '${this.name}'.`);\n            }\n            return value;\n        }\n        else {\n            throw new Error(`Unrecognized 'require' syntax on upgraded directive '${this.name}': ${require}`);\n        }\n    }\n}\nfunction getOrCall(property, ...args) {\n    return isFunction(property) ? property(...args) : property;\n}\n// NOTE: Only works for `typeof T !== 'object'`.\nfunction isMap(value) {\n    return value && !Array.isArray(value) && typeof value === 'object';\n}\nfunction notSupported(name, feature) {\n    throw new Error(`Upgraded directive '${name}' contains unsupported feature: '${feature}'.`);\n}\n\n/**\n * @license\n * Copyright Google LLC 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 */\nconst NOT_SUPPORTED = 'NOT_SUPPORTED';\nconst INITIAL_VALUE = {\n    __UNINITIALIZED__: true\n};\nclass Bindings {\n    constructor() {\n        this.twoWayBoundProperties = [];\n        this.twoWayBoundLastValues = [];\n        this.expressionBoundProperties = [];\n        this.propertyToOutputMap = {};\n    }\n}\n/**\n * @description\n *\n * A helper class that allows an AngularJS component to be used from Angular.\n *\n * *Part of the [upgrade/static](api?query=upgrade%2Fstatic)\n * library for hybrid upgrade apps that support AOT compilation.*\n *\n * This helper class should be used as a base class for creating Angular directives\n * that wrap AngularJS components that need to be \"upgraded\".\n *\n * @usageNotes\n * ### Examples\n *\n * Let's assume that you have an AngularJS component called `ng1Hero` that needs\n * to be made available in Angular templates.\n *\n * {@example upgrade/static/ts/full/module.ts region=\"ng1-hero\"}\n *\n * We must create a `Directive` that will make this AngularJS component\n * available inside Angular templates.\n *\n * {@example upgrade/static/ts/full/module.ts region=\"ng1-hero-wrapper\"}\n *\n * In this example you can see that we must derive from the `UpgradeComponent`\n * base class but also provide an {@link Directive `@Directive`} decorator. This is\n * because the AOT compiler requires that this information is statically available at\n * compile time.\n *\n * Note that we must do the following:\n * * specify the directive's selector (`ng1-hero`)\n * * specify all inputs and outputs that the AngularJS component expects\n * * derive from `UpgradeComponent`\n * * call the base class from the constructor, passing\n *   * the AngularJS name of the component (`ng1Hero`)\n *   * the `ElementRef` and `Injector` for the component wrapper\n *\n * @publicApi\n * @extensible\n */\nclass UpgradeComponent {\n    /**\n     * Create a new `UpgradeComponent` instance. You should not normally need to do this.\n     * Instead you should derive a new class from this one and call the super constructor\n     * from the base class.\n     *\n     * {@example upgrade/static/ts/full/module.ts region=\"ng1-hero-wrapper\" }\n     *\n     * * The `name` parameter should be the name of the AngularJS directive.\n     * * The `elementRef` and `injector` parameters should be acquired from Angular by dependency\n     *   injection into the base class constructor.\n     */\n    constructor(name, elementRef, injector) {\n        this.name = name;\n        this.elementRef = elementRef;\n        this.injector = injector;\n        this.helper = new UpgradeHelper(injector, name, elementRef);\n        this.$injector = this.helper.$injector;\n        this.element = this.helper.element;\n        this.$element = this.helper.$element;\n        this.directive = this.helper.directive;\n        this.bindings = this.initializeBindings(this.directive);\n        // We ask for the AngularJS scope from the Angular injector, since\n        // we will put the new component scope onto the new injector for each component\n        const $parentScope = injector.get($SCOPE);\n        // QUESTION 1: Should we create an isolated scope if the scope is only true?\n        // QUESTION 2: Should we make the scope accessible through `$element.scope()/isolateScope()`?\n        this.$componentScope = $parentScope.$new(!!this.directive.scope);\n        this.initializeOutputs();\n    }\n    ngOnInit() {\n        // Collect contents, insert and compile template\n        const attachChildNodes = this.helper.prepareTransclusion();\n        const linkFn = this.helper.compileTemplate();\n        // Instantiate controller\n        const controllerType = this.directive.controller;\n        const bindToController = this.directive.bindToController;\n        if (controllerType) {\n            this.controllerInstance = this.helper.buildController(controllerType, this.$componentScope);\n        }\n        else if (bindToController) {\n            throw new Error(`Upgraded directive '${this.directive.name}' specifies 'bindToController' but no controller.`);\n        }\n        // Set up outputs\n        this.bindingDestination = bindToController ? this.controllerInstance : this.$componentScope;\n        this.bindOutputs();\n        // Require other controllers\n        const requiredControllers = this.helper.resolveAndBindRequiredControllers(this.controllerInstance);\n        // Hook: $onChanges\n        if (this.pendingChanges) {\n            this.forwardChanges(this.pendingChanges);\n            this.pendingChanges = null;\n        }\n        // Hook: $onInit\n        if (this.controllerInstance && isFunction(this.controllerInstance.$onInit)) {\n            this.controllerInstance.$onInit();\n        }\n        // Hook: $doCheck\n        if (this.controllerInstance && isFunction(this.controllerInstance.$doCheck)) {\n            const callDoCheck = () => this.controllerInstance.$doCheck();\n            this.unregisterDoCheckWatcher = this.$componentScope.$parent.$watch(callDoCheck);\n            callDoCheck();\n        }\n        // Linking\n        const link = this.directive.link;\n        const preLink = typeof link == 'object' && link.pre;\n        const postLink = typeof link == 'object' ? link.post : link;\n        const attrs = NOT_SUPPORTED;\n        const transcludeFn = NOT_SUPPORTED;\n        if (preLink) {\n            preLink(this.$componentScope, this.$element, attrs, requiredControllers, transcludeFn);\n        }\n        linkFn(this.$componentScope, null, { parentBoundTranscludeFn: attachChildNodes });\n        if (postLink) {\n            postLink(this.$componentScope, this.$element, attrs, requiredControllers, transcludeFn);\n        }\n        // Hook: $postLink\n        if (this.controllerInstance && isFunction(this.controllerInstance.$postLink)) {\n            this.controllerInstance.$postLink();\n        }\n    }\n    ngOnChanges(changes) {\n        if (!this.bindingDestination) {\n            this.pendingChanges = changes;\n        }\n        else {\n            this.forwardChanges(changes);\n        }\n    }\n    ngDoCheck() {\n        const twoWayBoundProperties = this.bindings.twoWayBoundProperties;\n        const twoWayBoundLastValues = this.bindings.twoWayBoundLastValues;\n        const propertyToOutputMap = this.bindings.propertyToOutputMap;\n        twoWayBoundProperties.forEach((propName, idx) => {\n            const newValue = this.bindingDestination[propName];\n            const oldValue = twoWayBoundLastValues[idx];\n            if (!Object.is(newValue, oldValue)) {\n                const outputName = propertyToOutputMap[propName];\n                const eventEmitter = this[outputName];\n                eventEmitter.emit(newValue);\n                twoWayBoundLastValues[idx] = newValue;\n            }\n        });\n    }\n    ngOnDestroy() {\n        if (isFunction(this.unregisterDoCheckWatcher)) {\n            this.unregisterDoCheckWatcher();\n        }\n        this.helper.onDestroy(this.$componentScope, this.controllerInstance);\n    }\n    initializeBindings(directive) {\n        const btcIsObject = typeof directive.bindToController === 'object';\n        if (btcIsObject && Object.keys(directive.scope).length) {\n            throw new Error(`Binding definitions on scope and controller at the same time is not supported.`);\n        }\n        const context = btcIsObject ? directive.bindToController : directive.scope;\n        const bindings = new Bindings();\n        if (typeof context == 'object') {\n            Object.keys(context).forEach(propName => {\n                const definition = context[propName];\n                const bindingType = definition.charAt(0);\n                // QUESTION: What about `=*`? Ignore? Throw? Support?\n                switch (bindingType) {\n                    case '@':\n                    case '<':\n                        // We don't need to do anything special. They will be defined as inputs on the\n                        // upgraded component facade and the change propagation will be handled by\n                        // `ngOnChanges()`.\n                        break;\n                    case '=':\n                        bindings.twoWayBoundProperties.push(propName);\n                        bindings.twoWayBoundLastValues.push(INITIAL_VALUE);\n                        bindings.propertyToOutputMap[propName] = propName + 'Change';\n                        break;\n                    case '&':\n                        bindings.expressionBoundProperties.push(propName);\n                        bindings.propertyToOutputMap[propName] = propName;\n                        break;\n                    default:\n                        let json = JSON.stringify(context);\n                        throw new Error(`Unexpected mapping '${bindingType}' in '${json}' in '${this.name}' directive.`);\n                }\n            });\n        }\n        return bindings;\n    }\n    initializeOutputs() {\n        // Initialize the outputs for `=` and `&` bindings\n        this.bindings.twoWayBoundProperties.concat(this.bindings.expressionBoundProperties)\n            .forEach(propName => {\n            const outputName = this.bindings.propertyToOutputMap[propName];\n            this[outputName] = new EventEmitter();\n        });\n    }\n    bindOutputs() {\n        // Bind `&` bindings to the corresponding outputs\n        this.bindings.expressionBoundProperties.forEach(propName => {\n            const outputName = this.bindings.propertyToOutputMap[propName];\n            const emitter = this[outputName];\n            this.bindingDestination[propName] = (value) => emitter.emit(value);\n        });\n    }\n    forwardChanges(changes) {\n        // Forward input changes to `bindingDestination`\n        Object.keys(changes).forEach(propName => this.bindingDestination[propName] = changes[propName].currentValue);\n        if (isFunction(this.bindingDestination.$onChanges)) {\n            this.bindingDestination.$onChanges(changes);\n        }\n    }\n}\nUpgradeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"13.1.1\", ngImport: i0, type: UpgradeComponent, deps: \"invalid\", target: i0.ɵɵFactoryTarget.Directive });\nUpgradeComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"12.0.0\", version: \"13.1.1\", type: UpgradeComponent, usesOnChanges: true, ngImport: i0 });\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"13.1.1\", ngImport: i0, type: UpgradeComponent, decorators: [{\n            type: Directive\n        }], ctorParameters: function () { return [{ type: undefined }, { type: i0.ElementRef }, { type: i0.Injector }]; } });\n\n/**\n * @license\n * Copyright Google LLC 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 * @description\n *\n * An `NgModule`, which you import to provide AngularJS core services,\n * and has an instance method used to bootstrap the hybrid upgrade application.\n *\n * *Part of the [upgrade/static](api?query=upgrade/static)\n * library for hybrid upgrade apps that support AOT compilation*\n *\n * The `upgrade/static` package contains helpers that allow AngularJS and Angular components\n * to be used together inside a hybrid upgrade application, which supports AOT compilation.\n *\n * Specifically, the classes and functions in the `upgrade/static` module allow the following:\n *\n * 1. Creation of an Angular directive that wraps and exposes an AngularJS component so\n *    that it can be used in an Angular template. See `UpgradeComponent`.\n * 2. Creation of an AngularJS directive that wraps and exposes an Angular component so\n *    that it can be used in an AngularJS template. See `downgradeComponent`.\n * 3. Creation of an Angular root injector provider that wraps and exposes an AngularJS\n *    service so that it can be injected into an Angular context. See\n *    {@link UpgradeModule#upgrading-an-angular-1-service Upgrading an AngularJS service} below.\n * 4. Creation of an AngularJS service that wraps and exposes an Angular injectable\n *    so that it can be injected into an AngularJS context. See `downgradeInjectable`.\n * 3. Bootstrapping of a hybrid Angular application which contains both of the frameworks\n *    coexisting in a single application.\n *\n * @usageNotes\n *\n * ```ts\n * import {UpgradeModule} from '@angular/upgrade/static';\n * ```\n *\n * See also the {@link UpgradeModule#examples examples} below.\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 the AngularJS framework codebase regardless of\n *    where they are instantiated.\n * 4. Angular components always execute inside the Angular framework codebase regardless of\n *    where they are instantiated.\n * 5. An AngularJS component can be \"upgraded\"\" to an Angular component. This is achieved by\n *    defining an Angular directive, which bootstraps the AngularJS component at its location\n *    in the DOM. See `UpgradeComponent`.\n * 6. An Angular component can be \"downgraded\" to an AngularJS component. This is achieved by\n *    defining an AngularJS directive, which bootstraps the Angular component at its location\n *    in the DOM. See `downgradeComponent`.\n * 7. Whenever an \"upgraded\"/\"downgraded\" component is instantiated the host element is owned by\n *    the framework doing the instantiation. The other framework then instantiates and owns the\n *    view for that component.\n *    1. This implies that the component bindings will always follow the semantics of the\n *       instantiation framework.\n *    2. The DOM attributes are parsed by the framework that owns the current template. So\n *       attributes in AngularJS templates must use kebab-case, while AngularJS templates must use\n *       camelCase.\n *    3. However the template binding syntax will always use the Angular style, e.g. square\n *       brackets (`[...]`) for property binding.\n * 8. Angular is bootstrapped first; AngularJS is bootstrapped second. AngularJS always owns the\n *    root component of the application.\n * 9. The new application is running in an Angular zone, and therefore it no longer needs calls to\n *    `$apply()`.\n *\n * ### The `UpgradeModule` class\n *\n * This class is an `NgModule`, which you import to provide AngularJS core services,\n * and has an instance method used to bootstrap the hybrid upgrade application.\n *\n * * Core AngularJS services\n *   Importing this `NgModule` will add providers for the core\n *   [AngularJS services](https://docs.angularjs.org/api/ng/service) to the root injector.\n *\n * * Bootstrap\n *   The runtime instance of this class contains a {@link UpgradeModule#bootstrap `bootstrap()`}\n *   method, which you use to bootstrap the top level AngularJS module onto an element in the\n *   DOM for the hybrid upgrade app.\n *\n *   It also contains properties to access the {@link UpgradeModule#injector root injector}, the\n *   bootstrap `NgZone` and the\n *   [AngularJS $injector](https://docs.angularjs.org/api/auto/service/$injector).\n *\n * ### Examples\n *\n * Import the `UpgradeModule` into your top level {@link NgModule Angular `NgModule`}.\n *\n * {@example upgrade/static/ts/full/module.ts region='ng2-module'}\n *\n * Then inject `UpgradeModule` into your Angular `NgModule` and use it to bootstrap the top level\n * [AngularJS module](https://docs.angularjs.org/api/ng/type/angular.Module) in the\n * `ngDoBootstrap()` method.\n *\n * {@example upgrade/static/ts/full/module.ts region='bootstrap-ng1'}\n *\n * Finally, kick off the whole process, by bootstrapping your top level Angular `NgModule`.\n *\n * {@example upgrade/static/ts/full/module.ts region='bootstrap-ng2'}\n *\n * {@a upgrading-an-angular-1-service}\n * ### Upgrading an AngularJS service\n *\n * There is no specific API for upgrading an AngularJS service. Instead you should just follow the\n * following recipe:\n *\n * Let's say you have an AngularJS service:\n *\n * {@example upgrade/static/ts/full/module.ts region=\"ng1-text-formatter-service\"}\n *\n * Then you should define an Angular provider to be included in your `NgModule` `providers`\n * property.\n *\n * {@example upgrade/static/ts/full/module.ts region=\"upgrade-ng1-service\"}\n *\n * Then you can use the \"upgraded\" AngularJS service by injecting it into an Angular component\n * or service.\n *\n * {@example upgrade/static/ts/full/module.ts region=\"use-ng1-upgraded-service\"}\n *\n * @publicApi\n */\nclass UpgradeModule {\n    constructor(\n    /** The root `Injector` for the upgrade application. */\n    injector, \n    /** The bootstrap zone for the upgrade application */\n    ngZone, \n    /**\n     * The owning `NgModuleRef`s `PlatformRef` instance.\n     * This is used to tie the lifecycle of the bootstrapped AngularJS apps to that of the Angular\n     * `PlatformRef`.\n     */\n    platformRef) {\n        this.ngZone = ngZone;\n        this.platformRef = platformRef;\n        this.injector = new NgAdapterInjector(injector);\n    }\n    /**\n     * Bootstrap an AngularJS application from this NgModule\n     * @param element the element on which to bootstrap the AngularJS application\n     * @param [modules] the AngularJS modules to bootstrap for this application\n     * @param [config] optional extra AngularJS bootstrap configuration\n     */\n    bootstrap(element$1, modules = [], config /*angular.IAngularBootstrapConfig*/) {\n        const INIT_MODULE_NAME = UPGRADE_MODULE_NAME + '.init';\n        // Create an ng1 module to bootstrap\n        module_(INIT_MODULE_NAME, [])\n            .constant(UPGRADE_APP_TYPE_KEY, 2 /* Static */)\n            .value(INJECTOR_KEY, this.injector)\n            .factory(LAZY_MODULE_REF, [INJECTOR_KEY, (injector) => ({ injector })])\n            .config([\n            $PROVIDE, $INJECTOR,\n            ($provide, $injector) => {\n                if ($injector.has($$TESTABILITY)) {\n                    $provide.decorator($$TESTABILITY, [\n                        $DELEGATE,\n                        (testabilityDelegate) => {\n                            const originalWhenStable = testabilityDelegate.whenStable;\n                            const injector = this.injector;\n                            // Cannot use arrow function below because we need the context\n                            const newWhenStable = function (callback) {\n                                originalWhenStable.call(testabilityDelegate, function () {\n                                    const ng2Testability = injector.get(Testability);\n                                    if (ng2Testability.isStable()) {\n                                        callback();\n                                    }\n                                    else {\n                                        ng2Testability.whenStable(newWhenStable.bind(testabilityDelegate, callback));\n                                    }\n                                });\n                            };\n                            testabilityDelegate.whenStable = newWhenStable;\n                            return testabilityDelegate;\n                        }\n                    ]);\n                }\n                if ($injector.has($INTERVAL)) {\n                    $provide.decorator($INTERVAL, [\n                        $DELEGATE,\n                        (intervalDelegate) => {\n                            // Wrap the $interval service so that setInterval is called outside NgZone,\n                            // but the callback is still invoked within it. This is so that $interval\n                            // won't block stability, which preserves the behavior from AngularJS.\n                            let wrappedInterval = (fn, delay, count, invokeApply, ...pass) => {\n                                return this.ngZone.runOutsideAngular(() => {\n                                    return intervalDelegate((...args) => {\n                                        // Run callback in the next VM turn - $interval calls\n                                        // $rootScope.$apply, and running the callback in NgZone will\n                                        // cause a '$digest already in progress' error if it's in the\n                                        // same vm turn.\n                                        setTimeout(() => {\n                                            this.ngZone.run(() => fn(...args));\n                                        });\n                                    }, delay, count, invokeApply, ...pass);\n                                });\n                            };\n                            Object.keys(intervalDelegate)\n                                .forEach(prop => wrappedInterval[prop] = intervalDelegate[prop]);\n                            // the `flush` method will be present when ngMocks is used\n                            if (intervalDelegate.hasOwnProperty('flush')) {\n                                wrappedInterval['flush'] = () => {\n                                    intervalDelegate['flush']();\n                                    return wrappedInterval;\n                                };\n                            }\n                            return wrappedInterval;\n                        }\n                    ]);\n                }\n            }\n        ])\n            .run([\n            $INJECTOR,\n            ($injector) => {\n                this.$injector = $injector;\n                const $rootScope = $injector.get('$rootScope');\n                // Initialize the ng1 $injector provider\n                setTempInjectorRef($injector);\n                this.injector.get($INJECTOR);\n                // Put the injector on the DOM, so that it can be \"required\"\n                element(element$1).data(controllerKey(INJECTOR_KEY), this.injector);\n                // Destroy the AngularJS app once the Angular `PlatformRef` is destroyed.\n                // This does not happen in a typical SPA scenario, but it might be useful for\n                // other use-cases where disposing of an Angular/AngularJS app is necessary\n                // (such as Hot Module Replacement (HMR)).\n                // See https://github.com/angular/angular/issues/39935.\n                this.platformRef.onDestroy(() => destroyApp($injector));\n                // Wire up the ng1 rootScope to run a digest cycle whenever the zone settles\n                // We need to do this in the next tick so that we don't prevent the bootup stabilizing\n                setTimeout(() => {\n                    const subscription = this.ngZone.onMicrotaskEmpty.subscribe(() => {\n                        if ($rootScope.$$phase) {\n                            if (typeof ngDevMode === 'undefined' || ngDevMode) {\n                                console.warn('A digest was triggered while one was already in progress. This may mean that something is triggering digests outside the Angular zone.');\n                            }\n                            return $rootScope.$evalAsync();\n                        }\n                        return $rootScope.$digest();\n                    });\n                    $rootScope.$on('$destroy', () => {\n                        subscription.unsubscribe();\n                    });\n                }, 0);\n            }\n        ]);\n        const upgradeModule = module_(UPGRADE_MODULE_NAME, [INIT_MODULE_NAME].concat(modules));\n        // Make sure resumeBootstrap() only exists if the current bootstrap is deferred\n        const windowAngular = window['angular'];\n        windowAngular.resumeBootstrap = undefined;\n        // Bootstrap the AngularJS application inside our zone\n        this.ngZone.run(() => {\n            bootstrap(element$1, [upgradeModule.name], config);\n        });\n        // Patch resumeBootstrap() to run inside the ngZone\n        if (windowAngular.resumeBootstrap) {\n            const originalResumeBootstrap = windowAngular.resumeBootstrap;\n            const ngZone = this.ngZone;\n            windowAngular.resumeBootstrap = function () {\n                let args = arguments;\n                windowAngular.resumeBootstrap = originalResumeBootstrap;\n                return ngZone.run(() => windowAngular.resumeBootstrap.apply(this, args));\n            };\n        }\n    }\n}\nUpgradeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"13.1.1\", ngImport: i0, type: UpgradeModule, deps: [{ token: i0.Injector }, { token: i0.NgZone }, { token: i0.PlatformRef }], target: i0.ɵɵFactoryTarget.NgModule });\nUpgradeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"12.0.0\", version: \"13.1.1\", ngImport: i0, type: UpgradeModule });\nUpgradeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"13.1.1\", ngImport: i0, type: UpgradeModule, providers: [angular1Providers] });\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"13.1.1\", ngImport: i0, type: UpgradeModule, decorators: [{\n            type: NgModule,\n            args: [{ providers: [angular1Providers] }]\n        }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.NgZone }, { type: i0.PlatformRef }]; } });\n\n/**\n * @license\n * Copyright Google LLC 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// This file only re-exports items to appear in the public api. Keep it that way.\n\n/**\n * @license\n * Copyright Google LLC 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/**\n * Generated bundle index. Do not edit.\n */\n\nexport { UpgradeComponent, UpgradeModule, VERSION, downgradeComponent, downgradeInjectable, downgradeModule, getAngularJSGlobal, getAngularLib, setAngularJSGlobal, setAngularLib };\n"]},"metadata":{},"sourceType":"module"}