\n `,\n styles: [`\n .share-link{cursor:pointer;margin-left:-15px;padding:0;line-height:1;width:15px;display:inline-block}.share-link:before{content:\"\";width:15px;height:15px;background-size:contain;background-image:url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgeD0iMCIgeT0iMCIgd2lkdGg9IjUxMiIgaGVpZ2h0PSI1MTIiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA1MTIgNTEyIiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBmaWxsPSIjMDEwMTAxIiBkPSJNNDU5LjcgMjMzLjRsLTkwLjUgOTAuNWMtNTAgNTAtMTMxIDUwLTE4MSAwIC03LjktNy44LTE0LTE2LjctMTkuNC0yNS44bDQyLjEtNDIuMWMyLTIgNC41LTMuMiA2LjgtNC41IDIuOSA5LjkgOCAxOS4zIDE1LjggMjcuMiAyNSAyNSA2NS42IDI0LjkgOTAuNSAwbDkwLjUtOTAuNWMyNS0yNSAyNS02NS42IDAtOTAuNSAtMjQuOS0yNS02NS41LTI1LTkwLjUgMGwtMzIuMiAzMi4yYy0yNi4xLTEwLjItNTQuMi0xMi45LTgxLjYtOC45bDY4LjYtNjguNmM1MC01MCAxMzEtNTAgMTgxIDBDNTA5LjYgMTAyLjMgNTA5LjYgMTgzLjQgNDU5LjcgMjMzLjR6TTIyMC4zIDM4Mi4ybC0zMi4yIDMyLjJjLTI1IDI0LjktNjUuNiAyNC45LTkwLjUgMCAtMjUtMjUtMjUtNjUuNiAwLTkwLjVsOTAuNS05MC41YzI1LTI1IDY1LjUtMjUgOTAuNSAwIDcuOCA3LjggMTIuOSAxNy4yIDE1LjggMjcuMSAyLjQtMS40IDQuOC0yLjUgNi44LTQuNWw0Mi4xLTQyYy01LjQtOS4yLTExLjYtMTgtMTkuNC0yNS44IC01MC01MC0xMzEtNTAtMTgxIDBsLTkwLjUgOTAuNWMtNTAgNTAtNTAgMTMxIDAgMTgxIDUwIDUwIDEzMSA1MCAxODEgMGw2OC42LTY4LjZDMjc0LjYgMzk1LjEgMjQ2LjQgMzkyLjMgMjIwLjMgMzgyLjJ6Ii8+PC9zdmc+Cg==\");opacity:0.5;visibility:hidden;display:inline-block;vertical-align:middle}.sharable-header:hover .share-link:before,.share-link:hover:before{visibility:visible}:host{padding-bottom:100px;display:block;border-bottom:2px solid rgba(127,127,127,0.25)}responses-list,params-list{display:block}.method-header{font-size:25px;font-weight:200;color:#253137}.method-endpoint{margin:0;font-weight:200;font-size:0}.method-endpoint>span{padding-top:3px;padding-bottom:3px;vertical-align:middle;font-size:14px}.api-url{color:#999;margin-left:10px}.path{font-family:monospace;font-weight:bold;color:#00329F}.method-tags{margin-top:20px}.method-tags a{font-size:16px;color:#999;display:inline-block;padding:0 0.5em;text-decoration:none}.method-tags a:before{content:'#';margin-right:-0.4em}.method-tags a:first-of-type{padding:0}.method-content,.method-samples{display:block;box-sizing:border-box;float:left}.method-content{width:60%;padding:0 20px}.method-samples{color:#CFD2D3;width:40%;padding:10px 20px;background:#263238}responses-samples{display:block}.method-samples header{font-size:16px;margin:5px 0;color:#8A9094;text-transform:uppercase}.method-samples schema-sample{display:block}.method:after{content:\"\";display:table;clear:both}.method-description{padding:30px 0;margin:0}.http-method{color:white;background-color:#1976D3;padding:3px 10px;text-transform:uppercase}.http-method.delete{background-color:red}.http-method.post{background-color:#00329F}.http-method.patch{background-color:orange}.http-method.put{background-color:crimson}.http-method.options{background-color:black}.http-method.head{background-color:darkkhaki}@media (max-width: 1100px){.methods:before{display:none}.method-samples,.method-content{width:100%}.method-samples{margin-top:2em}:host{padding-bottom:0}}\n `],\n directives: [ParamsList, ResponsesList, ResponsesSamples, SchemaSample, RequestSamples],\n inputs: ['tag']\n})\nexport default class Method extends BaseComponent {\n constructor(schemaMgr) {\n super(schemaMgr);\n }\n\n prepareModel() {\n this.data = {};\n this.data.apiUrl = this.schemaMgr.apiUrl;\n this.data.httpMethod = JsonPointer.baseName(this.pointer);\n this.data.path = JsonPointer.baseName(this.pointer, 2);\n this.data.methodInfo = this.componentSchema;\n this.data.methodInfo.tags = this.filterMainTags(this.data.methodInfo.tags);\n this.data.bodyParam = this.findBodyParam();\n if (this.componentSchema.operationId) {\n this.data.methodAnchor = 'operation/' + this.componentSchema.operationId;\n } else {\n this.data.methodAnchor = 'tag/' + this.tag + this.pointer;\n }\n }\n\n filterMainTags(tags) {\n var tagsMap = this.schemaMgr.getTagsMap();\n if (!tags) return [];\n return tags.filter(tag => tagsMap[tag] && tagsMap[tag]['x-traitTag']);\n }\n\n findBodyParam() {\n let pathParams = this.schemaMgr.getMethodParams(this.pointer, true);\n let bodyParam = pathParams.find(param => param.in === 'body');\n return bodyParam;\n }\n}\n","'use strict';\n\nimport {RedocComponent, BaseComponent} from '../base';\nimport Method from '../Method/method';\n\n@RedocComponent({\n selector: 'methods-list',\n template: `\n
\n `,\n styles: [`\n .share-link{cursor:pointer;margin-left:-15px;padding:0;line-height:1;width:15px;display:inline-block}.share-link:before{content:\"\";width:15px;height:15px;background-size:contain;background-image:url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgeD0iMCIgeT0iMCIgd2lkdGg9IjUxMiIgaGVpZ2h0PSI1MTIiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA1MTIgNTEyIiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBmaWxsPSIjMDEwMTAxIiBkPSJNNDU5LjcgMjMzLjRsLTkwLjUgOTAuNWMtNTAgNTAtMTMxIDUwLTE4MSAwIC03LjktNy44LTE0LTE2LjctMTkuNC0yNS44bDQyLjEtNDIuMWMyLTIgNC41LTMuMiA2LjgtNC41IDIuOSA5LjkgOCAxOS4zIDE1LjggMjcuMiAyNSAyNSA2NS42IDI0LjkgOTAuNSAwbDkwLjUtOTAuNWMyNS0yNSAyNS02NS42IDAtOTAuNSAtMjQuOS0yNS02NS41LTI1LTkwLjUgMGwtMzIuMiAzMi4yYy0yNi4xLTEwLjItNTQuMi0xMi45LTgxLjYtOC45bDY4LjYtNjguNmM1MC01MCAxMzEtNTAgMTgxIDBDNTA5LjYgMTAyLjMgNTA5LjYgMTgzLjQgNDU5LjcgMjMzLjR6TTIyMC4zIDM4Mi4ybC0zMi4yIDMyLjJjLTI1IDI0LjktNjUuNiAyNC45LTkwLjUgMCAtMjUtMjUtMjUtNjUuNiAwLTkwLjVsOTAuNS05MC41YzI1LTI1IDY1LjUtMjUgOTAuNSAwIDcuOCA3LjggMTIuOSAxNy4yIDE1LjggMjcuMSAyLjQtMS40IDQuOC0yLjUgNi44LTQuNWw0Mi4xLTQyYy01LjQtOS4yLTExLjYtMTgtMTkuNC0yNS44IC01MC01MC0xMzEtNTAtMTgxIDBsLTkwLjUgOTAuNWMtNTAgNTAtNTAgMTMxIDAgMTgxIDUwIDUwIDEzMSA1MCAxODEgMGw2OC42LTY4LjZDMjc0LjYgMzk1LjEgMjQ2LjQgMzkyLjMgMjIwLjMgMzgyLjJ6Ii8+PC9zdmc+Cg==\");opacity:0.5;visibility:hidden;display:inline-block;vertical-align:middle}.sharable-header:hover .share-link:before,.share-link:hover:before{visibility:visible}.tag-info{padding:0 20px;box-sizing:border-box;background-color:white}.tag-info:after,.tag-info:before{content:\"\";display:table}.tag-info h1{color:#00329F;text-transform:capitalize;font-weight:normal}.methods{display:block;position:relative}.methods:before{content:\"\";background:#263238;height:100%;width:40%;top:0;right:0;position:absolute;z-index:-1}@media (max-width: 1100px){.methods:before{display:none}}\n `],\n directives: [Method]\n})\nexport default class MethodsList extends BaseComponent {\n\n constructor(schemaMgr) {\n super(schemaMgr);\n }\n\n prepareModel() {\n this.data = {};\n // follow SwaggerUI behavior for cases when one method has more than one tag:\n // duplicate methods\n\n let menuStructure = this.schemaMgr.buildMenuTree();\n let tags = Array.from(menuStructure.entries())\n .map((entry) => {\n let [tag, {description, methods}] = entry;\n // inject tag name into method info\n methods = methods || [];\n methods.forEach(method => {\n method.tag = tag;\n });\n return {\n name: tag,\n description: description,\n methods: methods\n };\n });\n this.data.tags = tags;\n // TODO: check $ref field\n }\n}\n","'use strict';\n\nimport {Directive, ElementRef} from 'angular2/core';\nimport {BrowserDomAdapter} from 'angular2/platform/browser';\n\n@Directive({\n selector: '[sticky-sidebar]',\n inputs: ['scrollParent', 'scrollYOffset']\n})\n@Reflect.metadata('parameters', [[ElementRef], [BrowserDomAdapter]])\nexport default class StickySidebar {\n constructor(elementRef, dom) {\n this.$element = elementRef.nativeElement;\n this.dom = dom;\n\n // initial styling\n this.dom.setStyle(this.$element, 'position', 'absolute');\n this.dom.setStyle(this.$element, 'top', '0');\n this.dom.setStyle(this.$element, 'bottom', '0');\n this.dom.setStyle(this.$element, 'max-height', '100%');\n }\n\n bind() {\n this.cancelScrollBinding = this.dom.onAndCancel(this.scrollParent, 'scroll', () => { this.updatePosition(); });\n this.updatePosition();\n }\n\n unbind() {\n this.cancelScrollBinding && this.cancelScrollBinding();\n }\n\n updatePosition() {\n if ( this.scrollY + this.scrollYOffset() >= this.$redocEl.offsetTop) {\n this.stick();\n } else {\n this.unstick();\n }\n }\n\n stick() {\n this.dom.setStyle(this.$element, 'position', 'fixed');\n this.dom.setStyle(this.$element, 'top', this.scrollYOffset() + 'px');\n }\n\n unstick() {\n this.dom.setStyle(this.$element, 'position', 'absolute');\n this.dom.setStyle(this.$element, 'top', 0);\n }\n\n get scrollY() {\n return (this.scrollParent.pageYOffset != null) ? this.scrollParent.pageYOffset : this.scrollParent.scrollTop;\n }\n\n ngOnInit() {\n // FIXME use more reliable code\n this.$redocEl = this.$element.offsetParent;\n this.bind();\n }\n\n ngOnDestroy() {\n this.unbind();\n }\n}\n","'use strict';\n\nimport {ChangeDetectionStrategy, provide, enableProdMode} from 'angular2/core';\nimport {ElementRef} from 'angular2/core';\nimport {BrowserDomAdapter, bootstrap} from 'angular2/platform/browser';\nimport detectScollParent from 'scrollparent';\nimport {RedocComponent, BaseComponent} from '../base';\nimport SchemaManager from '../../utils/SchemaManager';\n\nimport ApiInfo from '../ApiInfo/api-info';\nimport ApiLogo from '../ApiLogo/api-logo';\nimport MethodsList from '../MethodsList/methods-list';\nimport SideMenu from '../SideMenu/side-menu';\nimport StickySidebar from '../../common/components/StickySidebar/sticky-sidebar';\nimport OptionsManager from '../../options';\nimport {redocEvents} from '../../events';\n\nimport './redoc-loading-styles.css!css';\n\nvar dom = new BrowserDomAdapter();\nvar _modeLocked = false;\n\n@RedocComponent({\n selector: 'redoc',\n providers: [\n SchemaManager,\n BrowserDomAdapter\n ],\n template: `\n
\n `,\n styles: [`\n :host{display:block;box-sizing:border-box}.redoc-wrap{position:relative}side-menu{display:block;box-sizing:border-box}methods-list{display:block;overflow:hidden}api-info,.side-bar{display:block;padding:10px 0}api-info{padding:10px 20px}api-logo{display:block;text-align:center}@media (max-width: 1000px){api-logo{display:none}}[sticky-sidebar]{width:260px;background-color:#FAFAFA;overflow-y:auto;overflow-x:hidden}@media (max-width: 1000px){[sticky-sidebar]{z-index:1;width:100%;bottom:auto !important}}#api-content{margin-left:260px}@media (max-width: 1000px){#api-content{padding-top:3em;margin-left:0}}#api-content:after{content:\"\";position:absolute;left:0;right:0;top:0;bottom:0;background-color:black;opacity:0.5;transition:all 0.3s ease;display:none}#api-content.menu-opened:after{display:block}footer{text-align:right;padding:10px;font-size:15px}footer a{color:#999;text-decoration:none}footer strong{font-size:18px;color:#00329F}:host p{margin:0;margin-bottom:1em}:host .redoc-markdown-block pre{font-family:Courier, monospace;white-space:pre-wrap;background-color:rgba(0,0,0,0.04);padding:10px;overflow-x:auto;line-height:normal;border-radius:3px}:host .redoc-markdown-block pre code{background-color:transparent}:host .redoc-markdown-block pre code:before,:host .redoc-markdown-block pre code:after{content:none}:host .redoc-markdown-block code{font-family:Courier, monospace;background-color:rgba(0,0,0,0.04);padding:0.2em 0;font-size:0.85em;border-radius:3px}:host .redoc-markdown-block code:before,:host .redoc-markdown-block code:after{letter-spacing:-0.2em;content:\"\\\\00a0\"}:host .redoc-markdown-block p{margin:0;margin-bottom:1em}:host .redoc-markdown-block p:last-of-type{margin-bottom:0}:host .redoc-markdown-block blockquote{margin:0;margin-bottom:1em;padding:0 15px;color:#777;border-left:4px solid #ddd}:host .redoc-markdown-block img{max-width:100%;box-sizing:content-box}:host .redoc-markdown-block ul,:host .redoc-markdown-block ol{padding-left:2em;margin:0;margin-bottom:1em}:host .redoc-markdown-block table{display:block;width:100%;overflow:auto;word-break:normal;word-break:keep-all;border-collapse:collapse;border-spacing:0;margin-top:0.5em;margin-bottom:0.5em}:host .redoc-markdown-block table tr{background-color:#fff;border-top:1px solid #ccc}:host .redoc-markdown-block table tr:nth-child(2n){background-color:#f8f8f8}:host .redoc-markdown-block table th,:host .redoc-markdown-block table td{padding:6px 13px;border:1px solid #ddd}:host .redoc-markdown-block table th{text-align:left;font-weight:bold}\n `],\n directives: [ApiInfo, ApiLogo, MethodsList, SideMenu, StickySidebar],\n changeDetection: ChangeDetectionStrategy.Default\n})\n@Reflect.metadata('parameters', [\n [SchemaManager], [OptionsManager], [ElementRef]])\nexport default class Redoc extends BaseComponent {\n constructor(schemaMgr, optionsMgr, elementRef) {\n super(schemaMgr);\n this.element = elementRef.nativeElement;\n //parse options (top level component doesn't support inputs)\n optionsMgr.parseOptions( this.element );\n optionsMgr.options.$scrollParent = detectScollParent( this.element );\n this.options = optionsMgr.options;\n }\n\n static showLoadingAnimation() {\n let elem = dom.query('redoc');\n dom.addClass(elem, 'loading');\n }\n\n static hideLoadingAnimation() {\n let redocEl = dom.query('redoc');\n dom.addClass(redocEl, 'loading-remove');\n setTimeout(() => {\n dom.removeClass(redocEl, 'loading-remove');\n dom.removeClass(redocEl, 'loading');\n }, 400);\n }\n\n static init(schemaUrl, options) {\n var optionsMgr = new OptionsManager();\n optionsMgr.options = options;\n var providers = [\n provide(OptionsManager, {useValue: optionsMgr})\n ];\n\n if (Redoc.appRef) {\n Redoc.dispose();\n }\n Redoc.showLoadingAnimation();\n return SchemaManager.instance().load(schemaUrl)\n .then(() => {\n if (!_modeLocked && !optionsMgr.options.debugMode) {\n enableProdMode();\n _modeLocked = true;\n }\n return bootstrap(Redoc, providers);\n })\n .then(\n (appRef) => {\n Redoc.hideLoadingAnimation();\n Redoc.appRef = appRef;\n // setTimeout to allow cached elements to init\n setTimeout(() => redocEvents.bootstrapped.next());\n console.log('ReDoc bootstrapped!');\n },\n error => {\n console.log(error);\n throw error;\n }\n );\n }\n\n static autoInit() {\n const specUrlAttributeName = 'spec-url';\n let redocEl = dom.query('redoc');\n if (!redocEl) return;\n if (dom.hasAttribute(redocEl, specUrlAttributeName)) {\n let url = dom.getAttribute(redocEl, specUrlAttributeName);\n Redoc.init(url);\n }\n }\n\n static dispose() {\n let el = dom.query('redoc');\n let elClone;\n let parent;\n let nextSibling;\n if (el) {\n parent = el.parentElement;\n nextSibling = el.nextElementSibling;\n }\n\n elClone = el.cloneNode(false);\n\n if (Redoc.appRef) {\n Redoc.appRef.dispose();\n Redoc.appRef = null;\n\n // Redoc dispose removes host element, so need to restore it\n elClone.innerHTML = 'Loading...';\n parent && parent.insertBefore(elClone, nextSibling);\n }\n }\n}\n","'use strict';\n\nimport {Component, View, ElementRef} from 'angular2/core';\nimport {CORE_DIRECTIVES} from 'angular2/common';\nimport {DynamicComponentLoader} from 'angular2/src/core/linker/dynamic_component_loader';\n\nimport JsonSchema from './json-schema';\nimport OptionsManager from '../../options';\nimport SchemaManager from '../../utils/SchemaManager';\n\n\nvar cache = {};\n\n\n@Component({\n selector: 'json-schema-lazy',\n inputs: ['pointer', 'auto']\n})\n@View({\n template: '',\n directives: [CORE_DIRECTIVES]\n})\n@Reflect.metadata('parameters', [[SchemaManager], [ElementRef], [DynamicComponentLoader], [OptionsManager]])\nexport default class JsonSchemaLazy {\n\n constructor(schemaMgr, elementRef, dcl, optionsMgr) {\n this.elementRef = elementRef;\n this.dcl = dcl;\n this.optionsMgr = optionsMgr;\n this.schemaMgr = schemaMgr;\n }\n\n normalizePointer() {\n let schema = this.schemaMgr.byPointer(this.pointer);\n return schema && schema.$ref || this.pointer;\n }\n\n load() {\n if (this.optionsMgr.options.disableLazySchemas) return;\n if (this.loaded) return;\n if (this.pointer) {\n this.dcl.loadNextToLocation(JsonSchema, this.elementRef).then((compRef) => {\n compRef.instance.pointer = this.pointer;\n });\n }\n this.loaded = true;\n }\n\n // cache JsonSchema view\n loadCached() {\n this.pointer = this.normalizePointer(this.pointer);\n if (cache[this.pointer]) {\n cache[this.pointer].then((compRef) => {\n setTimeout( ()=> {\n let $element = compRef.location.nativeElement;\n\n // skip caching view with tabs inside (discriminator) as it needs attached controller\n if ($element.querySelector('tabs')) {\n this.dcl.loadNextToLocation(JsonSchema, this.elementRef).then((compRef) => {\n compRef.instance.pointer = this.pointer;\n compRef.hostView.changeDetectorRef.markForCheck();\n });\n return;\n }\n insertAfter($element.cloneNode(true), this.elementRef.nativeElement);\n } );\n });\n } else {\n cache[this.pointer] = this.dcl.loadNextToLocation(JsonSchema, this.elementRef).then((compRef) => {\n compRef.instance.pointer = this.pointer;\n compRef.hostView.changeDetectorRef.markForCheck();\n return compRef;\n });\n }\n }\n\n ngAfterViewInit() {\n if (!this.auto) return;\n this.loadCached();\n }\n\n ngOnDestroy() {\n // clear cache\n cache = {};\n }\n}\n\nfunction insertAfter(newNode, referenceNode) {\n referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);\n}\n","'use strict';\n\nimport {Component, View, EventEmitter} from 'angular2/core';\nimport {CORE_DIRECTIVES} from 'angular2/common';\n\n@Component({\n selector: 'zippy',\n events: ['open', 'close'],\n inputs: ['title', 'visible', 'type', 'empty']\n})\n@View({\n template: `\n
\n
\n {{ visible ? '▾' : '▸' }}\n {{title}}\n
\n
\n \n
\n
\n `,\n styles: [`\n .zippy-title{padding:10px;margin:2px 0;line-height:1.5em;background-color:#f2f2f2;cursor:pointer}.zippy-success>.zippy-title{color:#09AC1C;background-color:#E1F5E3}.zippy-error>.zippy-title{color:#E54541;background-color:#FBE7E7}.zippy-redirect>.zippy-title{color:#AC7C09;background-color:#F5F0E1}.zippy-info>.zippy-title{color:#096DAC;background-color:#E1EFF5}span.zippy-indicator{font-size:1.5em;line-height:1;margin-right:0.2em;vertical-align:text-bottom}.zippy-content{padding:15px 0}.zippy-empty .zippy-title{cursor:default}.zippy-empty .zippy-indicator{display:none}.zippy-empty .zippy-content{display:none}.zippy-hidden{overflow:hidden;visibility:hidden;height:0;padding:0}\n `],\n directives: [CORE_DIRECTIVES]\n})\nexport default class Zippy {\n\n constructor() {\n this.type = 'general';\n this.visible = false;\n this.empty = false;\n this.open = new EventEmitter();\n this.close = new EventEmitter();\n }\n\n toggle() {\n this.visible = !this.visible;\n if (this.empty) return;\n (this.visible) ? this.open.next() : this.close.next();\n }\n}\n","'use strict';\n\nimport {RedocComponent, BaseComponent, SchemaManager} from '../base';\nimport JsonPointer from '../../utils/JsonPointer';\nimport JsonSchema from '../JsonSchema/json-schema';\nimport JsonSchemaLazy from '../JsonSchema/json-schema-lazy';\nimport Zippy from '../../common/components/Zippy/zippy';\nimport {statusCodeType} from '../../utils/helpers';\nimport OptionsManager from '../../options';\n\nfunction isNumeric(n) {\n return (!isNaN(parseFloat(n)) && isFinite(n));\n}\n\n@RedocComponent({\n selector: 'responses-list',\n template: `\n \n
\n \n \n \n \n \n \n \n `,\n styles: [`\n .responses-list-header{font-size:18px;padding:0.2em 0;margin:0.5em 0;color:#253137;font-weight:normal}.header-name{font-weight:bold;display:inline-block}.header-type{display:inline-block;font-weight:bold;color:#999}header{font-size:14px;font-weight:bold;text-transform:uppercase;margin-bottom:15px}.header{margin-bottom:10px}\n `],\n directives: [JsonSchema, Zippy, JsonSchemaLazy]\n})\n@Reflect.metadata('parameters', [[SchemaManager], [OptionsManager]])\nexport default class ResponsesList extends BaseComponent {\n constructor(schemaMgr, optionsMgr) {\n super(schemaMgr);\n this.options = optionsMgr.options;\n }\n\n prepareModel() {\n this.data = {};\n this.data.responses = [];\n\n let responses = this.componentSchema;\n if (!responses) return;\n\n responses = Object.keys(responses).filter(respCode => {\n // only response-codes and \"default\"\n return ( isNumeric(respCode) || (respCode === 'default'));\n }).map(respCode => {\n let resp = responses[respCode];\n resp.pointer = JsonPointer.join(this.pointer, respCode);\n if (resp.$ref) {\n let ref = resp.$ref;\n resp = this.schemaMgr.byPointer(resp.$ref);\n resp.pointer = ref;\n }\n\n resp.empty = !resp.schema;\n resp.code = respCode;\n resp.type = statusCodeType(resp.code);\n if (resp.headers) {\n resp.headers = Object.keys(resp.headers).map((k) => {\n let respInfo = resp.headers[k];\n respInfo.name = k;\n return respInfo;\n });\n resp.empty = false;\n }\n resp.extendable = resp.headers || resp.length;\n return resp;\n });\n this.data.responses = responses;\n }\n}\n","'use strict';\n\nexport function statusCodeType(statusCode) {\n if (statusCode < 100 || statusCode > 599) {\n throw new Error('invalid HTTP code');\n }\n let res = 'success';\n if (statusCode >= 300 && statusCode < 400) {\n res = 'redirect';\n } else if (statusCode >= 400) {\n res = 'error';\n } else if (statusCode < 200) {\n res = 'info';\n }\n return res;\n}\n","'use strict';\n\nimport {RedocComponent, BaseComponent} from '../base';\nimport JsonPointer from '../../utils/JsonPointer';\nimport {Tabs, Tab} from '../../common/components/Tabs/tabs';\nimport SchemaSample from '../SchemaSample/schema-sample';\nimport {statusCodeType} from '../../utils/helpers';\n\n\nfunction isNumeric(n) {\n return (!isNaN(parseFloat(n)) && isFinite(n));\n}\n\nfunction hasExample(response) {\n return ((response.examples && response.examples['application/json']) ||\n response.schema);\n}\n\n@RedocComponent({\n selector: 'responses-samples',\n template: `\n
\n
\n \n \n \n \n `,\n styles: [`\n tab,tabs{display:block}schema-sample{display:block}header{font-size:16px;margin:5px 0;color:#8A9094;text-transform:uppercase;font-weight:normal}:host>tabs>ul li{font-size:13px;margin:2px 0;padding:2px 5px;color:#8A9094;line-height:1.25;color:#8A9094}:host>tabs>ul li.active{background-color:white;color:#666}:host tabs ul{padding-top:10px}\n `],\n directives: [SchemaSample, Tabs, Tab]\n})\nexport default class ResponsesSamples extends BaseComponent {\n constructor(schemaMgr) {\n super(schemaMgr);\n }\n\n prepareModel() {\n this.data = {};\n this.data.responses = [];\n\n let responses = this.componentSchema;\n if (!responses) return;\n\n responses = Object.keys(responses).filter(respCode => {\n // only response-codes and \"default\"\n return ( isNumeric(respCode) || (respCode === 'default'));\n }).map(respCode => {\n let resp = responses[respCode];\n resp.pointer = JsonPointer.join(this.pointer, respCode);\n if (resp.$ref) {\n let ref = resp.$ref;\n resp = this.schemaMgr.byPointer(resp.$ref);\n resp.pointer = ref;\n }\n\n resp.code = respCode;\n resp.type = statusCodeType(resp.code);\n return resp;\n })\n .filter(response => hasExample(response));\n this.data.responses = responses;\n }\n}\n","/* */ \n'use strict';\n\n// The JSON Object that defines the default values of certain types.\nvar typesInstantiator = {\n 'string': '',\n 'number': 0,\n 'integer': 0,\n 'null': null,\n 'boolean': false, // Always stay positive?\n 'object': { }\n};\n\n/**\n * Checks whether a variable is a primitive.\n * @param obj - an object.\n * @returns {boolean}\n */\nfunction isPrimitive(obj) {\n var type = obj.type;\n\n return typesInstantiator[type] !== undefined;\n}\n\n/**\n * Instantiate a primitive.\n * @param val - The object that represents the primitive.\n * @returns {*}\n */\nfunction instantiatePrimitive(val) {\n var type = val.type;\n\n // Support for default values in the JSON Schema.\n if (val.default) {\n return val.default;\n }\n\n return typesInstantiator[type];\n}\n\n/**\n * The main function.\n * Calls sub-objects recursively, depth first, using the sub-function 'visit'.\n * @param schema - The schema to instantiate.\n * @returns {*}\n */\nfunction instantiate(schema) {\n\n /**\n * Visits each sub-object using recursion.\n * If it reaches a primitive, instantiate it.\n * @param obj - The object that represents the schema.\n * @param name - The name of the current object.\n * @param data - The instance data that represents the current object.\n */\n function visit(obj, name, data) {\n if (!obj) {\n return;\n }\n var i;\n var type = obj.type;\n // We want non-primitives objects (primitive === object w/o properties).\n if (type === 'object' && obj.properties) {\n data[name] = data[name] || { };\n\n // Visit each property.\n for (var property in obj.properties) {\n if (obj.properties.hasOwnProperty(property)) {\n visit(obj.properties[property], property, data[name]);\n }\n }\n } else if (obj.allOf) {\n for (i = 0; i < obj.allOf.length; i++) {\n visit(obj.allOf[i], name, data);\n }\n } else if (type === 'array') {\n data[name] = [];\n var len = 1;\n if (obj.minItems || obj.minItems === 0) {\n len = obj.minItems;\n }\n\n // Instantiate 'len' items.\n for (i = 0; i < len; i++) {\n visit(obj.items, i, data[name]);\n }\n\n } else if (isPrimitive(obj)) {\n data[name] = instantiatePrimitive(obj);\n }\n }\n\n var data = {};\n visit(schema, 'kek', data);\n return data['kek'];\n}\n\n// If we're using Node.js, export the module.\nif (typeof module !== 'undefined') {\n module.exports = {\n instantiate: instantiate\n };\n}\n","/* */ \nmodule.exports = require('./src/instantiator');\n","module.exports = require(\"npm:json-schema-instantiator@0.3.0/index\");","'use strict';\nimport {Pipe} from 'angular2/core';\nimport {isBlank} from 'angular2/src/facade/lang';\n\nvar level = 1;\nconst COLLAPSE_LEVEL = 2;\n\n@Pipe({ name: 'jsonFormatter' })\nexport class JsonFormatter {\n transform(value) {\n if (isBlank(value)) return value;\n return jsonToHTML(value);\n }\n}\n\nfunction htmlEncode(t) {\n return t != null ? t.toString().replace(/&/g, '&').replace(/\"/g, '"').replace(//g, '>') : '';\n}\n\nfunction decorateWithSpan(value, className) {\n return '
' + htmlEncode(value) + '';\n}\n\nfunction valueToHTML(value) {\n var valueType = typeof value, output = '';\n if (value == null) {\n output += decorateWithSpan('null', 'type-null');\n }\n else if (value && value.constructor === Array) {\n level++;\n output += arrayToHTML(value);\n level--;\n }\n else if (valueType === 'object') {\n level++;\n output += objectToHTML(value);\n level--;\n }\n else if (valueType === 'number') {\n output += decorateWithSpan(value, 'type-number');\n }\n else if (valueType === 'string') {\n if (/^(http|https):\\/\\/[^\\\\s]+$/.test(value)) {\n output += decorateWithSpan('\"', 'type-string') + '
' + htmlEncode(value) + '' + decorateWithSpan('\"', 'type-string');\n } else {\n output += decorateWithSpan('\"' + value + '\"', 'type-string');\n }\n } else if (valueType === 'boolean') {\n output += decorateWithSpan(value, 'type-boolean');\n }\n\n return output;\n}\n\nfunction arrayToHTML(json) {\n var collapsed = level > COLLAPSE_LEVEL ? 'collapsed' : '';\n var i, length;\n var output = '
[
]';\n if (!hasContents) {\n output = '[ ]';\n }\n return output;\n}\n\nfunction objectToHTML(json) {\n var collapsed = level > COLLAPSE_LEVEL ? 'collapsed' : '';\n var i, key, length, keys = Object.keys(json);\n var output = '
{
}';\n if (!hasContents) {\n output = '{ }';\n }\n return output;\n}\n\nfunction jsonToHTML(json) {\n level = 1;\n var output = '';\n output += '
';\n output += valueToHTML(json);\n output += '
';\n return output;\n}\n","'use strict';\n\nimport {ElementRef} from 'angular2/core';\n\nimport SchemaSampler from 'json-schema-instantiator';\n\nimport {JsonFormatter} from '../../utils/JsonFormatterPipe';\nimport {RedocComponent, BaseComponent, SchemaManager} from '../base';\n\n@RedocComponent({\n selector: 'schema-sample',\n template: `\n
\n \n
Sample unavailable
\n
\n
\n `,\n pipes: [JsonFormatter],\n styles: [`\n pre{background-color:transparent;padding:0}:host .type-null{color:gray}:host .type-boolean{color:firebrick}:host .type-number{color:#4A8BB3}:host .type-string{color:#66B16E}:host .callback-function{color:gray}:host .collapser:after{content:\"-\";cursor:pointer}:host .collapsed>.collapser:after{content:\"+\";cursor:pointer}:host .ellipsis:after{content:\" … \"}:host .collapsible{margin-left:2em}:host .hoverable{padding-top:1px;padding-bottom:1px;padding-left:2px;padding-right:2px;border-radius:2px}:host .hovered{background-color:#ebeef9}:host .collapser{padding-right:6px;padding-left:6px}:host ul,:host .redoc-json ul{list-style-type:none;padding:0px;margin:0px 0px 0px 26px}:host li{position:relative}:host .hoverable{transition:background-color .2s ease-out 0s;-webkit-transition:background-color .2s ease-out 0s;display:inline-block}:host .hovered{transition-delay:.2s;-webkit-transition-delay:.2s}:host .selected{outline-style:solid;outline-width:1px;outline-style:dotted}:host .collapsed>.collapsible{display:none}:host .ellipsis{display:none}:host .collapsed>.ellipsis{display:inherit}:host .collapser{position:absolute;top:1px;left:-1.5em;cursor:default;user-select:none;-webkit-user-select:none}\n `]\n})\n@Reflect.metadata('parameters', [[SchemaManager], [ElementRef]])\nexport default class SchemaSample extends BaseComponent {\n constructor(schemaMgr, elementRef) {\n super(schemaMgr);\n this.element = elementRef.nativeElement;\n }\n\n init() {\n this.data = {};\n\n let base = {};\n let sample;\n\n // got pointer not directly to the schema but e.g. to response obj\n if (this.componentSchema.schema) {\n base = this.componentSchema;\n this.componentSchema = this.componentSchema.schema;\n }\n\n if (base.examples && base.examples['application/json']) {\n sample = base.examples['application/json'];\n } else {\n this.dereference(this.componentSchema);\n sample = SchemaSampler.instantiate(this.componentSchema);\n }\n\n this.data.sample = sample;\n\n\n this.element.addEventListener('click', (event) => {\n var collapsed, target = event.target;\n if (event.target.className === 'collapser') {\n collapsed = target.parentNode.getElementsByClassName('collapsible')[0];\n if (collapsed.parentNode.classList.contains('collapsed')) {\n collapsed.parentNode.classList.remove('collapsed');\n } else {\n collapsed.parentNode.classList.add('collapsed');\n }\n }\n });\n }\n}\n","/* */ \nvar classof = require('./$.classof'),\n ITERATOR = require('./$.wks')('iterator'),\n Iterators = require('./$.iterators');\nmodule.exports = require('./$.core').isIterable = function(it) {\n var O = Object(it);\n return O[ITERATOR] !== undefined || '@@iterator' in O || Iterators.hasOwnProperty(classof(O));\n};\n","/* */ \nrequire('../modules/web.dom.iterable');\nrequire('../modules/es6.string.iterator');\nmodule.exports = require('../modules/core.is-iterable');\n","/* */ \nmodule.exports = { \"default\": require(\"core-js/library/fn/is-iterable\"), __esModule: true };","/* */ \n\"use strict\";\nvar _getIterator = require('../core-js/get-iterator')[\"default\"];\nvar _isIterable = require('../core-js/is-iterable')[\"default\"];\nexports[\"default\"] = (function() {\n function sliceIterator(arr, i) {\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n try {\n for (var _i = _getIterator(arr),\n _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n if (i && _arr.length === i)\n break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"])\n _i[\"return\"]();\n } finally {\n if (_d)\n throw _e;\n }\n }\n return _arr;\n }\n return function(arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (_isIterable(Object(arr))) {\n return sliceIterator(arr, i);\n } else {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n };\n})();\nexports.__esModule = true;\n","'use strict';\n\nimport {EventEmitter} from 'angular2/core';\n\nvar bootsrEmmiter = new EventEmitter();\nvar langChanged = new EventEmitter();\nexport var redocEvents = {\n bootstrapped: bootsrEmmiter,\n samplesLanguageChanged: langChanged\n};\n","/* */ \n(function(process) {\n 'use strict';\n var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };\n var __metadata = (this && this.__metadata) || function(k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(k, v);\n };\n var lang_1 = require('../facade/lang');\n var AngularEntrypoint = (function() {\n function AngularEntrypoint(name) {\n this.name = name;\n }\n AngularEntrypoint = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], AngularEntrypoint);\n return AngularEntrypoint;\n })();\n exports.AngularEntrypoint = AngularEntrypoint;\n})(require('process'));\n","/* */ \n(function(process) {\n 'use strict';\n var __extends = (this && this.__extends) || function(d, b) {\n for (var p in b)\n if (b.hasOwnProperty(p))\n d[p] = b[p];\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };\n var __metadata = (this && this.__metadata) || function(k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(k, v);\n };\n var dom_adapter_1 = require('../dom_adapter');\n var lang_1 = require('../../../facade/lang');\n var collection_1 = require('../../../facade/collection');\n var event_manager_1 = require('./event_manager');\n var di_1 = require('../../../core/di');\n var modifierKeys = ['alt', 'control', 'meta', 'shift'];\n var modifierKeyGetters = {\n 'alt': function(event) {\n return event.altKey;\n },\n 'control': function(event) {\n return event.ctrlKey;\n },\n 'meta': function(event) {\n return event.metaKey;\n },\n 'shift': function(event) {\n return event.shiftKey;\n }\n };\n var KeyEventsPlugin = (function(_super) {\n __extends(KeyEventsPlugin, _super);\n function KeyEventsPlugin() {\n _super.call(this);\n }\n KeyEventsPlugin.prototype.supports = function(eventName) {\n return lang_1.isPresent(KeyEventsPlugin.parseEventName(eventName));\n };\n KeyEventsPlugin.prototype.addEventListener = function(element, eventName, handler) {\n var parsedEvent = KeyEventsPlugin.parseEventName(eventName);\n var outsideHandler = KeyEventsPlugin.eventCallback(element, collection_1.StringMapWrapper.get(parsedEvent, 'fullKey'), handler, this.manager.getZone());\n return this.manager.getZone().runOutsideAngular(function() {\n return dom_adapter_1.DOM.onAndCancel(element, collection_1.StringMapWrapper.get(parsedEvent, 'domEventName'), outsideHandler);\n });\n };\n KeyEventsPlugin.parseEventName = function(eventName) {\n var parts = eventName.toLowerCase().split('.');\n var domEventName = parts.shift();\n if ((parts.length === 0) || !(lang_1.StringWrapper.equals(domEventName, 'keydown') || lang_1.StringWrapper.equals(domEventName, 'keyup'))) {\n return null;\n }\n var key = KeyEventsPlugin._normalizeKey(parts.pop());\n var fullKey = '';\n modifierKeys.forEach(function(modifierName) {\n if (collection_1.ListWrapper.contains(parts, modifierName)) {\n collection_1.ListWrapper.remove(parts, modifierName);\n fullKey += modifierName + '.';\n }\n });\n fullKey += key;\n if (parts.length != 0 || key.length === 0) {\n return null;\n }\n var result = collection_1.StringMapWrapper.create();\n collection_1.StringMapWrapper.set(result, 'domEventName', domEventName);\n collection_1.StringMapWrapper.set(result, 'fullKey', fullKey);\n return result;\n };\n KeyEventsPlugin.getEventFullKey = function(event) {\n var fullKey = '';\n var key = dom_adapter_1.DOM.getEventKey(event);\n key = key.toLowerCase();\n if (lang_1.StringWrapper.equals(key, ' ')) {\n key = 'space';\n } else if (lang_1.StringWrapper.equals(key, '.')) {\n key = 'dot';\n }\n modifierKeys.forEach(function(modifierName) {\n if (modifierName != key) {\n var modifierGetter = collection_1.StringMapWrapper.get(modifierKeyGetters, modifierName);\n if (modifierGetter(event)) {\n fullKey += modifierName + '.';\n }\n }\n });\n fullKey += key;\n return fullKey;\n };\n KeyEventsPlugin.eventCallback = function(element, fullKey, handler, zone) {\n return function(event) {\n if (lang_1.StringWrapper.equals(KeyEventsPlugin.getEventFullKey(event), fullKey)) {\n zone.run(function() {\n return handler(event);\n });\n }\n };\n };\n KeyEventsPlugin._normalizeKey = function(keyName) {\n switch (keyName) {\n case 'esc':\n return 'escape';\n default:\n return keyName;\n }\n };\n KeyEventsPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], KeyEventsPlugin);\n return KeyEventsPlugin;\n })(event_manager_1.EventManagerPlugin);\n exports.KeyEventsPlugin = KeyEventsPlugin;\n})(require('process'));\n","/* */ \n'use strict';\nvar __extends = (this && this.__extends) || function(d, b) {\n for (var p in b)\n if (b.hasOwnProperty(p))\n d[p] = b[p];\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar event_manager_1 = require('./event_manager');\nvar collection_1 = require('../../../facade/collection');\nvar _eventNames = {\n 'pan': true,\n 'panstart': true,\n 'panmove': true,\n 'panend': true,\n 'pancancel': true,\n 'panleft': true,\n 'panright': true,\n 'panup': true,\n 'pandown': true,\n 'pinch': true,\n 'pinchstart': true,\n 'pinchmove': true,\n 'pinchend': true,\n 'pinchcancel': true,\n 'pinchin': true,\n 'pinchout': true,\n 'press': true,\n 'pressup': true,\n 'rotate': true,\n 'rotatestart': true,\n 'rotatemove': true,\n 'rotateend': true,\n 'rotatecancel': true,\n 'swipe': true,\n 'swipeleft': true,\n 'swiperight': true,\n 'swipeup': true,\n 'swipedown': true,\n 'tap': true\n};\nvar HammerGesturesPluginCommon = (function(_super) {\n __extends(HammerGesturesPluginCommon, _super);\n function HammerGesturesPluginCommon() {\n _super.call(this);\n }\n HammerGesturesPluginCommon.prototype.supports = function(eventName) {\n eventName = eventName.toLowerCase();\n return collection_1.StringMapWrapper.contains(_eventNames, eventName);\n };\n return HammerGesturesPluginCommon;\n})(event_manager_1.EventManagerPlugin);\nexports.HammerGesturesPluginCommon = HammerGesturesPluginCommon;\n","/* */ \n'use strict';\nvar __extends = (this && this.__extends) || function(d, b) {\n for (var p in b)\n if (b.hasOwnProperty(p))\n d[p] = b[p];\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function(k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(k, v);\n};\nvar hammer_common_1 = require('./hammer_common');\nvar lang_1 = require('../../../facade/lang');\nvar exceptions_1 = require('../../../facade/exceptions');\nvar di_1 = require('../../../core/di');\nvar HammerGesturesPlugin = (function(_super) {\n __extends(HammerGesturesPlugin, _super);\n function HammerGesturesPlugin() {\n _super.apply(this, arguments);\n }\n HammerGesturesPlugin.prototype.supports = function(eventName) {\n if (!_super.prototype.supports.call(this, eventName))\n return false;\n if (!lang_1.isPresent(window['Hammer'])) {\n throw new exceptions_1.BaseException(\"Hammer.js is not loaded, can not bind \" + eventName + \" event\");\n }\n return true;\n };\n HammerGesturesPlugin.prototype.addEventListener = function(element, eventName, handler) {\n var zone = this.manager.getZone();\n eventName = eventName.toLowerCase();\n return zone.runOutsideAngular(function() {\n var mc = new Hammer(element);\n mc.get('pinch').set({enable: true});\n mc.get('rotate').set({enable: true});\n var handler = function(eventObj) {\n zone.run(function() {\n handler(eventObj);\n });\n };\n mc.on(eventName, handler);\n return function() {\n mc.off(eventName, handler);\n };\n });\n };\n HammerGesturesPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], HammerGesturesPlugin);\n return HammerGesturesPlugin;\n})(hammer_common_1.HammerGesturesPluginCommon);\nexports.HammerGesturesPlugin = HammerGesturesPlugin;\n","/* */ \n'use strict';\nvar __extends = (this && this.__extends) || function(d, b) {\n for (var p in b)\n if (b.hasOwnProperty(p))\n d[p] = b[p];\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar collection_1 = require('../../facade/collection');\nvar lang_1 = require('../../facade/lang');\nvar dom_adapter_1 = require('../dom/dom_adapter');\nvar xhr_impl_1 = require('./xhr_impl');\nvar GenericBrowserDomAdapter = (function(_super) {\n __extends(GenericBrowserDomAdapter, _super);\n function GenericBrowserDomAdapter() {\n var _this = this;\n _super.call(this);\n this._animationPrefix = null;\n this._transitionEnd = null;\n try {\n var element = this.createElement('div', this.defaultDoc());\n if (lang_1.isPresent(this.getStyle(element, 'animationName'))) {\n this._animationPrefix = '';\n } else {\n var domPrefixes = ['Webkit', 'Moz', 'O', 'ms'];\n for (var i = 0; i < domPrefixes.length; i++) {\n if (lang_1.isPresent(this.getStyle(element, domPrefixes[i] + 'AnimationName'))) {\n this._animationPrefix = '-' + domPrefixes[i].toLowerCase() + '-';\n break;\n }\n }\n }\n var transEndEventNames = {\n WebkitTransition: 'webkitTransitionEnd',\n MozTransition: 'transitionend',\n OTransition: 'oTransitionEnd otransitionend',\n transition: 'transitionend'\n };\n collection_1.StringMapWrapper.forEach(transEndEventNames, function(value, key) {\n if (lang_1.isPresent(_this.getStyle(element, key))) {\n _this._transitionEnd = value;\n }\n });\n } catch (e) {\n this._animationPrefix = null;\n this._transitionEnd = null;\n }\n }\n GenericBrowserDomAdapter.prototype.getXHR = function() {\n return xhr_impl_1.XHRImpl;\n };\n GenericBrowserDomAdapter.prototype.getDistributedNodes = function(el) {\n return el.getDistributedNodes();\n };\n GenericBrowserDomAdapter.prototype.resolveAndSetHref = function(el, baseUrl, href) {\n el.href = href == null ? baseUrl : baseUrl + '/../' + href;\n };\n GenericBrowserDomAdapter.prototype.supportsDOMEvents = function() {\n return true;\n };\n GenericBrowserDomAdapter.prototype.supportsNativeShadowDOM = function() {\n return lang_1.isFunction(this.defaultDoc().body.createShadowRoot);\n };\n GenericBrowserDomAdapter.prototype.getAnimationPrefix = function() {\n return lang_1.isPresent(this._animationPrefix) ? this._animationPrefix : \"\";\n };\n GenericBrowserDomAdapter.prototype.getTransitionEnd = function() {\n return lang_1.isPresent(this._transitionEnd) ? this._transitionEnd : \"\";\n };\n GenericBrowserDomAdapter.prototype.supportsAnimation = function() {\n return lang_1.isPresent(this._animationPrefix) && lang_1.isPresent(this._transitionEnd);\n };\n return GenericBrowserDomAdapter;\n})(dom_adapter_1.DomAdapter);\nexports.GenericBrowserDomAdapter = GenericBrowserDomAdapter;\n","/* */ \n'use strict';\nvar __extends = (this && this.__extends) || function(d, b) {\n for (var p in b)\n if (b.hasOwnProperty(p))\n d[p] = b[p];\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar collection_1 = require('../../facade/collection');\nvar lang_1 = require('../../facade/lang');\nvar dom_adapter_1 = require('../dom/dom_adapter');\nvar generic_browser_adapter_1 = require('./generic_browser_adapter');\nvar _attrToPropMap = {\n 'class': 'className',\n 'innerHtml': 'innerHTML',\n 'readonly': 'readOnly',\n 'tabindex': 'tabIndex'\n};\nvar DOM_KEY_LOCATION_NUMPAD = 3;\nvar _keyMap = {\n '\\b': 'Backspace',\n '\\t': 'Tab',\n '\\x7F': 'Delete',\n '\\x1B': 'Escape',\n 'Del': 'Delete',\n 'Esc': 'Escape',\n 'Left': 'ArrowLeft',\n 'Right': 'ArrowRight',\n 'Up': 'ArrowUp',\n 'Down': 'ArrowDown',\n 'Menu': 'ContextMenu',\n 'Scroll': 'ScrollLock',\n 'Win': 'OS'\n};\nvar _chromeNumKeyPadMap = {\n 'A': '1',\n 'B': '2',\n 'C': '3',\n 'D': '4',\n 'E': '5',\n 'F': '6',\n 'G': '7',\n 'H': '8',\n 'I': '9',\n 'J': '*',\n 'K': '+',\n 'M': '-',\n 'N': '.',\n 'O': '/',\n '\\x60': '0',\n '\\x90': 'NumLock'\n};\nvar BrowserDomAdapter = (function(_super) {\n __extends(BrowserDomAdapter, _super);\n function BrowserDomAdapter() {\n _super.apply(this, arguments);\n }\n BrowserDomAdapter.prototype.parse = function(templateHtml) {\n throw new Error(\"parse not implemented\");\n };\n BrowserDomAdapter.makeCurrent = function() {\n dom_adapter_1.setRootDomAdapter(new BrowserDomAdapter());\n };\n BrowserDomAdapter.prototype.hasProperty = function(element, name) {\n return name in element;\n };\n BrowserDomAdapter.prototype.setProperty = function(el, name, value) {\n el[name] = value;\n };\n BrowserDomAdapter.prototype.getProperty = function(el, name) {\n return el[name];\n };\n BrowserDomAdapter.prototype.invoke = function(el, methodName, args) {\n el[methodName].apply(el, args);\n };\n BrowserDomAdapter.prototype.logError = function(error) {\n if (window.console.error) {\n window.console.error(error);\n } else {\n window.console.log(error);\n }\n };\n BrowserDomAdapter.prototype.log = function(error) {\n window.console.log(error);\n };\n BrowserDomAdapter.prototype.logGroup = function(error) {\n if (window.console.group) {\n window.console.group(error);\n this.logError(error);\n } else {\n window.console.log(error);\n }\n };\n BrowserDomAdapter.prototype.logGroupEnd = function() {\n if (window.console.groupEnd) {\n window.console.groupEnd();\n }\n };\n Object.defineProperty(BrowserDomAdapter.prototype, \"attrToPropMap\", {\n get: function() {\n return _attrToPropMap;\n },\n enumerable: true,\n configurable: true\n });\n BrowserDomAdapter.prototype.query = function(selector) {\n return document.querySelector(selector);\n };\n BrowserDomAdapter.prototype.querySelector = function(el, selector) {\n return el.querySelector(selector);\n };\n BrowserDomAdapter.prototype.querySelectorAll = function(el, selector) {\n return el.querySelectorAll(selector);\n };\n BrowserDomAdapter.prototype.on = function(el, evt, listener) {\n el.addEventListener(evt, listener, false);\n };\n BrowserDomAdapter.prototype.onAndCancel = function(el, evt, listener) {\n el.addEventListener(evt, listener, false);\n return function() {\n el.removeEventListener(evt, listener, false);\n };\n };\n BrowserDomAdapter.prototype.dispatchEvent = function(el, evt) {\n el.dispatchEvent(evt);\n };\n BrowserDomAdapter.prototype.createMouseEvent = function(eventType) {\n var evt = document.createEvent('MouseEvent');\n evt.initEvent(eventType, true, true);\n return evt;\n };\n BrowserDomAdapter.prototype.createEvent = function(eventType) {\n var evt = document.createEvent('Event');\n evt.initEvent(eventType, true, true);\n return evt;\n };\n BrowserDomAdapter.prototype.preventDefault = function(evt) {\n evt.preventDefault();\n evt.returnValue = false;\n };\n BrowserDomAdapter.prototype.isPrevented = function(evt) {\n return evt.defaultPrevented || lang_1.isPresent(evt.returnValue) && !evt.returnValue;\n };\n BrowserDomAdapter.prototype.getInnerHTML = function(el) {\n return el.innerHTML;\n };\n BrowserDomAdapter.prototype.getOuterHTML = function(el) {\n return el.outerHTML;\n };\n BrowserDomAdapter.prototype.nodeName = function(node) {\n return node.nodeName;\n };\n BrowserDomAdapter.prototype.nodeValue = function(node) {\n return node.nodeValue;\n };\n BrowserDomAdapter.prototype.type = function(node) {\n return node.type;\n };\n BrowserDomAdapter.prototype.content = function(node) {\n if (this.hasProperty(node, \"content\")) {\n return node.content;\n } else {\n return node;\n }\n };\n BrowserDomAdapter.prototype.firstChild = function(el) {\n return el.firstChild;\n };\n BrowserDomAdapter.prototype.nextSibling = function(el) {\n return el.nextSibling;\n };\n BrowserDomAdapter.prototype.parentElement = function(el) {\n return el.parentNode;\n };\n BrowserDomAdapter.prototype.childNodes = function(el) {\n return el.childNodes;\n };\n BrowserDomAdapter.prototype.childNodesAsList = function(el) {\n var childNodes = el.childNodes;\n var res = collection_1.ListWrapper.createFixedSize(childNodes.length);\n for (var i = 0; i < childNodes.length; i++) {\n res[i] = childNodes[i];\n }\n return res;\n };\n BrowserDomAdapter.prototype.clearNodes = function(el) {\n while (el.firstChild) {\n el.removeChild(el.firstChild);\n }\n };\n BrowserDomAdapter.prototype.appendChild = function(el, node) {\n el.appendChild(node);\n };\n BrowserDomAdapter.prototype.removeChild = function(el, node) {\n el.removeChild(node);\n };\n BrowserDomAdapter.prototype.replaceChild = function(el, newChild, oldChild) {\n el.replaceChild(newChild, oldChild);\n };\n BrowserDomAdapter.prototype.remove = function(node) {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n return node;\n };\n BrowserDomAdapter.prototype.insertBefore = function(el, node) {\n el.parentNode.insertBefore(node, el);\n };\n BrowserDomAdapter.prototype.insertAllBefore = function(el, nodes) {\n nodes.forEach(function(n) {\n return el.parentNode.insertBefore(n, el);\n });\n };\n BrowserDomAdapter.prototype.insertAfter = function(el, node) {\n el.parentNode.insertBefore(node, el.nextSibling);\n };\n BrowserDomAdapter.prototype.setInnerHTML = function(el, value) {\n el.innerHTML = value;\n };\n BrowserDomAdapter.prototype.getText = function(el) {\n return el.textContent;\n };\n BrowserDomAdapter.prototype.setText = function(el, value) {\n el.textContent = value;\n };\n BrowserDomAdapter.prototype.getValue = function(el) {\n return el.value;\n };\n BrowserDomAdapter.prototype.setValue = function(el, value) {\n el.value = value;\n };\n BrowserDomAdapter.prototype.getChecked = function(el) {\n return el.checked;\n };\n BrowserDomAdapter.prototype.setChecked = function(el, value) {\n el.checked = value;\n };\n BrowserDomAdapter.prototype.createComment = function(text) {\n return document.createComment(text);\n };\n BrowserDomAdapter.prototype.createTemplate = function(html) {\n var t = document.createElement('template');\n t.innerHTML = html;\n return t;\n };\n BrowserDomAdapter.prototype.createElement = function(tagName, doc) {\n if (doc === void 0) {\n doc = document;\n }\n return doc.createElement(tagName);\n };\n BrowserDomAdapter.prototype.createElementNS = function(ns, tagName, doc) {\n if (doc === void 0) {\n doc = document;\n }\n return doc.createElementNS(ns, tagName);\n };\n BrowserDomAdapter.prototype.createTextNode = function(text, doc) {\n if (doc === void 0) {\n doc = document;\n }\n return doc.createTextNode(text);\n };\n BrowserDomAdapter.prototype.createScriptTag = function(attrName, attrValue, doc) {\n if (doc === void 0) {\n doc = document;\n }\n var el = doc.createElement('SCRIPT');\n el.setAttribute(attrName, attrValue);\n return el;\n };\n BrowserDomAdapter.prototype.createStyleElement = function(css, doc) {\n if (doc === void 0) {\n doc = document;\n }\n var style = doc.createElement('style');\n this.appendChild(style, this.createTextNode(css));\n return style;\n };\n BrowserDomAdapter.prototype.createShadowRoot = function(el) {\n return el.createShadowRoot();\n };\n BrowserDomAdapter.prototype.getShadowRoot = function(el) {\n return el.shadowRoot;\n };\n BrowserDomAdapter.prototype.getHost = function(el) {\n return el.host;\n };\n BrowserDomAdapter.prototype.clone = function(node) {\n return node.cloneNode(true);\n };\n BrowserDomAdapter.prototype.getElementsByClassName = function(element, name) {\n return element.getElementsByClassName(name);\n };\n BrowserDomAdapter.prototype.getElementsByTagName = function(element, name) {\n return element.getElementsByTagName(name);\n };\n BrowserDomAdapter.prototype.classList = function(element) {\n return Array.prototype.slice.call(element.classList, 0);\n };\n BrowserDomAdapter.prototype.addClass = function(element, className) {\n element.classList.add(className);\n };\n BrowserDomAdapter.prototype.removeClass = function(element, className) {\n element.classList.remove(className);\n };\n BrowserDomAdapter.prototype.hasClass = function(element, className) {\n return element.classList.contains(className);\n };\n BrowserDomAdapter.prototype.setStyle = function(element, styleName, styleValue) {\n element.style[styleName] = styleValue;\n };\n BrowserDomAdapter.prototype.removeStyle = function(element, stylename) {\n element.style[stylename] = null;\n };\n BrowserDomAdapter.prototype.getStyle = function(element, stylename) {\n return element.style[stylename];\n };\n BrowserDomAdapter.prototype.hasStyle = function(element, styleName, styleValue) {\n if (styleValue === void 0) {\n styleValue = null;\n }\n var value = this.getStyle(element, styleName) || '';\n return styleValue ? value == styleValue : value.length > 0;\n };\n BrowserDomAdapter.prototype.tagName = function(element) {\n return element.tagName;\n };\n BrowserDomAdapter.prototype.attributeMap = function(element) {\n var res = new Map();\n var elAttrs = element.attributes;\n for (var i = 0; i < elAttrs.length; i++) {\n var attrib = elAttrs[i];\n res.set(attrib.name, attrib.value);\n }\n return res;\n };\n BrowserDomAdapter.prototype.hasAttribute = function(element, attribute) {\n return element.hasAttribute(attribute);\n };\n BrowserDomAdapter.prototype.getAttribute = function(element, attribute) {\n return element.getAttribute(attribute);\n };\n BrowserDomAdapter.prototype.setAttribute = function(element, name, value) {\n element.setAttribute(name, value);\n };\n BrowserDomAdapter.prototype.setAttributeNS = function(element, ns, name, value) {\n element.setAttributeNS(ns, name, value);\n };\n BrowserDomAdapter.prototype.removeAttribute = function(element, attribute) {\n element.removeAttribute(attribute);\n };\n BrowserDomAdapter.prototype.templateAwareRoot = function(el) {\n return this.isTemplateElement(el) ? this.content(el) : el;\n };\n BrowserDomAdapter.prototype.createHtmlDocument = function() {\n return document.implementation.createHTMLDocument('fakeTitle');\n };\n BrowserDomAdapter.prototype.defaultDoc = function() {\n return document;\n };\n BrowserDomAdapter.prototype.getBoundingClientRect = function(el) {\n try {\n return el.getBoundingClientRect();\n } catch (e) {\n return {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n width: 0,\n height: 0\n };\n }\n };\n BrowserDomAdapter.prototype.getTitle = function() {\n return document.title;\n };\n BrowserDomAdapter.prototype.setTitle = function(newTitle) {\n document.title = newTitle || '';\n };\n BrowserDomAdapter.prototype.elementMatches = function(n, selector) {\n var matches = false;\n if (n instanceof HTMLElement) {\n if (n.matches) {\n matches = n.matches(selector);\n } else if (n.msMatchesSelector) {\n matches = n.msMatchesSelector(selector);\n } else if (n.webkitMatchesSelector) {\n matches = n.webkitMatchesSelector(selector);\n }\n }\n return matches;\n };\n BrowserDomAdapter.prototype.isTemplateElement = function(el) {\n return el instanceof HTMLElement && el.nodeName == \"TEMPLATE\";\n };\n BrowserDomAdapter.prototype.isTextNode = function(node) {\n return node.nodeType === Node.TEXT_NODE;\n };\n BrowserDomAdapter.prototype.isCommentNode = function(node) {\n return node.nodeType === Node.COMMENT_NODE;\n };\n BrowserDomAdapter.prototype.isElementNode = function(node) {\n return node.nodeType === Node.ELEMENT_NODE;\n };\n BrowserDomAdapter.prototype.hasShadowRoot = function(node) {\n return node instanceof HTMLElement && lang_1.isPresent(node.shadowRoot);\n };\n BrowserDomAdapter.prototype.isShadowRoot = function(node) {\n return node instanceof DocumentFragment;\n };\n BrowserDomAdapter.prototype.importIntoDoc = function(node) {\n var toImport = node;\n if (this.isTemplateElement(node)) {\n toImport = this.content(node);\n }\n return document.importNode(toImport, true);\n };\n BrowserDomAdapter.prototype.adoptNode = function(node) {\n return document.adoptNode(node);\n };\n BrowserDomAdapter.prototype.getHref = function(el) {\n return el.href;\n };\n BrowserDomAdapter.prototype.getEventKey = function(event) {\n var key = event.key;\n if (lang_1.isBlank(key)) {\n key = event.keyIdentifier;\n if (lang_1.isBlank(key)) {\n return 'Unidentified';\n }\n if (key.startsWith('U+')) {\n key = String.fromCharCode(parseInt(key.substring(2), 16));\n if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) {\n key = _chromeNumKeyPadMap[key];\n }\n }\n }\n if (_keyMap.hasOwnProperty(key)) {\n key = _keyMap[key];\n }\n return key;\n };\n BrowserDomAdapter.prototype.getGlobalEventTarget = function(target) {\n if (target == \"window\") {\n return window;\n } else if (target == \"document\") {\n return document;\n } else if (target == \"body\") {\n return document.body;\n }\n };\n BrowserDomAdapter.prototype.getHistory = function() {\n return window.history;\n };\n BrowserDomAdapter.prototype.getLocation = function() {\n return window.location;\n };\n BrowserDomAdapter.prototype.getBaseHref = function() {\n var href = getBaseElementHref();\n if (lang_1.isBlank(href)) {\n return null;\n }\n return relativePath(href);\n };\n BrowserDomAdapter.prototype.resetBaseElement = function() {\n baseElement = null;\n };\n BrowserDomAdapter.prototype.getUserAgent = function() {\n return window.navigator.userAgent;\n };\n BrowserDomAdapter.prototype.setData = function(element, name, value) {\n this.setAttribute(element, 'data-' + name, value);\n };\n BrowserDomAdapter.prototype.getData = function(element, name) {\n return this.getAttribute(element, 'data-' + name);\n };\n BrowserDomAdapter.prototype.getComputedStyle = function(element) {\n return getComputedStyle(element);\n };\n BrowserDomAdapter.prototype.setGlobalVar = function(path, value) {\n lang_1.setValueOnPath(lang_1.global, path, value);\n };\n BrowserDomAdapter.prototype.requestAnimationFrame = function(callback) {\n return window.requestAnimationFrame(callback);\n };\n BrowserDomAdapter.prototype.cancelAnimationFrame = function(id) {\n window.cancelAnimationFrame(id);\n };\n BrowserDomAdapter.prototype.performanceNow = function() {\n if (lang_1.isPresent(window.performance) && lang_1.isPresent(window.performance.now)) {\n return window.performance.now();\n } else {\n return lang_1.DateWrapper.toMillis(lang_1.DateWrapper.now());\n }\n };\n return BrowserDomAdapter;\n})(generic_browser_adapter_1.GenericBrowserDomAdapter);\nexports.BrowserDomAdapter = BrowserDomAdapter;\nvar baseElement = null;\nfunction getBaseElementHref() {\n if (lang_1.isBlank(baseElement)) {\n baseElement = document.querySelector('base');\n if (lang_1.isBlank(baseElement)) {\n return null;\n }\n }\n return baseElement.getAttribute('href');\n}\nvar urlParsingNode = null;\nfunction relativePath(url) {\n if (lang_1.isBlank(urlParsingNode)) {\n urlParsingNode = document.createElement(\"a\");\n }\n urlParsingNode.setAttribute('href', url);\n return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname : '/' + urlParsingNode.pathname;\n}\n","/* */ \n'use strict';\nvar collection_1 = require('../../facade/collection');\nvar lang_1 = require('../../facade/lang');\nvar dom_adapter_1 = require('../dom/dom_adapter');\nvar core_1 = require('../../../core');\nvar PublicTestability = (function() {\n function PublicTestability(testability) {\n this._testability = testability;\n }\n PublicTestability.prototype.isStable = function() {\n return this._testability.isStable();\n };\n PublicTestability.prototype.whenStable = function(callback) {\n this._testability.whenStable(callback);\n };\n PublicTestability.prototype.findBindings = function(using, provider, exactMatch) {\n return this.findProviders(using, provider, exactMatch);\n };\n PublicTestability.prototype.findProviders = function(using, provider, exactMatch) {\n return this._testability.findBindings(using, provider, exactMatch);\n };\n return PublicTestability;\n})();\nvar BrowserGetTestability = (function() {\n function BrowserGetTestability() {}\n BrowserGetTestability.init = function() {\n core_1.setTestabilityGetter(new BrowserGetTestability());\n };\n BrowserGetTestability.prototype.addToWindow = function(registry) {\n lang_1.global.getAngularTestability = function(elem, findInAncestors) {\n if (findInAncestors === void 0) {\n findInAncestors = true;\n }\n var testability = registry.findTestabilityInTree(elem, findInAncestors);\n if (testability == null) {\n throw new Error('Could not find testability for element.');\n }\n return new PublicTestability(testability);\n };\n lang_1.global.getAllAngularTestabilities = function() {\n var testabilities = registry.getAllTestabilities();\n return testabilities.map(function(testability) {\n return new PublicTestability(testability);\n });\n };\n var whenAllStable = function(callback) {\n var testabilities = lang_1.global.getAllAngularTestabilities();\n var count = testabilities.length;\n var didWork = false;\n var decrement = function(didWork_) {\n didWork = didWork || didWork_;\n count--;\n if (count == 0) {\n callback(didWork);\n }\n };\n testabilities.forEach(function(testability) {\n testability.whenStable(decrement);\n });\n };\n if (!lang_1.global.frameworkStabilizers) {\n lang_1.global.frameworkStabilizers = collection_1.ListWrapper.createGrowableSize(0);\n }\n lang_1.global.frameworkStabilizers.push(whenAllStable);\n };\n BrowserGetTestability.prototype.findTestabilityInTree = function(registry, elem, findInAncestors) {\n if (elem == null) {\n return null;\n }\n var t = registry.getTestability(elem);\n if (lang_1.isPresent(t)) {\n return t;\n } else if (!findInAncestors) {\n return null;\n }\n if (dom_adapter_1.DOM.isShadowRoot(elem)) {\n return this.findTestabilityInTree(registry, dom_adapter_1.DOM.getHost(elem), true);\n }\n return this.findTestabilityInTree(registry, dom_adapter_1.DOM.parentElement(elem), true);\n };\n return BrowserGetTestability;\n})();\nexports.BrowserGetTestability = BrowserGetTestability;\n","/* */ \n'use strict';/**\r\n * This is here because DART requires it. It is noop in JS.\r\n */\r\nfunction wtfInit() { }\r\nexports.wtfInit = wtfInit;\r\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid3RmX2luaXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJhbmd1bGFyMi9zcmMvY29yZS9wcm9maWxlL3d0Zl9pbml0LnRzIl0sIm5hbWVzIjpbInd0ZkluaXQiXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gscUJBQTJCQSxDQUFDQTtBQUFaLGVBQU8sVUFBSyxDQUFBIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBUaGlzIGlzIGhlcmUgYmVjYXVzZSBEQVJUIHJlcXVpcmVzIGl0LiBJdCBpcyBub29wIGluIEpTLlxuICovXG5leHBvcnQgZnVuY3Rpb24gd3RmSW5pdCgpIHt9XG4iXX0=","/* */ \n'use strict';\nvar __extends = (this && this.__extends) || function(d, b) {\n for (var p in b)\n if (b.hasOwnProperty(p))\n d[p] = b[p];\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function(k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(k, v);\n};\nvar dom_adapter_1 = require('../dom_adapter');\nvar core_1 = require('../../../../core');\nvar event_manager_1 = require('./event_manager');\nvar DomEventsPlugin = (function(_super) {\n __extends(DomEventsPlugin, _super);\n function DomEventsPlugin() {\n _super.apply(this, arguments);\n }\n DomEventsPlugin.prototype.supports = function(eventName) {\n return true;\n };\n DomEventsPlugin.prototype.addEventListener = function(element, eventName, handler) {\n var zone = this.manager.getZone();\n var outsideHandler = function(event) {\n return zone.run(function() {\n return handler(event);\n });\n };\n return this.manager.getZone().runOutsideAngular(function() {\n return dom_adapter_1.DOM.onAndCancel(element, eventName, outsideHandler);\n });\n };\n DomEventsPlugin.prototype.addGlobalEventListener = function(target, eventName, handler) {\n var element = dom_adapter_1.DOM.getGlobalEventTarget(target);\n var zone = this.manager.getZone();\n var outsideHandler = function(event) {\n return zone.run(function() {\n return handler(event);\n });\n };\n return this.manager.getZone().runOutsideAngular(function() {\n return dom_adapter_1.DOM.onAndCancel(element, eventName, outsideHandler);\n });\n };\n DomEventsPlugin = __decorate([core_1.Injectable(), __metadata('design:paramtypes', [])], DomEventsPlugin);\n return DomEventsPlugin;\n})(event_manager_1.EventManagerPlugin);\nexports.DomEventsPlugin = DomEventsPlugin;\n","/* */ \n'use strict';\nvar lang_1 = require('../../../facade/lang');\nvar dom_adapter_1 = require('../dom_adapter');\nvar By = (function() {\n function By() {}\n By.all = function() {\n return function(debugElement) {\n return true;\n };\n };\n By.css = function(selector) {\n return function(debugElement) {\n return lang_1.isPresent(debugElement.nativeElement) ? dom_adapter_1.DOM.elementMatches(debugElement.nativeElement, selector) : false;\n };\n };\n By.directive = function(type) {\n return function(debugElement) {\n return debugElement.providerTokens.indexOf(type) !== -1;\n };\n };\n return By;\n})();\nexports.By = By;\n","/* */ \n'use strict';var CssAnimationOptions = (function () {\r\n function CssAnimationOptions() {\r\n /** classes to be added to the element */\r\n this.classesToAdd = [];\r\n /** classes to be removed from the element */\r\n this.classesToRemove = [];\r\n /** classes to be added for the duration of the animation */\r\n this.animationClasses = [];\r\n }\r\n return CssAnimationOptions;\r\n})();\r\nexports.CssAnimationOptions = CssAnimationOptions;\r\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3NzX2FuaW1hdGlvbl9vcHRpb25zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiYW5ndWxhcjIvc3JjL2FuaW1hdGUvY3NzX2FuaW1hdGlvbl9vcHRpb25zLnRzIl0sIm5hbWVzIjpbIkNzc0FuaW1hdGlvbk9wdGlvbnMiLCJDc3NBbmltYXRpb25PcHRpb25zLmNvbnN0cnVjdG9yIl0sIm1hcHBpbmdzIjoiQUFBQTtJQUFBQTtRQU9FQyx5Q0FBeUNBO1FBQ3pDQSxpQkFBWUEsR0FBYUEsRUFBRUEsQ0FBQ0E7UUFFNUJBLDZDQUE2Q0E7UUFDN0NBLG9CQUFlQSxHQUFhQSxFQUFFQSxDQUFDQTtRQUUvQkEsNERBQTREQTtRQUM1REEscUJBQWdCQSxHQUFhQSxFQUFFQSxDQUFDQTtJQU9sQ0EsQ0FBQ0E7SUFBREQsMEJBQUNBO0FBQURBLENBQUNBLEFBckJELElBcUJDO0FBckJZLDJCQUFtQixzQkFxQi9CLENBQUEiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgY2xhc3MgQ3NzQW5pbWF0aW9uT3B0aW9ucyB7XG4gIC8qKiBpbml0aWFsIHN0eWxlcyBmb3IgdGhlIGVsZW1lbnQgKi9cbiAgZnJvbVN0eWxlczoge1trZXk6IHN0cmluZ106IGFueX07XG5cbiAgLyoqIGRlc3RpbmF0aW9uIHN0eWxlcyBmb3IgdGhlIGVsZW1lbnQgKi9cbiAgdG9TdHlsZXM6IHtba2V5OiBzdHJpbmddOiBhbnl9O1xuXG4gIC8qKiBjbGFzc2VzIHRvIGJlIGFkZGVkIHRvIHRoZSBlbGVtZW50ICovXG4gIGNsYXNzZXNUb0FkZDogc3RyaW5nW10gPSBbXTtcblxuICAvKiogY2xhc3NlcyB0byBiZSByZW1vdmVkIGZyb20gdGhlIGVsZW1lbnQgKi9cbiAgY2xhc3Nlc1RvUmVtb3ZlOiBzdHJpbmdbXSA9IFtdO1xuXG4gIC8qKiBjbGFzc2VzIHRvIGJlIGFkZGVkIGZvciB0aGUgZHVyYXRpb24gb2YgdGhlIGFuaW1hdGlvbiAqL1xuICBhbmltYXRpb25DbGFzc2VzOiBzdHJpbmdbXSA9IFtdO1xuXG4gIC8qKiBvdmVycmlkZSB0aGUgZHVyYXRpb24gb2YgdGhlIGFuaW1hdGlvbiAoaW4gbWlsbGlzZWNvbmRzKSAqL1xuICBkdXJhdGlvbjogbnVtYmVyO1xuXG4gIC8qKiBvdmVycmlkZSB0aGUgdHJhbnNpdGlvbiBkZWxheSAoaW4gbWlsbGlzZWNvbmRzKSAqL1xuICBkZWxheTogbnVtYmVyO1xufVxuIl19","/* */ \n'use strict';\nvar lang_1 = require('../facade/lang');\nvar math_1 = require('../facade/math');\nvar util_1 = require('../platform/dom/util');\nvar collection_1 = require('../facade/collection');\nvar dom_adapter_1 = require('../platform/dom/dom_adapter');\nvar Animation = (function() {\n function Animation(element, data, browserDetails) {\n var _this = this;\n this.element = element;\n this.data = data;\n this.browserDetails = browserDetails;\n this.callbacks = [];\n this.eventClearFunctions = [];\n this.completed = false;\n this._stringPrefix = '';\n this.startTime = lang_1.DateWrapper.toMillis(lang_1.DateWrapper.now());\n this._stringPrefix = dom_adapter_1.DOM.getAnimationPrefix();\n this.setup();\n this.wait(function(timestamp) {\n return _this.start();\n });\n }\n Object.defineProperty(Animation.prototype, \"totalTime\", {\n get: function() {\n var delay = this.computedDelay != null ? this.computedDelay : 0;\n var duration = this.computedDuration != null ? this.computedDuration : 0;\n return delay + duration;\n },\n enumerable: true,\n configurable: true\n });\n Animation.prototype.wait = function(callback) {\n this.browserDetails.raf(callback, 2);\n };\n Animation.prototype.setup = function() {\n if (this.data.fromStyles != null)\n this.applyStyles(this.data.fromStyles);\n if (this.data.duration != null)\n this.applyStyles({'transitionDuration': this.data.duration.toString() + 'ms'});\n if (this.data.delay != null)\n this.applyStyles({'transitionDelay': this.data.delay.toString() + 'ms'});\n };\n Animation.prototype.start = function() {\n this.addClasses(this.data.classesToAdd);\n this.addClasses(this.data.animationClasses);\n this.removeClasses(this.data.classesToRemove);\n if (this.data.toStyles != null)\n this.applyStyles(this.data.toStyles);\n var computedStyles = dom_adapter_1.DOM.getComputedStyle(this.element);\n this.computedDelay = math_1.Math.max(this.parseDurationString(computedStyles.getPropertyValue(this._stringPrefix + 'transition-delay')), this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix + 'transition-delay')));\n this.computedDuration = math_1.Math.max(this.parseDurationString(computedStyles.getPropertyValue(this._stringPrefix + 'transition-duration')), this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix + 'transition-duration')));\n this.addEvents();\n };\n Animation.prototype.applyStyles = function(styles) {\n var _this = this;\n collection_1.StringMapWrapper.forEach(styles, function(value, key) {\n var dashCaseKey = util_1.camelCaseToDashCase(key);\n if (lang_1.isPresent(dom_adapter_1.DOM.getStyle(_this.element, dashCaseKey))) {\n dom_adapter_1.DOM.setStyle(_this.element, dashCaseKey, value.toString());\n } else {\n dom_adapter_1.DOM.setStyle(_this.element, _this._stringPrefix + dashCaseKey, value.toString());\n }\n });\n };\n Animation.prototype.addClasses = function(classes) {\n for (var i = 0,\n len = classes.length; i < len; i++)\n dom_adapter_1.DOM.addClass(this.element, classes[i]);\n };\n Animation.prototype.removeClasses = function(classes) {\n for (var i = 0,\n len = classes.length; i < len; i++)\n dom_adapter_1.DOM.removeClass(this.element, classes[i]);\n };\n Animation.prototype.addEvents = function() {\n var _this = this;\n if (this.totalTime > 0) {\n this.eventClearFunctions.push(dom_adapter_1.DOM.onAndCancel(this.element, dom_adapter_1.DOM.getTransitionEnd(), function(event) {\n return _this.handleAnimationEvent(event);\n }));\n } else {\n this.handleAnimationCompleted();\n }\n };\n Animation.prototype.handleAnimationEvent = function(event) {\n var elapsedTime = math_1.Math.round(event.elapsedTime * 1000);\n if (!this.browserDetails.elapsedTimeIncludesDelay)\n elapsedTime += this.computedDelay;\n event.stopPropagation();\n if (elapsedTime >= this.totalTime)\n this.handleAnimationCompleted();\n };\n Animation.prototype.handleAnimationCompleted = function() {\n this.removeClasses(this.data.animationClasses);\n this.callbacks.forEach(function(callback) {\n return callback();\n });\n this.callbacks = [];\n this.eventClearFunctions.forEach(function(fn) {\n return fn();\n });\n this.eventClearFunctions = [];\n this.completed = true;\n };\n Animation.prototype.onComplete = function(callback) {\n if (this.completed) {\n callback();\n } else {\n this.callbacks.push(callback);\n }\n return this;\n };\n Animation.prototype.parseDurationString = function(duration) {\n var maxValue = 0;\n if (duration == null || duration.length < 2) {\n return maxValue;\n } else if (duration.substring(duration.length - 2) == 'ms') {\n var value = lang_1.NumberWrapper.parseInt(this.stripLetters(duration), 10);\n if (value > maxValue)\n maxValue = value;\n } else if (duration.substring(duration.length - 1) == 's') {\n var ms = lang_1.NumberWrapper.parseFloat(this.stripLetters(duration)) * 1000;\n var value = math_1.Math.floor(ms);\n if (value > maxValue)\n maxValue = value;\n }\n return maxValue;\n };\n Animation.prototype.stripLetters = function(str) {\n return lang_1.StringWrapper.replaceAll(str, lang_1.RegExpWrapper.create('[^0-9]+$', ''), '');\n };\n return Animation;\n})();\nexports.Animation = Animation;\n","/* */ \n'use strict';\nvar css_animation_options_1 = require('./css_animation_options');\nvar animation_1 = require('./animation');\nvar CssAnimationBuilder = (function() {\n function CssAnimationBuilder(browserDetails) {\n this.browserDetails = browserDetails;\n this.data = new css_animation_options_1.CssAnimationOptions();\n }\n CssAnimationBuilder.prototype.addAnimationClass = function(className) {\n this.data.animationClasses.push(className);\n return this;\n };\n CssAnimationBuilder.prototype.addClass = function(className) {\n this.data.classesToAdd.push(className);\n return this;\n };\n CssAnimationBuilder.prototype.removeClass = function(className) {\n this.data.classesToRemove.push(className);\n return this;\n };\n CssAnimationBuilder.prototype.setDuration = function(duration) {\n this.data.duration = duration;\n return this;\n };\n CssAnimationBuilder.prototype.setDelay = function(delay) {\n this.data.delay = delay;\n return this;\n };\n CssAnimationBuilder.prototype.setStyles = function(from, to) {\n return this.setFromStyles(from).setToStyles(to);\n };\n CssAnimationBuilder.prototype.setFromStyles = function(from) {\n this.data.fromStyles = from;\n return this;\n };\n CssAnimationBuilder.prototype.setToStyles = function(to) {\n this.data.toStyles = to;\n return this;\n };\n CssAnimationBuilder.prototype.start = function(element) {\n return new animation_1.Animation(element, this.data, this.browserDetails);\n };\n return CssAnimationBuilder;\n})();\nexports.CssAnimationBuilder = CssAnimationBuilder;\n","/* */ \n'use strict';\nvar lang_1 = require('./lang');\nexports.Math = lang_1.global.Math;\nexports.NaN = typeof exports.NaN;\n","/* */ \n'use strict';\nvar __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function(k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(k, v);\n};\nvar di_1 = require('../core/di');\nvar math_1 = require('../facade/math');\nvar dom_adapter_1 = require('../platform/dom/dom_adapter');\nvar BrowserDetails = (function() {\n function BrowserDetails() {\n this.elapsedTimeIncludesDelay = false;\n this.doesElapsedTimeIncludesDelay();\n }\n BrowserDetails.prototype.doesElapsedTimeIncludesDelay = function() {\n var _this = this;\n var div = dom_adapter_1.DOM.createElement('div');\n dom_adapter_1.DOM.setAttribute(div, 'style', \"position: absolute; top: -9999px; left: -9999px; width: 1px;\\n height: 1px; transition: all 1ms linear 1ms;\");\n this.raf(function(timestamp) {\n dom_adapter_1.DOM.on(div, 'transitionend', function(event) {\n var elapsed = math_1.Math.round(event.elapsedTime * 1000);\n _this.elapsedTimeIncludesDelay = elapsed == 2;\n dom_adapter_1.DOM.remove(div);\n });\n dom_adapter_1.DOM.setStyle(div, 'width', '2px');\n }, 2);\n };\n BrowserDetails.prototype.raf = function(callback, frames) {\n if (frames === void 0) {\n frames = 1;\n }\n var queue = new RafQueue(callback, frames);\n return function() {\n return queue.cancel();\n };\n };\n BrowserDetails = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], BrowserDetails);\n return BrowserDetails;\n})();\nexports.BrowserDetails = BrowserDetails;\nvar RafQueue = (function() {\n function RafQueue(callback, frames) {\n this.callback = callback;\n this.frames = frames;\n this._raf();\n }\n RafQueue.prototype._raf = function() {\n var _this = this;\n this.currentFrameId = dom_adapter_1.DOM.requestAnimationFrame(function(timestamp) {\n return _this._nextFrame(timestamp);\n });\n };\n RafQueue.prototype._nextFrame = function(timestamp) {\n this.frames--;\n if (this.frames > 0) {\n this._raf();\n } else {\n this.callback(timestamp);\n }\n };\n RafQueue.prototype.cancel = function() {\n dom_adapter_1.DOM.cancelAnimationFrame(this.currentFrameId);\n this.currentFrameId = null;\n };\n return RafQueue;\n})();\n","/* */ \n'use strict';\nvar __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function(k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(k, v);\n};\nvar di_1 = require('../core/di');\nvar css_animation_builder_1 = require('./css_animation_builder');\nvar browser_details_1 = require('./browser_details');\nvar AnimationBuilder = (function() {\n function AnimationBuilder(browserDetails) {\n this.browserDetails = browserDetails;\n }\n AnimationBuilder.prototype.css = function() {\n return new css_animation_builder_1.CssAnimationBuilder(this.browserDetails);\n };\n AnimationBuilder = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [browser_details_1.BrowserDetails])], AnimationBuilder);\n return AnimationBuilder;\n})();\nexports.AnimationBuilder = AnimationBuilder;\n","/* */ \n'use strict';\nvar __extends = (this && this.__extends) || function(d, b) {\n for (var p in b)\n if (b.hasOwnProperty(p))\n d[p] = b[p];\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function(k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(k, v);\n};\nvar __param = (this && this.__param) || function(paramIndex, decorator) {\n return function(target, key) {\n decorator(target, key, paramIndex);\n };\n};\nvar dom_adapter_1 = require('./dom_adapter');\nvar di_1 = require('../../core/di');\nvar collection_1 = require('../../facade/collection');\nvar dom_tokens_1 = require('./dom_tokens');\nvar SharedStylesHost = (function() {\n function SharedStylesHost() {\n this._styles = [];\n this._stylesSet = new Set();\n }\n SharedStylesHost.prototype.addStyles = function(styles) {\n var _this = this;\n var additions = [];\n styles.forEach(function(style) {\n if (!collection_1.SetWrapper.has(_this._stylesSet, style)) {\n _this._stylesSet.add(style);\n _this._styles.push(style);\n additions.push(style);\n }\n });\n this.onStylesAdded(additions);\n };\n SharedStylesHost.prototype.onStylesAdded = function(additions) {};\n SharedStylesHost.prototype.getAllStyles = function() {\n return this._styles;\n };\n SharedStylesHost = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], SharedStylesHost);\n return SharedStylesHost;\n})();\nexports.SharedStylesHost = SharedStylesHost;\nvar DomSharedStylesHost = (function(_super) {\n __extends(DomSharedStylesHost, _super);\n function DomSharedStylesHost(doc) {\n _super.call(this);\n this._hostNodes = new Set();\n this._hostNodes.add(doc.head);\n }\n DomSharedStylesHost.prototype._addStylesToHost = function(styles, host) {\n for (var i = 0; i < styles.length; i++) {\n var style = styles[i];\n dom_adapter_1.DOM.appendChild(host, dom_adapter_1.DOM.createStyleElement(style));\n }\n };\n DomSharedStylesHost.prototype.addHost = function(hostNode) {\n this._addStylesToHost(this._styles, hostNode);\n this._hostNodes.add(hostNode);\n };\n DomSharedStylesHost.prototype.removeHost = function(hostNode) {\n collection_1.SetWrapper.delete(this._hostNodes, hostNode);\n };\n DomSharedStylesHost.prototype.onStylesAdded = function(additions) {\n var _this = this;\n this._hostNodes.forEach(function(hostNode) {\n _this._addStylesToHost(additions, hostNode);\n });\n };\n DomSharedStylesHost = __decorate([di_1.Injectable(), __param(0, di_1.Inject(dom_tokens_1.DOCUMENT)), __metadata('design:paramtypes', [Object])], DomSharedStylesHost);\n return DomSharedStylesHost;\n})(SharedStylesHost);\nexports.DomSharedStylesHost = DomSharedStylesHost;\n","/* */ \n'use strict';\nvar __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function(k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(k, v);\n};\nvar __param = (this && this.__param) || function(paramIndex, decorator) {\n return function(target, key) {\n decorator(target, key, paramIndex);\n };\n};\nvar lang_1 = require('../../../facade/lang');\nvar exceptions_1 = require('../../../facade/exceptions');\nvar di_1 = require('../../../core/di');\nvar ng_zone_1 = require('../../../core/zone/ng_zone');\nvar collection_1 = require('../../../facade/collection');\nexports.EVENT_MANAGER_PLUGINS = lang_1.CONST_EXPR(new di_1.OpaqueToken(\"EventManagerPlugins\"));\nvar EventManager = (function() {\n function EventManager(plugins, _zone) {\n var _this = this;\n this._zone = _zone;\n plugins.forEach(function(p) {\n return p.manager = _this;\n });\n this._plugins = collection_1.ListWrapper.reversed(plugins);\n }\n EventManager.prototype.addEventListener = function(element, eventName, handler) {\n var plugin = this._findPluginFor(eventName);\n return plugin.addEventListener(element, eventName, handler);\n };\n EventManager.prototype.addGlobalEventListener = function(target, eventName, handler) {\n var plugin = this._findPluginFor(eventName);\n return plugin.addGlobalEventListener(target, eventName, handler);\n };\n EventManager.prototype.getZone = function() {\n return this._zone;\n };\n EventManager.prototype._findPluginFor = function(eventName) {\n var plugins = this._plugins;\n for (var i = 0; i < plugins.length; i++) {\n var plugin = plugins[i];\n if (plugin.supports(eventName)) {\n return plugin;\n }\n }\n throw new exceptions_1.BaseException(\"No event manager plugin found for event \" + eventName);\n };\n EventManager = __decorate([di_1.Injectable(), __param(0, di_1.Inject(exports.EVENT_MANAGER_PLUGINS)), __metadata('design:paramtypes', [Array, ng_zone_1.NgZone])], EventManager);\n return EventManager;\n})();\nexports.EventManager = EventManager;\nvar EventManagerPlugin = (function() {\n function EventManagerPlugin() {}\n EventManagerPlugin.prototype.supports = function(eventName) {\n return false;\n };\n EventManagerPlugin.prototype.addEventListener = function(element, eventName, handler) {\n throw \"not implemented\";\n };\n EventManagerPlugin.prototype.addGlobalEventListener = function(element, eventName, handler) {\n throw \"not implemented\";\n };\n return EventManagerPlugin;\n})();\nexports.EventManagerPlugin = EventManagerPlugin;\n","/* */ \n'use strict';\nvar di_1 = require('../../core/di');\nvar lang_1 = require('../../facade/lang');\nexports.DOCUMENT = lang_1.CONST_EXPR(new di_1.OpaqueToken('DocumentToken'));\n","/* */ \n'use strict';\nvar lang_1 = require('../../facade/lang');\nvar CAMEL_CASE_REGEXP = /([A-Z])/g;\nvar DASH_CASE_REGEXP = /-([a-z])/g;\nfunction camelCaseToDashCase(input) {\n return lang_1.StringWrapper.replaceAllMapped(input, CAMEL_CASE_REGEXP, function(m) {\n return '-' + m[1].toLowerCase();\n });\n}\nexports.camelCaseToDashCase = camelCaseToDashCase;\nfunction dashCaseToCamelCase(input) {\n return lang_1.StringWrapper.replaceAllMapped(input, DASH_CASE_REGEXP, function(m) {\n return m[1].toUpperCase();\n });\n}\nexports.dashCaseToCamelCase = dashCaseToCamelCase;\n","/* */ \n'use strict';\nvar __extends = (this && this.__extends) || function(d, b) {\n for (var p in b)\n if (b.hasOwnProperty(p))\n d[p] = b[p];\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function(k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(k, v);\n};\nvar __param = (this && this.__param) || function(paramIndex, decorator) {\n return function(target, key) {\n decorator(target, key, paramIndex);\n };\n};\nvar di_1 = require('../../core/di');\nvar animation_builder_1 = require('../../animate/animation_builder');\nvar lang_1 = require('../../facade/lang');\nvar exceptions_1 = require('../../facade/exceptions');\nvar shared_styles_host_1 = require('./shared_styles_host');\nvar event_manager_1 = require('./events/event_manager');\nvar dom_tokens_1 = require('./dom_tokens');\nvar metadata_1 = require('../../core/metadata');\nvar dom_adapter_1 = require('./dom_adapter');\nvar util_1 = require('./util');\nvar NAMESPACE_URIS = lang_1.CONST_EXPR({\n 'xlink': 'http://www.w3.org/1999/xlink',\n 'svg': 'http://www.w3.org/2000/svg'\n});\nvar TEMPLATE_COMMENT_TEXT = 'template bindings={}';\nvar TEMPLATE_BINDINGS_EXP = /^template bindings=(.*)$/g;\nvar DomRootRenderer = (function() {\n function DomRootRenderer(document, eventManager, sharedStylesHost, animate) {\n this.document = document;\n this.eventManager = eventManager;\n this.sharedStylesHost = sharedStylesHost;\n this.animate = animate;\n this._registeredComponents = new Map();\n }\n DomRootRenderer.prototype.renderComponent = function(componentProto) {\n var renderer = this._registeredComponents.get(componentProto.id);\n if (lang_1.isBlank(renderer)) {\n renderer = new DomRenderer(this, componentProto);\n this._registeredComponents.set(componentProto.id, renderer);\n }\n return renderer;\n };\n return DomRootRenderer;\n})();\nexports.DomRootRenderer = DomRootRenderer;\nvar DomRootRenderer_ = (function(_super) {\n __extends(DomRootRenderer_, _super);\n function DomRootRenderer_(_document, _eventManager, sharedStylesHost, animate) {\n _super.call(this, _document, _eventManager, sharedStylesHost, animate);\n }\n DomRootRenderer_ = __decorate([di_1.Injectable(), __param(0, di_1.Inject(dom_tokens_1.DOCUMENT)), __metadata('design:paramtypes', [Object, event_manager_1.EventManager, shared_styles_host_1.DomSharedStylesHost, animation_builder_1.AnimationBuilder])], DomRootRenderer_);\n return DomRootRenderer_;\n})(DomRootRenderer);\nexports.DomRootRenderer_ = DomRootRenderer_;\nvar DomRenderer = (function() {\n function DomRenderer(_rootRenderer, componentProto) {\n this._rootRenderer = _rootRenderer;\n this.componentProto = componentProto;\n this._styles = _flattenStyles(componentProto.id, componentProto.styles, []);\n if (componentProto.encapsulation !== metadata_1.ViewEncapsulation.Native) {\n this._rootRenderer.sharedStylesHost.addStyles(this._styles);\n }\n if (this.componentProto.encapsulation === metadata_1.ViewEncapsulation.Emulated) {\n this._contentAttr = _shimContentAttribute(componentProto.id);\n this._hostAttr = _shimHostAttribute(componentProto.id);\n } else {\n this._contentAttr = null;\n this._hostAttr = null;\n }\n }\n DomRenderer.prototype.renderComponent = function(componentProto) {\n return this._rootRenderer.renderComponent(componentProto);\n };\n DomRenderer.prototype.selectRootElement = function(selector) {\n var el = dom_adapter_1.DOM.querySelector(this._rootRenderer.document, selector);\n if (lang_1.isBlank(el)) {\n throw new exceptions_1.BaseException(\"The selector \\\"\" + selector + \"\\\" did not match any elements\");\n }\n dom_adapter_1.DOM.clearNodes(el);\n return el;\n };\n DomRenderer.prototype.createElement = function(parent, name) {\n var nsAndName = splitNamespace(name);\n var el = lang_1.isPresent(nsAndName[0]) ? dom_adapter_1.DOM.createElementNS(NAMESPACE_URIS[nsAndName[0]], nsAndName[1]) : dom_adapter_1.DOM.createElement(nsAndName[1]);\n if (lang_1.isPresent(this._contentAttr)) {\n dom_adapter_1.DOM.setAttribute(el, this._contentAttr, '');\n }\n if (lang_1.isPresent(parent)) {\n dom_adapter_1.DOM.appendChild(parent, el);\n }\n return el;\n };\n DomRenderer.prototype.createViewRoot = function(hostElement) {\n var nodesParent;\n if (this.componentProto.encapsulation === metadata_1.ViewEncapsulation.Native) {\n nodesParent = dom_adapter_1.DOM.createShadowRoot(hostElement);\n this._rootRenderer.sharedStylesHost.addHost(nodesParent);\n for (var i = 0; i < this._styles.length; i++) {\n dom_adapter_1.DOM.appendChild(nodesParent, dom_adapter_1.DOM.createStyleElement(this._styles[i]));\n }\n } else {\n if (lang_1.isPresent(this._hostAttr)) {\n dom_adapter_1.DOM.setAttribute(hostElement, this._hostAttr, '');\n }\n nodesParent = hostElement;\n }\n return nodesParent;\n };\n DomRenderer.prototype.createTemplateAnchor = function(parentElement) {\n var comment = dom_adapter_1.DOM.createComment(TEMPLATE_COMMENT_TEXT);\n if (lang_1.isPresent(parentElement)) {\n dom_adapter_1.DOM.appendChild(parentElement, comment);\n }\n return comment;\n };\n DomRenderer.prototype.createText = function(parentElement, value) {\n var node = dom_adapter_1.DOM.createTextNode(value);\n if (lang_1.isPresent(parentElement)) {\n dom_adapter_1.DOM.appendChild(parentElement, node);\n }\n return node;\n };\n DomRenderer.prototype.projectNodes = function(parentElement, nodes) {\n if (lang_1.isBlank(parentElement))\n return;\n appendNodes(parentElement, nodes);\n };\n DomRenderer.prototype.attachViewAfter = function(node, viewRootNodes) {\n moveNodesAfterSibling(node, viewRootNodes);\n for (var i = 0; i < viewRootNodes.length; i++)\n this.animateNodeEnter(viewRootNodes[i]);\n };\n DomRenderer.prototype.detachView = function(viewRootNodes) {\n for (var i = 0; i < viewRootNodes.length; i++) {\n var node = viewRootNodes[i];\n dom_adapter_1.DOM.remove(node);\n this.animateNodeLeave(node);\n }\n };\n DomRenderer.prototype.destroyView = function(hostElement, viewAllNodes) {\n if (this.componentProto.encapsulation === metadata_1.ViewEncapsulation.Native && lang_1.isPresent(hostElement)) {\n this._rootRenderer.sharedStylesHost.removeHost(dom_adapter_1.DOM.getShadowRoot(hostElement));\n }\n };\n DomRenderer.prototype.listen = function(renderElement, name, callback) {\n return this._rootRenderer.eventManager.addEventListener(renderElement, name, decoratePreventDefault(callback));\n };\n DomRenderer.prototype.listenGlobal = function(target, name, callback) {\n return this._rootRenderer.eventManager.addGlobalEventListener(target, name, decoratePreventDefault(callback));\n };\n DomRenderer.prototype.setElementProperty = function(renderElement, propertyName, propertyValue) {\n dom_adapter_1.DOM.setProperty(renderElement, propertyName, propertyValue);\n };\n DomRenderer.prototype.setElementAttribute = function(renderElement, attributeName, attributeValue) {\n var attrNs;\n var nsAndName = splitNamespace(attributeName);\n if (lang_1.isPresent(nsAndName[0])) {\n attributeName = nsAndName[0] + ':' + nsAndName[1];\n attrNs = NAMESPACE_URIS[nsAndName[0]];\n }\n if (lang_1.isPresent(attributeValue)) {\n if (lang_1.isPresent(attrNs)) {\n dom_adapter_1.DOM.setAttributeNS(renderElement, attrNs, attributeName, attributeValue);\n } else {\n dom_adapter_1.DOM.setAttribute(renderElement, nsAndName[1], attributeValue);\n }\n } else {\n dom_adapter_1.DOM.removeAttribute(renderElement, attributeName);\n }\n };\n DomRenderer.prototype.setBindingDebugInfo = function(renderElement, propertyName, propertyValue) {\n var dashCasedPropertyName = util_1.camelCaseToDashCase(propertyName);\n if (dom_adapter_1.DOM.isCommentNode(renderElement)) {\n var existingBindings = lang_1.RegExpWrapper.firstMatch(TEMPLATE_BINDINGS_EXP, lang_1.StringWrapper.replaceAll(dom_adapter_1.DOM.getText(renderElement), /\\n/g, ''));\n var parsedBindings = lang_1.Json.parse(existingBindings[1]);\n parsedBindings[dashCasedPropertyName] = propertyValue;\n dom_adapter_1.DOM.setText(renderElement, lang_1.StringWrapper.replace(TEMPLATE_COMMENT_TEXT, '{}', lang_1.Json.stringify(parsedBindings)));\n } else {\n this.setElementAttribute(renderElement, propertyName, propertyValue);\n }\n };\n DomRenderer.prototype.setElementDebugInfo = function(renderElement, info) {};\n DomRenderer.prototype.setElementClass = function(renderElement, className, isAdd) {\n if (isAdd) {\n dom_adapter_1.DOM.addClass(renderElement, className);\n } else {\n dom_adapter_1.DOM.removeClass(renderElement, className);\n }\n };\n DomRenderer.prototype.setElementStyle = function(renderElement, styleName, styleValue) {\n if (lang_1.isPresent(styleValue)) {\n dom_adapter_1.DOM.setStyle(renderElement, styleName, lang_1.stringify(styleValue));\n } else {\n dom_adapter_1.DOM.removeStyle(renderElement, styleName);\n }\n };\n DomRenderer.prototype.invokeElementMethod = function(renderElement, methodName, args) {\n dom_adapter_1.DOM.invoke(renderElement, methodName, args);\n };\n DomRenderer.prototype.setText = function(renderNode, text) {\n dom_adapter_1.DOM.setText(renderNode, text);\n };\n DomRenderer.prototype.animateNodeEnter = function(node) {\n if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.hasClass(node, 'ng-animate')) {\n dom_adapter_1.DOM.addClass(node, 'ng-enter');\n this._rootRenderer.animate.css().addAnimationClass('ng-enter-active').start(node).onComplete(function() {\n dom_adapter_1.DOM.removeClass(node, 'ng-enter');\n });\n }\n };\n DomRenderer.prototype.animateNodeLeave = function(node) {\n if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.hasClass(node, 'ng-animate')) {\n dom_adapter_1.DOM.addClass(node, 'ng-leave');\n this._rootRenderer.animate.css().addAnimationClass('ng-leave-active').start(node).onComplete(function() {\n dom_adapter_1.DOM.removeClass(node, 'ng-leave');\n dom_adapter_1.DOM.remove(node);\n });\n } else {\n dom_adapter_1.DOM.remove(node);\n }\n };\n return DomRenderer;\n})();\nexports.DomRenderer = DomRenderer;\nfunction moveNodesAfterSibling(sibling, nodes) {\n var parent = dom_adapter_1.DOM.parentElement(sibling);\n if (nodes.length > 0 && lang_1.isPresent(parent)) {\n var nextSibling = dom_adapter_1.DOM.nextSibling(sibling);\n if (lang_1.isPresent(nextSibling)) {\n for (var i = 0; i < nodes.length; i++) {\n dom_adapter_1.DOM.insertBefore(nextSibling, nodes[i]);\n }\n } else {\n for (var i = 0; i < nodes.length; i++) {\n dom_adapter_1.DOM.appendChild(parent, nodes[i]);\n }\n }\n }\n}\nfunction appendNodes(parent, nodes) {\n for (var i = 0; i < nodes.length; i++) {\n dom_adapter_1.DOM.appendChild(parent, nodes[i]);\n }\n}\nfunction decoratePreventDefault(eventHandler) {\n return function(event) {\n var allowDefaultBehavior = eventHandler(event);\n if (allowDefaultBehavior === false) {\n dom_adapter_1.DOM.preventDefault(event);\n }\n };\n}\nvar COMPONENT_REGEX = /%COMP%/g;\nexports.COMPONENT_VARIABLE = '%COMP%';\nexports.HOST_ATTR = \"_nghost-\" + exports.COMPONENT_VARIABLE;\nexports.CONTENT_ATTR = \"_ngcontent-\" + exports.COMPONENT_VARIABLE;\nfunction _shimContentAttribute(componentShortId) {\n return lang_1.StringWrapper.replaceAll(exports.CONTENT_ATTR, COMPONENT_REGEX, componentShortId);\n}\nfunction _shimHostAttribute(componentShortId) {\n return lang_1.StringWrapper.replaceAll(exports.HOST_ATTR, COMPONENT_REGEX, componentShortId);\n}\nfunction _flattenStyles(compId, styles, target) {\n for (var i = 0; i < styles.length; i++) {\n var style = styles[i];\n if (lang_1.isArray(style)) {\n _flattenStyles(compId, style, target);\n } else {\n style = lang_1.StringWrapper.replaceAll(style, COMPONENT_REGEX, compId);\n target.push(style);\n }\n }\n return target;\n}\nvar NS_PREFIX_RE = /^@([^:]+):(.+)/g;\nfunction splitNamespace(name) {\n if (name[0] != '@') {\n return [null, name];\n }\n var match = lang_1.RegExpWrapper.firstMatch(NS_PREFIX_RE, name);\n return [match[1], match[2]];\n}\n","/* */ \n'use strict';\nvar lang_1 = require('../../facade/lang');\nvar debug_node_1 = require('./debug_node');\nvar DebugDomRootRenderer = (function() {\n function DebugDomRootRenderer(_delegate) {\n this._delegate = _delegate;\n }\n DebugDomRootRenderer.prototype.renderComponent = function(componentProto) {\n return new DebugDomRenderer(this, this._delegate.renderComponent(componentProto));\n };\n return DebugDomRootRenderer;\n})();\nexports.DebugDomRootRenderer = DebugDomRootRenderer;\nvar DebugDomRenderer = (function() {\n function DebugDomRenderer(_rootRenderer, _delegate) {\n this._rootRenderer = _rootRenderer;\n this._delegate = _delegate;\n }\n DebugDomRenderer.prototype.renderComponent = function(componentType) {\n return this._rootRenderer.renderComponent(componentType);\n };\n DebugDomRenderer.prototype.selectRootElement = function(selector) {\n var nativeEl = this._delegate.selectRootElement(selector);\n var debugEl = new debug_node_1.DebugElement(nativeEl, null);\n debug_node_1.indexDebugNode(debugEl);\n return nativeEl;\n };\n DebugDomRenderer.prototype.createElement = function(parentElement, name) {\n var nativeEl = this._delegate.createElement(parentElement, name);\n var debugEl = new debug_node_1.DebugElement(nativeEl, debug_node_1.getDebugNode(parentElement));\n debugEl.name = name;\n debug_node_1.indexDebugNode(debugEl);\n return nativeEl;\n };\n DebugDomRenderer.prototype.createViewRoot = function(hostElement) {\n return this._delegate.createViewRoot(hostElement);\n };\n DebugDomRenderer.prototype.createTemplateAnchor = function(parentElement) {\n var comment = this._delegate.createTemplateAnchor(parentElement);\n var debugEl = new debug_node_1.DebugNode(comment, debug_node_1.getDebugNode(parentElement));\n debug_node_1.indexDebugNode(debugEl);\n return comment;\n };\n DebugDomRenderer.prototype.createText = function(parentElement, value) {\n var text = this._delegate.createText(parentElement, value);\n var debugEl = new debug_node_1.DebugNode(text, debug_node_1.getDebugNode(parentElement));\n debug_node_1.indexDebugNode(debugEl);\n return text;\n };\n DebugDomRenderer.prototype.projectNodes = function(parentElement, nodes) {\n var debugParent = debug_node_1.getDebugNode(parentElement);\n if (lang_1.isPresent(debugParent) && debugParent instanceof debug_node_1.DebugElement) {\n nodes.forEach(function(node) {\n debugParent.addChild(debug_node_1.getDebugNode(node));\n });\n }\n return this._delegate.projectNodes(parentElement, nodes);\n };\n DebugDomRenderer.prototype.attachViewAfter = function(node, viewRootNodes) {\n var debugNode = debug_node_1.getDebugNode(node);\n if (lang_1.isPresent(debugNode)) {\n var debugParent = debugNode.parent;\n if (viewRootNodes.length > 0 && lang_1.isPresent(debugParent)) {\n var debugViewRootNodes = [];\n viewRootNodes.forEach(function(rootNode) {\n return debugViewRootNodes.push(debug_node_1.getDebugNode(rootNode));\n });\n debugParent.insertChildrenAfter(debugNode, debugViewRootNodes);\n }\n }\n return this._delegate.attachViewAfter(node, viewRootNodes);\n };\n DebugDomRenderer.prototype.detachView = function(viewRootNodes) {\n viewRootNodes.forEach(function(node) {\n var debugNode = debug_node_1.getDebugNode(node);\n if (lang_1.isPresent(debugNode) && lang_1.isPresent(debugNode.parent)) {\n debugNode.parent.removeChild(debugNode);\n }\n });\n return this._delegate.detachView(viewRootNodes);\n };\n DebugDomRenderer.prototype.destroyView = function(hostElement, viewAllNodes) {\n viewAllNodes.forEach(function(node) {\n debug_node_1.removeDebugNodeFromIndex(debug_node_1.getDebugNode(node));\n });\n return this._delegate.destroyView(hostElement, viewAllNodes);\n };\n DebugDomRenderer.prototype.listen = function(renderElement, name, callback) {\n var debugEl = debug_node_1.getDebugNode(renderElement);\n if (lang_1.isPresent(debugEl)) {\n debugEl.listeners.push(new debug_node_1.EventListener(name, callback));\n }\n return this._delegate.listen(renderElement, name, callback);\n };\n DebugDomRenderer.prototype.listenGlobal = function(target, name, callback) {\n return this._delegate.listenGlobal(target, name, callback);\n };\n DebugDomRenderer.prototype.setElementProperty = function(renderElement, propertyName, propertyValue) {\n var debugEl = debug_node_1.getDebugNode(renderElement);\n if (lang_1.isPresent(debugEl) && debugEl instanceof debug_node_1.DebugElement) {\n debugEl.properties.set(propertyName, propertyValue);\n }\n return this._delegate.setElementProperty(renderElement, propertyName, propertyValue);\n };\n DebugDomRenderer.prototype.setElementAttribute = function(renderElement, attributeName, attributeValue) {\n var debugEl = debug_node_1.getDebugNode(renderElement);\n if (lang_1.isPresent(debugEl) && debugEl instanceof debug_node_1.DebugElement) {\n debugEl.attributes.set(attributeName, attributeValue);\n }\n return this._delegate.setElementAttribute(renderElement, attributeName, attributeValue);\n };\n DebugDomRenderer.prototype.setBindingDebugInfo = function(renderElement, propertyName, propertyValue) {\n return this._delegate.setBindingDebugInfo(renderElement, propertyName, propertyValue);\n };\n DebugDomRenderer.prototype.setElementDebugInfo = function(renderElement, info) {\n var debugEl = debug_node_1.getDebugNode(renderElement);\n debugEl.setDebugInfo(info);\n return this._delegate.setElementDebugInfo(renderElement, info);\n };\n DebugDomRenderer.prototype.setElementClass = function(renderElement, className, isAdd) {\n return this._delegate.setElementClass(renderElement, className, isAdd);\n };\n DebugDomRenderer.prototype.setElementStyle = function(renderElement, styleName, styleValue) {\n return this._delegate.setElementStyle(renderElement, styleName, styleValue);\n };\n DebugDomRenderer.prototype.invokeElementMethod = function(renderElement, methodName, args) {\n return this._delegate.invokeElementMethod(renderElement, methodName, args);\n };\n DebugDomRenderer.prototype.setText = function(renderNode, text) {\n return this._delegate.setText(renderNode, text);\n };\n return DebugDomRenderer;\n})();\nexports.DebugDomRenderer = DebugDomRenderer;\n","/* */ \n'use strict';\nvar lang_1 = require('../../../facade/lang');\nvar di_1 = require('../../../core/di');\nvar dom_adapter_1 = require('../dom_adapter');\nvar debug_node_1 = require('../../../core/debug/debug_node');\nvar dom_renderer_1 = require('../dom_renderer');\nvar core_1 = require('../../../../core');\nvar debug_renderer_1 = require('../../../core/debug/debug_renderer');\nvar INSPECT_GLOBAL_NAME = 'ng.probe';\nfunction inspectNativeElement(element) {\n return debug_node_1.getDebugNode(element);\n}\nexports.inspectNativeElement = inspectNativeElement;\nfunction _createConditionalRootRenderer(rootRenderer) {\n if (lang_1.assertionsEnabled()) {\n return _createRootRenderer(rootRenderer);\n }\n return rootRenderer;\n}\nfunction _createRootRenderer(rootRenderer) {\n dom_adapter_1.DOM.setGlobalVar(INSPECT_GLOBAL_NAME, inspectNativeElement);\n return new debug_renderer_1.DebugDomRootRenderer(rootRenderer);\n}\nexports.ELEMENT_PROBE_PROVIDERS = lang_1.CONST_EXPR([new di_1.Provider(core_1.RootRenderer, {\n useFactory: _createConditionalRootRenderer,\n deps: [dom_renderer_1.DomRootRenderer]\n})]);\nexports.ELEMENT_PROBE_PROVIDERS_PROD_MODE = lang_1.CONST_EXPR([new di_1.Provider(core_1.RootRenderer, {\n useFactory: _createRootRenderer,\n deps: [dom_renderer_1.DomRootRenderer]\n})]);\n","/* */ \n'use strict';\nfunction __export(m) {\n for (var p in m)\n if (!exports.hasOwnProperty(p))\n exports[p] = m[p];\n}\nvar dom_adapter_1 = require('../src/platform/dom/dom_adapter');\nexports.DOM = dom_adapter_1.DOM;\nexports.setRootDomAdapter = dom_adapter_1.setRootDomAdapter;\nexports.DomAdapter = dom_adapter_1.DomAdapter;\nvar dom_renderer_1 = require('../src/platform/dom/dom_renderer');\nexports.DomRenderer = dom_renderer_1.DomRenderer;\nvar dom_tokens_1 = require('../src/platform/dom/dom_tokens');\nexports.DOCUMENT = dom_tokens_1.DOCUMENT;\nvar shared_styles_host_1 = require('../src/platform/dom/shared_styles_host');\nexports.SharedStylesHost = shared_styles_host_1.SharedStylesHost;\nexports.DomSharedStylesHost = shared_styles_host_1.DomSharedStylesHost;\nvar dom_events_1 = require('../src/platform/dom/events/dom_events');\nexports.DomEventsPlugin = dom_events_1.DomEventsPlugin;\nvar event_manager_1 = require('../src/platform/dom/events/event_manager');\nexports.EVENT_MANAGER_PLUGINS = event_manager_1.EVENT_MANAGER_PLUGINS;\nexports.EventManager = event_manager_1.EventManager;\nexports.EventManagerPlugin = event_manager_1.EventManagerPlugin;\n__export(require('../src/platform/dom/debug/by'));\n__export(require('../src/platform/dom/debug/ng_probe'));\n","/* */ \n'use strict';\nvar dom_adapter_1 = require('../dom/dom_adapter');\nvar Title = (function() {\n function Title() {}\n Title.prototype.getTitle = function() {\n return dom_adapter_1.DOM.getTitle();\n };\n Title.prototype.setTitle = function(newTitle) {\n dom_adapter_1.DOM.setTitle(newTitle);\n };\n return Title;\n})();\nexports.Title = Title;\n","/* */ \n'use strict';/**\r\n * JS version of browser APIs. This library can only run in the browser.\r\n */\r\nvar win = window;\r\nexports.window = win;\r\nexports.document = window.document;\r\nexports.location = window.location;\r\nexports.gc = window['gc'] ? function () { return window['gc'](); } : function () { return null; };\r\nexports.performance = window['performance'] ? window['performance'] : null;\r\nexports.Event = window['Event'];\r\nexports.MouseEvent = window['MouseEvent'];\r\nexports.KeyboardEvent = window['KeyboardEvent'];\r\nexports.EventTarget = window['EventTarget'];\r\nexports.History = window['History'];\r\nexports.Location = window['Location'];\r\nexports.EventListener = window['EventListener'];\r\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnJvd3Nlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImFuZ3VsYXIyL3NyYy9mYWNhZGUvYnJvd3Nlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUNILElBQUksR0FBRyxHQUFHLE1BQU07QUFFRCxjQUFNLE9BRko7QUFHTixnQkFBUSxHQUFHLE1BQU0sQ0FBQyxRQUFRLENBQUM7QUFDM0IsZ0JBQVEsR0FBRyxNQUFNLENBQUMsUUFBUSxDQUFDO0FBQzNCLFVBQUUsR0FBRyxNQUFNLENBQUMsSUFBSSxDQUFDLEdBQUcsY0FBTSxPQUFBLE1BQU0sQ0FBQyxJQUFJLENBQUMsRUFBRSxFQUFkLENBQWMsR0FBRyxjQUFNLE9BQUEsSUFBSSxFQUFKLENBQUksQ0FBQztBQUN0RCxtQkFBVyxHQUFHLE1BQU0sQ0FBQyxhQUFhLENBQUMsR0FBRyxNQUFNLENBQUMsYUFBYSxDQUFDLE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V5Ym9hcmRFdmVudCddO1xuZXhwb3J0IGNvbnN0IEV2ZW50VGFyZ2V0ID0gd2luZG93WydFdmVudFRhcmdldCddO1xuZXhwb3J0IGNvbnN0IEhpc3RvcnkgPSB3aW5kb3dbJ0hpc3RvcnknXTtcbmV4cG9ydCBjb25zdCBMb2NhdGlvbiA9IHdpbmRvd1snTG9jYXRpb24nXTtcbmV4cG9ydCBjb25zdCBFdmVudExpc3RlbmVyID0gd2luZG93WydFdmVudExpc3RlbmVyJ107XG4iXX0=","/* */ \n'use strict';\nvar application_ref_1 = require('../../../core/application_ref');\nvar lang_1 = require('../../../facade/lang');\nvar browser_1 = require('../../../facade/browser');\nvar dom_adapter_1 = require('../../dom/dom_adapter');\nvar AngularTools = (function() {\n function AngularTools(ref) {\n this.profiler = new AngularProfiler(ref);\n }\n return AngularTools;\n})();\nexports.AngularTools = AngularTools;\nvar AngularProfiler = (function() {\n function AngularProfiler(ref) {\n this.appRef = ref.injector.get(application_ref_1.ApplicationRef);\n }\n AngularProfiler.prototype.timeChangeDetection = function(config) {\n var record = lang_1.isPresent(config) && config['record'];\n var profileName = 'Change Detection';\n var isProfilerAvailable = lang_1.isPresent(browser_1.window.console.profile);\n if (record && isProfilerAvailable) {\n browser_1.window.console.profile(profileName);\n }\n var start = dom_adapter_1.DOM.performanceNow();\n var numTicks = 0;\n while (numTicks < 5 || (dom_adapter_1.DOM.performanceNow() - start) < 500) {\n this.appRef.tick();\n numTicks++;\n }\n var end = dom_adapter_1.DOM.performanceNow();\n if (record && isProfilerAvailable) {\n browser_1.window.console.profileEnd(profileName);\n }\n var msPerTick = (end - start) / numTicks;\n browser_1.window.console.log(\"ran \" + numTicks + \" change detection cycles\");\n browser_1.window.console.log(lang_1.NumberWrapper.toFixed(msPerTick, 2) + \" ms per check\");\n };\n return AngularProfiler;\n})();\nexports.AngularProfiler = AngularProfiler;\n","/* */ \n'use strict';\nvar lang_1 = require('../../../facade/lang');\nvar common_tools_1 = require('./common_tools');\nvar context = lang_1.global;\nfunction enableDebugTools(ref) {\n context.ng = new common_tools_1.AngularTools(ref);\n}\nexports.enableDebugTools = enableDebugTools;\nfunction disableDebugTools() {\n delete context.ng;\n}\nexports.disableDebugTools = disableDebugTools;\n","/* */ \n'use strict';\nvar lang_1 = require('../facade/lang');\nvar di_1 = require('../core/di');\nvar core_1 = require('../../core');\nvar common_1 = require('../../common');\nvar testability_1 = require('../core/testability/testability');\nvar dom_adapter_1 = require('./dom/dom_adapter');\nvar dom_events_1 = require('./dom/events/dom_events');\nvar key_events_1 = require('./dom/events/key_events');\nvar hammer_gestures_1 = require('./dom/events/hammer_gestures');\nvar dom_tokens_1 = require('./dom/dom_tokens');\nvar dom_renderer_1 = require('./dom/dom_renderer');\nvar shared_styles_host_1 = require('./dom/shared_styles_host');\nvar shared_styles_host_2 = require('./dom/shared_styles_host');\nvar browser_details_1 = require('../animate/browser_details');\nvar animation_builder_1 = require('../animate/animation_builder');\nvar browser_adapter_1 = require('./browser/browser_adapter');\nvar testability_2 = require('./browser/testability');\nvar wtf_init_1 = require('../core/profile/wtf_init');\nvar event_manager_1 = require('./dom/events/event_manager');\nvar common_dom_1 = require('../../platform/common_dom');\nvar dom_tokens_2 = require('./dom/dom_tokens');\nexports.DOCUMENT = dom_tokens_2.DOCUMENT;\nvar title_1 = require('./browser/title');\nexports.Title = title_1.Title;\nvar common_dom_2 = require('../../platform/common_dom');\nexports.ELEMENT_PROBE_PROVIDERS = common_dom_2.ELEMENT_PROBE_PROVIDERS;\nexports.ELEMENT_PROBE_PROVIDERS_PROD_MODE = common_dom_2.ELEMENT_PROBE_PROVIDERS_PROD_MODE;\nexports.inspectNativeElement = common_dom_2.inspectNativeElement;\nexports.By = common_dom_2.By;\nvar browser_adapter_2 = require('./browser/browser_adapter');\nexports.BrowserDomAdapter = browser_adapter_2.BrowserDomAdapter;\nvar tools_1 = require('./browser/tools/tools');\nexports.enableDebugTools = tools_1.enableDebugTools;\nexports.disableDebugTools = tools_1.disableDebugTools;\nexports.BROWSER_PROVIDERS = lang_1.CONST_EXPR([core_1.PLATFORM_COMMON_PROVIDERS, new di_1.Provider(core_1.PLATFORM_INITIALIZER, {\n useValue: initDomAdapter,\n multi: true\n})]);\nfunction _exceptionHandler() {\n return new core_1.ExceptionHandler(dom_adapter_1.DOM, !lang_1.IS_DART);\n}\nfunction _document() {\n return dom_adapter_1.DOM.defaultDoc();\n}\nexports.BROWSER_APP_COMMON_PROVIDERS = lang_1.CONST_EXPR([core_1.APPLICATION_COMMON_PROVIDERS, common_1.FORM_PROVIDERS, new di_1.Provider(core_1.PLATFORM_PIPES, {\n useValue: common_1.COMMON_PIPES,\n multi: true\n}), new di_1.Provider(core_1.PLATFORM_DIRECTIVES, {\n useValue: common_1.COMMON_DIRECTIVES,\n multi: true\n}), new di_1.Provider(core_1.ExceptionHandler, {\n useFactory: _exceptionHandler,\n deps: []\n}), new di_1.Provider(dom_tokens_1.DOCUMENT, {\n useFactory: _document,\n deps: []\n}), new di_1.Provider(event_manager_1.EVENT_MANAGER_PLUGINS, {\n useClass: dom_events_1.DomEventsPlugin,\n multi: true\n}), new di_1.Provider(event_manager_1.EVENT_MANAGER_PLUGINS, {\n useClass: key_events_1.KeyEventsPlugin,\n multi: true\n}), new di_1.Provider(event_manager_1.EVENT_MANAGER_PLUGINS, {\n useClass: hammer_gestures_1.HammerGesturesPlugin,\n multi: true\n}), new di_1.Provider(dom_renderer_1.DomRootRenderer, {useClass: dom_renderer_1.DomRootRenderer_}), new di_1.Provider(core_1.RootRenderer, {useExisting: dom_renderer_1.DomRootRenderer}), new di_1.Provider(shared_styles_host_2.SharedStylesHost, {useExisting: shared_styles_host_1.DomSharedStylesHost}), shared_styles_host_1.DomSharedStylesHost, testability_1.Testability, browser_details_1.BrowserDetails, animation_builder_1.AnimationBuilder, event_manager_1.EventManager, common_dom_1.ELEMENT_PROBE_PROVIDERS]);\nfunction initDomAdapter() {\n browser_adapter_1.BrowserDomAdapter.makeCurrent();\n wtf_init_1.wtfInit();\n testability_2.BrowserGetTestability.init();\n}\nexports.initDomAdapter = initDomAdapter;\n","/* */ \n'use strict';\nvar __extends = (this && this.__extends) || function(d, b) {\n for (var p in b)\n if (b.hasOwnProperty(p))\n d[p] = b[p];\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function(k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(k, v);\n};\nvar compiler_1 = require('../core/linker/compiler');\nvar view_ref_1 = require('../core/linker/view_ref');\nvar template_compiler_1 = require('./template_compiler');\nvar di_1 = require('../core/di');\nvar RuntimeCompiler = (function(_super) {\n __extends(RuntimeCompiler, _super);\n function RuntimeCompiler() {\n _super.apply(this, arguments);\n }\n return RuntimeCompiler;\n})(compiler_1.Compiler);\nexports.RuntimeCompiler = RuntimeCompiler;\nvar RuntimeCompiler_ = (function(_super) {\n __extends(RuntimeCompiler_, _super);\n function RuntimeCompiler_(_templateCompiler) {\n _super.call(this);\n this._templateCompiler = _templateCompiler;\n }\n RuntimeCompiler_.prototype.compileInHost = function(componentType) {\n return this._templateCompiler.compileHostComponentRuntime(componentType).then(function(hostViewFactory) {\n return new view_ref_1.HostViewFactoryRef_(hostViewFactory);\n });\n };\n RuntimeCompiler_.prototype.clearCache = function() {\n _super.prototype.clearCache.call(this);\n this._templateCompiler.clearCache();\n };\n RuntimeCompiler_ = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [template_compiler_1.TemplateCompiler])], RuntimeCompiler_);\n return RuntimeCompiler_;\n})(compiler_1.Compiler_);\nexports.RuntimeCompiler_ = RuntimeCompiler_;\n","/* */ \n'use strict';\nvar __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function(k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(k, v);\n};\nvar lang_1 = require('../facade/lang');\nvar exceptions_1 = require('../facade/exceptions');\nvar collection_1 = require('../facade/collection');\nvar async_1 = require('../facade/async');\nvar directive_metadata_1 = require('./directive_metadata');\nvar template_ast_1 = require('./template_ast');\nvar di_1 = require('../core/di');\nvar source_module_1 = require('./source_module');\nvar change_detector_compiler_1 = require('./change_detector_compiler');\nvar style_compiler_1 = require('./style_compiler');\nvar view_compiler_1 = require('./view_compiler');\nvar proto_view_compiler_1 = require('./proto_view_compiler');\nvar template_parser_1 = require('./template_parser');\nvar template_normalizer_1 = require('./template_normalizer');\nvar runtime_metadata_1 = require('./runtime_metadata');\nvar view_1 = require('../core/linker/view');\nvar change_detection_1 = require('../core/change_detection/change_detection');\nvar resolved_metadata_cache_1 = require('../core/linker/resolved_metadata_cache');\nvar util_1 = require('./util');\nexports.METADATA_CACHE_MODULE_REF = source_module_1.moduleRef('package:angular2/src/core/linker/resolved_metadata_cache' + util_1.MODULE_SUFFIX);\nvar TemplateCompiler = (function() {\n function TemplateCompiler(_runtimeMetadataResolver, _templateNormalizer, _templateParser, _styleCompiler, _cdCompiler, _protoViewCompiler, _viewCompiler, _resolvedMetadataCache, _genConfig) {\n this._runtimeMetadataResolver = _runtimeMetadataResolver;\n this._templateNormalizer = _templateNormalizer;\n this._templateParser = _templateParser;\n this._styleCompiler = _styleCompiler;\n this._cdCompiler = _cdCompiler;\n this._protoViewCompiler = _protoViewCompiler;\n this._viewCompiler = _viewCompiler;\n this._resolvedMetadataCache = _resolvedMetadataCache;\n this._genConfig = _genConfig;\n this._hostCacheKeys = new Map();\n this._compiledTemplateCache = new Map();\n this._compiledTemplateDone = new Map();\n }\n TemplateCompiler.prototype.normalizeDirectiveMetadata = function(directive) {\n if (!directive.isComponent) {\n return async_1.PromiseWrapper.resolve(directive);\n }\n return this._templateNormalizer.normalizeTemplate(directive.type, directive.template).then(function(normalizedTemplate) {\n return new directive_metadata_1.CompileDirectiveMetadata({\n type: directive.type,\n isComponent: directive.isComponent,\n dynamicLoadable: directive.dynamicLoadable,\n selector: directive.selector,\n exportAs: directive.exportAs,\n changeDetection: directive.changeDetection,\n inputs: directive.inputs,\n outputs: directive.outputs,\n hostListeners: directive.hostListeners,\n hostProperties: directive.hostProperties,\n hostAttributes: directive.hostAttributes,\n lifecycleHooks: directive.lifecycleHooks,\n template: normalizedTemplate\n });\n });\n };\n TemplateCompiler.prototype.compileHostComponentRuntime = function(type) {\n var compMeta = this._runtimeMetadataResolver.getDirectiveMetadata(type);\n var hostCacheKey = this._hostCacheKeys.get(type);\n if (lang_1.isBlank(hostCacheKey)) {\n hostCacheKey = new Object();\n this._hostCacheKeys.set(type, hostCacheKey);\n assertComponent(compMeta);\n var hostMeta = directive_metadata_1.createHostComponentMeta(compMeta.type, compMeta.selector);\n this._compileComponentRuntime(hostCacheKey, hostMeta, [compMeta], [], []);\n }\n return this._compiledTemplateDone.get(hostCacheKey).then(function(compiledTemplate) {\n return new view_1.HostViewFactory(compMeta.selector, compiledTemplate.viewFactory);\n });\n };\n TemplateCompiler.prototype.clearCache = function() {\n this._styleCompiler.clearCache();\n this._compiledTemplateCache.clear();\n this._compiledTemplateDone.clear();\n this._hostCacheKeys.clear();\n };\n TemplateCompiler.prototype.compileTemplatesCodeGen = function(components) {\n var _this = this;\n if (components.length === 0) {\n throw new exceptions_1.BaseException('No components given');\n }\n var declarations = [];\n components.forEach(function(componentWithDirs) {\n var compMeta = componentWithDirs.component;\n assertComponent(compMeta);\n _this._compileComponentCodeGen(compMeta, componentWithDirs.directives, componentWithDirs.pipes, declarations);\n if (compMeta.dynamicLoadable) {\n var hostMeta = directive_metadata_1.createHostComponentMeta(compMeta.type, compMeta.selector);\n var viewFactoryExpression = _this._compileComponentCodeGen(hostMeta, [compMeta], [], declarations);\n var constructionKeyword = lang_1.IS_DART ? 'const' : 'new';\n var compiledTemplateExpr = constructionKeyword + \" \" + proto_view_compiler_1.APP_VIEW_MODULE_REF + \"HostViewFactory('\" + compMeta.selector + \"',\" + viewFactoryExpression + \")\";\n var varName = codeGenHostViewFactoryName(compMeta.type);\n declarations.push(\"\" + util_1.codeGenExportVariable(varName) + compiledTemplateExpr + \";\");\n }\n });\n var moduleUrl = components[0].component.type.moduleUrl;\n return new source_module_1.SourceModule(\"\" + templateModuleUrl(moduleUrl), declarations.join('\\n'));\n };\n TemplateCompiler.prototype.compileStylesheetCodeGen = function(stylesheetUrl, cssText) {\n return this._styleCompiler.compileStylesheetCodeGen(stylesheetUrl, cssText);\n };\n TemplateCompiler.prototype._compileComponentRuntime = function(cacheKey, compMeta, viewDirectives, pipes, compilingComponentsPath) {\n var _this = this;\n var uniqViewDirectives = removeDuplicates(viewDirectives);\n var uniqViewPipes = removeDuplicates(pipes);\n var compiledTemplate = this._compiledTemplateCache.get(cacheKey);\n var done = this._compiledTemplateDone.get(cacheKey);\n if (lang_1.isBlank(compiledTemplate)) {\n compiledTemplate = new CompiledTemplate();\n this._compiledTemplateCache.set(cacheKey, compiledTemplate);\n done = async_1.PromiseWrapper.all([this._styleCompiler.compileComponentRuntime(compMeta.template)].concat(uniqViewDirectives.map(function(dirMeta) {\n return _this.normalizeDirectiveMetadata(dirMeta);\n }))).then(function(stylesAndNormalizedViewDirMetas) {\n var normalizedViewDirMetas = stylesAndNormalizedViewDirMetas.slice(1);\n var styles = stylesAndNormalizedViewDirMetas[0];\n var parsedTemplate = _this._templateParser.parse(compMeta.template.template, normalizedViewDirMetas, uniqViewPipes, compMeta.type.name);\n var childPromises = [];\n var usedDirectives = DirectiveCollector.findUsedDirectives(parsedTemplate);\n usedDirectives.components.forEach(function(component) {\n return _this._compileNestedComponentRuntime(component, compilingComponentsPath, childPromises);\n });\n return async_1.PromiseWrapper.all(childPromises).then(function(_) {\n var filteredPipes = filterPipes(parsedTemplate, uniqViewPipes);\n compiledTemplate.init(_this._createViewFactoryRuntime(compMeta, parsedTemplate, usedDirectives.directives, styles, filteredPipes));\n return compiledTemplate;\n });\n });\n this._compiledTemplateDone.set(cacheKey, done);\n }\n return compiledTemplate;\n };\n TemplateCompiler.prototype._compileNestedComponentRuntime = function(childComponentDir, parentCompilingComponentsPath, childPromises) {\n var compilingComponentsPath = collection_1.ListWrapper.clone(parentCompilingComponentsPath);\n var childCacheKey = childComponentDir.type.runtime;\n var childViewDirectives = this._runtimeMetadataResolver.getViewDirectivesMetadata(childComponentDir.type.runtime);\n var childViewPipes = this._runtimeMetadataResolver.getViewPipesMetadata(childComponentDir.type.runtime);\n var childIsRecursive = collection_1.ListWrapper.contains(compilingComponentsPath, childCacheKey);\n compilingComponentsPath.push(childCacheKey);\n this._compileComponentRuntime(childCacheKey, childComponentDir, childViewDirectives, childViewPipes, compilingComponentsPath);\n if (!childIsRecursive) {\n childPromises.push(this._compiledTemplateDone.get(childCacheKey));\n }\n };\n TemplateCompiler.prototype._createViewFactoryRuntime = function(compMeta, parsedTemplate, directives, styles, pipes) {\n var _this = this;\n if (lang_1.IS_DART || !this._genConfig.useJit) {\n var changeDetectorFactories = this._cdCompiler.compileComponentRuntime(compMeta.type, compMeta.changeDetection, parsedTemplate);\n var protoViews = this._protoViewCompiler.compileProtoViewRuntime(this._resolvedMetadataCache, compMeta, parsedTemplate, pipes);\n return this._viewCompiler.compileComponentRuntime(compMeta, parsedTemplate, styles, protoViews.protoViews, changeDetectorFactories, function(compMeta) {\n return _this._getNestedComponentViewFactory(compMeta);\n });\n } else {\n var declarations = [];\n var viewFactoryExpr = this._createViewFactoryCodeGen('resolvedMetadataCache', compMeta, new source_module_1.SourceExpression([], 'styles'), parsedTemplate, pipes, declarations);\n var vars = {\n 'exports': {},\n 'styles': styles,\n 'resolvedMetadataCache': this._resolvedMetadataCache\n };\n directives.forEach(function(dirMeta) {\n vars[dirMeta.type.name] = dirMeta.type.runtime;\n if (dirMeta.isComponent && dirMeta.type.runtime !== compMeta.type.runtime) {\n vars[(\"viewFactory_\" + dirMeta.type.name + \"0\")] = _this._getNestedComponentViewFactory(dirMeta);\n }\n });\n pipes.forEach(function(pipeMeta) {\n return vars[pipeMeta.type.name] = pipeMeta.type.runtime;\n });\n var declarationsWithoutImports = source_module_1.SourceModule.getSourceWithoutImports(declarations.join('\\n'));\n return lang_1.evalExpression(\"viewFactory_\" + compMeta.type.name, viewFactoryExpr, declarationsWithoutImports, mergeStringMaps([vars, change_detector_compiler_1.CHANGE_DETECTION_JIT_IMPORTS, proto_view_compiler_1.PROTO_VIEW_JIT_IMPORTS, view_compiler_1.VIEW_JIT_IMPORTS]));\n }\n };\n TemplateCompiler.prototype._getNestedComponentViewFactory = function(compMeta) {\n return this._compiledTemplateCache.get(compMeta.type.runtime).viewFactory;\n };\n TemplateCompiler.prototype._compileComponentCodeGen = function(compMeta, directives, pipes, targetDeclarations) {\n var uniqueDirectives = removeDuplicates(directives);\n var uniqPipes = removeDuplicates(pipes);\n var styleExpr = this._styleCompiler.compileComponentCodeGen(compMeta.template);\n var parsedTemplate = this._templateParser.parse(compMeta.template.template, uniqueDirectives, uniqPipes, compMeta.type.name);\n var filteredPipes = filterPipes(parsedTemplate, uniqPipes);\n return this._createViewFactoryCodeGen(exports.METADATA_CACHE_MODULE_REF + \"CODEGEN_RESOLVED_METADATA_CACHE\", compMeta, styleExpr, parsedTemplate, filteredPipes, targetDeclarations);\n };\n TemplateCompiler.prototype._createViewFactoryCodeGen = function(resolvedMetadataCacheExpr, compMeta, styleExpr, parsedTemplate, pipes, targetDeclarations) {\n var changeDetectorsExprs = this._cdCompiler.compileComponentCodeGen(compMeta.type, compMeta.changeDetection, parsedTemplate);\n var protoViewExprs = this._protoViewCompiler.compileProtoViewCodeGen(new util_1.Expression(resolvedMetadataCacheExpr), compMeta, parsedTemplate, pipes);\n var viewFactoryExpr = this._viewCompiler.compileComponentCodeGen(compMeta, parsedTemplate, styleExpr, protoViewExprs.protoViews, changeDetectorsExprs, codeGenComponentViewFactoryName);\n util_1.addAll(changeDetectorsExprs.declarations, targetDeclarations);\n util_1.addAll(protoViewExprs.declarations, targetDeclarations);\n util_1.addAll(viewFactoryExpr.declarations, targetDeclarations);\n return viewFactoryExpr.expression;\n };\n TemplateCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [runtime_metadata_1.RuntimeMetadataResolver, template_normalizer_1.TemplateNormalizer, template_parser_1.TemplateParser, style_compiler_1.StyleCompiler, change_detector_compiler_1.ChangeDetectionCompiler, proto_view_compiler_1.ProtoViewCompiler, view_compiler_1.ViewCompiler, resolved_metadata_cache_1.ResolvedMetadataCache, change_detection_1.ChangeDetectorGenConfig])], TemplateCompiler);\n return TemplateCompiler;\n})();\nexports.TemplateCompiler = TemplateCompiler;\nvar NormalizedComponentWithViewDirectives = (function() {\n function NormalizedComponentWithViewDirectives(component, directives, pipes) {\n this.component = component;\n this.directives = directives;\n this.pipes = pipes;\n }\n return NormalizedComponentWithViewDirectives;\n})();\nexports.NormalizedComponentWithViewDirectives = NormalizedComponentWithViewDirectives;\nvar CompiledTemplate = (function() {\n function CompiledTemplate() {\n this.viewFactory = null;\n }\n CompiledTemplate.prototype.init = function(viewFactory) {\n this.viewFactory = viewFactory;\n };\n return CompiledTemplate;\n})();\nfunction assertComponent(meta) {\n if (!meta.isComponent) {\n throw new exceptions_1.BaseException(\"Could not compile '\" + meta.type.name + \"' because it is not a component.\");\n }\n}\nfunction templateModuleUrl(moduleUrl) {\n var urlWithoutSuffix = moduleUrl.substring(0, moduleUrl.length - util_1.MODULE_SUFFIX.length);\n return urlWithoutSuffix + \".template\" + util_1.MODULE_SUFFIX;\n}\nfunction codeGenHostViewFactoryName(type) {\n return \"hostViewFactory_\" + type.name;\n}\nfunction codeGenComponentViewFactoryName(nestedCompType) {\n return source_module_1.moduleRef(templateModuleUrl(nestedCompType.type.moduleUrl)) + \"viewFactory_\" + nestedCompType.type.name + \"0\";\n}\nfunction mergeStringMaps(maps) {\n var result = {};\n maps.forEach(function(map) {\n collection_1.StringMapWrapper.forEach(map, function(value, key) {\n result[key] = value;\n });\n });\n return result;\n}\nfunction removeDuplicates(items) {\n var res = [];\n items.forEach(function(item) {\n var hasMatch = res.filter(function(r) {\n return r.type.name == item.type.name && r.type.moduleUrl == item.type.moduleUrl && r.type.runtime == item.type.runtime;\n }).length > 0;\n if (!hasMatch) {\n res.push(item);\n }\n });\n return res;\n}\nvar DirectiveCollector = (function() {\n function DirectiveCollector() {\n this.directives = [];\n this.components = [];\n }\n DirectiveCollector.findUsedDirectives = function(parsedTemplate) {\n var collector = new DirectiveCollector();\n template_ast_1.templateVisitAll(collector, parsedTemplate);\n return collector;\n };\n DirectiveCollector.prototype.visitBoundText = function(ast, context) {\n return null;\n };\n DirectiveCollector.prototype.visitText = function(ast, context) {\n return null;\n };\n DirectiveCollector.prototype.visitNgContent = function(ast, context) {\n return null;\n };\n DirectiveCollector.prototype.visitElement = function(ast, context) {\n template_ast_1.templateVisitAll(this, ast.directives);\n template_ast_1.templateVisitAll(this, ast.children);\n return null;\n };\n DirectiveCollector.prototype.visitEmbeddedTemplate = function(ast, context) {\n template_ast_1.templateVisitAll(this, ast.directives);\n template_ast_1.templateVisitAll(this, ast.children);\n return null;\n };\n DirectiveCollector.prototype.visitVariable = function(ast, ctx) {\n return null;\n };\n DirectiveCollector.prototype.visitAttr = function(ast, attrNameAndValues) {\n return null;\n };\n DirectiveCollector.prototype.visitDirective = function(ast, ctx) {\n if (ast.directive.isComponent) {\n this.components.push(ast.directive);\n }\n this.directives.push(ast.directive);\n return null;\n };\n DirectiveCollector.prototype.visitEvent = function(ast, eventTargetAndNames) {\n return null;\n };\n DirectiveCollector.prototype.visitDirectiveProperty = function(ast, context) {\n return null;\n };\n DirectiveCollector.prototype.visitElementProperty = function(ast, context) {\n return null;\n };\n return DirectiveCollector;\n})();\nfunction filterPipes(template, allPipes) {\n var visitor = new PipeVisitor();\n template_ast_1.templateVisitAll(visitor, template);\n return allPipes.filter(function(pipeMeta) {\n return collection_1.SetWrapper.has(visitor.collector.pipes, pipeMeta.name);\n });\n}\nvar PipeVisitor = (function() {\n function PipeVisitor() {\n this.collector = new template_parser_1.PipeCollector();\n }\n PipeVisitor.prototype.visitBoundText = function(ast, context) {\n ast.value.visit(this.collector);\n return null;\n };\n PipeVisitor.prototype.visitText = function(ast, context) {\n return null;\n };\n PipeVisitor.prototype.visitNgContent = function(ast, context) {\n return null;\n };\n PipeVisitor.prototype.visitElement = function(ast, context) {\n template_ast_1.templateVisitAll(this, ast.inputs);\n template_ast_1.templateVisitAll(this, ast.outputs);\n template_ast_1.templateVisitAll(this, ast.directives);\n template_ast_1.templateVisitAll(this, ast.children);\n return null;\n };\n PipeVisitor.prototype.visitEmbeddedTemplate = function(ast, context) {\n template_ast_1.templateVisitAll(this, ast.outputs);\n template_ast_1.templateVisitAll(this, ast.directives);\n template_ast_1.templateVisitAll(this, ast.children);\n return null;\n };\n PipeVisitor.prototype.visitVariable = function(ast, ctx) {\n return null;\n };\n PipeVisitor.prototype.visitAttr = function(ast, attrNameAndValues) {\n return null;\n };\n PipeVisitor.prototype.visitDirective = function(ast, ctx) {\n template_ast_1.templateVisitAll(this, ast.inputs);\n template_ast_1.templateVisitAll(this, ast.hostEvents);\n template_ast_1.templateVisitAll(this, ast.hostProperties);\n return null;\n };\n PipeVisitor.prototype.visitEvent = function(ast, eventTargetAndNames) {\n ast.handler.visit(this.collector);\n return null;\n };\n PipeVisitor.prototype.visitDirectiveProperty = function(ast, context) {\n ast.value.visit(this.collector);\n return null;\n };\n PipeVisitor.prototype.visitElementProperty = function(ast, context) {\n ast.value.visit(this.collector);\n return null;\n };\n return PipeVisitor;\n})();\n","/* */ \n(function(process) {\n 'use strict';\n var __extends = (this && this.__extends) || function(d, b) {\n for (var p in b)\n if (b.hasOwnProperty(p))\n d[p] = b[p];\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };\n var __metadata = (this && this.__metadata) || function(k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(k, v);\n };\n var __param = (this && this.__param) || function(paramIndex, decorator) {\n return function(target, key) {\n decorator(target, key, paramIndex);\n };\n };\n var collection_1 = require('../facade/collection');\n var lang_1 = require('../facade/lang');\n var core_1 = require('../../core');\n var lang_2 = require('../facade/lang');\n var exceptions_1 = require('../facade/exceptions');\n var change_detection_1 = require('../core/change_detection/change_detection');\n var html_parser_1 = require('./html_parser');\n var html_tags_1 = require('./html_tags');\n var parse_util_1 = require('./parse_util');\n var ast_1 = require('../core/change_detection/parser/ast');\n var template_ast_1 = require('./template_ast');\n var selector_1 = require('./selector');\n var element_schema_registry_1 = require('./schema/element_schema_registry');\n var template_preparser_1 = require('./template_preparser');\n var style_url_resolver_1 = require('./style_url_resolver');\n var html_ast_1 = require('./html_ast');\n var util_1 = require('./util');\n var BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(var-|#)|(on-)|(bindon-))(.+))|\\[\\(([^\\)]+)\\)\\]|\\[([^\\]]+)\\]|\\(([^\\)]+)\\))$/g;\n var TEMPLATE_ELEMENT = 'template';\n var TEMPLATE_ATTR = 'template';\n var TEMPLATE_ATTR_PREFIX = '*';\n var CLASS_ATTR = 'class';\n var PROPERTY_PARTS_SEPARATOR = '.';\n var ATTRIBUTE_PREFIX = 'attr';\n var CLASS_PREFIX = 'class';\n var STYLE_PREFIX = 'style';\n var TEXT_CSS_SELECTOR = selector_1.CssSelector.parse('*')[0];\n exports.TEMPLATE_TRANSFORMS = lang_2.CONST_EXPR(new core_1.OpaqueToken('TemplateTransforms'));\n var TemplateParseError = (function(_super) {\n __extends(TemplateParseError, _super);\n function TemplateParseError(message, location) {\n _super.call(this, location, message);\n }\n return TemplateParseError;\n })(parse_util_1.ParseError);\n exports.TemplateParseError = TemplateParseError;\n var TemplateParser = (function() {\n function TemplateParser(_exprParser, _schemaRegistry, _htmlParser, transforms) {\n this._exprParser = _exprParser;\n this._schemaRegistry = _schemaRegistry;\n this._htmlParser = _htmlParser;\n this.transforms = transforms;\n }\n TemplateParser.prototype.parse = function(template, directives, pipes, templateUrl) {\n var parseVisitor = new TemplateParseVisitor(directives, pipes, this._exprParser, this._schemaRegistry);\n var htmlAstWithErrors = this._htmlParser.parse(template, templateUrl);\n var result = html_ast_1.htmlVisitAll(parseVisitor, htmlAstWithErrors.rootNodes, EMPTY_COMPONENT);\n var errors = htmlAstWithErrors.errors.concat(parseVisitor.errors);\n if (errors.length > 0) {\n var errorString = errors.join('\\n');\n throw new exceptions_1.BaseException(\"Template parse errors:\\n\" + errorString);\n }\n if (lang_1.isPresent(this.transforms)) {\n this.transforms.forEach(function(transform) {\n result = template_ast_1.templateVisitAll(transform, result);\n });\n }\n return result;\n };\n TemplateParser = __decorate([core_1.Injectable(), __param(3, core_1.Optional()), __param(3, core_1.Inject(exports.TEMPLATE_TRANSFORMS)), __metadata('design:paramtypes', [change_detection_1.Parser, element_schema_registry_1.ElementSchemaRegistry, html_parser_1.HtmlParser, Array])], TemplateParser);\n return TemplateParser;\n })();\n exports.TemplateParser = TemplateParser;\n var TemplateParseVisitor = (function() {\n function TemplateParseVisitor(directives, pipes, _exprParser, _schemaRegistry) {\n var _this = this;\n this._exprParser = _exprParser;\n this._schemaRegistry = _schemaRegistry;\n this.errors = [];\n this.directivesIndex = new Map();\n this.ngContentCount = 0;\n this.selectorMatcher = new selector_1.SelectorMatcher();\n collection_1.ListWrapper.forEachWithIndex(directives, function(directive, index) {\n var selector = selector_1.CssSelector.parse(directive.selector);\n _this.selectorMatcher.addSelectables(selector, directive);\n _this.directivesIndex.set(directive, index);\n });\n this.pipesByName = new Map();\n pipes.forEach(function(pipe) {\n return _this.pipesByName.set(pipe.name, pipe);\n });\n }\n TemplateParseVisitor.prototype._reportError = function(message, sourceSpan) {\n this.errors.push(new TemplateParseError(message, sourceSpan.start));\n };\n TemplateParseVisitor.prototype._parseInterpolation = function(value, sourceSpan) {\n var sourceInfo = sourceSpan.start.toString();\n try {\n var ast = this._exprParser.parseInterpolation(value, sourceInfo);\n this._checkPipes(ast, sourceSpan);\n return ast;\n } catch (e) {\n this._reportError(\"\" + e, sourceSpan);\n return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);\n }\n };\n TemplateParseVisitor.prototype._parseAction = function(value, sourceSpan) {\n var sourceInfo = sourceSpan.start.toString();\n try {\n var ast = this._exprParser.parseAction(value, sourceInfo);\n this._checkPipes(ast, sourceSpan);\n return ast;\n } catch (e) {\n this._reportError(\"\" + e, sourceSpan);\n return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);\n }\n };\n TemplateParseVisitor.prototype._parseBinding = function(value, sourceSpan) {\n var sourceInfo = sourceSpan.start.toString();\n try {\n var ast = this._exprParser.parseBinding(value, sourceInfo);\n this._checkPipes(ast, sourceSpan);\n return ast;\n } catch (e) {\n this._reportError(\"\" + e, sourceSpan);\n return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);\n }\n };\n TemplateParseVisitor.prototype._parseTemplateBindings = function(value, sourceSpan) {\n var _this = this;\n var sourceInfo = sourceSpan.start.toString();\n try {\n var bindings = this._exprParser.parseTemplateBindings(value, sourceInfo);\n bindings.forEach(function(binding) {\n if (lang_1.isPresent(binding.expression)) {\n _this._checkPipes(binding.expression, sourceSpan);\n }\n });\n return bindings;\n } catch (e) {\n this._reportError(\"\" + e, sourceSpan);\n return [];\n }\n };\n TemplateParseVisitor.prototype._checkPipes = function(ast, sourceSpan) {\n var _this = this;\n if (lang_1.isPresent(ast)) {\n var collector = new PipeCollector();\n ast.visit(collector);\n collector.pipes.forEach(function(pipeName) {\n if (!_this.pipesByName.has(pipeName)) {\n _this._reportError(\"The pipe '\" + pipeName + \"' could not be found\", sourceSpan);\n }\n });\n }\n };\n TemplateParseVisitor.prototype.visitText = function(ast, component) {\n var ngContentIndex = component.findNgContentIndex(TEXT_CSS_SELECTOR);\n var expr = this._parseInterpolation(ast.value, ast.sourceSpan);\n if (lang_1.isPresent(expr)) {\n return new template_ast_1.BoundTextAst(expr, ngContentIndex, ast.sourceSpan);\n } else {\n return new template_ast_1.TextAst(ast.value, ngContentIndex, ast.sourceSpan);\n }\n };\n TemplateParseVisitor.prototype.visitAttr = function(ast, contex) {\n return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceSpan);\n };\n TemplateParseVisitor.prototype.visitElement = function(element, component) {\n var _this = this;\n var nodeName = element.name;\n var preparsedElement = template_preparser_1.preparseElement(element);\n if (preparsedElement.type === template_preparser_1.PreparsedElementType.SCRIPT || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLE) {\n return null;\n }\n if (preparsedElement.type === template_preparser_1.PreparsedElementType.STYLESHEET && style_url_resolver_1.isStyleUrlResolvable(preparsedElement.hrefAttr)) {\n return null;\n }\n var matchableAttrs = [];\n var elementOrDirectiveProps = [];\n var vars = [];\n var events = [];\n var templateElementOrDirectiveProps = [];\n var templateVars = [];\n var templateMatchableAttrs = [];\n var hasInlineTemplates = false;\n var attrs = [];\n element.attrs.forEach(function(attr) {\n var hasBinding = _this._parseAttr(attr, matchableAttrs, elementOrDirectiveProps, events, vars);\n var hasTemplateBinding = _this._parseInlineTemplateBinding(attr, templateMatchableAttrs, templateElementOrDirectiveProps, templateVars);\n if (!hasBinding && !hasTemplateBinding) {\n attrs.push(_this.visitAttr(attr, null));\n matchableAttrs.push([attr.name, attr.value]);\n }\n if (hasTemplateBinding) {\n hasInlineTemplates = true;\n }\n });\n var lcElName = html_tags_1.splitNsName(nodeName.toLowerCase())[1];\n var isTemplateElement = lcElName == TEMPLATE_ELEMENT;\n var elementCssSelector = createElementCssSelector(nodeName, matchableAttrs);\n var directives = this._createDirectiveAsts(element.name, this._parseDirectives(this.selectorMatcher, elementCssSelector), elementOrDirectiveProps, isTemplateElement ? [] : vars, element.sourceSpan);\n var elementProps = this._createElementPropertyAsts(element.name, elementOrDirectiveProps, directives);\n var children = html_ast_1.htmlVisitAll(preparsedElement.nonBindable ? NON_BINDABLE_VISITOR : this, element.children, Component.create(directives));\n var elementNgContentIndex = hasInlineTemplates ? null : component.findNgContentIndex(elementCssSelector);\n var parsedElement;\n if (preparsedElement.type === template_preparser_1.PreparsedElementType.NG_CONTENT) {\n if (lang_1.isPresent(element.children) && element.children.length > 0) {\n this._reportError(\"
element cannot have content. must be immediately followed by \", element.sourceSpan);\n }\n parsedElement = new template_ast_1.NgContentAst(this.ngContentCount++, elementNgContentIndex, element.sourceSpan);\n } else if (isTemplateElement) {\n this._assertAllEventsPublishedByDirectives(directives, events);\n this._assertNoComponentsNorElementBindingsOnTemplate(directives, elementProps, element.sourceSpan);\n parsedElement = new template_ast_1.EmbeddedTemplateAst(attrs, events, vars, directives, children, elementNgContentIndex, element.sourceSpan);\n } else {\n this._assertOnlyOneComponent(directives, element.sourceSpan);\n var elementExportAsVars = vars.filter(function(varAst) {\n return varAst.value.length === 0;\n });\n parsedElement = new template_ast_1.ElementAst(nodeName, attrs, elementProps, events, elementExportAsVars, directives, children, elementNgContentIndex, element.sourceSpan);\n }\n if (hasInlineTemplates) {\n var templateCssSelector = createElementCssSelector(TEMPLATE_ELEMENT, templateMatchableAttrs);\n var templateDirectives = this._createDirectiveAsts(element.name, this._parseDirectives(this.selectorMatcher, templateCssSelector), templateElementOrDirectiveProps, [], element.sourceSpan);\n var templateElementProps = this._createElementPropertyAsts(element.name, templateElementOrDirectiveProps, templateDirectives);\n this._assertNoComponentsNorElementBindingsOnTemplate(templateDirectives, templateElementProps, element.sourceSpan);\n parsedElement = new template_ast_1.EmbeddedTemplateAst([], [], templateVars, templateDirectives, [parsedElement], component.findNgContentIndex(templateCssSelector), element.sourceSpan);\n }\n return parsedElement;\n };\n TemplateParseVisitor.prototype._parseInlineTemplateBinding = function(attr, targetMatchableAttrs, targetProps, targetVars) {\n var templateBindingsSource = null;\n if (attr.name == TEMPLATE_ATTR) {\n templateBindingsSource = attr.value;\n } else if (attr.name.startsWith(TEMPLATE_ATTR_PREFIX)) {\n var key = attr.name.substring(TEMPLATE_ATTR_PREFIX.length);\n templateBindingsSource = (attr.value.length == 0) ? key : key + ' ' + attr.value;\n }\n if (lang_1.isPresent(templateBindingsSource)) {\n var bindings = this._parseTemplateBindings(templateBindingsSource, attr.sourceSpan);\n for (var i = 0; i < bindings.length; i++) {\n var binding = bindings[i];\n if (binding.keyIsVar) {\n targetVars.push(new template_ast_1.VariableAst(binding.key, binding.name, attr.sourceSpan));\n targetMatchableAttrs.push([binding.key, binding.name]);\n } else if (lang_1.isPresent(binding.expression)) {\n this._parsePropertyAst(binding.key, binding.expression, attr.sourceSpan, targetMatchableAttrs, targetProps);\n } else {\n targetMatchableAttrs.push([binding.key, '']);\n this._parseLiteralAttr(binding.key, null, attr.sourceSpan, targetProps);\n }\n }\n return true;\n }\n return false;\n };\n TemplateParseVisitor.prototype._parseAttr = function(attr, targetMatchableAttrs, targetProps, targetEvents, targetVars) {\n var attrName = this._normalizeAttributeName(attr.name);\n var attrValue = attr.value;\n var bindParts = lang_1.RegExpWrapper.firstMatch(BIND_NAME_REGEXP, attrName);\n var hasBinding = false;\n if (lang_1.isPresent(bindParts)) {\n hasBinding = true;\n if (lang_1.isPresent(bindParts[1])) {\n this._parseProperty(bindParts[5], attrValue, attr.sourceSpan, targetMatchableAttrs, targetProps);\n } else if (lang_1.isPresent(bindParts[2])) {\n var identifier = bindParts[5];\n this._parseVariable(identifier, attrValue, attr.sourceSpan, targetVars);\n } else if (lang_1.isPresent(bindParts[3])) {\n this._parseEvent(bindParts[5], attrValue, attr.sourceSpan, targetMatchableAttrs, targetEvents);\n } else if (lang_1.isPresent(bindParts[4])) {\n this._parseProperty(bindParts[5], attrValue, attr.sourceSpan, targetMatchableAttrs, targetProps);\n this._parseAssignmentEvent(bindParts[5], attrValue, attr.sourceSpan, targetMatchableAttrs, targetEvents);\n } else if (lang_1.isPresent(bindParts[6])) {\n this._parseProperty(bindParts[6], attrValue, attr.sourceSpan, targetMatchableAttrs, targetProps);\n this._parseAssignmentEvent(bindParts[6], attrValue, attr.sourceSpan, targetMatchableAttrs, targetEvents);\n } else if (lang_1.isPresent(bindParts[7])) {\n this._parseProperty(bindParts[7], attrValue, attr.sourceSpan, targetMatchableAttrs, targetProps);\n } else if (lang_1.isPresent(bindParts[8])) {\n this._parseEvent(bindParts[8], attrValue, attr.sourceSpan, targetMatchableAttrs, targetEvents);\n }\n } else {\n hasBinding = this._parsePropertyInterpolation(attrName, attrValue, attr.sourceSpan, targetMatchableAttrs, targetProps);\n }\n if (!hasBinding) {\n this._parseLiteralAttr(attrName, attrValue, attr.sourceSpan, targetProps);\n }\n return hasBinding;\n };\n TemplateParseVisitor.prototype._normalizeAttributeName = function(attrName) {\n return attrName.toLowerCase().startsWith('data-') ? attrName.substring(5) : attrName;\n };\n TemplateParseVisitor.prototype._parseVariable = function(identifier, value, sourceSpan, targetVars) {\n if (identifier.indexOf('-') > -1) {\n this._reportError(\"\\\"-\\\" is not allowed in variable names\", sourceSpan);\n }\n targetVars.push(new template_ast_1.VariableAst(identifier, value, sourceSpan));\n };\n TemplateParseVisitor.prototype._parseProperty = function(name, expression, sourceSpan, targetMatchableAttrs, targetProps) {\n this._parsePropertyAst(name, this._parseBinding(expression, sourceSpan), sourceSpan, targetMatchableAttrs, targetProps);\n };\n TemplateParseVisitor.prototype._parsePropertyInterpolation = function(name, value, sourceSpan, targetMatchableAttrs, targetProps) {\n var expr = this._parseInterpolation(value, sourceSpan);\n if (lang_1.isPresent(expr)) {\n this._parsePropertyAst(name, expr, sourceSpan, targetMatchableAttrs, targetProps);\n return true;\n }\n return false;\n };\n TemplateParseVisitor.prototype._parsePropertyAst = function(name, ast, sourceSpan, targetMatchableAttrs, targetProps) {\n targetMatchableAttrs.push([name, ast.source]);\n targetProps.push(new BoundElementOrDirectiveProperty(name, ast, false, sourceSpan));\n };\n TemplateParseVisitor.prototype._parseAssignmentEvent = function(name, expression, sourceSpan, targetMatchableAttrs, targetEvents) {\n this._parseEvent(name + \"Change\", expression + \"=$event\", sourceSpan, targetMatchableAttrs, targetEvents);\n };\n TemplateParseVisitor.prototype._parseEvent = function(name, expression, sourceSpan, targetMatchableAttrs, targetEvents) {\n var parts = util_1.splitAtColon(name, [null, name]);\n var target = parts[0];\n var eventName = parts[1];\n var ast = this._parseAction(expression, sourceSpan);\n targetMatchableAttrs.push([name, ast.source]);\n targetEvents.push(new template_ast_1.BoundEventAst(eventName, target, ast, sourceSpan));\n };\n TemplateParseVisitor.prototype._parseLiteralAttr = function(name, value, sourceSpan, targetProps) {\n targetProps.push(new BoundElementOrDirectiveProperty(name, this._exprParser.wrapLiteralPrimitive(value, ''), true, sourceSpan));\n };\n TemplateParseVisitor.prototype._parseDirectives = function(selectorMatcher, elementCssSelector) {\n var _this = this;\n var directives = [];\n selectorMatcher.match(elementCssSelector, function(selector, directive) {\n directives.push(directive);\n });\n collection_1.ListWrapper.sort(directives, function(dir1, dir2) {\n var dir1Comp = dir1.isComponent;\n var dir2Comp = dir2.isComponent;\n if (dir1Comp && !dir2Comp) {\n return -1;\n } else if (!dir1Comp && dir2Comp) {\n return 1;\n } else {\n return _this.directivesIndex.get(dir1) - _this.directivesIndex.get(dir2);\n }\n });\n return directives;\n };\n TemplateParseVisitor.prototype._createDirectiveAsts = function(elementName, directives, props, possibleExportAsVars, sourceSpan) {\n var _this = this;\n var matchedVariables = new Set();\n var directiveAsts = directives.map(function(directive) {\n var hostProperties = [];\n var hostEvents = [];\n var directiveProperties = [];\n _this._createDirectiveHostPropertyAsts(elementName, directive.hostProperties, sourceSpan, hostProperties);\n _this._createDirectiveHostEventAsts(directive.hostListeners, sourceSpan, hostEvents);\n _this._createDirectivePropertyAsts(directive.inputs, props, directiveProperties);\n var exportAsVars = [];\n possibleExportAsVars.forEach(function(varAst) {\n if ((varAst.value.length === 0 && directive.isComponent) || (directive.exportAs == varAst.value)) {\n exportAsVars.push(varAst);\n matchedVariables.add(varAst.name);\n }\n });\n return new template_ast_1.DirectiveAst(directive, directiveProperties, hostProperties, hostEvents, exportAsVars, sourceSpan);\n });\n possibleExportAsVars.forEach(function(varAst) {\n if (varAst.value.length > 0 && !collection_1.SetWrapper.has(matchedVariables, varAst.name)) {\n _this._reportError(\"There is no directive with \\\"exportAs\\\" set to \\\"\" + varAst.value + \"\\\"\", varAst.sourceSpan);\n }\n });\n return directiveAsts;\n };\n TemplateParseVisitor.prototype._createDirectiveHostPropertyAsts = function(elementName, hostProps, sourceSpan, targetPropertyAsts) {\n var _this = this;\n if (lang_1.isPresent(hostProps)) {\n collection_1.StringMapWrapper.forEach(hostProps, function(expression, propName) {\n var exprAst = _this._parseBinding(expression, sourceSpan);\n targetPropertyAsts.push(_this._createElementPropertyAst(elementName, propName, exprAst, sourceSpan));\n });\n }\n };\n TemplateParseVisitor.prototype._createDirectiveHostEventAsts = function(hostListeners, sourceSpan, targetEventAsts) {\n var _this = this;\n if (lang_1.isPresent(hostListeners)) {\n collection_1.StringMapWrapper.forEach(hostListeners, function(expression, propName) {\n _this._parseEvent(propName, expression, sourceSpan, [], targetEventAsts);\n });\n }\n };\n TemplateParseVisitor.prototype._createDirectivePropertyAsts = function(directiveProperties, boundProps, targetBoundDirectiveProps) {\n if (lang_1.isPresent(directiveProperties)) {\n var boundPropsByName = new Map();\n boundProps.forEach(function(boundProp) {\n var prevValue = boundPropsByName.get(boundProp.name);\n if (lang_1.isBlank(prevValue) || prevValue.isLiteral) {\n boundPropsByName.set(boundProp.name, boundProp);\n }\n });\n collection_1.StringMapWrapper.forEach(directiveProperties, function(elProp, dirProp) {\n var boundProp = boundPropsByName.get(elProp);\n if (lang_1.isPresent(boundProp)) {\n targetBoundDirectiveProps.push(new template_ast_1.BoundDirectivePropertyAst(dirProp, boundProp.name, boundProp.expression, boundProp.sourceSpan));\n }\n });\n }\n };\n TemplateParseVisitor.prototype._createElementPropertyAsts = function(elementName, props, directives) {\n var _this = this;\n var boundElementProps = [];\n var boundDirectivePropsIndex = new Map();\n directives.forEach(function(directive) {\n directive.inputs.forEach(function(prop) {\n boundDirectivePropsIndex.set(prop.templateName, prop);\n });\n });\n props.forEach(function(prop) {\n if (!prop.isLiteral && lang_1.isBlank(boundDirectivePropsIndex.get(prop.name))) {\n boundElementProps.push(_this._createElementPropertyAst(elementName, prop.name, prop.expression, prop.sourceSpan));\n }\n });\n return boundElementProps;\n };\n TemplateParseVisitor.prototype._createElementPropertyAst = function(elementName, name, ast, sourceSpan) {\n var unit = null;\n var bindingType;\n var boundPropertyName;\n var parts = name.split(PROPERTY_PARTS_SEPARATOR);\n if (parts.length === 1) {\n boundPropertyName = this._schemaRegistry.getMappedPropName(parts[0]);\n bindingType = template_ast_1.PropertyBindingType.Property;\n if (!this._schemaRegistry.hasProperty(elementName, boundPropertyName)) {\n this._reportError(\"Can't bind to '\" + boundPropertyName + \"' since it isn't a known native property\", sourceSpan);\n }\n } else {\n if (parts[0] == ATTRIBUTE_PREFIX) {\n boundPropertyName = parts[1];\n bindingType = template_ast_1.PropertyBindingType.Attribute;\n } else if (parts[0] == CLASS_PREFIX) {\n boundPropertyName = parts[1];\n bindingType = template_ast_1.PropertyBindingType.Class;\n } else if (parts[0] == STYLE_PREFIX) {\n unit = parts.length > 2 ? parts[2] : null;\n boundPropertyName = parts[1];\n bindingType = template_ast_1.PropertyBindingType.Style;\n } else {\n this._reportError(\"Invalid property name '\" + name + \"'\", sourceSpan);\n bindingType = null;\n }\n }\n return new template_ast_1.BoundElementPropertyAst(boundPropertyName, bindingType, ast, unit, sourceSpan);\n };\n TemplateParseVisitor.prototype._findComponentDirectiveNames = function(directives) {\n var componentTypeNames = [];\n directives.forEach(function(directive) {\n var typeName = directive.directive.type.name;\n if (directive.directive.isComponent) {\n componentTypeNames.push(typeName);\n }\n });\n return componentTypeNames;\n };\n TemplateParseVisitor.prototype._assertOnlyOneComponent = function(directives, sourceSpan) {\n var componentTypeNames = this._findComponentDirectiveNames(directives);\n if (componentTypeNames.length > 1) {\n this._reportError(\"More than one component: \" + componentTypeNames.join(','), sourceSpan);\n }\n };\n TemplateParseVisitor.prototype._assertNoComponentsNorElementBindingsOnTemplate = function(directives, elementProps, sourceSpan) {\n var _this = this;\n var componentTypeNames = this._findComponentDirectiveNames(directives);\n if (componentTypeNames.length > 0) {\n this._reportError(\"Components on an embedded template: \" + componentTypeNames.join(','), sourceSpan);\n }\n elementProps.forEach(function(prop) {\n _this._reportError(\"Property binding \" + prop.name + \" not used by any directive on an embedded template\", sourceSpan);\n });\n };\n TemplateParseVisitor.prototype._assertAllEventsPublishedByDirectives = function(directives, events) {\n var _this = this;\n var allDirectiveEvents = new Set();\n directives.forEach(function(directive) {\n collection_1.StringMapWrapper.forEach(directive.directive.outputs, function(eventName, _) {\n allDirectiveEvents.add(eventName);\n });\n });\n events.forEach(function(event) {\n if (lang_1.isPresent(event.target) || !collection_1.SetWrapper.has(allDirectiveEvents, event.name)) {\n _this._reportError(\"Event binding \" + event.fullName + \" not emitted by any directive on an embedded template\", event.sourceSpan);\n }\n });\n };\n return TemplateParseVisitor;\n })();\n var NonBindableVisitor = (function() {\n function NonBindableVisitor() {}\n NonBindableVisitor.prototype.visitElement = function(ast, component) {\n var preparsedElement = template_preparser_1.preparseElement(ast);\n if (preparsedElement.type === template_preparser_1.PreparsedElementType.SCRIPT || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLE || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLESHEET) {\n return null;\n }\n var attrNameAndValues = ast.attrs.map(function(attrAst) {\n return [attrAst.name, attrAst.value];\n });\n var selector = createElementCssSelector(ast.name, attrNameAndValues);\n var ngContentIndex = component.findNgContentIndex(selector);\n var children = html_ast_1.htmlVisitAll(this, ast.children, EMPTY_COMPONENT);\n return new template_ast_1.ElementAst(ast.name, html_ast_1.htmlVisitAll(this, ast.attrs), [], [], [], [], children, ngContentIndex, ast.sourceSpan);\n };\n NonBindableVisitor.prototype.visitAttr = function(ast, context) {\n return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceSpan);\n };\n NonBindableVisitor.prototype.visitText = function(ast, component) {\n var ngContentIndex = component.findNgContentIndex(TEXT_CSS_SELECTOR);\n return new template_ast_1.TextAst(ast.value, ngContentIndex, ast.sourceSpan);\n };\n return NonBindableVisitor;\n })();\n var BoundElementOrDirectiveProperty = (function() {\n function BoundElementOrDirectiveProperty(name, expression, isLiteral, sourceSpan) {\n this.name = name;\n this.expression = expression;\n this.isLiteral = isLiteral;\n this.sourceSpan = sourceSpan;\n }\n return BoundElementOrDirectiveProperty;\n })();\n function splitClasses(classAttrValue) {\n return lang_1.StringWrapper.split(classAttrValue.trim(), /\\s+/g);\n }\n exports.splitClasses = splitClasses;\n var Component = (function() {\n function Component(ngContentIndexMatcher, wildcardNgContentIndex) {\n this.ngContentIndexMatcher = ngContentIndexMatcher;\n this.wildcardNgContentIndex = wildcardNgContentIndex;\n }\n Component.create = function(directives) {\n if (directives.length === 0 || !directives[0].directive.isComponent) {\n return EMPTY_COMPONENT;\n }\n var matcher = new selector_1.SelectorMatcher();\n var ngContentSelectors = directives[0].directive.template.ngContentSelectors;\n var wildcardNgContentIndex = null;\n for (var i = 0; i < ngContentSelectors.length; i++) {\n var selector = ngContentSelectors[i];\n if (lang_1.StringWrapper.equals(selector, '*')) {\n wildcardNgContentIndex = i;\n } else {\n matcher.addSelectables(selector_1.CssSelector.parse(ngContentSelectors[i]), i);\n }\n }\n return new Component(matcher, wildcardNgContentIndex);\n };\n Component.prototype.findNgContentIndex = function(selector) {\n var ngContentIndices = [];\n this.ngContentIndexMatcher.match(selector, function(selector, ngContentIndex) {\n ngContentIndices.push(ngContentIndex);\n });\n collection_1.ListWrapper.sort(ngContentIndices);\n if (lang_1.isPresent(this.wildcardNgContentIndex)) {\n ngContentIndices.push(this.wildcardNgContentIndex);\n }\n return ngContentIndices.length > 0 ? ngContentIndices[0] : null;\n };\n return Component;\n })();\n function createElementCssSelector(elementName, matchableAttrs) {\n var cssSelector = new selector_1.CssSelector();\n var elNameNoNs = html_tags_1.splitNsName(elementName)[1];\n cssSelector.setElement(elNameNoNs);\n for (var i = 0; i < matchableAttrs.length; i++) {\n var attrName = matchableAttrs[i][0];\n var attrNameNoNs = html_tags_1.splitNsName(attrName)[1];\n var attrValue = matchableAttrs[i][1];\n cssSelector.addAttribute(attrNameNoNs, attrValue);\n if (attrName.toLowerCase() == CLASS_ATTR) {\n var classes = splitClasses(attrValue);\n classes.forEach(function(className) {\n return cssSelector.addClassName(className);\n });\n }\n }\n return cssSelector;\n }\n var EMPTY_COMPONENT = new Component(new selector_1.SelectorMatcher(), null);\n var NON_BINDABLE_VISITOR = new NonBindableVisitor();\n var PipeCollector = (function(_super) {\n __extends(PipeCollector, _super);\n function PipeCollector() {\n _super.apply(this, arguments);\n this.pipes = new Set();\n }\n PipeCollector.prototype.visitPipe = function(ast) {\n this.pipes.add(ast.name);\n ast.exp.visit(this);\n this.visitAll(ast.args);\n return null;\n };\n return PipeCollector;\n })(ast_1.RecursiveAstVisitor);\n exports.PipeCollector = PipeCollector;\n})(require('process'));\n","/* */ \n'use strict';\nvar lang_1 = require('../facade/lang');\nvar HtmlTextAst = (function() {\n function HtmlTextAst(value, sourceSpan) {\n this.value = value;\n this.sourceSpan = sourceSpan;\n }\n HtmlTextAst.prototype.visit = function(visitor, context) {\n return visitor.visitText(this, context);\n };\n return HtmlTextAst;\n})();\nexports.HtmlTextAst = HtmlTextAst;\nvar HtmlAttrAst = (function() {\n function HtmlAttrAst(name, value, sourceSpan) {\n this.name = name;\n this.value = value;\n this.sourceSpan = sourceSpan;\n }\n HtmlAttrAst.prototype.visit = function(visitor, context) {\n return visitor.visitAttr(this, context);\n };\n return HtmlAttrAst;\n})();\nexports.HtmlAttrAst = HtmlAttrAst;\nvar HtmlElementAst = (function() {\n function HtmlElementAst(name, attrs, children, sourceSpan) {\n this.name = name;\n this.attrs = attrs;\n this.children = children;\n this.sourceSpan = sourceSpan;\n }\n HtmlElementAst.prototype.visit = function(visitor, context) {\n return visitor.visitElement(this, context);\n };\n return HtmlElementAst;\n})();\nexports.HtmlElementAst = HtmlElementAst;\nfunction htmlVisitAll(visitor, asts, context) {\n if (context === void 0) {\n context = null;\n }\n var result = [];\n asts.forEach(function(ast) {\n var astResult = ast.visit(visitor, context);\n if (lang_1.isPresent(astResult)) {\n result.push(astResult);\n }\n });\n return result;\n}\nexports.htmlVisitAll = htmlVisitAll;\n","/* */ \n(function(process) {\n 'use strict';\n var __extends = (this && this.__extends) || function(d, b) {\n for (var p in b)\n if (b.hasOwnProperty(p))\n d[p] = b[p];\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n var lang_1 = require('../facade/lang');\n var collection_1 = require('../facade/collection');\n var parse_util_1 = require('./parse_util');\n var html_tags_1 = require('./html_tags');\n (function(HtmlTokenType) {\n HtmlTokenType[HtmlTokenType[\"TAG_OPEN_START\"] = 0] = \"TAG_OPEN_START\";\n HtmlTokenType[HtmlTokenType[\"TAG_OPEN_END\"] = 1] = \"TAG_OPEN_END\";\n HtmlTokenType[HtmlTokenType[\"TAG_OPEN_END_VOID\"] = 2] = \"TAG_OPEN_END_VOID\";\n HtmlTokenType[HtmlTokenType[\"TAG_CLOSE\"] = 3] = \"TAG_CLOSE\";\n HtmlTokenType[HtmlTokenType[\"TEXT\"] = 4] = \"TEXT\";\n HtmlTokenType[HtmlTokenType[\"ESCAPABLE_RAW_TEXT\"] = 5] = \"ESCAPABLE_RAW_TEXT\";\n HtmlTokenType[HtmlTokenType[\"RAW_TEXT\"] = 6] = \"RAW_TEXT\";\n HtmlTokenType[HtmlTokenType[\"COMMENT_START\"] = 7] = \"COMMENT_START\";\n HtmlTokenType[HtmlTokenType[\"COMMENT_END\"] = 8] = \"COMMENT_END\";\n HtmlTokenType[HtmlTokenType[\"CDATA_START\"] = 9] = \"CDATA_START\";\n HtmlTokenType[HtmlTokenType[\"CDATA_END\"] = 10] = \"CDATA_END\";\n HtmlTokenType[HtmlTokenType[\"ATTR_NAME\"] = 11] = \"ATTR_NAME\";\n HtmlTokenType[HtmlTokenType[\"ATTR_VALUE\"] = 12] = \"ATTR_VALUE\";\n HtmlTokenType[HtmlTokenType[\"DOC_TYPE\"] = 13] = \"DOC_TYPE\";\n HtmlTokenType[HtmlTokenType[\"EOF\"] = 14] = \"EOF\";\n })(exports.HtmlTokenType || (exports.HtmlTokenType = {}));\n var HtmlTokenType = exports.HtmlTokenType;\n var HtmlToken = (function() {\n function HtmlToken(type, parts, sourceSpan) {\n this.type = type;\n this.parts = parts;\n this.sourceSpan = sourceSpan;\n }\n return HtmlToken;\n })();\n exports.HtmlToken = HtmlToken;\n var HtmlTokenError = (function(_super) {\n __extends(HtmlTokenError, _super);\n function HtmlTokenError(errorMsg, tokenType, location) {\n _super.call(this, location, errorMsg);\n this.tokenType = tokenType;\n }\n return HtmlTokenError;\n })(parse_util_1.ParseError);\n exports.HtmlTokenError = HtmlTokenError;\n var HtmlTokenizeResult = (function() {\n function HtmlTokenizeResult(tokens, errors) {\n this.tokens = tokens;\n this.errors = errors;\n }\n return HtmlTokenizeResult;\n })();\n exports.HtmlTokenizeResult = HtmlTokenizeResult;\n function tokenizeHtml(sourceContent, sourceUrl) {\n return new _HtmlTokenizer(new parse_util_1.ParseSourceFile(sourceContent, sourceUrl)).tokenize();\n }\n exports.tokenizeHtml = tokenizeHtml;\n var $EOF = 0;\n var $TAB = 9;\n var $LF = 10;\n var $FF = 12;\n var $CR = 13;\n var $SPACE = 32;\n var $BANG = 33;\n var $DQ = 34;\n var $HASH = 35;\n var $$ = 36;\n var $AMPERSAND = 38;\n var $SQ = 39;\n var $MINUS = 45;\n var $SLASH = 47;\n var $0 = 48;\n var $SEMICOLON = 59;\n var $9 = 57;\n var $COLON = 58;\n var $LT = 60;\n var $EQ = 61;\n var $GT = 62;\n var $QUESTION = 63;\n var $LBRACKET = 91;\n var $RBRACKET = 93;\n var $A = 65;\n var $F = 70;\n var $X = 88;\n var $Z = 90;\n var $a = 97;\n var $f = 102;\n var $z = 122;\n var $x = 120;\n var $NBSP = 160;\n var CR_OR_CRLF_REGEXP = /\\r\\n?/g;\n function unexpectedCharacterErrorMsg(charCode) {\n var char = charCode === $EOF ? 'EOF' : lang_1.StringWrapper.fromCharCode(charCode);\n return \"Unexpected character \\\"\" + char + \"\\\"\";\n }\n function unknownEntityErrorMsg(entitySrc) {\n return \"Unknown entity \\\"\" + entitySrc + \"\\\" - use the \\\";\\\" or \\\";\\\" syntax\";\n }\n var ControlFlowError = (function() {\n function ControlFlowError(error) {\n this.error = error;\n }\n return ControlFlowError;\n })();\n var _HtmlTokenizer = (function() {\n function _HtmlTokenizer(file) {\n this.file = file;\n this.peek = -1;\n this.index = -1;\n this.line = 0;\n this.column = -1;\n this.tokens = [];\n this.errors = [];\n this.input = file.content;\n this.length = file.content.length;\n this._advance();\n }\n _HtmlTokenizer.prototype._processCarriageReturns = function(content) {\n return lang_1.StringWrapper.replaceAll(content, CR_OR_CRLF_REGEXP, '\\n');\n };\n _HtmlTokenizer.prototype.tokenize = function() {\n while (this.peek !== $EOF) {\n var start = this._getLocation();\n try {\n if (this._attemptCharCode($LT)) {\n if (this._attemptCharCode($BANG)) {\n if (this._attemptCharCode($LBRACKET)) {\n this._consumeCdata(start);\n } else if (this._attemptCharCode($MINUS)) {\n this._consumeComment(start);\n } else {\n this._consumeDocType(start);\n }\n } else if (this._attemptCharCode($SLASH)) {\n this._consumeTagClose(start);\n } else {\n this._consumeTagOpen(start);\n }\n } else {\n this._consumeText();\n }\n } catch (e) {\n if (e instanceof ControlFlowError) {\n this.errors.push(e.error);\n } else {\n throw e;\n }\n }\n }\n this._beginToken(HtmlTokenType.EOF);\n this._endToken([]);\n return new HtmlTokenizeResult(mergeTextTokens(this.tokens), this.errors);\n };\n _HtmlTokenizer.prototype._getLocation = function() {\n return new parse_util_1.ParseLocation(this.file, this.index, this.line, this.column);\n };\n _HtmlTokenizer.prototype._beginToken = function(type, start) {\n if (start === void 0) {\n start = null;\n }\n if (lang_1.isBlank(start)) {\n start = this._getLocation();\n }\n this.currentTokenStart = start;\n this.currentTokenType = type;\n };\n _HtmlTokenizer.prototype._endToken = function(parts, end) {\n if (end === void 0) {\n end = null;\n }\n if (lang_1.isBlank(end)) {\n end = this._getLocation();\n }\n var token = new HtmlToken(this.currentTokenType, parts, new parse_util_1.ParseSourceSpan(this.currentTokenStart, end));\n this.tokens.push(token);\n this.currentTokenStart = null;\n this.currentTokenType = null;\n return token;\n };\n _HtmlTokenizer.prototype._createError = function(msg, position) {\n var error = new HtmlTokenError(msg, this.currentTokenType, position);\n this.currentTokenStart = null;\n this.currentTokenType = null;\n return new ControlFlowError(error);\n };\n _HtmlTokenizer.prototype._advance = function() {\n if (this.index >= this.length) {\n throw this._createError(unexpectedCharacterErrorMsg($EOF), this._getLocation());\n }\n if (this.peek === $LF) {\n this.line++;\n this.column = 0;\n } else if (this.peek !== $LF && this.peek !== $CR) {\n this.column++;\n }\n this.index++;\n this.peek = this.index >= this.length ? $EOF : lang_1.StringWrapper.charCodeAt(this.input, this.index);\n };\n _HtmlTokenizer.prototype._attemptCharCode = function(charCode) {\n if (this.peek === charCode) {\n this._advance();\n return true;\n }\n return false;\n };\n _HtmlTokenizer.prototype._attemptCharCodeCaseInsensitive = function(charCode) {\n if (compareCharCodeCaseInsensitive(this.peek, charCode)) {\n this._advance();\n return true;\n }\n return false;\n };\n _HtmlTokenizer.prototype._requireCharCode = function(charCode) {\n var location = this._getLocation();\n if (!this._attemptCharCode(charCode)) {\n throw this._createError(unexpectedCharacterErrorMsg(this.peek), location);\n }\n };\n _HtmlTokenizer.prototype._attemptStr = function(chars) {\n for (var i = 0; i < chars.length; i++) {\n if (!this._attemptCharCode(lang_1.StringWrapper.charCodeAt(chars, i))) {\n return false;\n }\n }\n return true;\n };\n _HtmlTokenizer.prototype._attemptStrCaseInsensitive = function(chars) {\n for (var i = 0; i < chars.length; i++) {\n if (!this._attemptCharCodeCaseInsensitive(lang_1.StringWrapper.charCodeAt(chars, i))) {\n return false;\n }\n }\n return true;\n };\n _HtmlTokenizer.prototype._requireStr = function(chars) {\n var location = this._getLocation();\n if (!this._attemptStr(chars)) {\n throw this._createError(unexpectedCharacterErrorMsg(this.peek), location);\n }\n };\n _HtmlTokenizer.prototype._attemptCharCodeUntilFn = function(predicate) {\n while (!predicate(this.peek)) {\n this._advance();\n }\n };\n _HtmlTokenizer.prototype._requireCharCodeUntilFn = function(predicate, len) {\n var start = this._getLocation();\n this._attemptCharCodeUntilFn(predicate);\n if (this.index - start.offset < len) {\n throw this._createError(unexpectedCharacterErrorMsg(this.peek), start);\n }\n };\n _HtmlTokenizer.prototype._attemptUntilChar = function(char) {\n while (this.peek !== char) {\n this._advance();\n }\n };\n _HtmlTokenizer.prototype._readChar = function(decodeEntities) {\n if (decodeEntities && this.peek === $AMPERSAND) {\n return this._decodeEntity();\n } else {\n var index = this.index;\n this._advance();\n return this.input[index];\n }\n };\n _HtmlTokenizer.prototype._decodeEntity = function() {\n var start = this._getLocation();\n this._advance();\n if (this._attemptCharCode($HASH)) {\n var isHex = this._attemptCharCode($x) || this._attemptCharCode($X);\n var numberStart = this._getLocation().offset;\n this._attemptCharCodeUntilFn(isDigitEntityEnd);\n if (this.peek != $SEMICOLON) {\n throw this._createError(unexpectedCharacterErrorMsg(this.peek), this._getLocation());\n }\n this._advance();\n var strNum = this.input.substring(numberStart, this.index - 1);\n try {\n var charCode = lang_1.NumberWrapper.parseInt(strNum, isHex ? 16 : 10);\n return lang_1.StringWrapper.fromCharCode(charCode);\n } catch (e) {\n var entity = this.input.substring(start.offset + 1, this.index - 1);\n throw this._createError(unknownEntityErrorMsg(entity), start);\n }\n } else {\n var startPosition = this._savePosition();\n this._attemptCharCodeUntilFn(isNamedEntityEnd);\n if (this.peek != $SEMICOLON) {\n this._restorePosition(startPosition);\n return '&';\n }\n this._advance();\n var name_1 = this.input.substring(start.offset + 1, this.index - 1);\n var char = html_tags_1.NAMED_ENTITIES[name_1];\n if (lang_1.isBlank(char)) {\n throw this._createError(unknownEntityErrorMsg(name_1), start);\n }\n return char;\n }\n };\n _HtmlTokenizer.prototype._consumeRawText = function(decodeEntities, firstCharOfEnd, attemptEndRest) {\n var tagCloseStart;\n var textStart = this._getLocation();\n this._beginToken(decodeEntities ? HtmlTokenType.ESCAPABLE_RAW_TEXT : HtmlTokenType.RAW_TEXT, textStart);\n var parts = [];\n while (true) {\n tagCloseStart = this._getLocation();\n if (this._attemptCharCode(firstCharOfEnd) && attemptEndRest()) {\n break;\n }\n if (this.index > tagCloseStart.offset) {\n parts.push(this.input.substring(tagCloseStart.offset, this.index));\n }\n while (this.peek !== firstCharOfEnd) {\n parts.push(this._readChar(decodeEntities));\n }\n }\n return this._endToken([this._processCarriageReturns(parts.join(''))], tagCloseStart);\n };\n _HtmlTokenizer.prototype._consumeComment = function(start) {\n var _this = this;\n this._beginToken(HtmlTokenType.COMMENT_START, start);\n this._requireCharCode($MINUS);\n this._endToken([]);\n var textToken = this._consumeRawText(false, $MINUS, function() {\n return _this._attemptStr('->');\n });\n this._beginToken(HtmlTokenType.COMMENT_END, textToken.sourceSpan.end);\n this._endToken([]);\n };\n _HtmlTokenizer.prototype._consumeCdata = function(start) {\n var _this = this;\n this._beginToken(HtmlTokenType.CDATA_START, start);\n this._requireStr('CDATA[');\n this._endToken([]);\n var textToken = this._consumeRawText(false, $RBRACKET, function() {\n return _this._attemptStr(']>');\n });\n this._beginToken(HtmlTokenType.CDATA_END, textToken.sourceSpan.end);\n this._endToken([]);\n };\n _HtmlTokenizer.prototype._consumeDocType = function(start) {\n this._beginToken(HtmlTokenType.DOC_TYPE, start);\n this._attemptUntilChar($GT);\n this._advance();\n this._endToken([this.input.substring(start.offset + 2, this.index - 1)]);\n };\n _HtmlTokenizer.prototype._consumePrefixAndName = function() {\n var nameOrPrefixStart = this.index;\n var prefix = null;\n while (this.peek !== $COLON && !isPrefixEnd(this.peek)) {\n this._advance();\n }\n var nameStart;\n if (this.peek === $COLON) {\n this._advance();\n prefix = this.input.substring(nameOrPrefixStart, this.index - 1);\n nameStart = this.index;\n } else {\n nameStart = nameOrPrefixStart;\n }\n this._requireCharCodeUntilFn(isNameEnd, this.index === nameStart ? 1 : 0);\n var name = this.input.substring(nameStart, this.index);\n return [prefix, name];\n };\n _HtmlTokenizer.prototype._consumeTagOpen = function(start) {\n var savedPos = this._savePosition();\n var lowercaseTagName;\n try {\n if (!isAsciiLetter(this.peek)) {\n throw this._createError(unexpectedCharacterErrorMsg(this.peek), this._getLocation());\n }\n var nameStart = this.index;\n this._consumeTagOpenStart(start);\n lowercaseTagName = this.input.substring(nameStart, this.index).toLowerCase();\n this._attemptCharCodeUntilFn(isNotWhitespace);\n while (this.peek !== $SLASH && this.peek !== $GT) {\n this._consumeAttributeName();\n this._attemptCharCodeUntilFn(isNotWhitespace);\n if (this._attemptCharCode($EQ)) {\n this._attemptCharCodeUntilFn(isNotWhitespace);\n this._consumeAttributeValue();\n }\n this._attemptCharCodeUntilFn(isNotWhitespace);\n }\n this._consumeTagOpenEnd();\n } catch (e) {\n if (e instanceof ControlFlowError) {\n this._restorePosition(savedPos);\n this._beginToken(HtmlTokenType.TEXT, start);\n this._endToken(['<']);\n return;\n }\n throw e;\n }\n var contentTokenType = html_tags_1.getHtmlTagDefinition(lowercaseTagName).contentType;\n if (contentTokenType === html_tags_1.HtmlTagContentType.RAW_TEXT) {\n this._consumeRawTextWithTagClose(lowercaseTagName, false);\n } else if (contentTokenType === html_tags_1.HtmlTagContentType.ESCAPABLE_RAW_TEXT) {\n this._consumeRawTextWithTagClose(lowercaseTagName, true);\n }\n };\n _HtmlTokenizer.prototype._consumeRawTextWithTagClose = function(lowercaseTagName, decodeEntities) {\n var _this = this;\n var textToken = this._consumeRawText(decodeEntities, $LT, function() {\n if (!_this._attemptCharCode($SLASH))\n return false;\n _this._attemptCharCodeUntilFn(isNotWhitespace);\n if (!_this._attemptStrCaseInsensitive(lowercaseTagName))\n return false;\n _this._attemptCharCodeUntilFn(isNotWhitespace);\n if (!_this._attemptCharCode($GT))\n return false;\n return true;\n });\n this._beginToken(HtmlTokenType.TAG_CLOSE, textToken.sourceSpan.end);\n this._endToken([null, lowercaseTagName]);\n };\n _HtmlTokenizer.prototype._consumeTagOpenStart = function(start) {\n this._beginToken(HtmlTokenType.TAG_OPEN_START, start);\n var parts = this._consumePrefixAndName();\n this._endToken(parts);\n };\n _HtmlTokenizer.prototype._consumeAttributeName = function() {\n this._beginToken(HtmlTokenType.ATTR_NAME);\n var prefixAndName = this._consumePrefixAndName();\n this._endToken(prefixAndName);\n };\n _HtmlTokenizer.prototype._consumeAttributeValue = function() {\n this._beginToken(HtmlTokenType.ATTR_VALUE);\n var value;\n if (this.peek === $SQ || this.peek === $DQ) {\n var quoteChar = this.peek;\n this._advance();\n var parts = [];\n while (this.peek !== quoteChar) {\n parts.push(this._readChar(true));\n }\n value = parts.join('');\n this._advance();\n } else {\n var valueStart = this.index;\n this._requireCharCodeUntilFn(isNameEnd, 1);\n value = this.input.substring(valueStart, this.index);\n }\n this._endToken([this._processCarriageReturns(value)]);\n };\n _HtmlTokenizer.prototype._consumeTagOpenEnd = function() {\n var tokenType = this._attemptCharCode($SLASH) ? HtmlTokenType.TAG_OPEN_END_VOID : HtmlTokenType.TAG_OPEN_END;\n this._beginToken(tokenType);\n this._requireCharCode($GT);\n this._endToken([]);\n };\n _HtmlTokenizer.prototype._consumeTagClose = function(start) {\n this._beginToken(HtmlTokenType.TAG_CLOSE, start);\n this._attemptCharCodeUntilFn(isNotWhitespace);\n var prefixAndName;\n prefixAndName = this._consumePrefixAndName();\n this._attemptCharCodeUntilFn(isNotWhitespace);\n this._requireCharCode($GT);\n this._endToken(prefixAndName);\n };\n _HtmlTokenizer.prototype._consumeText = function() {\n var start = this._getLocation();\n this._beginToken(HtmlTokenType.TEXT, start);\n var parts = [this._readChar(true)];\n while (!isTextEnd(this.peek)) {\n parts.push(this._readChar(true));\n }\n this._endToken([this._processCarriageReturns(parts.join(''))]);\n };\n _HtmlTokenizer.prototype._savePosition = function() {\n return [this.peek, this.index, this.column, this.line, this.tokens.length];\n };\n _HtmlTokenizer.prototype._restorePosition = function(position) {\n this.peek = position[0];\n this.index = position[1];\n this.column = position[2];\n this.line = position[3];\n var nbTokens = position[4];\n if (nbTokens < this.tokens.length) {\n this.tokens = collection_1.ListWrapper.slice(this.tokens, 0, nbTokens);\n }\n };\n return _HtmlTokenizer;\n })();\n function isNotWhitespace(code) {\n return !isWhitespace(code) || code === $EOF;\n }\n function isWhitespace(code) {\n return (code >= $TAB && code <= $SPACE) || (code === $NBSP);\n }\n function isNameEnd(code) {\n return isWhitespace(code) || code === $GT || code === $SLASH || code === $SQ || code === $DQ || code === $EQ;\n }\n function isPrefixEnd(code) {\n return (code < $a || $z < code) && (code < $A || $Z < code) && (code < $0 || code > $9);\n }\n function isDigitEntityEnd(code) {\n return code == $SEMICOLON || code == $EOF || !isAsciiHexDigit(code);\n }\n function isNamedEntityEnd(code) {\n return code == $SEMICOLON || code == $EOF || !isAsciiLetter(code);\n }\n function isTextEnd(code) {\n return code === $LT || code === $EOF;\n }\n function isAsciiLetter(code) {\n return code >= $a && code <= $z || code >= $A && code <= $Z;\n }\n function isAsciiHexDigit(code) {\n return code >= $a && code <= $f || code >= $A && code <= $F || code >= $0 && code <= $9;\n }\n function compareCharCodeCaseInsensitive(code1, code2) {\n return toUpperCaseCharCode(code1) == toUpperCaseCharCode(code2);\n }\n function toUpperCaseCharCode(code) {\n return code >= $a && code <= $z ? code - $a + $A : code;\n }\n function mergeTextTokens(srcTokens) {\n var dstTokens = [];\n var lastDstToken;\n for (var i = 0; i < srcTokens.length; i++) {\n var token = srcTokens[i];\n if (lang_1.isPresent(lastDstToken) && lastDstToken.type == HtmlTokenType.TEXT && token.type == HtmlTokenType.TEXT) {\n lastDstToken.parts[0] += token.parts[0];\n lastDstToken.sourceSpan.end = token.sourceSpan.end;\n } else {\n lastDstToken = token;\n dstTokens.push(lastDstToken);\n }\n }\n return dstTokens;\n }\n})(require('process'));\n","/* */ \n'use strict';var ParseLocation = (function () {\r\n function ParseLocation(file, offset, line, col) {\r\n this.file = file;\r\n this.offset = offset;\r\n this.line = line;\r\n this.col = col;\r\n }\r\n ParseLocation.prototype.toString = function () { return this.file.url + \"@\" + this.line + \":\" + this.col; };\r\n return ParseLocation;\r\n})();\r\nexports.ParseLocation = ParseLocation;\r\nvar ParseSourceFile = (function () {\r\n function ParseSourceFile(content, url) {\r\n this.content = content;\r\n this.url = url;\r\n }\r\n return ParseSourceFile;\r\n})();\r\nexports.ParseSourceFile = ParseSourceFile;\r\nvar ParseError = (function () {\r\n function ParseError(location, msg) {\r\n this.location = location;\r\n this.msg = msg;\r\n }\r\n ParseError.prototype.toString = function () {\r\n var source = this.location.file.content;\r\n var ctxStart = this.location.offset;\r\n if (ctxStart > source.length - 1) {\r\n ctxStart = source.length - 1;\r\n }\r\n var ctxEnd = ctxStart;\r\n var ctxLen = 0;\r\n var ctxLines = 0;\r\n while (ctxLen < 100 && ctxStart > 0) {\r\n ctxStart--;\r\n ctxLen++;\r\n if (source[ctxStart] == \"\\n\") {\r\n if (++ctxLines == 3) {\r\n break;\r\n }\r\n }\r\n }\r\n ctxLen = 0;\r\n ctxLines = 0;\r\n while (ctxLen < 100 && ctxEnd < source.length - 1) {\r\n ctxEnd++;\r\n ctxLen++;\r\n if (source[ctxEnd] == \"\\n\") {\r\n if (++ctxLines == 3) {\r\n break;\r\n }\r\n }\r\n }\r\n var context = source.substring(ctxStart, this.location.offset) + '[ERROR ->]' +\r\n source.substring(this.location.offset, ctxEnd + 1);\r\n return this.msg + \" (\\\"\" + context + \"\\\"): \" + this.location;\r\n };\r\n return ParseError;\r\n})();\r\nexports.ParseError = ParseError;\r\nvar ParseSourceSpan = (function () {\r\n function ParseSourceSpan(start, end) {\r\n this.start = start;\r\n this.end = end;\r\n }\r\n ParseSourceSpan.prototype.toString = function () {\r\n return this.start.file.content.substring(this.start.offset, this.end.offset);\r\n };\r\n return ParseSourceSpan;\r\n})();\r\nexports.ParseSourceSpan = ParseSourceSpan;\r\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFyc2VfdXRpbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImFuZ3VsYXIyL3NyYy9jb21waWxlci9wYXJzZV91dGlsLnRzIl0sIm5hbWVzIjpbIlBhcnNlTG9jYXRpb24iLCJQYXJzZUxvY2F0aW9uLmNvbnN0cnVjdG9yIiwiUGFyc2VMb2NhdGlvbi50b1N0cmluZyIsIlBhcnNlU291cmNlRmlsZSIsIlBhcnNlU291cmNlRmlsZS5jb25zdHJ1Y3RvciIsIlBhcnNlRXJyb3IiLCJQYXJzZUVycm9yLmNvbnN0cnVjdG9yIiwiUGFyc2VFcnJvci50b1N0cmluZyIsIlBhcnNlU291cmNlU3BhbiIsIlBhcn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hdGlvbi5vZmZzZXQsIGN0eEVuZCArIDEpO1xuXG4gICAgcmV0dXJuIGAke3RoaXMubXNnfSAoXCIke2NvbnRleHR9XCIpOiAke3RoaXMubG9jYXRpb259YDtcbiAgfVxufVxuXG5leHBvcnQgY2xhc3MgUGFyc2VTb3VyY2VTcGFuIHtcbiAgY29uc3RydWN0b3IocHVibGljIHN0YXJ0OiBQYXJzZUxvY2F0aW9uLCBwdWJsaWMgZW5kOiBQYXJzZUxvY2F0aW9uKSB7fVxuXG4gIHRvU3RyaW5nKCk6IHN0cmluZyB7XG4gICAgcmV0dXJuIHRoaXMuc3RhcnQuZmlsZS5jb250ZW50LnN1YnN0cmluZyh0aGlzLnN0YXJ0Lm9mZnNldCwgdGhpcy5lbmQub2Zmc2V0KTtcbiAgfVxufVxuIl19","/* */ \n'use strict';\nvar __extends = (this && this.__extends) || function(d, b) {\n for (var p in b)\n if (b.hasOwnProperty(p))\n d[p] = b[p];\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function(k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(k, v);\n};\nvar lang_1 = require('../facade/lang');\nvar collection_1 = require('../facade/collection');\nvar html_ast_1 = require('./html_ast');\nvar di_1 = require('../core/di');\nvar html_lexer_1 = require('./html_lexer');\nvar parse_util_1 = require('./parse_util');\nvar html_tags_1 = require('./html_tags');\nvar HtmlTreeError = (function(_super) {\n __extends(HtmlTreeError, _super);\n function HtmlTreeError(elementName, location, msg) {\n _super.call(this, location, msg);\n this.elementName = elementName;\n }\n HtmlTreeError.create = function(elementName, location, msg) {\n return new HtmlTreeError(elementName, location, msg);\n };\n return HtmlTreeError;\n})(parse_util_1.ParseError);\nexports.HtmlTreeError = HtmlTreeError;\nvar HtmlParseTreeResult = (function() {\n function HtmlParseTreeResult(rootNodes, errors) {\n this.rootNodes = rootNodes;\n this.errors = errors;\n }\n return HtmlParseTreeResult;\n})();\nexports.HtmlParseTreeResult = HtmlParseTreeResult;\nvar HtmlParser = (function() {\n function HtmlParser() {}\n HtmlParser.prototype.parse = function(sourceContent, sourceUrl) {\n var tokensAndErrors = html_lexer_1.tokenizeHtml(sourceContent, sourceUrl);\n var treeAndErrors = new TreeBuilder(tokensAndErrors.tokens).build();\n return new HtmlParseTreeResult(treeAndErrors.rootNodes, tokensAndErrors.errors.concat(treeAndErrors.errors));\n };\n HtmlParser = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], HtmlParser);\n return HtmlParser;\n})();\nexports.HtmlParser = HtmlParser;\nvar TreeBuilder = (function() {\n function TreeBuilder(tokens) {\n this.tokens = tokens;\n this.index = -1;\n this.rootNodes = [];\n this.errors = [];\n this.elementStack = [];\n this._advance();\n }\n TreeBuilder.prototype.build = function() {\n while (this.peek.type !== html_lexer_1.HtmlTokenType.EOF) {\n if (this.peek.type === html_lexer_1.HtmlTokenType.TAG_OPEN_START) {\n this._consumeStartTag(this._advance());\n } else if (this.peek.type === html_lexer_1.HtmlTokenType.TAG_CLOSE) {\n this._consumeEndTag(this._advance());\n } else if (this.peek.type === html_lexer_1.HtmlTokenType.CDATA_START) {\n this._closeVoidElement();\n this._consumeCdata(this._advance());\n } else if (this.peek.type === html_lexer_1.HtmlTokenType.COMMENT_START) {\n this._closeVoidElement();\n this._consumeComment(this._advance());\n } else if (this.peek.type === html_lexer_1.HtmlTokenType.TEXT || this.peek.type === html_lexer_1.HtmlTokenType.RAW_TEXT || this.peek.type === html_lexer_1.HtmlTokenType.ESCAPABLE_RAW_TEXT) {\n this._closeVoidElement();\n this._consumeText(this._advance());\n } else {\n this._advance();\n }\n }\n return new HtmlParseTreeResult(this.rootNodes, this.errors);\n };\n TreeBuilder.prototype._advance = function() {\n var prev = this.peek;\n if (this.index < this.tokens.length - 1) {\n this.index++;\n }\n this.peek = this.tokens[this.index];\n return prev;\n };\n TreeBuilder.prototype._advanceIf = function(type) {\n if (this.peek.type === type) {\n return this._advance();\n }\n return null;\n };\n TreeBuilder.prototype._consumeCdata = function(startToken) {\n this._consumeText(this._advance());\n this._advanceIf(html_lexer_1.HtmlTokenType.CDATA_END);\n };\n TreeBuilder.prototype._consumeComment = function(startToken) {\n this._advanceIf(html_lexer_1.HtmlTokenType.RAW_TEXT);\n this._advanceIf(html_lexer_1.HtmlTokenType.COMMENT_END);\n };\n TreeBuilder.prototype._consumeText = function(token) {\n var text = token.parts[0];\n if (text.length > 0 && text[0] == '\\n') {\n var parent_1 = this._getParentElement();\n if (lang_1.isPresent(parent_1) && parent_1.children.length == 0 && html_tags_1.getHtmlTagDefinition(parent_1.name).ignoreFirstLf) {\n text = text.substring(1);\n }\n }\n if (text.length > 0) {\n this._addToParent(new html_ast_1.HtmlTextAst(text, token.sourceSpan));\n }\n };\n TreeBuilder.prototype._closeVoidElement = function() {\n if (this.elementStack.length > 0) {\n var el = collection_1.ListWrapper.last(this.elementStack);\n if (html_tags_1.getHtmlTagDefinition(el.name).isVoid) {\n this.elementStack.pop();\n }\n }\n };\n TreeBuilder.prototype._consumeStartTag = function(startTagToken) {\n var prefix = startTagToken.parts[0];\n var name = startTagToken.parts[1];\n var attrs = [];\n while (this.peek.type === html_lexer_1.HtmlTokenType.ATTR_NAME) {\n attrs.push(this._consumeAttr(this._advance()));\n }\n var fullName = getElementFullName(prefix, name, this._getParentElement());\n var selfClosing = false;\n if (this.peek.type === html_lexer_1.HtmlTokenType.TAG_OPEN_END_VOID) {\n this._advance();\n selfClosing = true;\n if (html_tags_1.getNsPrefix(fullName) == null && !html_tags_1.getHtmlTagDefinition(fullName).isVoid) {\n this.errors.push(HtmlTreeError.create(fullName, startTagToken.sourceSpan.start, \"Only void and foreign elements can be self closed \\\"\" + startTagToken.parts[1] + \"\\\"\"));\n }\n } else if (this.peek.type === html_lexer_1.HtmlTokenType.TAG_OPEN_END) {\n this._advance();\n selfClosing = false;\n }\n var end = this.peek.sourceSpan.start;\n var el = new html_ast_1.HtmlElementAst(fullName, attrs, [], new parse_util_1.ParseSourceSpan(startTagToken.sourceSpan.start, end));\n this._pushElement(el);\n if (selfClosing) {\n this._popElement(fullName);\n }\n };\n TreeBuilder.prototype._pushElement = function(el) {\n if (this.elementStack.length > 0) {\n var parentEl = collection_1.ListWrapper.last(this.elementStack);\n if (html_tags_1.getHtmlTagDefinition(parentEl.name).isClosedByChild(el.name)) {\n this.elementStack.pop();\n }\n }\n var tagDef = html_tags_1.getHtmlTagDefinition(el.name);\n var parentEl = this._getParentElement();\n if (tagDef.requireExtraParent(lang_1.isPresent(parentEl) ? parentEl.name : null)) {\n var newParent = new html_ast_1.HtmlElementAst(tagDef.parentToAdd, [], [el], el.sourceSpan);\n this._addToParent(newParent);\n this.elementStack.push(newParent);\n this.elementStack.push(el);\n } else {\n this._addToParent(el);\n this.elementStack.push(el);\n }\n };\n TreeBuilder.prototype._consumeEndTag = function(endTagToken) {\n var fullName = getElementFullName(endTagToken.parts[0], endTagToken.parts[1], this._getParentElement());\n if (html_tags_1.getHtmlTagDefinition(fullName).isVoid) {\n this.errors.push(HtmlTreeError.create(fullName, endTagToken.sourceSpan.start, \"Void elements do not have end tags \\\"\" + endTagToken.parts[1] + \"\\\"\"));\n } else if (!this._popElement(fullName)) {\n this.errors.push(HtmlTreeError.create(fullName, endTagToken.sourceSpan.start, \"Unexpected closing tag \\\"\" + endTagToken.parts[1] + \"\\\"\"));\n }\n };\n TreeBuilder.prototype._popElement = function(fullName) {\n for (var stackIndex = this.elementStack.length - 1; stackIndex >= 0; stackIndex--) {\n var el = this.elementStack[stackIndex];\n if (el.name == fullName) {\n collection_1.ListWrapper.splice(this.elementStack, stackIndex, this.elementStack.length - stackIndex);\n return true;\n }\n if (!html_tags_1.getHtmlTagDefinition(el.name).closedByParent) {\n return false;\n }\n }\n return false;\n };\n TreeBuilder.prototype._consumeAttr = function(attrName) {\n var fullName = mergeNsAndName(attrName.parts[0], attrName.parts[1]);\n var end = attrName.sourceSpan.end;\n var value = '';\n if (this.peek.type === html_lexer_1.HtmlTokenType.ATTR_VALUE) {\n var valueToken = this._advance();\n value = valueToken.parts[0];\n end = valueToken.sourceSpan.end;\n }\n return new html_ast_1.HtmlAttrAst(fullName, value, new parse_util_1.ParseSourceSpan(attrName.sourceSpan.start, end));\n };\n TreeBuilder.prototype._getParentElement = function() {\n return this.elementStack.length > 0 ? collection_1.ListWrapper.last(this.elementStack) : null;\n };\n TreeBuilder.prototype._addToParent = function(node) {\n var parent = this._getParentElement();\n if (lang_1.isPresent(parent)) {\n parent.children.push(node);\n } else {\n this.rootNodes.push(node);\n }\n };\n return TreeBuilder;\n})();\nfunction mergeNsAndName(prefix, localName) {\n return lang_1.isPresent(prefix) ? \"@\" + prefix + \":\" + localName : localName;\n}\nfunction getElementFullName(prefix, localName, parentElement) {\n if (lang_1.isBlank(prefix)) {\n prefix = html_tags_1.getHtmlTagDefinition(localName).implicitNamespacePrefix;\n if (lang_1.isBlank(prefix) && lang_1.isPresent(parentElement)) {\n prefix = html_tags_1.getNsPrefix(parentElement.name);\n }\n }\n return mergeNsAndName(prefix, localName);\n}\n","/* */ \n'use strict';\nvar lang_1 = require('../facade/lang');\nvar html_tags_1 = require('./html_tags');\nvar NG_CONTENT_SELECT_ATTR = 'select';\nvar NG_CONTENT_ELEMENT = 'ng-content';\nvar LINK_ELEMENT = 'link';\nvar LINK_STYLE_REL_ATTR = 'rel';\nvar LINK_STYLE_HREF_ATTR = 'href';\nvar LINK_STYLE_REL_VALUE = 'stylesheet';\nvar STYLE_ELEMENT = 'style';\nvar SCRIPT_ELEMENT = 'script';\nvar NG_NON_BINDABLE_ATTR = 'ngNonBindable';\nfunction preparseElement(ast) {\n var selectAttr = null;\n var hrefAttr = null;\n var relAttr = null;\n var nonBindable = false;\n ast.attrs.forEach(function(attr) {\n var lcAttrName = attr.name.toLowerCase();\n if (lcAttrName == NG_CONTENT_SELECT_ATTR) {\n selectAttr = attr.value;\n } else if (lcAttrName == LINK_STYLE_HREF_ATTR) {\n hrefAttr = attr.value;\n } else if (lcAttrName == LINK_STYLE_REL_ATTR) {\n relAttr = attr.value;\n } else if (attr.name == NG_NON_BINDABLE_ATTR) {\n nonBindable = true;\n }\n });\n selectAttr = normalizeNgContentSelect(selectAttr);\n var nodeName = ast.name.toLowerCase();\n var type = PreparsedElementType.OTHER;\n if (html_tags_1.splitNsName(nodeName)[1] == NG_CONTENT_ELEMENT) {\n type = PreparsedElementType.NG_CONTENT;\n } else if (nodeName == STYLE_ELEMENT) {\n type = PreparsedElementType.STYLE;\n } else if (nodeName == SCRIPT_ELEMENT) {\n type = PreparsedElementType.SCRIPT;\n } else if (nodeName == LINK_ELEMENT && relAttr == LINK_STYLE_REL_VALUE) {\n type = PreparsedElementType.STYLESHEET;\n }\n return new PreparsedElement(type, selectAttr, hrefAttr, nonBindable);\n}\nexports.preparseElement = preparseElement;\n(function(PreparsedElementType) {\n PreparsedElementType[PreparsedElementType[\"NG_CONTENT\"] = 0] = \"NG_CONTENT\";\n PreparsedElementType[PreparsedElementType[\"STYLE\"] = 1] = \"STYLE\";\n PreparsedElementType[PreparsedElementType[\"STYLESHEET\"] = 2] = \"STYLESHEET\";\n PreparsedElementType[PreparsedElementType[\"SCRIPT\"] = 3] = \"SCRIPT\";\n PreparsedElementType[PreparsedElementType[\"OTHER\"] = 4] = \"OTHER\";\n})(exports.PreparsedElementType || (exports.PreparsedElementType = {}));\nvar PreparsedElementType = exports.PreparsedElementType;\nvar PreparsedElement = (function() {\n function PreparsedElement(type, selectAttr, hrefAttr, nonBindable) {\n this.type = type;\n this.selectAttr = selectAttr;\n this.hrefAttr = hrefAttr;\n this.nonBindable = nonBindable;\n }\n return PreparsedElement;\n})();\nexports.PreparsedElement = PreparsedElement;\nfunction normalizeNgContentSelect(selectAttr) {\n if (lang_1.isBlank(selectAttr) || selectAttr.length === 0) {\n return '*';\n }\n return selectAttr;\n}\n","/* */ \n'use strict';\nvar __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function(k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(k, v);\n};\nvar directive_metadata_1 = require('./directive_metadata');\nvar lang_1 = require('../facade/lang');\nvar exceptions_1 = require('../facade/exceptions');\nvar async_1 = require('../facade/async');\nvar xhr_1 = require('./xhr');\nvar url_resolver_1 = require('./url_resolver');\nvar style_url_resolver_1 = require('./style_url_resolver');\nvar di_1 = require('../core/di');\nvar view_1 = require('../core/metadata/view');\nvar html_ast_1 = require('./html_ast');\nvar html_parser_1 = require('./html_parser');\nvar template_preparser_1 = require('./template_preparser');\nvar TemplateNormalizer = (function() {\n function TemplateNormalizer(_xhr, _urlResolver, _htmlParser) {\n this._xhr = _xhr;\n this._urlResolver = _urlResolver;\n this._htmlParser = _htmlParser;\n }\n TemplateNormalizer.prototype.normalizeTemplate = function(directiveType, template) {\n var _this = this;\n if (lang_1.isPresent(template.template)) {\n return async_1.PromiseWrapper.resolve(this.normalizeLoadedTemplate(directiveType, template, template.template, directiveType.moduleUrl));\n } else if (lang_1.isPresent(template.templateUrl)) {\n var sourceAbsUrl = this._urlResolver.resolve(directiveType.moduleUrl, template.templateUrl);\n return this._xhr.get(sourceAbsUrl).then(function(templateContent) {\n return _this.normalizeLoadedTemplate(directiveType, template, templateContent, sourceAbsUrl);\n });\n } else {\n throw new exceptions_1.BaseException(\"No template specified for component \" + directiveType.name);\n }\n };\n TemplateNormalizer.prototype.normalizeLoadedTemplate = function(directiveType, templateMeta, template, templateAbsUrl) {\n var _this = this;\n var rootNodesAndErrors = this._htmlParser.parse(template, directiveType.name);\n if (rootNodesAndErrors.errors.length > 0) {\n var errorString = rootNodesAndErrors.errors.join('\\n');\n throw new exceptions_1.BaseException(\"Template parse errors:\\n\" + errorString);\n }\n var visitor = new TemplatePreparseVisitor();\n html_ast_1.htmlVisitAll(visitor, rootNodesAndErrors.rootNodes);\n var allStyles = templateMeta.styles.concat(visitor.styles);\n var allStyleAbsUrls = visitor.styleUrls.filter(style_url_resolver_1.isStyleUrlResolvable).map(function(url) {\n return _this._urlResolver.resolve(templateAbsUrl, url);\n }).concat(templateMeta.styleUrls.filter(style_url_resolver_1.isStyleUrlResolvable).map(function(url) {\n return _this._urlResolver.resolve(directiveType.moduleUrl, url);\n }));\n var allResolvedStyles = allStyles.map(function(style) {\n var styleWithImports = style_url_resolver_1.extractStyleUrls(_this._urlResolver, templateAbsUrl, style);\n styleWithImports.styleUrls.forEach(function(styleUrl) {\n return allStyleAbsUrls.push(styleUrl);\n });\n return styleWithImports.style;\n });\n var encapsulation = templateMeta.encapsulation;\n if (encapsulation === view_1.ViewEncapsulation.Emulated && allResolvedStyles.length === 0 && allStyleAbsUrls.length === 0) {\n encapsulation = view_1.ViewEncapsulation.None;\n }\n return new directive_metadata_1.CompileTemplateMetadata({\n encapsulation: encapsulation,\n template: template,\n templateUrl: templateAbsUrl,\n styles: allResolvedStyles,\n styleUrls: allStyleAbsUrls,\n ngContentSelectors: visitor.ngContentSelectors\n });\n };\n TemplateNormalizer = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, url_resolver_1.UrlResolver, html_parser_1.HtmlParser])], TemplateNormalizer);\n return TemplateNormalizer;\n})();\nexports.TemplateNormalizer = TemplateNormalizer;\nvar TemplatePreparseVisitor = (function() {\n function TemplatePreparseVisitor() {\n this.ngContentSelectors = [];\n this.styles = [];\n this.styleUrls = [];\n this.ngNonBindableStackCount = 0;\n }\n TemplatePreparseVisitor.prototype.visitElement = function(ast, context) {\n var preparsedElement = template_preparser_1.preparseElement(ast);\n switch (preparsedElement.type) {\n case template_preparser_1.PreparsedElementType.NG_CONTENT:\n if (this.ngNonBindableStackCount === 0) {\n this.ngContentSelectors.push(preparsedElement.selectAttr);\n }\n break;\n case template_preparser_1.PreparsedElementType.STYLE:\n var textContent = '';\n ast.children.forEach(function(child) {\n if (child instanceof html_ast_1.HtmlTextAst) {\n textContent += child.value;\n }\n });\n this.styles.push(textContent);\n break;\n case template_preparser_1.PreparsedElementType.STYLESHEET:\n this.styleUrls.push(preparsedElement.hrefAttr);\n break;\n default:\n break;\n }\n if (preparsedElement.nonBindable) {\n this.ngNonBindableStackCount++;\n }\n html_ast_1.htmlVisitAll(this, ast.children);\n if (preparsedElement.nonBindable) {\n this.ngNonBindableStackCount--;\n }\n return null;\n };\n TemplatePreparseVisitor.prototype.visitAttr = function(ast, context) {\n return null;\n };\n TemplatePreparseVisitor.prototype.visitText = function(ast, context) {\n return null;\n };\n return TemplatePreparseVisitor;\n})();\n","/* */ \n(function(process) {\n 'use strict';\n var collection_1 = require('../facade/collection');\n var lang_1 = require('../facade/lang');\n var exceptions_1 = require('../facade/exceptions');\n var _EMPTY_ATTR_VALUE = '';\n var _SELECTOR_REGEXP = lang_1.RegExpWrapper.create('(\\\\:not\\\\()|' + '([-\\\\w]+)|' + '(?:\\\\.([-\\\\w]+))|' + '(?:\\\\[([-\\\\w*]+)(?:=([^\\\\]]*))?\\\\])|' + '(\\\\))|' + '(\\\\s*,\\\\s*)');\n var CssSelector = (function() {\n function CssSelector() {\n this.element = null;\n this.classNames = [];\n this.attrs = [];\n this.notSelectors = [];\n }\n CssSelector.parse = function(selector) {\n var results = [];\n var _addResult = function(res, cssSel) {\n if (cssSel.notSelectors.length > 0 && lang_1.isBlank(cssSel.element) && collection_1.ListWrapper.isEmpty(cssSel.classNames) && collection_1.ListWrapper.isEmpty(cssSel.attrs)) {\n cssSel.element = \"*\";\n }\n res.push(cssSel);\n };\n var cssSelector = new CssSelector();\n var matcher = lang_1.RegExpWrapper.matcher(_SELECTOR_REGEXP, selector);\n var match;\n var current = cssSelector;\n var inNot = false;\n while (lang_1.isPresent(match = lang_1.RegExpMatcherWrapper.next(matcher))) {\n if (lang_1.isPresent(match[1])) {\n if (inNot) {\n throw new exceptions_1.BaseException('Nesting :not is not allowed in a selector');\n }\n inNot = true;\n current = new CssSelector();\n cssSelector.notSelectors.push(current);\n }\n if (lang_1.isPresent(match[2])) {\n current.setElement(match[2]);\n }\n if (lang_1.isPresent(match[3])) {\n current.addClassName(match[3]);\n }\n if (lang_1.isPresent(match[4])) {\n current.addAttribute(match[4], match[5]);\n }\n if (lang_1.isPresent(match[6])) {\n inNot = false;\n current = cssSelector;\n }\n if (lang_1.isPresent(match[7])) {\n if (inNot) {\n throw new exceptions_1.BaseException('Multiple selectors in :not are not supported');\n }\n _addResult(results, cssSelector);\n cssSelector = current = new CssSelector();\n }\n }\n _addResult(results, cssSelector);\n return results;\n };\n CssSelector.prototype.isElementSelector = function() {\n return lang_1.isPresent(this.element) && collection_1.ListWrapper.isEmpty(this.classNames) && collection_1.ListWrapper.isEmpty(this.attrs) && this.notSelectors.length === 0;\n };\n CssSelector.prototype.setElement = function(element) {\n if (element === void 0) {\n element = null;\n }\n this.element = element;\n };\n CssSelector.prototype.getMatchingElementTemplate = function() {\n var tagName = lang_1.isPresent(this.element) ? this.element : 'div';\n var classAttr = this.classNames.length > 0 ? \" class=\\\"\" + this.classNames.join(' ') + \"\\\"\" : '';\n var attrs = '';\n for (var i = 0; i < this.attrs.length; i += 2) {\n var attrName = this.attrs[i];\n var attrValue = this.attrs[i + 1] !== '' ? \"=\\\"\" + this.attrs[i + 1] + \"\\\"\" : '';\n attrs += \" \" + attrName + attrValue;\n }\n return \"<\" + tagName + classAttr + attrs + \">\" + tagName + \">\";\n };\n CssSelector.prototype.addAttribute = function(name, value) {\n if (value === void 0) {\n value = _EMPTY_ATTR_VALUE;\n }\n this.attrs.push(name);\n if (lang_1.isPresent(value)) {\n value = value.toLowerCase();\n } else {\n value = _EMPTY_ATTR_VALUE;\n }\n this.attrs.push(value);\n };\n CssSelector.prototype.addClassName = function(name) {\n this.classNames.push(name.toLowerCase());\n };\n CssSelector.prototype.toString = function() {\n var res = '';\n if (lang_1.isPresent(this.element)) {\n res += this.element;\n }\n if (lang_1.isPresent(this.classNames)) {\n for (var i = 0; i < this.classNames.length; i++) {\n res += '.' + this.classNames[i];\n }\n }\n if (lang_1.isPresent(this.attrs)) {\n for (var i = 0; i < this.attrs.length; ) {\n var attrName = this.attrs[i++];\n var attrValue = this.attrs[i++];\n res += '[' + attrName;\n if (attrValue.length > 0) {\n res += '=' + attrValue;\n }\n res += ']';\n }\n }\n this.notSelectors.forEach(function(notSelector) {\n return res += \":not(\" + notSelector + \")\";\n });\n return res;\n };\n return CssSelector;\n })();\n exports.CssSelector = CssSelector;\n var SelectorMatcher = (function() {\n function SelectorMatcher() {\n this._elementMap = new collection_1.Map();\n this._elementPartialMap = new collection_1.Map();\n this._classMap = new collection_1.Map();\n this._classPartialMap = new collection_1.Map();\n this._attrValueMap = new collection_1.Map();\n this._attrValuePartialMap = new collection_1.Map();\n this._listContexts = [];\n }\n SelectorMatcher.createNotMatcher = function(notSelectors) {\n var notMatcher = new SelectorMatcher();\n notMatcher.addSelectables(notSelectors, null);\n return notMatcher;\n };\n SelectorMatcher.prototype.addSelectables = function(cssSelectors, callbackCtxt) {\n var listContext = null;\n if (cssSelectors.length > 1) {\n listContext = new SelectorListContext(cssSelectors);\n this._listContexts.push(listContext);\n }\n for (var i = 0; i < cssSelectors.length; i++) {\n this._addSelectable(cssSelectors[i], callbackCtxt, listContext);\n }\n };\n SelectorMatcher.prototype._addSelectable = function(cssSelector, callbackCtxt, listContext) {\n var matcher = this;\n var element = cssSelector.element;\n var classNames = cssSelector.classNames;\n var attrs = cssSelector.attrs;\n var selectable = new SelectorContext(cssSelector, callbackCtxt, listContext);\n if (lang_1.isPresent(element)) {\n var isTerminal = attrs.length === 0 && classNames.length === 0;\n if (isTerminal) {\n this._addTerminal(matcher._elementMap, element, selectable);\n } else {\n matcher = this._addPartial(matcher._elementPartialMap, element);\n }\n }\n if (lang_1.isPresent(classNames)) {\n for (var index = 0; index < classNames.length; index++) {\n var isTerminal = attrs.length === 0 && index === classNames.length - 1;\n var className = classNames[index];\n if (isTerminal) {\n this._addTerminal(matcher._classMap, className, selectable);\n } else {\n matcher = this._addPartial(matcher._classPartialMap, className);\n }\n }\n }\n if (lang_1.isPresent(attrs)) {\n for (var index = 0; index < attrs.length; ) {\n var isTerminal = index === attrs.length - 2;\n var attrName = attrs[index++];\n var attrValue = attrs[index++];\n if (isTerminal) {\n var terminalMap = matcher._attrValueMap;\n var terminalValuesMap = terminalMap.get(attrName);\n if (lang_1.isBlank(terminalValuesMap)) {\n terminalValuesMap = new collection_1.Map();\n terminalMap.set(attrName, terminalValuesMap);\n }\n this._addTerminal(terminalValuesMap, attrValue, selectable);\n } else {\n var parttialMap = matcher._attrValuePartialMap;\n var partialValuesMap = parttialMap.get(attrName);\n if (lang_1.isBlank(partialValuesMap)) {\n partialValuesMap = new collection_1.Map();\n parttialMap.set(attrName, partialValuesMap);\n }\n matcher = this._addPartial(partialValuesMap, attrValue);\n }\n }\n }\n };\n SelectorMatcher.prototype._addTerminal = function(map, name, selectable) {\n var terminalList = map.get(name);\n if (lang_1.isBlank(terminalList)) {\n terminalList = [];\n map.set(name, terminalList);\n }\n terminalList.push(selectable);\n };\n SelectorMatcher.prototype._addPartial = function(map, name) {\n var matcher = map.get(name);\n if (lang_1.isBlank(matcher)) {\n matcher = new SelectorMatcher();\n map.set(name, matcher);\n }\n return matcher;\n };\n SelectorMatcher.prototype.match = function(cssSelector, matchedCallback) {\n var result = false;\n var element = cssSelector.element;\n var classNames = cssSelector.classNames;\n var attrs = cssSelector.attrs;\n for (var i = 0; i < this._listContexts.length; i++) {\n this._listContexts[i].alreadyMatched = false;\n }\n result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result;\n result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) || result;\n if (lang_1.isPresent(classNames)) {\n for (var index = 0; index < classNames.length; index++) {\n var className = classNames[index];\n result = this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result;\n result = this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) || result;\n }\n }\n if (lang_1.isPresent(attrs)) {\n for (var index = 0; index < attrs.length; ) {\n var attrName = attrs[index++];\n var attrValue = attrs[index++];\n var terminalValuesMap = this._attrValueMap.get(attrName);\n if (!lang_1.StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) {\n result = this._matchTerminal(terminalValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result;\n }\n result = this._matchTerminal(terminalValuesMap, attrValue, cssSelector, matchedCallback) || result;\n var partialValuesMap = this._attrValuePartialMap.get(attrName);\n if (!lang_1.StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) {\n result = this._matchPartial(partialValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result;\n }\n result = this._matchPartial(partialValuesMap, attrValue, cssSelector, matchedCallback) || result;\n }\n }\n return result;\n };\n SelectorMatcher.prototype._matchTerminal = function(map, name, cssSelector, matchedCallback) {\n if (lang_1.isBlank(map) || lang_1.isBlank(name)) {\n return false;\n }\n var selectables = map.get(name);\n var starSelectables = map.get(\"*\");\n if (lang_1.isPresent(starSelectables)) {\n selectables = selectables.concat(starSelectables);\n }\n if (lang_1.isBlank(selectables)) {\n return false;\n }\n var selectable;\n var result = false;\n for (var index = 0; index < selectables.length; index++) {\n selectable = selectables[index];\n result = selectable.finalize(cssSelector, matchedCallback) || result;\n }\n return result;\n };\n SelectorMatcher.prototype._matchPartial = function(map, name, cssSelector, matchedCallback) {\n if (lang_1.isBlank(map) || lang_1.isBlank(name)) {\n return false;\n }\n var nestedSelector = map.get(name);\n if (lang_1.isBlank(nestedSelector)) {\n return false;\n }\n return nestedSelector.match(cssSelector, matchedCallback);\n };\n return SelectorMatcher;\n })();\n exports.SelectorMatcher = SelectorMatcher;\n var SelectorListContext = (function() {\n function SelectorListContext(selectors) {\n this.selectors = selectors;\n this.alreadyMatched = false;\n }\n return SelectorListContext;\n })();\n exports.SelectorListContext = SelectorListContext;\n var SelectorContext = (function() {\n function SelectorContext(selector, cbContext, listContext) {\n this.selector = selector;\n this.cbContext = cbContext;\n this.listContext = listContext;\n this.notSelectors = selector.notSelectors;\n }\n SelectorContext.prototype.finalize = function(cssSelector, callback) {\n var result = true;\n if (this.notSelectors.length > 0 && (lang_1.isBlank(this.listContext) || !this.listContext.alreadyMatched)) {\n var notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors);\n result = !notMatcher.match(cssSelector, null);\n }\n if (result && lang_1.isPresent(callback) && (lang_1.isBlank(this.listContext) || !this.listContext.alreadyMatched)) {\n if (lang_1.isPresent(this.listContext)) {\n this.listContext.alreadyMatched = true;\n }\n callback(this.selector, this.cbContext);\n }\n return result;\n };\n return SelectorContext;\n })();\n exports.SelectorContext = SelectorContext;\n})(require('process'));\n","/* */ \n'use strict';\nvar lang_1 = require('../facade/lang');\nvar exceptions_1 = require('../facade/exceptions');\nvar collection_1 = require('../facade/collection');\nvar change_detection_1 = require('../core/change_detection/change_detection');\nvar view_1 = require('../core/metadata/view');\nvar selector_1 = require('./selector');\nvar util_1 = require('./util');\nvar interfaces_1 = require('../core/linker/interfaces');\nvar HOST_REG_EXP = /^(?:(?:\\[([^\\]]+)\\])|(?:\\(([^\\)]+)\\)))$/g;\nvar CompileMetadataWithType = (function() {\n function CompileMetadataWithType() {}\n CompileMetadataWithType.fromJson = function(data) {\n return _COMPILE_METADATA_FROM_JSON[data['class']](data);\n };\n Object.defineProperty(CompileMetadataWithType.prototype, \"type\", {\n get: function() {\n return exceptions_1.unimplemented();\n },\n enumerable: true,\n configurable: true\n });\n return CompileMetadataWithType;\n})();\nexports.CompileMetadataWithType = CompileMetadataWithType;\nvar CompileTypeMetadata = (function() {\n function CompileTypeMetadata(_a) {\n var _b = _a === void 0 ? {} : _a,\n runtime = _b.runtime,\n name = _b.name,\n moduleUrl = _b.moduleUrl,\n isHost = _b.isHost;\n this.runtime = runtime;\n this.name = name;\n this.moduleUrl = moduleUrl;\n this.isHost = lang_1.normalizeBool(isHost);\n }\n CompileTypeMetadata.fromJson = function(data) {\n return new CompileTypeMetadata({\n name: data['name'],\n moduleUrl: data['moduleUrl'],\n isHost: data['isHost']\n });\n };\n CompileTypeMetadata.prototype.toJson = function() {\n return {\n 'name': this.name,\n 'moduleUrl': this.moduleUrl,\n 'isHost': this.isHost\n };\n };\n return CompileTypeMetadata;\n})();\nexports.CompileTypeMetadata = CompileTypeMetadata;\nvar CompileTemplateMetadata = (function() {\n function CompileTemplateMetadata(_a) {\n var _b = _a === void 0 ? {} : _a,\n encapsulation = _b.encapsulation,\n template = _b.template,\n templateUrl = _b.templateUrl,\n styles = _b.styles,\n styleUrls = _b.styleUrls,\n ngContentSelectors = _b.ngContentSelectors;\n this.encapsulation = lang_1.isPresent(encapsulation) ? encapsulation : view_1.ViewEncapsulation.Emulated;\n this.template = template;\n this.templateUrl = templateUrl;\n this.styles = lang_1.isPresent(styles) ? styles : [];\n this.styleUrls = lang_1.isPresent(styleUrls) ? styleUrls : [];\n this.ngContentSelectors = lang_1.isPresent(ngContentSelectors) ? ngContentSelectors : [];\n }\n CompileTemplateMetadata.fromJson = function(data) {\n return new CompileTemplateMetadata({\n encapsulation: lang_1.isPresent(data['encapsulation']) ? view_1.VIEW_ENCAPSULATION_VALUES[data['encapsulation']] : data['encapsulation'],\n template: data['template'],\n templateUrl: data['templateUrl'],\n styles: data['styles'],\n styleUrls: data['styleUrls'],\n ngContentSelectors: data['ngContentSelectors']\n });\n };\n CompileTemplateMetadata.prototype.toJson = function() {\n return {\n 'encapsulation': lang_1.isPresent(this.encapsulation) ? lang_1.serializeEnum(this.encapsulation) : this.encapsulation,\n 'template': this.template,\n 'templateUrl': this.templateUrl,\n 'styles': this.styles,\n 'styleUrls': this.styleUrls,\n 'ngContentSelectors': this.ngContentSelectors\n };\n };\n return CompileTemplateMetadata;\n})();\nexports.CompileTemplateMetadata = CompileTemplateMetadata;\nvar CompileDirectiveMetadata = (function() {\n function CompileDirectiveMetadata(_a) {\n var _b = _a === void 0 ? {} : _a,\n type = _b.type,\n isComponent = _b.isComponent,\n dynamicLoadable = _b.dynamicLoadable,\n selector = _b.selector,\n exportAs = _b.exportAs,\n changeDetection = _b.changeDetection,\n inputs = _b.inputs,\n outputs = _b.outputs,\n hostListeners = _b.hostListeners,\n hostProperties = _b.hostProperties,\n hostAttributes = _b.hostAttributes,\n lifecycleHooks = _b.lifecycleHooks,\n template = _b.template;\n this.type = type;\n this.isComponent = isComponent;\n this.dynamicLoadable = dynamicLoadable;\n this.selector = selector;\n this.exportAs = exportAs;\n this.changeDetection = changeDetection;\n this.inputs = inputs;\n this.outputs = outputs;\n this.hostListeners = hostListeners;\n this.hostProperties = hostProperties;\n this.hostAttributes = hostAttributes;\n this.lifecycleHooks = lifecycleHooks;\n this.template = template;\n }\n CompileDirectiveMetadata.create = function(_a) {\n var _b = _a === void 0 ? {} : _a,\n type = _b.type,\n isComponent = _b.isComponent,\n dynamicLoadable = _b.dynamicLoadable,\n selector = _b.selector,\n exportAs = _b.exportAs,\n changeDetection = _b.changeDetection,\n inputs = _b.inputs,\n outputs = _b.outputs,\n host = _b.host,\n lifecycleHooks = _b.lifecycleHooks,\n template = _b.template;\n var hostListeners = {};\n var hostProperties = {};\n var hostAttributes = {};\n if (lang_1.isPresent(host)) {\n collection_1.StringMapWrapper.forEach(host, function(value, key) {\n var matches = lang_1.RegExpWrapper.firstMatch(HOST_REG_EXP, key);\n if (lang_1.isBlank(matches)) {\n hostAttributes[key] = value;\n } else if (lang_1.isPresent(matches[1])) {\n hostProperties[matches[1]] = value;\n } else if (lang_1.isPresent(matches[2])) {\n hostListeners[matches[2]] = value;\n }\n });\n }\n var inputsMap = {};\n if (lang_1.isPresent(inputs)) {\n inputs.forEach(function(bindConfig) {\n var parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]);\n inputsMap[parts[0]] = parts[1];\n });\n }\n var outputsMap = {};\n if (lang_1.isPresent(outputs)) {\n outputs.forEach(function(bindConfig) {\n var parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]);\n outputsMap[parts[0]] = parts[1];\n });\n }\n return new CompileDirectiveMetadata({\n type: type,\n isComponent: lang_1.normalizeBool(isComponent),\n dynamicLoadable: lang_1.normalizeBool(dynamicLoadable),\n selector: selector,\n exportAs: exportAs,\n changeDetection: changeDetection,\n inputs: inputsMap,\n outputs: outputsMap,\n hostListeners: hostListeners,\n hostProperties: hostProperties,\n hostAttributes: hostAttributes,\n lifecycleHooks: lang_1.isPresent(lifecycleHooks) ? lifecycleHooks : [],\n template: template\n });\n };\n CompileDirectiveMetadata.fromJson = function(data) {\n return new CompileDirectiveMetadata({\n isComponent: data['isComponent'],\n dynamicLoadable: data['dynamicLoadable'],\n selector: data['selector'],\n exportAs: data['exportAs'],\n type: lang_1.isPresent(data['type']) ? CompileTypeMetadata.fromJson(data['type']) : data['type'],\n changeDetection: lang_1.isPresent(data['changeDetection']) ? change_detection_1.CHANGE_DETECTION_STRATEGY_VALUES[data['changeDetection']] : data['changeDetection'],\n inputs: data['inputs'],\n outputs: data['outputs'],\n hostListeners: data['hostListeners'],\n hostProperties: data['hostProperties'],\n hostAttributes: data['hostAttributes'],\n lifecycleHooks: data['lifecycleHooks'].map(function(hookValue) {\n return interfaces_1.LIFECYCLE_HOOKS_VALUES[hookValue];\n }),\n template: lang_1.isPresent(data['template']) ? CompileTemplateMetadata.fromJson(data['template']) : data['template']\n });\n };\n CompileDirectiveMetadata.prototype.toJson = function() {\n return {\n 'class': 'Directive',\n 'isComponent': this.isComponent,\n 'dynamicLoadable': this.dynamicLoadable,\n 'selector': this.selector,\n 'exportAs': this.exportAs,\n 'type': lang_1.isPresent(this.type) ? this.type.toJson() : this.type,\n 'changeDetection': lang_1.isPresent(this.changeDetection) ? lang_1.serializeEnum(this.changeDetection) : this.changeDetection,\n 'inputs': this.inputs,\n 'outputs': this.outputs,\n 'hostListeners': this.hostListeners,\n 'hostProperties': this.hostProperties,\n 'hostAttributes': this.hostAttributes,\n 'lifecycleHooks': this.lifecycleHooks.map(function(hook) {\n return lang_1.serializeEnum(hook);\n }),\n 'template': lang_1.isPresent(this.template) ? this.template.toJson() : this.template\n };\n };\n return CompileDirectiveMetadata;\n})();\nexports.CompileDirectiveMetadata = CompileDirectiveMetadata;\nfunction createHostComponentMeta(componentType, componentSelector) {\n var template = selector_1.CssSelector.parse(componentSelector)[0].getMatchingElementTemplate();\n return CompileDirectiveMetadata.create({\n type: new CompileTypeMetadata({\n runtime: Object,\n name: \"Host\" + componentType.name,\n moduleUrl: componentType.moduleUrl,\n isHost: true\n }),\n template: new CompileTemplateMetadata({\n template: template,\n templateUrl: '',\n styles: [],\n styleUrls: [],\n ngContentSelectors: []\n }),\n changeDetection: change_detection_1.ChangeDetectionStrategy.Default,\n inputs: [],\n outputs: [],\n host: {},\n lifecycleHooks: [],\n isComponent: true,\n dynamicLoadable: false,\n selector: '*'\n });\n}\nexports.createHostComponentMeta = createHostComponentMeta;\nvar CompilePipeMetadata = (function() {\n function CompilePipeMetadata(_a) {\n var _b = _a === void 0 ? {} : _a,\n type = _b.type,\n name = _b.name,\n pure = _b.pure;\n this.type = type;\n this.name = name;\n this.pure = lang_1.normalizeBool(pure);\n }\n CompilePipeMetadata.fromJson = function(data) {\n return new CompilePipeMetadata({\n type: lang_1.isPresent(data['type']) ? CompileTypeMetadata.fromJson(data['type']) : data['type'],\n name: data['name'],\n pure: data['pure']\n });\n };\n CompilePipeMetadata.prototype.toJson = function() {\n return {\n 'class': 'Pipe',\n 'type': lang_1.isPresent(this.type) ? this.type.toJson() : null,\n 'name': this.name,\n 'pure': this.pure\n };\n };\n return CompilePipeMetadata;\n})();\nexports.CompilePipeMetadata = CompilePipeMetadata;\nvar _COMPILE_METADATA_FROM_JSON = {\n 'Directive': CompileDirectiveMetadata.fromJson,\n 'Pipe': CompilePipeMetadata.fromJson\n};\n","/* */ \n'use strict';\nvar lang_1 = require('../../facade/lang');\nvar interfaces_1 = require('./interfaces');\nfunction hasLifecycleHook(lcInterface, token) {\n if (!(token instanceof lang_1.Type))\n return false;\n var proto = token.prototype;\n switch (lcInterface) {\n case interfaces_1.LifecycleHooks.AfterContentInit:\n return !!proto.ngAfterContentInit;\n case interfaces_1.LifecycleHooks.AfterContentChecked:\n return !!proto.ngAfterContentChecked;\n case interfaces_1.LifecycleHooks.AfterViewInit:\n return !!proto.ngAfterViewInit;\n case interfaces_1.LifecycleHooks.AfterViewChecked:\n return !!proto.ngAfterViewChecked;\n case interfaces_1.LifecycleHooks.OnChanges:\n return !!proto.ngOnChanges;\n case interfaces_1.LifecycleHooks.DoCheck:\n return !!proto.ngDoCheck;\n case interfaces_1.LifecycleHooks.OnDestroy:\n return !!proto.ngOnDestroy;\n case interfaces_1.LifecycleHooks.OnInit:\n return !!proto.ngOnInit;\n default:\n return false;\n }\n}\nexports.hasLifecycleHook = hasLifecycleHook;\n","/* */ \n'use strict';\nvar __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function(k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(k, v);\n};\nvar __param = (this && this.__param) || function(paramIndex, decorator) {\n return function(target, key) {\n decorator(target, key, paramIndex);\n };\n};\nvar di_1 = require('../core/di');\nvar lang_1 = require('../facade/lang');\nvar exceptions_1 = require('../facade/exceptions');\nvar cpl = require('./directive_metadata');\nvar md = require('../core/metadata/directives');\nvar directive_resolver_1 = require('../core/linker/directive_resolver');\nvar pipe_resolver_1 = require('../core/linker/pipe_resolver');\nvar view_resolver_1 = require('../core/linker/view_resolver');\nvar directive_lifecycle_reflector_1 = require('../core/linker/directive_lifecycle_reflector');\nvar interfaces_1 = require('../core/linker/interfaces');\nvar reflection_1 = require('../core/reflection/reflection');\nvar di_2 = require('../core/di');\nvar platform_directives_and_pipes_1 = require('../core/platform_directives_and_pipes');\nvar util_1 = require('./util');\nvar url_resolver_1 = require('./url_resolver');\nvar RuntimeMetadataResolver = (function() {\n function RuntimeMetadataResolver(_directiveResolver, _pipeResolver, _viewResolver, _platformDirectives, _platformPipes) {\n this._directiveResolver = _directiveResolver;\n this._pipeResolver = _pipeResolver;\n this._viewResolver = _viewResolver;\n this._platformDirectives = _platformDirectives;\n this._platformPipes = _platformPipes;\n this._directiveCache = new Map();\n this._pipeCache = new Map();\n }\n RuntimeMetadataResolver.prototype.getDirectiveMetadata = function(directiveType) {\n var meta = this._directiveCache.get(directiveType);\n if (lang_1.isBlank(meta)) {\n var dirMeta = this._directiveResolver.resolve(directiveType);\n var moduleUrl = null;\n var templateMeta = null;\n var changeDetectionStrategy = null;\n if (dirMeta instanceof md.ComponentMetadata) {\n var cmpMeta = dirMeta;\n moduleUrl = calcModuleUrl(directiveType, cmpMeta);\n var viewMeta = this._viewResolver.resolve(directiveType);\n templateMeta = new cpl.CompileTemplateMetadata({\n encapsulation: viewMeta.encapsulation,\n template: viewMeta.template,\n templateUrl: viewMeta.templateUrl,\n styles: viewMeta.styles,\n styleUrls: viewMeta.styleUrls\n });\n changeDetectionStrategy = cmpMeta.changeDetection;\n }\n meta = cpl.CompileDirectiveMetadata.create({\n selector: dirMeta.selector,\n exportAs: dirMeta.exportAs,\n isComponent: lang_1.isPresent(templateMeta),\n dynamicLoadable: true,\n type: new cpl.CompileTypeMetadata({\n name: lang_1.stringify(directiveType),\n moduleUrl: moduleUrl,\n runtime: directiveType\n }),\n template: templateMeta,\n changeDetection: changeDetectionStrategy,\n inputs: dirMeta.inputs,\n outputs: dirMeta.outputs,\n host: dirMeta.host,\n lifecycleHooks: interfaces_1.LIFECYCLE_HOOKS_VALUES.filter(function(hook) {\n return directive_lifecycle_reflector_1.hasLifecycleHook(hook, directiveType);\n })\n });\n this._directiveCache.set(directiveType, meta);\n }\n return meta;\n };\n RuntimeMetadataResolver.prototype.getPipeMetadata = function(pipeType) {\n var meta = this._pipeCache.get(pipeType);\n if (lang_1.isBlank(meta)) {\n var pipeMeta = this._pipeResolver.resolve(pipeType);\n var moduleUrl = reflection_1.reflector.importUri(pipeType);\n meta = new cpl.CompilePipeMetadata({\n type: new cpl.CompileTypeMetadata({\n name: lang_1.stringify(pipeType),\n moduleUrl: moduleUrl,\n runtime: pipeType\n }),\n name: pipeMeta.name,\n pure: pipeMeta.pure\n });\n this._pipeCache.set(pipeType, meta);\n }\n return meta;\n };\n RuntimeMetadataResolver.prototype.getViewDirectivesMetadata = function(component) {\n var _this = this;\n var view = this._viewResolver.resolve(component);\n var directives = flattenDirectives(view, this._platformDirectives);\n for (var i = 0; i < directives.length; i++) {\n if (!isValidType(directives[i])) {\n throw new exceptions_1.BaseException(\"Unexpected directive value '\" + lang_1.stringify(directives[i]) + \"' on the View of component '\" + lang_1.stringify(component) + \"'\");\n }\n }\n return directives.map(function(type) {\n return _this.getDirectiveMetadata(type);\n });\n };\n RuntimeMetadataResolver.prototype.getViewPipesMetadata = function(component) {\n var _this = this;\n var view = this._viewResolver.resolve(component);\n var pipes = flattenPipes(view, this._platformPipes);\n for (var i = 0; i < pipes.length; i++) {\n if (!isValidType(pipes[i])) {\n throw new exceptions_1.BaseException(\"Unexpected piped value '\" + lang_1.stringify(pipes[i]) + \"' on the View of component '\" + lang_1.stringify(component) + \"'\");\n }\n }\n return pipes.map(function(type) {\n return _this.getPipeMetadata(type);\n });\n };\n RuntimeMetadataResolver = __decorate([di_2.Injectable(), __param(3, di_2.Optional()), __param(3, di_2.Inject(platform_directives_and_pipes_1.PLATFORM_DIRECTIVES)), __param(4, di_2.Optional()), __param(4, di_2.Inject(platform_directives_and_pipes_1.PLATFORM_PIPES)), __metadata('design:paramtypes', [directive_resolver_1.DirectiveResolver, pipe_resolver_1.PipeResolver, view_resolver_1.ViewResolver, Array, Array])], RuntimeMetadataResolver);\n return RuntimeMetadataResolver;\n})();\nexports.RuntimeMetadataResolver = RuntimeMetadataResolver;\nfunction flattenDirectives(view, platformDirectives) {\n var directives = [];\n if (lang_1.isPresent(platformDirectives)) {\n flattenArray(platformDirectives, directives);\n }\n if (lang_1.isPresent(view.directives)) {\n flattenArray(view.directives, directives);\n }\n return directives;\n}\nfunction flattenPipes(view, platformPipes) {\n var pipes = [];\n if (lang_1.isPresent(platformPipes)) {\n flattenArray(platformPipes, pipes);\n }\n if (lang_1.isPresent(view.pipes)) {\n flattenArray(view.pipes, pipes);\n }\n return pipes;\n}\nfunction flattenArray(tree, out) {\n for (var i = 0; i < tree.length; i++) {\n var item = di_1.resolveForwardRef(tree[i]);\n if (lang_1.isArray(item)) {\n flattenArray(item, out);\n } else {\n out.push(item);\n }\n }\n}\nfunction isValidType(value) {\n return lang_1.isPresent(value) && (value instanceof lang_1.Type);\n}\nfunction calcModuleUrl(type, cmpMetadata) {\n var moduleId = cmpMetadata.moduleId;\n if (lang_1.isPresent(moduleId)) {\n var scheme = url_resolver_1.getUrlScheme(moduleId);\n return lang_1.isPresent(scheme) && scheme.length > 0 ? moduleId : \"package:\" + moduleId + util_1.MODULE_SUFFIX;\n } else {\n return reflection_1.reflector.importUri(type);\n }\n}\n","/* */ \n'use strict';(function (LifecycleHooks) {\r\n LifecycleHooks[LifecycleHooks[\"OnInit\"] = 0] = \"OnInit\";\r\n LifecycleHooks[LifecycleHooks[\"OnDestroy\"] = 1] = \"OnDestroy\";\r\n LifecycleHooks[LifecycleHooks[\"DoCheck\"] = 2] = \"DoCheck\";\r\n LifecycleHooks[LifecycleHooks[\"OnChanges\"] = 3] = \"OnChanges\";\r\n LifecycleHooks[LifecycleHooks[\"AfterContentInit\"] = 4] = \"AfterContentInit\";\r\n LifecycleHooks[LifecycleHooks[\"AfterContentChecked\"] = 5] = \"AfterContentChecked\";\r\n LifecycleHooks[LifecycleHooks[\"AfterViewInit\"] = 6] = \"AfterViewInit\";\r\n LifecycleHooks[LifecycleHooks[\"AfterViewChecked\"] = 7] = \"AfterViewChecked\";\r\n})(exports.LifecycleHooks || (exports.LifecycleHooks = {}));\r\nvar LifecycleHooks = exports.LifecycleHooks;\r\n/**\r\n * @internal\r\n */\r\nexports.LIFECYCLE_HOOKS_VALUES = [\r\n LifecycleHooks.OnInit,\r\n LifecycleHooks.OnDestroy,\r\n LifecycleHooks.DoCheck,\r\n LifecycleHooks.OnChanges,\r\n LifecycleHooks.AfterContentInit,\r\n LifecycleHooks.AfterContentChecked,\r\n LifecycleHooks.AfterViewInit,\r\n LifecycleHooks.AfterViewChecked\r\n];\r\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJmYWNlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImFuZ3VsYXIyL3NyYy9jb3JlL2xpbmtlci9pbnRlcmZhY2VzLnRzIl0sIm5hbWVzIjpbIkxpZmVjeWNsZUhvb2tzIl0sIm1hcHBpbmdzIjoiQUFHQ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2V0TWVzc2FnZSh0aGlzLnZpZXdDaGlsZCkpO1xuICogICB9XG4gKlxuICogICBwcml2YXRlIGdldE1lc3NhZ2UoY21wOiBDaGlsZENvbXBvbmVudCk6IHN0cmluZyB7XG4gKiAgICAgcmV0dXJuIGNtcCA/IGNtcC53aGVyZSArICcgY2hpbGQnIDogJ25vIGNoaWxkJztcbiAqICAgfVxuICogfVxuICpcbiAqIEBDb21wb25lbnQoe1xuICogICBzZWxlY3RvcjogJ2FwcCcsXG4gKiAgIHRlbXBsYXRlOiBgPHBhcmVudC1jbXA+PC9wYXJlbnQtY21wPmAsXG4gKiAgIGRpcmVjdGl2ZXM6IFtQYXJlbnRDb21wb25lbnRdXG4gKiB9KVxuICogZXhwb3J0IGNsYXNzIEFwcCB7XG4gKiB9XG4gKlxuICogYm9vdHN0cmFwKEFwcCkuY2F0Y2goZXJyID0+IGNvbnNvbGUuZXJyb3IoZXJyKSk7XG4gKiBgYGBcbiAqL1xuZXhwb3J0IGludGVyZmFjZSBBZnRlclZpZXdDaGVja2VkIHsgbmdBZnRlclZpZXdDaGVja2VkKCk7IH1cbiJdfQ==","/* */ \n'use strict';\nvar collection_1 = require('../facade/collection');\nvar lang_1 = require('../facade/lang');\nvar reflection_1 = require('../core/reflection/reflection');\nvar change_detection_1 = require('../core/change_detection/change_detection');\nvar template_ast_1 = require('./template_ast');\nvar interfaces_1 = require('../core/linker/interfaces');\nfunction createChangeDetectorDefinitions(componentType, componentStrategy, genConfig, parsedTemplate) {\n var pvVisitors = [];\n var visitor = new ProtoViewVisitor(null, pvVisitors, componentStrategy);\n template_ast_1.templateVisitAll(visitor, parsedTemplate);\n return createChangeDefinitions(pvVisitors, componentType, genConfig);\n}\nexports.createChangeDetectorDefinitions = createChangeDetectorDefinitions;\nvar ProtoViewVisitor = (function() {\n function ProtoViewVisitor(parent, allVisitors, strategy) {\n this.parent = parent;\n this.allVisitors = allVisitors;\n this.strategy = strategy;\n this.nodeCount = 0;\n this.boundElementCount = 0;\n this.variableNames = [];\n this.bindingRecords = [];\n this.eventRecords = [];\n this.directiveRecords = [];\n this.viewIndex = allVisitors.length;\n allVisitors.push(this);\n }\n ProtoViewVisitor.prototype.visitEmbeddedTemplate = function(ast, context) {\n this.nodeCount++;\n this.boundElementCount++;\n template_ast_1.templateVisitAll(this, ast.outputs);\n for (var i = 0; i < ast.directives.length; i++) {\n ast.directives[i].visit(this, i);\n }\n var childVisitor = new ProtoViewVisitor(this, this.allVisitors, change_detection_1.ChangeDetectionStrategy.Default);\n template_ast_1.templateVisitAll(childVisitor, ast.vars);\n template_ast_1.templateVisitAll(childVisitor, ast.children);\n return null;\n };\n ProtoViewVisitor.prototype.visitElement = function(ast, context) {\n this.nodeCount++;\n if (ast.isBound()) {\n this.boundElementCount++;\n }\n template_ast_1.templateVisitAll(this, ast.inputs, null);\n template_ast_1.templateVisitAll(this, ast.outputs);\n template_ast_1.templateVisitAll(this, ast.exportAsVars);\n for (var i = 0; i < ast.directives.length; i++) {\n ast.directives[i].visit(this, i);\n }\n template_ast_1.templateVisitAll(this, ast.children);\n return null;\n };\n ProtoViewVisitor.prototype.visitNgContent = function(ast, context) {\n return null;\n };\n ProtoViewVisitor.prototype.visitVariable = function(ast, context) {\n this.variableNames.push(ast.name);\n return null;\n };\n ProtoViewVisitor.prototype.visitEvent = function(ast, directiveRecord) {\n var bindingRecord = lang_1.isPresent(directiveRecord) ? change_detection_1.BindingRecord.createForHostEvent(ast.handler, ast.fullName, directiveRecord) : change_detection_1.BindingRecord.createForEvent(ast.handler, ast.fullName, this.boundElementCount - 1);\n this.eventRecords.push(bindingRecord);\n return null;\n };\n ProtoViewVisitor.prototype.visitElementProperty = function(ast, directiveRecord) {\n var boundElementIndex = this.boundElementCount - 1;\n var dirIndex = lang_1.isPresent(directiveRecord) ? directiveRecord.directiveIndex : null;\n var bindingRecord;\n if (ast.type === template_ast_1.PropertyBindingType.Property) {\n bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostProperty(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementProperty(ast.value, boundElementIndex, ast.name);\n } else if (ast.type === template_ast_1.PropertyBindingType.Attribute) {\n bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostAttribute(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementAttribute(ast.value, boundElementIndex, ast.name);\n } else if (ast.type === template_ast_1.PropertyBindingType.Class) {\n bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostClass(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementClass(ast.value, boundElementIndex, ast.name);\n } else if (ast.type === template_ast_1.PropertyBindingType.Style) {\n bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostStyle(dirIndex, ast.value, ast.name, ast.unit) : change_detection_1.BindingRecord.createForElementStyle(ast.value, boundElementIndex, ast.name, ast.unit);\n }\n this.bindingRecords.push(bindingRecord);\n return null;\n };\n ProtoViewVisitor.prototype.visitAttr = function(ast, context) {\n return null;\n };\n ProtoViewVisitor.prototype.visitBoundText = function(ast, context) {\n var nodeIndex = this.nodeCount++;\n this.bindingRecords.push(change_detection_1.BindingRecord.createForTextNode(ast.value, nodeIndex));\n return null;\n };\n ProtoViewVisitor.prototype.visitText = function(ast, context) {\n this.nodeCount++;\n return null;\n };\n ProtoViewVisitor.prototype.visitDirective = function(ast, directiveIndexAsNumber) {\n var directiveIndex = new change_detection_1.DirectiveIndex(this.boundElementCount - 1, directiveIndexAsNumber);\n var directiveMetadata = ast.directive;\n var outputsArray = [];\n collection_1.StringMapWrapper.forEach(ast.directive.outputs, function(eventName, dirProperty) {\n return outputsArray.push([dirProperty, eventName]);\n });\n var directiveRecord = new change_detection_1.DirectiveRecord({\n directiveIndex: directiveIndex,\n callAfterContentInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterContentInit) !== -1,\n callAfterContentChecked: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterContentChecked) !== -1,\n callAfterViewInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterViewInit) !== -1,\n callAfterViewChecked: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterViewChecked) !== -1,\n callOnChanges: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.OnChanges) !== -1,\n callDoCheck: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.DoCheck) !== -1,\n callOnInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.OnInit) !== -1,\n callOnDestroy: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.OnDestroy) !== -1,\n changeDetection: directiveMetadata.changeDetection,\n outputs: outputsArray\n });\n this.directiveRecords.push(directiveRecord);\n template_ast_1.templateVisitAll(this, ast.inputs, directiveRecord);\n var bindingRecords = this.bindingRecords;\n if (directiveRecord.callOnChanges) {\n bindingRecords.push(change_detection_1.BindingRecord.createDirectiveOnChanges(directiveRecord));\n }\n if (directiveRecord.callOnInit) {\n bindingRecords.push(change_detection_1.BindingRecord.createDirectiveOnInit(directiveRecord));\n }\n if (directiveRecord.callDoCheck) {\n bindingRecords.push(change_detection_1.BindingRecord.createDirectiveDoCheck(directiveRecord));\n }\n template_ast_1.templateVisitAll(this, ast.hostProperties, directiveRecord);\n template_ast_1.templateVisitAll(this, ast.hostEvents, directiveRecord);\n template_ast_1.templateVisitAll(this, ast.exportAsVars);\n return null;\n };\n ProtoViewVisitor.prototype.visitDirectiveProperty = function(ast, directiveRecord) {\n var setter = reflection_1.reflector.setter(ast.directiveName);\n this.bindingRecords.push(change_detection_1.BindingRecord.createForDirective(ast.value, ast.directiveName, setter, directiveRecord));\n return null;\n };\n return ProtoViewVisitor;\n})();\nfunction createChangeDefinitions(pvVisitors, componentType, genConfig) {\n var pvVariableNames = _collectNestedProtoViewsVariableNames(pvVisitors);\n return pvVisitors.map(function(pvVisitor) {\n var id = componentType.name + \"_\" + pvVisitor.viewIndex;\n return new change_detection_1.ChangeDetectorDefinition(id, pvVisitor.strategy, pvVariableNames[pvVisitor.viewIndex], pvVisitor.bindingRecords, pvVisitor.eventRecords, pvVisitor.directiveRecords, genConfig);\n });\n}\nfunction _collectNestedProtoViewsVariableNames(pvVisitors) {\n var nestedPvVariableNames = collection_1.ListWrapper.createFixedSize(pvVisitors.length);\n pvVisitors.forEach(function(pv) {\n var parentVariableNames = lang_1.isPresent(pv.parent) ? nestedPvVariableNames[pv.parent.viewIndex] : [];\n nestedPvVariableNames[pv.viewIndex] = parentVariableNames.concat(pv.variableNames);\n });\n return nestedPvVariableNames;\n}\n","/* */ \n'use strict';// Note: This class is only here so that we can reference it from TypeScript code.\r\n// The actual implementation lives under modules_dart.\r\n// TODO(tbosch): Move the corresponding code into angular2/src/compiler once\r\n// the new compiler is done.\r\nvar Codegen = (function () {\r\n function Codegen(moduleAlias) {\r\n }\r\n Codegen.prototype.generate = function (typeName, changeDetectorTypeName, def) {\r\n throw \"Not implemented in JS\";\r\n };\r\n Codegen.prototype.toString = function () { throw \"Not implemented in JS\"; };\r\n return Codegen;\r\n})();\r\nexports.Codegen = Codegen;\r\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhbmdlX2RldGVjdG9yX2NvZGVnZW4uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJhbmd1bGFyMi9zcmMvdHJhbnNmb3JtL3RlbXBsYXRlX2NvbXBpbGVyL2NoYW5nZV9kZXRlY3Rvcl9jb2RlZ2VuLnRzIl0sIm5hbWVzIjpbIkNvZGVnZW4iLCJDb2RlZ2VuLmNvbnN0cnVjdG9yIiwiQ29kZWdlbi5nZW5lcmF0ZSIsIkNvZGVnZW4udG9TdHJpbmciXSwibWFwcGluZ3MiOiJBQUlBLGtGQUFrRjtBQUNsRixzREFBc0Q7QUFDdEQsNEV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Y3RvckRlZmluaXRpb24pOiB2b2lkIHtcbiAgICB0aHJvdyBcIk5vdCBpbXBsZW1lbnRlZCBpbiBKU1wiO1xuICB9XG4gIHRvU3RyaW5nKCk6IHN0cmluZyB7IHRocm93IFwiTm90IGltcGxlbWVudGVkIGluIEpTXCI7IH1cbn1cbiJdfQ==","/* */ \n'use strict';\nvar __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function(k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(k, v);\n};\nvar source_module_1 = require('./source_module');\nvar change_detection_jit_generator_1 = require('../core/change_detection/change_detection_jit_generator');\nvar abstract_change_detector_1 = require('../core/change_detection/abstract_change_detector');\nvar change_detection_util_1 = require('../core/change_detection/change_detection_util');\nvar constants_1 = require('../core/change_detection/constants');\nvar change_definition_factory_1 = require('./change_definition_factory');\nvar lang_1 = require('../facade/lang');\nvar change_detection_1 = require('../core/change_detection/change_detection');\nvar change_detector_codegen_1 = require('../transform/template_compiler/change_detector_codegen');\nvar util_1 = require('./util');\nvar di_1 = require('../core/di');\nvar ABSTRACT_CHANGE_DETECTOR = \"AbstractChangeDetector\";\nvar UTIL = \"ChangeDetectionUtil\";\nvar CHANGE_DETECTOR_STATE = \"ChangeDetectorState\";\nexports.CHANGE_DETECTION_JIT_IMPORTS = lang_1.CONST_EXPR({\n 'AbstractChangeDetector': abstract_change_detector_1.AbstractChangeDetector,\n 'ChangeDetectionUtil': change_detection_util_1.ChangeDetectionUtil,\n 'ChangeDetectorState': constants_1.ChangeDetectorState\n});\nvar ABSTRACT_CHANGE_DETECTOR_MODULE = source_module_1.moduleRef(\"package:angular2/src/core/change_detection/abstract_change_detector\" + util_1.MODULE_SUFFIX);\nvar UTIL_MODULE = source_module_1.moduleRef(\"package:angular2/src/core/change_detection/change_detection_util\" + util_1.MODULE_SUFFIX);\nvar PREGEN_PROTO_CHANGE_DETECTOR_MODULE = source_module_1.moduleRef(\"package:angular2/src/core/change_detection/pregen_proto_change_detector\" + util_1.MODULE_SUFFIX);\nvar CONSTANTS_MODULE = source_module_1.moduleRef(\"package:angular2/src/core/change_detection/constants\" + util_1.MODULE_SUFFIX);\nvar ChangeDetectionCompiler = (function() {\n function ChangeDetectionCompiler(_genConfig) {\n this._genConfig = _genConfig;\n }\n ChangeDetectionCompiler.prototype.compileComponentRuntime = function(componentType, strategy, parsedTemplate) {\n var _this = this;\n var changeDetectorDefinitions = change_definition_factory_1.createChangeDetectorDefinitions(componentType, strategy, this._genConfig, parsedTemplate);\n return changeDetectorDefinitions.map(function(definition) {\n return _this._createChangeDetectorFactory(definition);\n });\n };\n ChangeDetectionCompiler.prototype._createChangeDetectorFactory = function(definition) {\n var proto = new change_detection_1.DynamicProtoChangeDetector(definition);\n return function() {\n return proto.instantiate();\n };\n };\n ChangeDetectionCompiler.prototype.compileComponentCodeGen = function(componentType, strategy, parsedTemplate) {\n var changeDetectorDefinitions = change_definition_factory_1.createChangeDetectorDefinitions(componentType, strategy, this._genConfig, parsedTemplate);\n var factories = [];\n var index = 0;\n var sourceParts = changeDetectorDefinitions.map(function(definition) {\n var codegen;\n var sourcePart;\n if (lang_1.IS_DART) {\n codegen = new change_detector_codegen_1.Codegen(PREGEN_PROTO_CHANGE_DETECTOR_MODULE);\n var className = \"_\" + definition.id;\n var typeRef = (index === 0 && componentType.isHost) ? 'dynamic' : \"\" + source_module_1.moduleRef(componentType.moduleUrl) + componentType.name;\n codegen.generate(typeRef, className, definition);\n factories.push(className + \".newChangeDetector\");\n sourcePart = codegen.toString();\n } else {\n codegen = new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, \"\" + UTIL_MODULE + UTIL, \"\" + ABSTRACT_CHANGE_DETECTOR_MODULE + ABSTRACT_CHANGE_DETECTOR, \"\" + CONSTANTS_MODULE + CHANGE_DETECTOR_STATE);\n factories.push(\"function() { return new \" + codegen.typeName + \"(); }\");\n sourcePart = codegen.generateSource();\n }\n index++;\n return sourcePart;\n });\n return new source_module_1.SourceExpressions(sourceParts, factories);\n };\n ChangeDetectionCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetectorGenConfig])], ChangeDetectionCompiler);\n return ChangeDetectionCompiler;\n})();\nexports.ChangeDetectionCompiler = ChangeDetectionCompiler;\n","/* */ \n(function(process) {\n 'use strict';\n var collection_1 = require('../facade/collection');\n var lang_1 = require('../facade/lang');\n var ShadowCss = (function() {\n function ShadowCss() {\n this.strictStyling = true;\n }\n ShadowCss.prototype.shimCssText = function(cssText, selector, hostSelector) {\n if (hostSelector === void 0) {\n hostSelector = '';\n }\n cssText = stripComments(cssText);\n cssText = this._insertDirectives(cssText);\n return this._scopeCssText(cssText, selector, hostSelector);\n };\n ShadowCss.prototype._insertDirectives = function(cssText) {\n cssText = this._insertPolyfillDirectivesInCssText(cssText);\n return this._insertPolyfillRulesInCssText(cssText);\n };\n ShadowCss.prototype._insertPolyfillDirectivesInCssText = function(cssText) {\n return lang_1.StringWrapper.replaceAllMapped(cssText, _cssContentNextSelectorRe, function(m) {\n return m[1] + '{';\n });\n };\n ShadowCss.prototype._insertPolyfillRulesInCssText = function(cssText) {\n return lang_1.StringWrapper.replaceAllMapped(cssText, _cssContentRuleRe, function(m) {\n var rule = m[0];\n rule = lang_1.StringWrapper.replace(rule, m[1], '');\n rule = lang_1.StringWrapper.replace(rule, m[2], '');\n return m[3] + rule;\n });\n };\n ShadowCss.prototype._scopeCssText = function(cssText, scopeSelector, hostSelector) {\n var unscoped = this._extractUnscopedRulesFromCssText(cssText);\n cssText = this._insertPolyfillHostInCssText(cssText);\n cssText = this._convertColonHost(cssText);\n cssText = this._convertColonHostContext(cssText);\n cssText = this._convertShadowDOMSelectors(cssText);\n if (lang_1.isPresent(scopeSelector)) {\n cssText = this._scopeSelectors(cssText, scopeSelector, hostSelector);\n }\n cssText = cssText + '\\n' + unscoped;\n return cssText.trim();\n };\n ShadowCss.prototype._extractUnscopedRulesFromCssText = function(cssText) {\n var r = '',\n m;\n var matcher = lang_1.RegExpWrapper.matcher(_cssContentUnscopedRuleRe, cssText);\n while (lang_1.isPresent(m = lang_1.RegExpMatcherWrapper.next(matcher))) {\n var rule = m[0];\n rule = lang_1.StringWrapper.replace(rule, m[2], '');\n rule = lang_1.StringWrapper.replace(rule, m[1], m[3]);\n r += rule + '\\n\\n';\n }\n return r;\n };\n ShadowCss.prototype._convertColonHost = function(cssText) {\n return this._convertColonRule(cssText, _cssColonHostRe, this._colonHostPartReplacer);\n };\n ShadowCss.prototype._convertColonHostContext = function(cssText) {\n return this._convertColonRule(cssText, _cssColonHostContextRe, this._colonHostContextPartReplacer);\n };\n ShadowCss.prototype._convertColonRule = function(cssText, regExp, partReplacer) {\n return lang_1.StringWrapper.replaceAllMapped(cssText, regExp, function(m) {\n if (lang_1.isPresent(m[2])) {\n var parts = m[2].split(','),\n r = [];\n for (var i = 0; i < parts.length; i++) {\n var p = parts[i];\n if (lang_1.isBlank(p))\n break;\n p = p.trim();\n r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));\n }\n return r.join(',');\n } else {\n return _polyfillHostNoCombinator + m[3];\n }\n });\n };\n ShadowCss.prototype._colonHostContextPartReplacer = function(host, part, suffix) {\n if (lang_1.StringWrapper.contains(part, _polyfillHost)) {\n return this._colonHostPartReplacer(host, part, suffix);\n } else {\n return host + part + suffix + ', ' + part + ' ' + host + suffix;\n }\n };\n ShadowCss.prototype._colonHostPartReplacer = function(host, part, suffix) {\n return host + lang_1.StringWrapper.replace(part, _polyfillHost, '') + suffix;\n };\n ShadowCss.prototype._convertShadowDOMSelectors = function(cssText) {\n for (var i = 0; i < _shadowDOMSelectorsRe.length; i++) {\n cssText = lang_1.StringWrapper.replaceAll(cssText, _shadowDOMSelectorsRe[i], ' ');\n }\n return cssText;\n };\n ShadowCss.prototype._scopeSelectors = function(cssText, scopeSelector, hostSelector) {\n var _this = this;\n return processRules(cssText, function(rule) {\n var selector = rule.selector;\n var content = rule.content;\n if (rule.selector[0] != '@' || rule.selector.startsWith('@page')) {\n selector = _this._scopeSelector(rule.selector, scopeSelector, hostSelector, _this.strictStyling);\n } else if (rule.selector.startsWith('@media')) {\n content = _this._scopeSelectors(rule.content, scopeSelector, hostSelector);\n }\n return new CssRule(selector, content);\n });\n };\n ShadowCss.prototype._scopeSelector = function(selector, scopeSelector, hostSelector, strict) {\n var r = [],\n parts = selector.split(',');\n for (var i = 0; i < parts.length; i++) {\n var p = parts[i];\n p = p.trim();\n if (this._selectorNeedsScoping(p, scopeSelector)) {\n p = strict && !lang_1.StringWrapper.contains(p, _polyfillHostNoCombinator) ? this._applyStrictSelectorScope(p, scopeSelector) : this._applySelectorScope(p, scopeSelector, hostSelector);\n }\n r.push(p);\n }\n return r.join(', ');\n };\n ShadowCss.prototype._selectorNeedsScoping = function(selector, scopeSelector) {\n var re = this._makeScopeMatcher(scopeSelector);\n return !lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(re, selector));\n };\n ShadowCss.prototype._makeScopeMatcher = function(scopeSelector) {\n var lre = /\\[/g;\n var rre = /\\]/g;\n scopeSelector = lang_1.StringWrapper.replaceAll(scopeSelector, lre, '\\\\[');\n scopeSelector = lang_1.StringWrapper.replaceAll(scopeSelector, rre, '\\\\]');\n return lang_1.RegExpWrapper.create('^(' + scopeSelector + ')' + _selectorReSuffix, 'm');\n };\n ShadowCss.prototype._applySelectorScope = function(selector, scopeSelector, hostSelector) {\n return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector);\n };\n ShadowCss.prototype._applySimpleSelectorScope = function(selector, scopeSelector, hostSelector) {\n if (lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(_polyfillHostRe, selector))) {\n var replaceBy = this.strictStyling ? \"[\" + hostSelector + \"]\" : scopeSelector;\n selector = lang_1.StringWrapper.replace(selector, _polyfillHostNoCombinator, replaceBy);\n return lang_1.StringWrapper.replaceAll(selector, _polyfillHostRe, replaceBy + ' ');\n } else {\n return scopeSelector + ' ' + selector;\n }\n };\n ShadowCss.prototype._applyStrictSelectorScope = function(selector, scopeSelector) {\n var isRe = /\\[is=([^\\]]*)\\]/g;\n scopeSelector = lang_1.StringWrapper.replaceAllMapped(scopeSelector, isRe, function(m) {\n return m[1];\n });\n var splits = [' ', '>', '+', '~'],\n scoped = selector,\n attrName = '[' + scopeSelector + ']';\n for (var i = 0; i < splits.length; i++) {\n var sep = splits[i];\n var parts = scoped.split(sep);\n scoped = parts.map(function(p) {\n var t = lang_1.StringWrapper.replaceAll(p.trim(), _polyfillHostRe, '');\n if (t.length > 0 && !collection_1.ListWrapper.contains(splits, t) && !lang_1.StringWrapper.contains(t, attrName)) {\n var re = /([^:]*)(:*)(.*)/g;\n var m = lang_1.RegExpWrapper.firstMatch(re, t);\n if (lang_1.isPresent(m)) {\n p = m[1] + attrName + m[2] + m[3];\n }\n }\n return p;\n }).join(sep);\n }\n return scoped;\n };\n ShadowCss.prototype._insertPolyfillHostInCssText = function(selector) {\n selector = lang_1.StringWrapper.replaceAll(selector, _colonHostContextRe, _polyfillHostContext);\n selector = lang_1.StringWrapper.replaceAll(selector, _colonHostRe, _polyfillHost);\n return selector;\n };\n return ShadowCss;\n })();\n exports.ShadowCss = ShadowCss;\n var _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\\s]*?['\"](.*?)['\"][;\\s]*}([^{]*?){/gim;\n var _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\\s]*['\"](.*?)['\"])[;\\s]*[^}]*}/gim;\n var _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\\s]*['\"](.*?)['\"])[;\\s]*[^}]*}/gim;\n var _polyfillHost = '-shadowcsshost';\n var _polyfillHostContext = '-shadowcsscontext';\n var _parenSuffix = ')(?:\\\\((' + '(?:\\\\([^)(]*\\\\)|[^)(]*)+?' + ')\\\\))?([^,{]*)';\n var _cssColonHostRe = lang_1.RegExpWrapper.create('(' + _polyfillHost + _parenSuffix, 'im');\n var _cssColonHostContextRe = lang_1.RegExpWrapper.create('(' + _polyfillHostContext + _parenSuffix, 'im');\n var _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';\n var _shadowDOMSelectorsRe = [/>>>/g, /::shadow/g, /::content/g, /\\/deep\\//g, /\\/shadow-deep\\//g, /\\/shadow\\//g];\n var _selectorReSuffix = '([>\\\\s~+\\[.,{:][\\\\s\\\\S]*)?$';\n var _polyfillHostRe = lang_1.RegExpWrapper.create(_polyfillHost, 'im');\n var _colonHostRe = /:host/gim;\n var _colonHostContextRe = /:host-context/gim;\n var _commentRe = /\\/\\*[\\s\\S]*?\\*\\//g;\n function stripComments(input) {\n return lang_1.StringWrapper.replaceAllMapped(input, _commentRe, function(_) {\n return '';\n });\n }\n var _ruleRe = /(\\s*)([^;\\{\\}]+?)(\\s*)((?:{%BLOCK%}?\\s*;?)|(?:\\s*;))/g;\n var _curlyRe = /([{}])/g;\n var OPEN_CURLY = '{';\n var CLOSE_CURLY = '}';\n var BLOCK_PLACEHOLDER = '%BLOCK%';\n var CssRule = (function() {\n function CssRule(selector, content) {\n this.selector = selector;\n this.content = content;\n }\n return CssRule;\n })();\n exports.CssRule = CssRule;\n function processRules(input, ruleCallback) {\n var inputWithEscapedBlocks = escapeBlocks(input);\n var nextBlockIndex = 0;\n return lang_1.StringWrapper.replaceAllMapped(inputWithEscapedBlocks.escapedString, _ruleRe, function(m) {\n var selector = m[2];\n var content = '';\n var suffix = m[4];\n var contentPrefix = '';\n if (lang_1.isPresent(m[4]) && m[4].startsWith('{' + BLOCK_PLACEHOLDER)) {\n content = inputWithEscapedBlocks.blocks[nextBlockIndex++];\n suffix = m[4].substring(BLOCK_PLACEHOLDER.length + 1);\n contentPrefix = '{';\n }\n var rule = ruleCallback(new CssRule(selector, content));\n return \"\" + m[1] + rule.selector + m[3] + contentPrefix + rule.content + suffix;\n });\n }\n exports.processRules = processRules;\n var StringWithEscapedBlocks = (function() {\n function StringWithEscapedBlocks(escapedString, blocks) {\n this.escapedString = escapedString;\n this.blocks = blocks;\n }\n return StringWithEscapedBlocks;\n })();\n function escapeBlocks(input) {\n var inputParts = lang_1.StringWrapper.split(input, _curlyRe);\n var resultParts = [];\n var escapedBlocks = [];\n var bracketCount = 0;\n var currentBlockParts = [];\n for (var partIndex = 0; partIndex < inputParts.length; partIndex++) {\n var part = inputParts[partIndex];\n if (part == CLOSE_CURLY) {\n bracketCount--;\n }\n if (bracketCount > 0) {\n currentBlockParts.push(part);\n } else {\n if (currentBlockParts.length > 0) {\n escapedBlocks.push(currentBlockParts.join(''));\n resultParts.push(BLOCK_PLACEHOLDER);\n currentBlockParts = [];\n }\n resultParts.push(part);\n }\n if (part == OPEN_CURLY) {\n bracketCount++;\n }\n }\n if (currentBlockParts.length > 0) {\n escapedBlocks.push(currentBlockParts.join(''));\n resultParts.push(BLOCK_PLACEHOLDER);\n }\n return new StringWithEscapedBlocks(resultParts.join(''), escapedBlocks);\n }\n})(require('process'));\n","/* */ \n'use strict';\nvar lang_1 = require('../facade/lang');\nvar StyleWithImports = (function() {\n function StyleWithImports(style, styleUrls) {\n this.style = style;\n this.styleUrls = styleUrls;\n }\n return StyleWithImports;\n})();\nexports.StyleWithImports = StyleWithImports;\nfunction isStyleUrlResolvable(url) {\n if (lang_1.isBlank(url) || url.length === 0 || url[0] == '/')\n return false;\n var schemeMatch = lang_1.RegExpWrapper.firstMatch(_urlWithSchemaRe, url);\n return lang_1.isBlank(schemeMatch) || schemeMatch[1] == 'package' || schemeMatch[1] == 'asset';\n}\nexports.isStyleUrlResolvable = isStyleUrlResolvable;\nfunction extractStyleUrls(resolver, baseUrl, cssText) {\n var foundUrls = [];\n var modifiedCssText = lang_1.StringWrapper.replaceAllMapped(cssText, _cssImportRe, function(m) {\n var url = lang_1.isPresent(m[1]) ? m[1] : m[2];\n if (!isStyleUrlResolvable(url)) {\n return m[0];\n }\n foundUrls.push(resolver.resolve(baseUrl, url));\n return '';\n });\n return new StyleWithImports(modifiedCssText, foundUrls);\n}\nexports.extractStyleUrls = extractStyleUrls;\nvar _cssImportRe = /@import\\s+(?:url\\()?\\s*(?:(?:['\"]([^'\"]*))|([^;\\)\\s]*))[^;]*;?/g;\nvar _urlWithSchemaRe = /^([a-zA-Z\\-\\+\\.]+):/g;\n","/* */ \n'use strict';\nvar __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function(k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(k, v);\n};\nvar source_module_1 = require('./source_module');\nvar view_1 = require('../core/metadata/view');\nvar xhr_1 = require('./xhr');\nvar lang_1 = require('../facade/lang');\nvar async_1 = require('../facade/async');\nvar shadow_css_1 = require('./shadow_css');\nvar url_resolver_1 = require('./url_resolver');\nvar style_url_resolver_1 = require('./style_url_resolver');\nvar util_1 = require('./util');\nvar di_1 = require('../core/di');\nvar COMPONENT_VARIABLE = '%COMP%';\nvar HOST_ATTR = \"_nghost-\" + COMPONENT_VARIABLE;\nvar CONTENT_ATTR = \"_ngcontent-\" + COMPONENT_VARIABLE;\nvar StyleCompiler = (function() {\n function StyleCompiler(_xhr, _urlResolver) {\n this._xhr = _xhr;\n this._urlResolver = _urlResolver;\n this._styleCache = new Map();\n this._shadowCss = new shadow_css_1.ShadowCss();\n }\n StyleCompiler.prototype.compileComponentRuntime = function(template) {\n var styles = template.styles;\n var styleAbsUrls = template.styleUrls;\n return this._loadStyles(styles, styleAbsUrls, template.encapsulation === view_1.ViewEncapsulation.Emulated);\n };\n StyleCompiler.prototype.compileComponentCodeGen = function(template) {\n var shim = template.encapsulation === view_1.ViewEncapsulation.Emulated;\n return this._styleCodeGen(template.styles, template.styleUrls, shim);\n };\n StyleCompiler.prototype.compileStylesheetCodeGen = function(stylesheetUrl, cssText) {\n var styleWithImports = style_url_resolver_1.extractStyleUrls(this._urlResolver, stylesheetUrl, cssText);\n return [this._styleModule(stylesheetUrl, false, this._styleCodeGen([styleWithImports.style], styleWithImports.styleUrls, false)), this._styleModule(stylesheetUrl, true, this._styleCodeGen([styleWithImports.style], styleWithImports.styleUrls, true))];\n };\n StyleCompiler.prototype.clearCache = function() {\n this._styleCache.clear();\n };\n StyleCompiler.prototype._loadStyles = function(plainStyles, absUrls, encapsulate) {\n var _this = this;\n var promises = absUrls.map(function(absUrl) {\n var cacheKey = \"\" + absUrl + (encapsulate ? '.shim' : '');\n var result = _this._styleCache.get(cacheKey);\n if (lang_1.isBlank(result)) {\n result = _this._xhr.get(absUrl).then(function(style) {\n var styleWithImports = style_url_resolver_1.extractStyleUrls(_this._urlResolver, absUrl, style);\n return _this._loadStyles([styleWithImports.style], styleWithImports.styleUrls, encapsulate);\n });\n _this._styleCache.set(cacheKey, result);\n }\n return result;\n });\n return async_1.PromiseWrapper.all(promises).then(function(nestedStyles) {\n var result = plainStyles.map(function(plainStyle) {\n return _this._shimIfNeeded(plainStyle, encapsulate);\n });\n nestedStyles.forEach(function(styles) {\n return result.push(styles);\n });\n return result;\n });\n };\n StyleCompiler.prototype._styleCodeGen = function(plainStyles, absUrls, shim) {\n var _this = this;\n var arrayPrefix = lang_1.IS_DART ? \"const\" : '';\n var styleExpressions = plainStyles.map(function(plainStyle) {\n return util_1.escapeSingleQuoteString(_this._shimIfNeeded(plainStyle, shim));\n });\n for (var i = 0; i < absUrls.length; i++) {\n var moduleUrl = this._createModuleUrl(absUrls[i], shim);\n styleExpressions.push(source_module_1.moduleRef(moduleUrl) + \"STYLES\");\n }\n var expressionSource = arrayPrefix + \" [\" + styleExpressions.join(',') + \"]\";\n return new source_module_1.SourceExpression([], expressionSource);\n };\n StyleCompiler.prototype._styleModule = function(stylesheetUrl, shim, expression) {\n var moduleSource = \"\\n \" + expression.declarations.join('\\n') + \"\\n \" + util_1.codeGenExportVariable('STYLES') + expression.expression + \";\\n \";\n return new source_module_1.SourceModule(this._createModuleUrl(stylesheetUrl, shim), moduleSource);\n };\n StyleCompiler.prototype._shimIfNeeded = function(style, shim) {\n return shim ? this._shadowCss.shimCssText(style, CONTENT_ATTR, HOST_ATTR) : style;\n };\n StyleCompiler.prototype._createModuleUrl = function(stylesheetUrl, shim) {\n return shim ? stylesheetUrl + \".shim\" + util_1.MODULE_SUFFIX : \"\" + stylesheetUrl + util_1.MODULE_SUFFIX;\n };\n StyleCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, url_resolver_1.UrlResolver])], StyleCompiler);\n return StyleCompiler;\n})();\nexports.StyleCompiler = StyleCompiler;\n","/* */ \n'use strict';\nvar __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function(k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(k, v);\n};\nvar lang_1 = require('../facade/lang');\nvar collection_1 = require('../facade/collection');\nvar template_ast_1 = require('./template_ast');\nvar source_module_1 = require('./source_module');\nvar view_1 = require('../core/linker/view');\nvar view_type_1 = require('../core/linker/view_type');\nvar element_1 = require('../core/linker/element');\nvar view_2 = require('../core/metadata/view');\nvar util_1 = require('./util');\nvar di_1 = require('../core/di');\nvar proto_view_compiler_1 = require('./proto_view_compiler');\nexports.VIEW_JIT_IMPORTS = lang_1.CONST_EXPR({\n 'AppView': view_1.AppView,\n 'AppElement': element_1.AppElement,\n 'flattenNestedViewRenderNodes': view_1.flattenNestedViewRenderNodes,\n 'checkSlotCount': view_1.checkSlotCount\n});\nvar ViewCompiler = (function() {\n function ViewCompiler() {}\n ViewCompiler.prototype.compileComponentRuntime = function(component, template, styles, protoViews, changeDetectorFactories, componentViewFactory) {\n var viewFactory = new RuntimeViewFactory(component, styles, protoViews, changeDetectorFactories, componentViewFactory);\n return viewFactory.createViewFactory(template, 0, []);\n };\n ViewCompiler.prototype.compileComponentCodeGen = function(component, template, styles, protoViews, changeDetectorFactoryExpressions, componentViewFactory) {\n var viewFactory = new CodeGenViewFactory(component, styles, protoViews, changeDetectorFactoryExpressions, componentViewFactory);\n var targetStatements = [];\n var viewFactoryExpression = viewFactory.createViewFactory(template, 0, targetStatements);\n return new source_module_1.SourceExpression(targetStatements.map(function(stmt) {\n return stmt.statement;\n }), viewFactoryExpression.expression);\n };\n ViewCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], ViewCompiler);\n return ViewCompiler;\n})();\nexports.ViewCompiler = ViewCompiler;\nvar CodeGenViewFactory = (function() {\n function CodeGenViewFactory(component, styles, protoViews, changeDetectorExpressions, componentViewFactory) {\n this.component = component;\n this.styles = styles;\n this.protoViews = protoViews;\n this.changeDetectorExpressions = changeDetectorExpressions;\n this.componentViewFactory = componentViewFactory;\n this._nextVarId = 0;\n }\n CodeGenViewFactory.prototype._nextVar = function(prefix) {\n return \"\" + prefix + this._nextVarId++ + \"_\" + this.component.type.name;\n };\n CodeGenViewFactory.prototype._nextRenderVar = function() {\n return this._nextVar('render');\n };\n CodeGenViewFactory.prototype._nextAppVar = function() {\n return this._nextVar('app');\n };\n CodeGenViewFactory.prototype._nextDisposableVar = function() {\n return \"disposable\" + this._nextVarId++ + \"_\" + this.component.type.name;\n };\n CodeGenViewFactory.prototype.createText = function(renderer, parent, text, targetStatements) {\n var varName = this._nextRenderVar();\n var statement = \"var \" + varName + \" = \" + renderer.expression + \".createText(\" + (lang_1.isPresent(parent) ? parent.expression : null) + \", \" + util_1.escapeSingleQuoteString(text) + \");\";\n targetStatements.push(new util_1.Statement(statement));\n return new util_1.Expression(varName);\n };\n CodeGenViewFactory.prototype.createElement = function(renderer, parentRenderNode, name, rootSelector, targetStatements) {\n var varName = this._nextRenderVar();\n var valueExpr;\n if (lang_1.isPresent(rootSelector)) {\n valueExpr = rootSelector.expression + \" == null ?\\n \" + renderer.expression + \".createElement(\" + (lang_1.isPresent(parentRenderNode) ? parentRenderNode.expression : null) + \", \" + util_1.escapeSingleQuoteString(name) + \") :\\n \" + renderer.expression + \".selectRootElement(\" + rootSelector.expression + \");\";\n } else {\n valueExpr = renderer.expression + \".createElement(\" + (lang_1.isPresent(parentRenderNode) ? parentRenderNode.expression : null) + \", \" + util_1.escapeSingleQuoteString(name) + \")\";\n }\n var statement = \"var \" + varName + \" = \" + valueExpr + \";\";\n targetStatements.push(new util_1.Statement(statement));\n return new util_1.Expression(varName);\n };\n CodeGenViewFactory.prototype.createTemplateAnchor = function(renderer, parentRenderNode, targetStatements) {\n var varName = this._nextRenderVar();\n var valueExpr = renderer.expression + \".createTemplateAnchor(\" + (lang_1.isPresent(parentRenderNode) ? parentRenderNode.expression : null) + \");\";\n targetStatements.push(new util_1.Statement(\"var \" + varName + \" = \" + valueExpr));\n return new util_1.Expression(varName);\n };\n CodeGenViewFactory.prototype.createGlobalEventListener = function(renderer, appView, boundElementIndex, eventAst, targetStatements) {\n var disposableVar = this._nextDisposableVar();\n var eventHandlerExpr = codeGenEventHandler(appView, boundElementIndex, eventAst.fullName);\n targetStatements.push(new util_1.Statement(\"var \" + disposableVar + \" = \" + renderer.expression + \".listenGlobal(\" + util_1.escapeValue(eventAst.target) + \", \" + util_1.escapeValue(eventAst.name) + \", \" + eventHandlerExpr + \");\"));\n return new util_1.Expression(disposableVar);\n };\n CodeGenViewFactory.prototype.createElementEventListener = function(renderer, appView, boundElementIndex, renderNode, eventAst, targetStatements) {\n var disposableVar = this._nextDisposableVar();\n var eventHandlerExpr = codeGenEventHandler(appView, boundElementIndex, eventAst.fullName);\n targetStatements.push(new util_1.Statement(\"var \" + disposableVar + \" = \" + renderer.expression + \".listen(\" + renderNode.expression + \", \" + util_1.escapeValue(eventAst.name) + \", \" + eventHandlerExpr + \");\"));\n return new util_1.Expression(disposableVar);\n };\n CodeGenViewFactory.prototype.setElementAttribute = function(renderer, renderNode, attrName, attrValue, targetStatements) {\n targetStatements.push(new util_1.Statement(renderer.expression + \".setElementAttribute(\" + renderNode.expression + \", \" + util_1.escapeSingleQuoteString(attrName) + \", \" + util_1.escapeSingleQuoteString(attrValue) + \");\"));\n };\n CodeGenViewFactory.prototype.createAppElement = function(appProtoEl, appView, renderNode, parentAppEl, embeddedViewFactory, targetStatements) {\n var appVar = this._nextAppVar();\n var varValue = \"new \" + proto_view_compiler_1.APP_EL_MODULE_REF + \"AppElement(\" + appProtoEl.expression + \", \" + appView.expression + \",\\n \" + (lang_1.isPresent(parentAppEl) ? parentAppEl.expression : null) + \", \" + renderNode.expression + \", \" + (lang_1.isPresent(embeddedViewFactory) ? embeddedViewFactory.expression : null) + \")\";\n targetStatements.push(new util_1.Statement(\"var \" + appVar + \" = \" + varValue + \";\"));\n return new util_1.Expression(appVar);\n };\n CodeGenViewFactory.prototype.createAndSetComponentView = function(renderer, viewManager, view, appEl, component, contentNodesByNgContentIndex, targetStatements) {\n var codeGenContentNodes;\n if (this.component.type.isHost) {\n codeGenContentNodes = view.expression + \".projectableNodes\";\n } else {\n codeGenContentNodes = \"[\" + contentNodesByNgContentIndex.map(function(nodes) {\n return util_1.codeGenFlatArray(nodes);\n }).join(',') + \"]\";\n }\n targetStatements.push(new util_1.Statement(this.componentViewFactory(component) + \"(\" + renderer.expression + \", \" + viewManager.expression + \", \" + appEl.expression + \", \" + codeGenContentNodes + \", null, null, null);\"));\n };\n CodeGenViewFactory.prototype.getProjectedNodes = function(projectableNodes, ngContentIndex) {\n return new util_1.Expression(projectableNodes.expression + \"[\" + ngContentIndex + \"]\", true);\n };\n CodeGenViewFactory.prototype.appendProjectedNodes = function(renderer, parent, nodes, targetStatements) {\n targetStatements.push(new util_1.Statement(renderer.expression + \".projectNodes(\" + parent.expression + \", \" + proto_view_compiler_1.APP_VIEW_MODULE_REF + \"flattenNestedViewRenderNodes(\" + nodes.expression + \"));\"));\n };\n CodeGenViewFactory.prototype.createViewFactory = function(asts, embeddedTemplateIndex, targetStatements) {\n var compileProtoView = this.protoViews[embeddedTemplateIndex];\n var isHostView = this.component.type.isHost;\n var isComponentView = embeddedTemplateIndex === 0 && !isHostView;\n var visitor = new ViewBuilderVisitor(new util_1.Expression('renderer'), new util_1.Expression('viewManager'), new util_1.Expression('projectableNodes'), isHostView ? new util_1.Expression('rootSelector') : null, new util_1.Expression('view'), compileProtoView, targetStatements, this);\n template_ast_1.templateVisitAll(visitor, asts, new ParentElement(isComponentView ? new util_1.Expression('parentRenderNode') : null, null, null));\n var appProtoView = compileProtoView.protoView.expression;\n var viewFactoryName = codeGenViewFactoryName(this.component, embeddedTemplateIndex);\n var changeDetectorFactory = this.changeDetectorExpressions.expressions[embeddedTemplateIndex];\n var factoryArgs = ['parentRenderer', 'viewManager', 'containerEl', 'projectableNodes', 'rootSelector', 'dynamicallyCreatedProviders', 'rootInjector'];\n var initRendererStmts = [];\n var rendererExpr = \"parentRenderer\";\n if (embeddedTemplateIndex === 0) {\n var renderCompTypeVar = this._nextVar('renderType');\n targetStatements.push(new util_1.Statement(\"var \" + renderCompTypeVar + \" = null;\"));\n var stylesVar = this._nextVar('styles');\n targetStatements.push(new util_1.Statement(util_1.CONST_VAR + \" \" + stylesVar + \" = \" + this.styles.expression + \";\"));\n var encapsulation = this.component.template.encapsulation;\n initRendererStmts.push(\"if (\" + renderCompTypeVar + \" == null) {\\n \" + renderCompTypeVar + \" = viewManager.createRenderComponentType(\" + codeGenViewEncapsulation(encapsulation) + \", \" + stylesVar + \");\\n }\");\n rendererExpr = \"parentRenderer.renderComponent(\" + renderCompTypeVar + \")\";\n }\n var statement = \"\\n\" + util_1.codeGenFnHeader(factoryArgs, viewFactoryName) + \"{\\n \" + initRendererStmts.join('\\n') + \"\\n var renderer = \" + rendererExpr + \";\\n var view = new \" + proto_view_compiler_1.APP_VIEW_MODULE_REF + \"AppView(\\n \" + appProtoView + \", renderer, viewManager,\\n projectableNodes,\\n containerEl,\\n dynamicallyCreatedProviders, rootInjector,\\n \" + changeDetectorFactory + \"()\\n );\\n \" + proto_view_compiler_1.APP_VIEW_MODULE_REF + \"checkSlotCount(\" + util_1.escapeValue(this.component.type.name) + \", \" + this.component.template.ngContentSelectors.length + \", projectableNodes);\\n \" + (isComponentView ? 'var parentRenderNode = renderer.createViewRoot(view.containerAppElement.nativeElement);' : '') + \"\\n \" + visitor.renderStmts.map(function(stmt) {\n return stmt.statement;\n }).join('\\n') + \"\\n \" + visitor.appStmts.map(function(stmt) {\n return stmt.statement;\n }).join('\\n') + \"\\n\\n view.init(\" + util_1.codeGenFlatArray(visitor.rootNodesOrAppElements) + \", \" + util_1.codeGenArray(visitor.renderNodes) + \", \" + util_1.codeGenArray(visitor.appDisposables) + \",\\n \" + util_1.codeGenArray(visitor.appElements) + \");\\n return view;\\n}\";\n targetStatements.push(new util_1.Statement(statement));\n return new util_1.Expression(viewFactoryName);\n };\n return CodeGenViewFactory;\n})();\nvar RuntimeViewFactory = (function() {\n function RuntimeViewFactory(component, styles, protoViews, changeDetectorFactories, componentViewFactory) {\n this.component = component;\n this.styles = styles;\n this.protoViews = protoViews;\n this.changeDetectorFactories = changeDetectorFactories;\n this.componentViewFactory = componentViewFactory;\n }\n RuntimeViewFactory.prototype.createText = function(renderer, parent, text, targetStatements) {\n return renderer.createText(parent, text);\n };\n RuntimeViewFactory.prototype.createElement = function(renderer, parent, name, rootSelector, targetStatements) {\n var el;\n if (lang_1.isPresent(rootSelector)) {\n el = renderer.selectRootElement(rootSelector);\n } else {\n el = renderer.createElement(parent, name);\n }\n return el;\n };\n RuntimeViewFactory.prototype.createTemplateAnchor = function(renderer, parent, targetStatements) {\n return renderer.createTemplateAnchor(parent);\n };\n RuntimeViewFactory.prototype.createGlobalEventListener = function(renderer, appView, boundElementIndex, eventAst, targetStatements) {\n return renderer.listenGlobal(eventAst.target, eventAst.name, function(event) {\n return appView.triggerEventHandlers(eventAst.fullName, event, boundElementIndex);\n });\n };\n RuntimeViewFactory.prototype.createElementEventListener = function(renderer, appView, boundElementIndex, renderNode, eventAst, targetStatements) {\n return renderer.listen(renderNode, eventAst.name, function(event) {\n return appView.triggerEventHandlers(eventAst.fullName, event, boundElementIndex);\n });\n };\n RuntimeViewFactory.prototype.setElementAttribute = function(renderer, renderNode, attrName, attrValue, targetStatements) {\n renderer.setElementAttribute(renderNode, attrName, attrValue);\n };\n RuntimeViewFactory.prototype.createAppElement = function(appProtoEl, appView, renderNode, parentAppEl, embeddedViewFactory, targetStatements) {\n return new element_1.AppElement(appProtoEl, appView, parentAppEl, renderNode, embeddedViewFactory);\n };\n RuntimeViewFactory.prototype.createAndSetComponentView = function(renderer, viewManager, appView, appEl, component, contentNodesByNgContentIndex, targetStatements) {\n var flattenedContentNodes;\n if (this.component.type.isHost) {\n flattenedContentNodes = appView.projectableNodes;\n } else {\n flattenedContentNodes = collection_1.ListWrapper.createFixedSize(contentNodesByNgContentIndex.length);\n for (var i = 0; i < contentNodesByNgContentIndex.length; i++) {\n flattenedContentNodes[i] = util_1.flattenArray(contentNodesByNgContentIndex[i], []);\n }\n }\n this.componentViewFactory(component)(renderer, viewManager, appEl, flattenedContentNodes);\n };\n RuntimeViewFactory.prototype.getProjectedNodes = function(projectableNodes, ngContentIndex) {\n return projectableNodes[ngContentIndex];\n };\n RuntimeViewFactory.prototype.appendProjectedNodes = function(renderer, parent, nodes, targetStatements) {\n renderer.projectNodes(parent, view_1.flattenNestedViewRenderNodes(nodes));\n };\n RuntimeViewFactory.prototype.createViewFactory = function(asts, embeddedTemplateIndex, targetStatements) {\n var _this = this;\n var compileProtoView = this.protoViews[embeddedTemplateIndex];\n var isComponentView = compileProtoView.protoView.type === view_type_1.ViewType.COMPONENT;\n var renderComponentType = null;\n return function(parentRenderer, viewManager, containerEl, projectableNodes, rootSelector, dynamicallyCreatedProviders, rootInjector) {\n if (rootSelector === void 0) {\n rootSelector = null;\n }\n if (dynamicallyCreatedProviders === void 0) {\n dynamicallyCreatedProviders = null;\n }\n if (rootInjector === void 0) {\n rootInjector = null;\n }\n view_1.checkSlotCount(_this.component.type.name, _this.component.template.ngContentSelectors.length, projectableNodes);\n var renderer;\n if (embeddedTemplateIndex === 0) {\n if (lang_1.isBlank(renderComponentType)) {\n renderComponentType = viewManager.createRenderComponentType(_this.component.template.encapsulation, _this.styles);\n }\n renderer = parentRenderer.renderComponent(renderComponentType);\n } else {\n renderer = parentRenderer;\n }\n var changeDetector = _this.changeDetectorFactories[embeddedTemplateIndex]();\n var view = new view_1.AppView(compileProtoView.protoView, renderer, viewManager, projectableNodes, containerEl, dynamicallyCreatedProviders, rootInjector, changeDetector);\n var visitor = new ViewBuilderVisitor(renderer, viewManager, projectableNodes, rootSelector, view, compileProtoView, [], _this);\n var parentRenderNode = isComponentView ? renderer.createViewRoot(containerEl.nativeElement) : null;\n template_ast_1.templateVisitAll(visitor, asts, new ParentElement(parentRenderNode, null, null));\n view.init(util_1.flattenArray(visitor.rootNodesOrAppElements, []), visitor.renderNodes, visitor.appDisposables, visitor.appElements);\n return view;\n };\n };\n return RuntimeViewFactory;\n})();\nvar ParentElement = (function() {\n function ParentElement(renderNode, appEl, component) {\n this.renderNode = renderNode;\n this.appEl = appEl;\n this.component = component;\n if (lang_1.isPresent(component)) {\n this.contentNodesByNgContentIndex = collection_1.ListWrapper.createFixedSize(component.template.ngContentSelectors.length);\n for (var i = 0; i < this.contentNodesByNgContentIndex.length; i++) {\n this.contentNodesByNgContentIndex[i] = [];\n }\n } else {\n this.contentNodesByNgContentIndex = null;\n }\n }\n ParentElement.prototype.addContentNode = function(ngContentIndex, nodeExpr) {\n this.contentNodesByNgContentIndex[ngContentIndex].push(nodeExpr);\n };\n return ParentElement;\n})();\nvar ViewBuilderVisitor = (function() {\n function ViewBuilderVisitor(renderer, viewManager, projectableNodes, rootSelector, view, protoView, targetStatements, factory) {\n this.renderer = renderer;\n this.viewManager = viewManager;\n this.projectableNodes = projectableNodes;\n this.rootSelector = rootSelector;\n this.view = view;\n this.protoView = protoView;\n this.targetStatements = targetStatements;\n this.factory = factory;\n this.renderStmts = [];\n this.renderNodes = [];\n this.appStmts = [];\n this.appElements = [];\n this.appDisposables = [];\n this.rootNodesOrAppElements = [];\n this.elementCount = 0;\n }\n ViewBuilderVisitor.prototype._addRenderNode = function(renderNode, appEl, ngContentIndex, parent) {\n this.renderNodes.push(renderNode);\n if (lang_1.isPresent(parent.component)) {\n if (lang_1.isPresent(ngContentIndex)) {\n parent.addContentNode(ngContentIndex, lang_1.isPresent(appEl) ? appEl : renderNode);\n }\n } else if (lang_1.isBlank(parent.renderNode)) {\n this.rootNodesOrAppElements.push(lang_1.isPresent(appEl) ? appEl : renderNode);\n }\n };\n ViewBuilderVisitor.prototype._getParentRenderNode = function(ngContentIndex, parent) {\n return lang_1.isPresent(parent.component) && parent.component.template.encapsulation !== view_2.ViewEncapsulation.Native ? null : parent.renderNode;\n };\n ViewBuilderVisitor.prototype.visitBoundText = function(ast, parent) {\n return this._visitText('', ast.ngContentIndex, parent);\n };\n ViewBuilderVisitor.prototype.visitText = function(ast, parent) {\n return this._visitText(ast.value, ast.ngContentIndex, parent);\n };\n ViewBuilderVisitor.prototype._visitText = function(value, ngContentIndex, parent) {\n var renderNode = this.factory.createText(this.renderer, this._getParentRenderNode(ngContentIndex, parent), value, this.renderStmts);\n this._addRenderNode(renderNode, null, ngContentIndex, parent);\n return null;\n };\n ViewBuilderVisitor.prototype.visitNgContent = function(ast, parent) {\n var nodesExpression = this.factory.getProjectedNodes(this.projectableNodes, ast.index);\n if (lang_1.isPresent(parent.component)) {\n if (lang_1.isPresent(ast.ngContentIndex)) {\n parent.addContentNode(ast.ngContentIndex, nodesExpression);\n }\n } else {\n if (lang_1.isPresent(parent.renderNode)) {\n this.factory.appendProjectedNodes(this.renderer, parent.renderNode, nodesExpression, this.renderStmts);\n } else {\n this.rootNodesOrAppElements.push(nodesExpression);\n }\n }\n return null;\n };\n ViewBuilderVisitor.prototype.visitElement = function(ast, parent) {\n var _this = this;\n var renderNode = this.factory.createElement(this.renderer, this._getParentRenderNode(ast.ngContentIndex, parent), ast.name, this.rootSelector, this.renderStmts);\n var component = ast.getComponent();\n var elementIndex = this.elementCount++;\n var protoEl = this.protoView.protoElements[elementIndex];\n protoEl.renderEvents.forEach(function(eventAst) {\n var disposable;\n if (lang_1.isPresent(eventAst.target)) {\n disposable = _this.factory.createGlobalEventListener(_this.renderer, _this.view, protoEl.boundElementIndex, eventAst, _this.renderStmts);\n } else {\n disposable = _this.factory.createElementEventListener(_this.renderer, _this.view, protoEl.boundElementIndex, renderNode, eventAst, _this.renderStmts);\n }\n _this.appDisposables.push(disposable);\n });\n for (var i = 0; i < protoEl.attrNameAndValues.length; i++) {\n var attrName = protoEl.attrNameAndValues[i][0];\n var attrValue = protoEl.attrNameAndValues[i][1];\n this.factory.setElementAttribute(this.renderer, renderNode, attrName, attrValue, this.renderStmts);\n }\n var appEl = null;\n if (lang_1.isPresent(protoEl.appProtoEl)) {\n appEl = this.factory.createAppElement(protoEl.appProtoEl, this.view, renderNode, parent.appEl, null, this.appStmts);\n this.appElements.push(appEl);\n }\n this._addRenderNode(renderNode, appEl, ast.ngContentIndex, parent);\n var newParent = new ParentElement(renderNode, lang_1.isPresent(appEl) ? appEl : parent.appEl, component);\n template_ast_1.templateVisitAll(this, ast.children, newParent);\n if (lang_1.isPresent(appEl) && lang_1.isPresent(component)) {\n this.factory.createAndSetComponentView(this.renderer, this.viewManager, this.view, appEl, component, newParent.contentNodesByNgContentIndex, this.appStmts);\n }\n return null;\n };\n ViewBuilderVisitor.prototype.visitEmbeddedTemplate = function(ast, parent) {\n var renderNode = this.factory.createTemplateAnchor(this.renderer, this._getParentRenderNode(ast.ngContentIndex, parent), this.renderStmts);\n var elementIndex = this.elementCount++;\n var protoEl = this.protoView.protoElements[elementIndex];\n var embeddedViewFactory = this.factory.createViewFactory(ast.children, protoEl.embeddedTemplateIndex, this.targetStatements);\n var appEl = this.factory.createAppElement(protoEl.appProtoEl, this.view, renderNode, parent.appEl, embeddedViewFactory, this.appStmts);\n this._addRenderNode(renderNode, appEl, ast.ngContentIndex, parent);\n this.appElements.push(appEl);\n return null;\n };\n ViewBuilderVisitor.prototype.visitVariable = function(ast, ctx) {\n return null;\n };\n ViewBuilderVisitor.prototype.visitAttr = function(ast, ctx) {\n return null;\n };\n ViewBuilderVisitor.prototype.visitDirective = function(ast, ctx) {\n return null;\n };\n ViewBuilderVisitor.prototype.visitEvent = function(ast, ctx) {\n return null;\n };\n ViewBuilderVisitor.prototype.visitDirectiveProperty = function(ast, context) {\n return null;\n };\n ViewBuilderVisitor.prototype.visitElementProperty = function(ast, context) {\n return null;\n };\n return ViewBuilderVisitor;\n})();\nfunction codeGenEventHandler(view, boundElementIndex, eventName) {\n return util_1.codeGenValueFn(['event'], view.expression + \".triggerEventHandlers(\" + util_1.escapeValue(eventName) + \", event, \" + boundElementIndex + \")\");\n}\nfunction codeGenViewFactoryName(component, embeddedTemplateIndex) {\n return \"viewFactory_\" + component.type.name + embeddedTemplateIndex;\n}\nfunction codeGenViewEncapsulation(value) {\n if (lang_1.IS_DART) {\n return \"\" + proto_view_compiler_1.METADATA_MODULE_REF + value;\n } else {\n return \"\" + value;\n }\n}\n","/* */ \n'use strict';\nvar lang_1 = require('../facade/lang');\nvar TextAst = (function() {\n function TextAst(value, ngContentIndex, sourceSpan) {\n this.value = value;\n this.ngContentIndex = ngContentIndex;\n this.sourceSpan = sourceSpan;\n }\n TextAst.prototype.visit = function(visitor, context) {\n return visitor.visitText(this, context);\n };\n return TextAst;\n})();\nexports.TextAst = TextAst;\nvar BoundTextAst = (function() {\n function BoundTextAst(value, ngContentIndex, sourceSpan) {\n this.value = value;\n this.ngContentIndex = ngContentIndex;\n this.sourceSpan = sourceSpan;\n }\n BoundTextAst.prototype.visit = function(visitor, context) {\n return visitor.visitBoundText(this, context);\n };\n return BoundTextAst;\n})();\nexports.BoundTextAst = BoundTextAst;\nvar AttrAst = (function() {\n function AttrAst(name, value, sourceSpan) {\n this.name = name;\n this.value = value;\n this.sourceSpan = sourceSpan;\n }\n AttrAst.prototype.visit = function(visitor, context) {\n return visitor.visitAttr(this, context);\n };\n return AttrAst;\n})();\nexports.AttrAst = AttrAst;\nvar BoundElementPropertyAst = (function() {\n function BoundElementPropertyAst(name, type, value, unit, sourceSpan) {\n this.name = name;\n this.type = type;\n this.value = value;\n this.unit = unit;\n this.sourceSpan = sourceSpan;\n }\n BoundElementPropertyAst.prototype.visit = function(visitor, context) {\n return visitor.visitElementProperty(this, context);\n };\n return BoundElementPropertyAst;\n})();\nexports.BoundElementPropertyAst = BoundElementPropertyAst;\nvar BoundEventAst = (function() {\n function BoundEventAst(name, target, handler, sourceSpan) {\n this.name = name;\n this.target = target;\n this.handler = handler;\n this.sourceSpan = sourceSpan;\n }\n BoundEventAst.prototype.visit = function(visitor, context) {\n return visitor.visitEvent(this, context);\n };\n Object.defineProperty(BoundEventAst.prototype, \"fullName\", {\n get: function() {\n if (lang_1.isPresent(this.target)) {\n return this.target + \":\" + this.name;\n } else {\n return this.name;\n }\n },\n enumerable: true,\n configurable: true\n });\n return BoundEventAst;\n})();\nexports.BoundEventAst = BoundEventAst;\nvar VariableAst = (function() {\n function VariableAst(name, value, sourceSpan) {\n this.name = name;\n this.value = value;\n this.sourceSpan = sourceSpan;\n }\n VariableAst.prototype.visit = function(visitor, context) {\n return visitor.visitVariable(this, context);\n };\n return VariableAst;\n})();\nexports.VariableAst = VariableAst;\nvar ElementAst = (function() {\n function ElementAst(name, attrs, inputs, outputs, exportAsVars, directives, children, ngContentIndex, sourceSpan) {\n this.name = name;\n this.attrs = attrs;\n this.inputs = inputs;\n this.outputs = outputs;\n this.exportAsVars = exportAsVars;\n this.directives = directives;\n this.children = children;\n this.ngContentIndex = ngContentIndex;\n this.sourceSpan = sourceSpan;\n }\n ElementAst.prototype.visit = function(visitor, context) {\n return visitor.visitElement(this, context);\n };\n ElementAst.prototype.isBound = function() {\n return (this.inputs.length > 0 || this.outputs.length > 0 || this.exportAsVars.length > 0 || this.directives.length > 0);\n };\n ElementAst.prototype.getComponent = function() {\n return this.directives.length > 0 && this.directives[0].directive.isComponent ? this.directives[0].directive : null;\n };\n return ElementAst;\n})();\nexports.ElementAst = ElementAst;\nvar EmbeddedTemplateAst = (function() {\n function EmbeddedTemplateAst(attrs, outputs, vars, directives, children, ngContentIndex, sourceSpan) {\n this.attrs = attrs;\n this.outputs = outputs;\n this.vars = vars;\n this.directives = directives;\n this.children = children;\n this.ngContentIndex = ngContentIndex;\n this.sourceSpan = sourceSpan;\n }\n EmbeddedTemplateAst.prototype.visit = function(visitor, context) {\n return visitor.visitEmbeddedTemplate(this, context);\n };\n return EmbeddedTemplateAst;\n})();\nexports.EmbeddedTemplateAst = EmbeddedTemplateAst;\nvar BoundDirectivePropertyAst = (function() {\n function BoundDirectivePropertyAst(directiveName, templateName, value, sourceSpan) {\n this.directiveName = directiveName;\n this.templateName = templateName;\n this.value = value;\n this.sourceSpan = sourceSpan;\n }\n BoundDirectivePropertyAst.prototype.visit = function(visitor, context) {\n return visitor.visitDirectiveProperty(this, context);\n };\n return BoundDirectivePropertyAst;\n})();\nexports.BoundDirectivePropertyAst = BoundDirectivePropertyAst;\nvar DirectiveAst = (function() {\n function DirectiveAst(directive, inputs, hostProperties, hostEvents, exportAsVars, sourceSpan) {\n this.directive = directive;\n this.inputs = inputs;\n this.hostProperties = hostProperties;\n this.hostEvents = hostEvents;\n this.exportAsVars = exportAsVars;\n this.sourceSpan = sourceSpan;\n }\n DirectiveAst.prototype.visit = function(visitor, context) {\n return visitor.visitDirective(this, context);\n };\n return DirectiveAst;\n})();\nexports.DirectiveAst = DirectiveAst;\nvar NgContentAst = (function() {\n function NgContentAst(index, ngContentIndex, sourceSpan) {\n this.index = index;\n this.ngContentIndex = ngContentIndex;\n this.sourceSpan = sourceSpan;\n }\n NgContentAst.prototype.visit = function(visitor, context) {\n return visitor.visitNgContent(this, context);\n };\n return NgContentAst;\n})();\nexports.NgContentAst = NgContentAst;\n(function(PropertyBindingType) {\n PropertyBindingType[PropertyBindingType[\"Property\"] = 0] = \"Property\";\n PropertyBindingType[PropertyBindingType[\"Attribute\"] = 1] = \"Attribute\";\n PropertyBindingType[PropertyBindingType[\"Class\"] = 2] = \"Class\";\n PropertyBindingType[PropertyBindingType[\"Style\"] = 3] = \"Style\";\n})(exports.PropertyBindingType || (exports.PropertyBindingType = {}));\nvar PropertyBindingType = exports.PropertyBindingType;\nfunction templateVisitAll(visitor, asts, context) {\n if (context === void 0) {\n context = null;\n }\n var result = [];\n asts.forEach(function(ast) {\n var astResult = ast.visit(visitor, context);\n if (lang_1.isPresent(astResult)) {\n result.push(astResult);\n }\n });\n return result;\n}\nexports.templateVisitAll = templateVisitAll;\n","/* */ \n'use strict';\nvar lang_1 = require('../facade/lang');\nvar MODULE_REGEXP = /#MODULE\\[([^\\]]*)\\]/g;\nfunction moduleRef(moduleUrl) {\n return \"#MODULE[\" + moduleUrl + \"]\";\n}\nexports.moduleRef = moduleRef;\nvar SourceModule = (function() {\n function SourceModule(moduleUrl, sourceWithModuleRefs) {\n this.moduleUrl = moduleUrl;\n this.sourceWithModuleRefs = sourceWithModuleRefs;\n }\n SourceModule.getSourceWithoutImports = function(sourceWithModuleRefs) {\n return lang_1.StringWrapper.replaceAllMapped(sourceWithModuleRefs, MODULE_REGEXP, function(match) {\n return '';\n });\n };\n SourceModule.prototype.getSourceWithImports = function() {\n var _this = this;\n var moduleAliases = {};\n var imports = [];\n var newSource = lang_1.StringWrapper.replaceAllMapped(this.sourceWithModuleRefs, MODULE_REGEXP, function(match) {\n var moduleUrl = match[1];\n var alias = moduleAliases[moduleUrl];\n if (lang_1.isBlank(alias)) {\n if (moduleUrl == _this.moduleUrl) {\n alias = '';\n } else {\n alias = \"import\" + imports.length;\n imports.push([moduleUrl, alias]);\n }\n moduleAliases[moduleUrl] = alias;\n }\n return alias.length > 0 ? alias + \".\" : '';\n });\n return new SourceWithImports(newSource, imports);\n };\n return SourceModule;\n})();\nexports.SourceModule = SourceModule;\nvar SourceExpression = (function() {\n function SourceExpression(declarations, expression) {\n this.declarations = declarations;\n this.expression = expression;\n }\n return SourceExpression;\n})();\nexports.SourceExpression = SourceExpression;\nvar SourceExpressions = (function() {\n function SourceExpressions(declarations, expressions) {\n this.declarations = declarations;\n this.expressions = expressions;\n }\n return SourceExpressions;\n})();\nexports.SourceExpressions = SourceExpressions;\nvar SourceWithImports = (function() {\n function SourceWithImports(source, imports) {\n this.source = source;\n this.imports = imports;\n }\n return SourceWithImports;\n})();\nexports.SourceWithImports = SourceWithImports;\n","/* */ \n'use strict';\nvar lang_1 = require('../facade/lang');\nvar CAMEL_CASE_REGEXP = /([A-Z])/g;\nvar DASH_CASE_REGEXP = /-([a-z])/g;\nvar SINGLE_QUOTE_ESCAPE_STRING_RE = /'|\\\\|\\n|\\r|\\$/g;\nvar DOUBLE_QUOTE_ESCAPE_STRING_RE = /\"|\\\\|\\n|\\r|\\$/g;\nexports.MODULE_SUFFIX = lang_1.IS_DART ? '.dart' : '.js';\nexports.CONST_VAR = lang_1.IS_DART ? 'const' : 'var';\nfunction camelCaseToDashCase(input) {\n return lang_1.StringWrapper.replaceAllMapped(input, CAMEL_CASE_REGEXP, function(m) {\n return '-' + m[1].toLowerCase();\n });\n}\nexports.camelCaseToDashCase = camelCaseToDashCase;\nfunction dashCaseToCamelCase(input) {\n return lang_1.StringWrapper.replaceAllMapped(input, DASH_CASE_REGEXP, function(m) {\n return m[1].toUpperCase();\n });\n}\nexports.dashCaseToCamelCase = dashCaseToCamelCase;\nfunction escapeSingleQuoteString(input) {\n if (lang_1.isBlank(input)) {\n return null;\n }\n return \"'\" + escapeString(input, SINGLE_QUOTE_ESCAPE_STRING_RE) + \"'\";\n}\nexports.escapeSingleQuoteString = escapeSingleQuoteString;\nfunction escapeDoubleQuoteString(input) {\n if (lang_1.isBlank(input)) {\n return null;\n }\n return \"\\\"\" + escapeString(input, DOUBLE_QUOTE_ESCAPE_STRING_RE) + \"\\\"\";\n}\nexports.escapeDoubleQuoteString = escapeDoubleQuoteString;\nfunction escapeString(input, re) {\n return lang_1.StringWrapper.replaceAllMapped(input, re, function(match) {\n if (match[0] == '$') {\n return lang_1.IS_DART ? '\\\\$' : '$';\n } else if (match[0] == '\\n') {\n return '\\\\n';\n } else if (match[0] == '\\r') {\n return '\\\\r';\n } else {\n return \"\\\\\" + match[0];\n }\n });\n}\nfunction codeGenExportVariable(name) {\n if (lang_1.IS_DART) {\n return \"const \" + name + \" = \";\n } else {\n return \"var \" + name + \" = exports['\" + name + \"'] = \";\n }\n}\nexports.codeGenExportVariable = codeGenExportVariable;\nfunction codeGenConstConstructorCall(name) {\n if (lang_1.IS_DART) {\n return \"const \" + name;\n } else {\n return \"new \" + name;\n }\n}\nexports.codeGenConstConstructorCall = codeGenConstConstructorCall;\nfunction codeGenValueFn(params, value, fnName) {\n if (fnName === void 0) {\n fnName = '';\n }\n if (lang_1.IS_DART) {\n return codeGenFnHeader(params, fnName) + \" => \" + value;\n } else {\n return codeGenFnHeader(params, fnName) + \" { return \" + value + \"; }\";\n }\n}\nexports.codeGenValueFn = codeGenValueFn;\nfunction codeGenFnHeader(params, fnName) {\n if (fnName === void 0) {\n fnName = '';\n }\n if (lang_1.IS_DART) {\n return fnName + \"(\" + params.join(',') + \")\";\n } else {\n return \"function \" + fnName + \"(\" + params.join(',') + \")\";\n }\n}\nexports.codeGenFnHeader = codeGenFnHeader;\nfunction codeGenToString(expr) {\n if (lang_1.IS_DART) {\n return \"'${\" + expr + \"}'\";\n } else {\n return expr;\n }\n}\nexports.codeGenToString = codeGenToString;\nfunction splitAtColon(input, defaultValues) {\n var parts = lang_1.StringWrapper.split(input.trim(), /\\s*:\\s*/g);\n if (parts.length > 1) {\n return parts;\n } else {\n return defaultValues;\n }\n}\nexports.splitAtColon = splitAtColon;\nvar Statement = (function() {\n function Statement(statement) {\n this.statement = statement;\n }\n return Statement;\n})();\nexports.Statement = Statement;\nvar Expression = (function() {\n function Expression(expression, isArray) {\n if (isArray === void 0) {\n isArray = false;\n }\n this.expression = expression;\n this.isArray = isArray;\n }\n return Expression;\n})();\nexports.Expression = Expression;\nfunction escapeValue(value) {\n if (value instanceof Expression) {\n return value.expression;\n } else if (lang_1.isString(value)) {\n return escapeSingleQuoteString(value);\n } else if (lang_1.isBlank(value)) {\n return 'null';\n } else {\n return \"\" + value;\n }\n}\nexports.escapeValue = escapeValue;\nfunction codeGenArray(data) {\n return \"[\" + data.map(escapeValue).join(',') + \"]\";\n}\nexports.codeGenArray = codeGenArray;\nfunction codeGenFlatArray(values) {\n var result = '([';\n var isFirstArrayEntry = true;\n var concatFn = lang_1.IS_DART ? '.addAll' : 'concat';\n for (var i = 0; i < values.length; i++) {\n var value = values[i];\n if (value instanceof Expression && value.isArray) {\n result += \"]).\" + concatFn + \"(\" + value.expression + \").\" + concatFn + \"([\";\n isFirstArrayEntry = true;\n } else {\n if (!isFirstArrayEntry) {\n result += ',';\n }\n isFirstArrayEntry = false;\n result += escapeValue(value);\n }\n }\n result += '])';\n return result;\n}\nexports.codeGenFlatArray = codeGenFlatArray;\nfunction codeGenStringMap(keyValueArray) {\n return \"{\" + keyValueArray.map(codeGenKeyValue).join(',') + \"}\";\n}\nexports.codeGenStringMap = codeGenStringMap;\nfunction codeGenKeyValue(keyValue) {\n return escapeValue(keyValue[0]) + \":\" + escapeValue(keyValue[1]);\n}\nfunction addAll(source, target) {\n for (var i = 0; i < source.length; i++) {\n target.push(source[i]);\n }\n}\nexports.addAll = addAll;\nfunction flattenArray(source, target) {\n if (lang_1.isPresent(source)) {\n for (var i = 0; i < source.length; i++) {\n var item = source[i];\n if (lang_1.isArray(item)) {\n flattenArray(item, target);\n } else {\n target.push(item);\n }\n }\n }\n return target;\n}\nexports.flattenArray = flattenArray;\n","/* */ \n'use strict';\nvar __extends = (this && this.__extends) || function(d, b) {\n for (var p in b)\n if (b.hasOwnProperty(p))\n d[p] = b[p];\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function(k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(k, v);\n};\nvar lang_1 = require('../facade/lang');\nvar collection_1 = require('../facade/collection');\nvar template_ast_1 = require('./template_ast');\nvar source_module_1 = require('./source_module');\nvar view_1 = require('../core/linker/view');\nvar view_type_1 = require('../core/linker/view_type');\nvar element_1 = require('../core/linker/element');\nvar util_1 = require('./util');\nvar di_1 = require('../core/di');\nexports.PROTO_VIEW_JIT_IMPORTS = lang_1.CONST_EXPR({\n 'AppProtoView': view_1.AppProtoView,\n 'AppProtoElement': element_1.AppProtoElement,\n 'ViewType': view_type_1.ViewType\n});\nexports.APP_VIEW_MODULE_REF = source_module_1.moduleRef('package:angular2/src/core/linker/view' + util_1.MODULE_SUFFIX);\nexports.VIEW_TYPE_MODULE_REF = source_module_1.moduleRef('package:angular2/src/core/linker/view_type' + util_1.MODULE_SUFFIX);\nexports.APP_EL_MODULE_REF = source_module_1.moduleRef('package:angular2/src/core/linker/element' + util_1.MODULE_SUFFIX);\nexports.METADATA_MODULE_REF = source_module_1.moduleRef('package:angular2/src/core/metadata/view' + util_1.MODULE_SUFFIX);\nvar IMPLICIT_TEMPLATE_VAR = '\\$implicit';\nvar CLASS_ATTR = 'class';\nvar STYLE_ATTR = 'style';\nvar ProtoViewCompiler = (function() {\n function ProtoViewCompiler() {}\n ProtoViewCompiler.prototype.compileProtoViewRuntime = function(metadataCache, component, template, pipes) {\n var protoViewFactory = new RuntimeProtoViewFactory(metadataCache, component, pipes);\n var allProtoViews = [];\n protoViewFactory.createCompileProtoView(template, [], [], allProtoViews);\n return new CompileProtoViews([], allProtoViews);\n };\n ProtoViewCompiler.prototype.compileProtoViewCodeGen = function(resolvedMetadataCacheExpr, component, template, pipes) {\n var protoViewFactory = new CodeGenProtoViewFactory(resolvedMetadataCacheExpr, component, pipes);\n var allProtoViews = [];\n var allStatements = [];\n protoViewFactory.createCompileProtoView(template, [], allStatements, allProtoViews);\n return new CompileProtoViews(allStatements.map(function(stmt) {\n return stmt.statement;\n }), allProtoViews);\n };\n ProtoViewCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], ProtoViewCompiler);\n return ProtoViewCompiler;\n})();\nexports.ProtoViewCompiler = ProtoViewCompiler;\nvar CompileProtoViews = (function() {\n function CompileProtoViews(declarations, protoViews) {\n this.declarations = declarations;\n this.protoViews = protoViews;\n }\n return CompileProtoViews;\n})();\nexports.CompileProtoViews = CompileProtoViews;\nvar CompileProtoView = (function() {\n function CompileProtoView(embeddedTemplateIndex, protoElements, protoView) {\n this.embeddedTemplateIndex = embeddedTemplateIndex;\n this.protoElements = protoElements;\n this.protoView = protoView;\n }\n return CompileProtoView;\n})();\nexports.CompileProtoView = CompileProtoView;\nvar CompileProtoElement = (function() {\n function CompileProtoElement(boundElementIndex, attrNameAndValues, variableNameAndValues, renderEvents, directives, embeddedTemplateIndex, appProtoEl) {\n this.boundElementIndex = boundElementIndex;\n this.attrNameAndValues = attrNameAndValues;\n this.variableNameAndValues = variableNameAndValues;\n this.renderEvents = renderEvents;\n this.directives = directives;\n this.embeddedTemplateIndex = embeddedTemplateIndex;\n this.appProtoEl = appProtoEl;\n }\n return CompileProtoElement;\n})();\nexports.CompileProtoElement = CompileProtoElement;\nfunction visitAndReturnContext(visitor, asts, context) {\n template_ast_1.templateVisitAll(visitor, asts, context);\n return context;\n}\nvar ProtoViewFactory = (function() {\n function ProtoViewFactory(component) {\n this.component = component;\n }\n ProtoViewFactory.prototype.createCompileProtoView = function(template, templateVariableBindings, targetStatements, targetProtoViews) {\n var embeddedTemplateIndex = targetProtoViews.length;\n targetProtoViews.push(null);\n var builder = new ProtoViewBuilderVisitor(this, targetStatements, targetProtoViews);\n template_ast_1.templateVisitAll(builder, template);\n var viewType = getViewType(this.component, embeddedTemplateIndex);\n var appProtoView = this.createAppProtoView(embeddedTemplateIndex, viewType, templateVariableBindings, targetStatements);\n var cpv = new CompileProtoView(embeddedTemplateIndex, builder.protoElements, appProtoView);\n targetProtoViews[embeddedTemplateIndex] = cpv;\n return cpv;\n };\n return ProtoViewFactory;\n})();\nvar CodeGenProtoViewFactory = (function(_super) {\n __extends(CodeGenProtoViewFactory, _super);\n function CodeGenProtoViewFactory(resolvedMetadataCacheExpr, component, pipes) {\n _super.call(this, component);\n this.resolvedMetadataCacheExpr = resolvedMetadataCacheExpr;\n this.pipes = pipes;\n this._nextVarId = 0;\n }\n CodeGenProtoViewFactory.prototype._nextProtoViewVar = function(embeddedTemplateIndex) {\n return \"appProtoView\" + this._nextVarId++ + \"_\" + this.component.type.name + embeddedTemplateIndex;\n };\n CodeGenProtoViewFactory.prototype.createAppProtoView = function(embeddedTemplateIndex, viewType, templateVariableBindings, targetStatements) {\n var protoViewVarName = this._nextProtoViewVar(embeddedTemplateIndex);\n var viewTypeExpr = codeGenViewType(viewType);\n var pipesExpr = embeddedTemplateIndex === 0 ? codeGenTypesArray(this.pipes.map(function(pipeMeta) {\n return pipeMeta.type;\n })) : null;\n var statement = \"var \" + protoViewVarName + \" = \" + exports.APP_VIEW_MODULE_REF + \"AppProtoView.create(\" + this.resolvedMetadataCacheExpr.expression + \", \" + viewTypeExpr + \", \" + pipesExpr + \", \" + util_1.codeGenStringMap(templateVariableBindings) + \");\";\n targetStatements.push(new util_1.Statement(statement));\n return new util_1.Expression(protoViewVarName);\n };\n CodeGenProtoViewFactory.prototype.createAppProtoElement = function(boundElementIndex, attrNameAndValues, variableNameAndValues, directives, targetStatements) {\n var varName = \"appProtoEl\" + this._nextVarId++ + \"_\" + this.component.type.name;\n var value = exports.APP_EL_MODULE_REF + \"AppProtoElement.create(\\n \" + this.resolvedMetadataCacheExpr.expression + \",\\n \" + boundElementIndex + \",\\n \" + util_1.codeGenStringMap(attrNameAndValues) + \",\\n \" + codeGenDirectivesArray(directives) + \",\\n \" + util_1.codeGenStringMap(variableNameAndValues) + \"\\n )\";\n var statement = \"var \" + varName + \" = \" + value + \";\";\n targetStatements.push(new util_1.Statement(statement));\n return new util_1.Expression(varName);\n };\n return CodeGenProtoViewFactory;\n})(ProtoViewFactory);\nvar RuntimeProtoViewFactory = (function(_super) {\n __extends(RuntimeProtoViewFactory, _super);\n function RuntimeProtoViewFactory(metadataCache, component, pipes) {\n _super.call(this, component);\n this.metadataCache = metadataCache;\n this.pipes = pipes;\n }\n RuntimeProtoViewFactory.prototype.createAppProtoView = function(embeddedTemplateIndex, viewType, templateVariableBindings, targetStatements) {\n var pipes = embeddedTemplateIndex === 0 ? this.pipes.map(function(pipeMeta) {\n return pipeMeta.type.runtime;\n }) : [];\n var templateVars = keyValueArrayToStringMap(templateVariableBindings);\n return view_1.AppProtoView.create(this.metadataCache, viewType, pipes, templateVars);\n };\n RuntimeProtoViewFactory.prototype.createAppProtoElement = function(boundElementIndex, attrNameAndValues, variableNameAndValues, directives, targetStatements) {\n var attrs = keyValueArrayToStringMap(attrNameAndValues);\n return element_1.AppProtoElement.create(this.metadataCache, boundElementIndex, attrs, directives.map(function(dirMeta) {\n return dirMeta.type.runtime;\n }), keyValueArrayToStringMap(variableNameAndValues));\n };\n return RuntimeProtoViewFactory;\n})(ProtoViewFactory);\nvar ProtoViewBuilderVisitor = (function() {\n function ProtoViewBuilderVisitor(factory, allStatements, allProtoViews) {\n this.factory = factory;\n this.allStatements = allStatements;\n this.allProtoViews = allProtoViews;\n this.protoElements = [];\n this.boundElementCount = 0;\n }\n ProtoViewBuilderVisitor.prototype._readAttrNameAndValues = function(directives, attrAsts) {\n var attrs = visitAndReturnContext(this, attrAsts, {});\n directives.forEach(function(directiveMeta) {\n collection_1.StringMapWrapper.forEach(directiveMeta.hostAttributes, function(value, name) {\n var prevValue = attrs[name];\n attrs[name] = lang_1.isPresent(prevValue) ? mergeAttributeValue(name, prevValue, value) : value;\n });\n });\n return mapToKeyValueArray(attrs);\n };\n ProtoViewBuilderVisitor.prototype.visitBoundText = function(ast, context) {\n return null;\n };\n ProtoViewBuilderVisitor.prototype.visitText = function(ast, context) {\n return null;\n };\n ProtoViewBuilderVisitor.prototype.visitNgContent = function(ast, context) {\n return null;\n };\n ProtoViewBuilderVisitor.prototype.visitElement = function(ast, context) {\n var _this = this;\n var boundElementIndex = null;\n if (ast.isBound()) {\n boundElementIndex = this.boundElementCount++;\n }\n var component = ast.getComponent();\n var variableNameAndValues = [];\n if (lang_1.isBlank(component)) {\n ast.exportAsVars.forEach(function(varAst) {\n variableNameAndValues.push([varAst.name, null]);\n });\n }\n var directives = [];\n var renderEvents = visitAndReturnContext(this, ast.outputs, new Map());\n collection_1.ListWrapper.forEachWithIndex(ast.directives, function(directiveAst, index) {\n directiveAst.visit(_this, new DirectiveContext(index, boundElementIndex, renderEvents, variableNameAndValues, directives));\n });\n var renderEventArray = [];\n renderEvents.forEach(function(eventAst, _) {\n return renderEventArray.push(eventAst);\n });\n var attrNameAndValues = this._readAttrNameAndValues(directives, ast.attrs);\n this._addProtoElement(ast.isBound(), boundElementIndex, attrNameAndValues, variableNameAndValues, renderEventArray, directives, null);\n template_ast_1.templateVisitAll(this, ast.children);\n return null;\n };\n ProtoViewBuilderVisitor.prototype.visitEmbeddedTemplate = function(ast, context) {\n var _this = this;\n var boundElementIndex = this.boundElementCount++;\n var directives = [];\n collection_1.ListWrapper.forEachWithIndex(ast.directives, function(directiveAst, index) {\n directiveAst.visit(_this, new DirectiveContext(index, boundElementIndex, new Map(), [], directives));\n });\n var attrNameAndValues = this._readAttrNameAndValues(directives, ast.attrs);\n var templateVariableBindings = ast.vars.map(function(varAst) {\n return [varAst.value.length > 0 ? varAst.value : IMPLICIT_TEMPLATE_VAR, varAst.name];\n });\n var nestedProtoView = this.factory.createCompileProtoView(ast.children, templateVariableBindings, this.allStatements, this.allProtoViews);\n this._addProtoElement(true, boundElementIndex, attrNameAndValues, [], [], directives, nestedProtoView.embeddedTemplateIndex);\n return null;\n };\n ProtoViewBuilderVisitor.prototype._addProtoElement = function(isBound, boundElementIndex, attrNameAndValues, variableNameAndValues, renderEvents, directives, embeddedTemplateIndex) {\n var appProtoEl = null;\n if (isBound) {\n appProtoEl = this.factory.createAppProtoElement(boundElementIndex, attrNameAndValues, variableNameAndValues, directives, this.allStatements);\n }\n var compileProtoEl = new CompileProtoElement(boundElementIndex, attrNameAndValues, variableNameAndValues, renderEvents, directives, embeddedTemplateIndex, appProtoEl);\n this.protoElements.push(compileProtoEl);\n };\n ProtoViewBuilderVisitor.prototype.visitVariable = function(ast, ctx) {\n return null;\n };\n ProtoViewBuilderVisitor.prototype.visitAttr = function(ast, attrNameAndValues) {\n attrNameAndValues[ast.name] = ast.value;\n return null;\n };\n ProtoViewBuilderVisitor.prototype.visitDirective = function(ast, ctx) {\n ctx.targetDirectives.push(ast.directive);\n template_ast_1.templateVisitAll(this, ast.hostEvents, ctx.hostEventTargetAndNames);\n ast.exportAsVars.forEach(function(varAst) {\n ctx.targetVariableNameAndValues.push([varAst.name, ctx.index]);\n });\n return null;\n };\n ProtoViewBuilderVisitor.prototype.visitEvent = function(ast, eventTargetAndNames) {\n eventTargetAndNames.set(ast.fullName, ast);\n return null;\n };\n ProtoViewBuilderVisitor.prototype.visitDirectiveProperty = function(ast, context) {\n return null;\n };\n ProtoViewBuilderVisitor.prototype.visitElementProperty = function(ast, context) {\n return null;\n };\n return ProtoViewBuilderVisitor;\n})();\nfunction mapToKeyValueArray(data) {\n var entryArray = [];\n collection_1.StringMapWrapper.forEach(data, function(value, name) {\n entryArray.push([name, value]);\n });\n collection_1.ListWrapper.sort(entryArray, function(entry1, entry2) {\n return lang_1.StringWrapper.compare(entry1[0], entry2[0]);\n });\n var keyValueArray = [];\n entryArray.forEach(function(entry) {\n keyValueArray.push([entry[0], entry[1]]);\n });\n return keyValueArray;\n}\nfunction mergeAttributeValue(attrName, attrValue1, attrValue2) {\n if (attrName == CLASS_ATTR || attrName == STYLE_ATTR) {\n return attrValue1 + \" \" + attrValue2;\n } else {\n return attrValue2;\n }\n}\nvar DirectiveContext = (function() {\n function DirectiveContext(index, boundElementIndex, hostEventTargetAndNames, targetVariableNameAndValues, targetDirectives) {\n this.index = index;\n this.boundElementIndex = boundElementIndex;\n this.hostEventTargetAndNames = hostEventTargetAndNames;\n this.targetVariableNameAndValues = targetVariableNameAndValues;\n this.targetDirectives = targetDirectives;\n }\n return DirectiveContext;\n})();\nfunction keyValueArrayToStringMap(keyValueArray) {\n var stringMap = {};\n for (var i = 0; i < keyValueArray.length; i++) {\n var entry = keyValueArray[i];\n stringMap[entry[0]] = entry[1];\n }\n return stringMap;\n}\nfunction codeGenDirectivesArray(directives) {\n var expressions = directives.map(function(directiveType) {\n return typeRef(directiveType.type);\n });\n return \"[\" + expressions.join(',') + \"]\";\n}\nfunction codeGenTypesArray(types) {\n var expressions = types.map(typeRef);\n return \"[\" + expressions.join(',') + \"]\";\n}\nfunction codeGenViewType(value) {\n if (lang_1.IS_DART) {\n return \"\" + exports.VIEW_TYPE_MODULE_REF + value;\n } else {\n return \"\" + value;\n }\n}\nfunction typeRef(type) {\n return \"\" + source_module_1.moduleRef(type.moduleUrl) + type.name;\n}\nfunction getViewType(component, embeddedTemplateIndex) {\n if (embeddedTemplateIndex > 0) {\n return view_type_1.ViewType.EMBEDDED;\n } else if (component.type.isHost) {\n return view_type_1.ViewType.HOST;\n } else {\n return view_type_1.ViewType.COMPONENT;\n }\n}\n","/* */ \n'use strict';\nvar lang_1 = require('../../facade/lang');\nexports.DOM = null;\nfunction setRootDomAdapter(adapter) {\n if (lang_1.isBlank(exports.DOM)) {\n exports.DOM = adapter;\n }\n}\nexports.setRootDomAdapter = setRootDomAdapter;\nvar DomAdapter = (function() {\n function DomAdapter() {}\n Object.defineProperty(DomAdapter.prototype, \"attrToPropMap\", {\n get: function() {\n return this._attrToPropMap;\n },\n set: function(value) {\n this._attrToPropMap = value;\n },\n enumerable: true,\n configurable: true\n });\n ;\n ;\n return DomAdapter;\n})();\nexports.DomAdapter = DomAdapter;\n","/* */ \n'use strict';\nvar lang_1 = require('../facade/lang');\nexports.NAMED_ENTITIES = lang_1.CONST_EXPR({\n 'Aacute': '\\u00C1',\n 'aacute': '\\u00E1',\n 'Acirc': '\\u00C2',\n 'acirc': '\\u00E2',\n 'acute': '\\u00B4',\n 'AElig': '\\u00C6',\n 'aelig': '\\u00E6',\n 'Agrave': '\\u00C0',\n 'agrave': '\\u00E0',\n 'alefsym': '\\u2135',\n 'Alpha': '\\u0391',\n 'alpha': '\\u03B1',\n 'amp': '&',\n 'and': '\\u2227',\n 'ang': '\\u2220',\n 'apos': '\\u0027',\n 'Aring': '\\u00C5',\n 'aring': '\\u00E5',\n 'asymp': '\\u2248',\n 'Atilde': '\\u00C3',\n 'atilde': '\\u00E3',\n 'Auml': '\\u00C4',\n 'auml': '\\u00E4',\n 'bdquo': '\\u201E',\n 'Beta': '\\u0392',\n 'beta': '\\u03B2',\n 'brvbar': '\\u00A6',\n 'bull': '\\u2022',\n 'cap': '\\u2229',\n 'Ccedil': '\\u00C7',\n 'ccedil': '\\u00E7',\n 'cedil': '\\u00B8',\n 'cent': '\\u00A2',\n 'Chi': '\\u03A7',\n 'chi': '\\u03C7',\n 'circ': '\\u02C6',\n 'clubs': '\\u2663',\n 'cong': '\\u2245',\n 'copy': '\\u00A9',\n 'crarr': '\\u21B5',\n 'cup': '\\u222A',\n 'curren': '\\u00A4',\n 'dagger': '\\u2020',\n 'Dagger': '\\u2021',\n 'darr': '\\u2193',\n 'dArr': '\\u21D3',\n 'deg': '\\u00B0',\n 'Delta': '\\u0394',\n 'delta': '\\u03B4',\n 'diams': '\\u2666',\n 'divide': '\\u00F7',\n 'Eacute': '\\u00C9',\n 'eacute': '\\u00E9',\n 'Ecirc': '\\u00CA',\n 'ecirc': '\\u00EA',\n 'Egrave': '\\u00C8',\n 'egrave': '\\u00E8',\n 'empty': '\\u2205',\n 'emsp': '\\u2003',\n 'ensp': '\\u2002',\n 'Epsilon': '\\u0395',\n 'epsilon': '\\u03B5',\n 'equiv': '\\u2261',\n 'Eta': '\\u0397',\n 'eta': '\\u03B7',\n 'ETH': '\\u00D0',\n 'eth': '\\u00F0',\n 'Euml': '\\u00CB',\n 'euml': '\\u00EB',\n 'euro': '\\u20AC',\n 'exist': '\\u2203',\n 'fnof': '\\u0192',\n 'forall': '\\u2200',\n 'frac12': '\\u00BD',\n 'frac14': '\\u00BC',\n 'frac34': '\\u00BE',\n 'frasl': '\\u2044',\n 'Gamma': '\\u0393',\n 'gamma': '\\u03B3',\n 'ge': '\\u2265',\n 'gt': '>',\n 'harr': '\\u2194',\n 'hArr': '\\u21D4',\n 'hearts': '\\u2665',\n 'hellip': '\\u2026',\n 'Iacute': '\\u00CD',\n 'iacute': '\\u00ED',\n 'Icirc': '\\u00CE',\n 'icirc': '\\u00EE',\n 'iexcl': '\\u00A1',\n 'Igrave': '\\u00CC',\n 'igrave': '\\u00EC',\n 'image': '\\u2111',\n 'infin': '\\u221E',\n 'int': '\\u222B',\n 'Iota': '\\u0399',\n 'iota': '\\u03B9',\n 'iquest': '\\u00BF',\n 'isin': '\\u2208',\n 'Iuml': '\\u00CF',\n 'iuml': '\\u00EF',\n 'Kappa': '\\u039A',\n 'kappa': '\\u03BA',\n 'Lambda': '\\u039B',\n 'lambda': '\\u03BB',\n 'lang': '\\u27E8',\n 'laquo': '\\u00AB',\n 'larr': '\\u2190',\n 'lArr': '\\u21D0',\n 'lceil': '\\u2308',\n 'ldquo': '\\u201C',\n 'le': '\\u2264',\n 'lfloor': '\\u230A',\n 'lowast': '\\u2217',\n 'loz': '\\u25CA',\n 'lrm': '\\u200E',\n 'lsaquo': '\\u2039',\n 'lsquo': '\\u2018',\n 'lt': '<',\n 'macr': '\\u00AF',\n 'mdash': '\\u2014',\n 'micro': '\\u00B5',\n 'middot': '\\u00B7',\n 'minus': '\\u2212',\n 'Mu': '\\u039C',\n 'mu': '\\u03BC',\n 'nabla': '\\u2207',\n 'nbsp': '\\u00A0',\n 'ndash': '\\u2013',\n 'ne': '\\u2260',\n 'ni': '\\u220B',\n 'not': '\\u00AC',\n 'notin': '\\u2209',\n 'nsub': '\\u2284',\n 'Ntilde': '\\u00D1',\n 'ntilde': '\\u00F1',\n 'Nu': '\\u039D',\n 'nu': '\\u03BD',\n 'Oacute': '\\u00D3',\n 'oacute': '\\u00F3',\n 'Ocirc': '\\u00D4',\n 'ocirc': '\\u00F4',\n 'OElig': '\\u0152',\n 'oelig': '\\u0153',\n 'Ograve': '\\u00D2',\n 'ograve': '\\u00F2',\n 'oline': '\\u203E',\n 'Omega': '\\u03A9',\n 'omega': '\\u03C9',\n 'Omicron': '\\u039F',\n 'omicron': '\\u03BF',\n 'oplus': '\\u2295',\n 'or': '\\u2228',\n 'ordf': '\\u00AA',\n 'ordm': '\\u00BA',\n 'Oslash': '\\u00D8',\n 'oslash': '\\u00F8',\n 'Otilde': '\\u00D5',\n 'otilde': '\\u00F5',\n 'otimes': '\\u2297',\n 'Ouml': '\\u00D6',\n 'ouml': '\\u00F6',\n 'para': '\\u00B6',\n 'permil': '\\u2030',\n 'perp': '\\u22A5',\n 'Phi': '\\u03A6',\n 'phi': '\\u03C6',\n 'Pi': '\\u03A0',\n 'pi': '\\u03C0',\n 'piv': '\\u03D6',\n 'plusmn': '\\u00B1',\n 'pound': '\\u00A3',\n 'prime': '\\u2032',\n 'Prime': '\\u2033',\n 'prod': '\\u220F',\n 'prop': '\\u221D',\n 'Psi': '\\u03A8',\n 'psi': '\\u03C8',\n 'quot': '\\u0022',\n 'radic': '\\u221A',\n 'rang': '\\u27E9',\n 'raquo': '\\u00BB',\n 'rarr': '\\u2192',\n 'rArr': '\\u21D2',\n 'rceil': '\\u2309',\n 'rdquo': '\\u201D',\n 'real': '\\u211C',\n 'reg': '\\u00AE',\n 'rfloor': '\\u230B',\n 'Rho': '\\u03A1',\n 'rho': '\\u03C1',\n 'rlm': '\\u200F',\n 'rsaquo': '\\u203A',\n 'rsquo': '\\u2019',\n 'sbquo': '\\u201A',\n 'Scaron': '\\u0160',\n 'scaron': '\\u0161',\n 'sdot': '\\u22C5',\n 'sect': '\\u00A7',\n 'shy': '\\u00AD',\n 'Sigma': '\\u03A3',\n 'sigma': '\\u03C3',\n 'sigmaf': '\\u03C2',\n 'sim': '\\u223C',\n 'spades': '\\u2660',\n 'sub': '\\u2282',\n 'sube': '\\u2286',\n 'sum': '\\u2211',\n 'sup': '\\u2283',\n 'sup1': '\\u00B9',\n 'sup2': '\\u00B2',\n 'sup3': '\\u00B3',\n 'supe': '\\u2287',\n 'szlig': '\\u00DF',\n 'Tau': '\\u03A4',\n 'tau': '\\u03C4',\n 'there4': '\\u2234',\n 'Theta': '\\u0398',\n 'theta': '\\u03B8',\n 'thetasym': '\\u03D1',\n 'thinsp': '\\u2009',\n 'THORN': '\\u00DE',\n 'thorn': '\\u00FE',\n 'tilde': '\\u02DC',\n 'times': '\\u00D7',\n 'trade': '\\u2122',\n 'Uacute': '\\u00DA',\n 'uacute': '\\u00FA',\n 'uarr': '\\u2191',\n 'uArr': '\\u21D1',\n 'Ucirc': '\\u00DB',\n 'ucirc': '\\u00FB',\n 'Ugrave': '\\u00D9',\n 'ugrave': '\\u00F9',\n 'uml': '\\u00A8',\n 'upsih': '\\u03D2',\n 'Upsilon': '\\u03A5',\n 'upsilon': '\\u03C5',\n 'Uuml': '\\u00DC',\n 'uuml': '\\u00FC',\n 'weierp': '\\u2118',\n 'Xi': '\\u039E',\n 'xi': '\\u03BE',\n 'Yacute': '\\u00DD',\n 'yacute': '\\u00FD',\n 'yen': '\\u00A5',\n 'yuml': '\\u00FF',\n 'Yuml': '\\u0178',\n 'Zeta': '\\u0396',\n 'zeta': '\\u03B6',\n 'zwj': '\\u200D',\n 'zwnj': '\\u200C'\n});\n(function(HtmlTagContentType) {\n HtmlTagContentType[HtmlTagContentType[\"RAW_TEXT\"] = 0] = \"RAW_TEXT\";\n HtmlTagContentType[HtmlTagContentType[\"ESCAPABLE_RAW_TEXT\"] = 1] = \"ESCAPABLE_RAW_TEXT\";\n HtmlTagContentType[HtmlTagContentType[\"PARSABLE_DATA\"] = 2] = \"PARSABLE_DATA\";\n})(exports.HtmlTagContentType || (exports.HtmlTagContentType = {}));\nvar HtmlTagContentType = exports.HtmlTagContentType;\nvar HtmlTagDefinition = (function() {\n function HtmlTagDefinition(_a) {\n var _this = this;\n var _b = _a === void 0 ? {} : _a,\n closedByChildren = _b.closedByChildren,\n requiredParents = _b.requiredParents,\n implicitNamespacePrefix = _b.implicitNamespacePrefix,\n contentType = _b.contentType,\n closedByParent = _b.closedByParent,\n isVoid = _b.isVoid,\n ignoreFirstLf = _b.ignoreFirstLf;\n this.closedByChildren = {};\n this.closedByParent = false;\n if (lang_1.isPresent(closedByChildren) && closedByChildren.length > 0) {\n closedByChildren.forEach(function(tagName) {\n return _this.closedByChildren[tagName] = true;\n });\n }\n this.isVoid = lang_1.normalizeBool(isVoid);\n this.closedByParent = lang_1.normalizeBool(closedByParent) || this.isVoid;\n if (lang_1.isPresent(requiredParents) && requiredParents.length > 0) {\n this.requiredParents = {};\n this.parentToAdd = requiredParents[0];\n requiredParents.forEach(function(tagName) {\n return _this.requiredParents[tagName] = true;\n });\n }\n this.implicitNamespacePrefix = implicitNamespacePrefix;\n this.contentType = lang_1.isPresent(contentType) ? contentType : HtmlTagContentType.PARSABLE_DATA;\n this.ignoreFirstLf = lang_1.normalizeBool(ignoreFirstLf);\n }\n HtmlTagDefinition.prototype.requireExtraParent = function(currentParent) {\n if (lang_1.isBlank(this.requiredParents)) {\n return false;\n }\n if (lang_1.isBlank(currentParent)) {\n return true;\n }\n var lcParent = currentParent.toLowerCase();\n return this.requiredParents[lcParent] != true && lcParent != 'template';\n };\n HtmlTagDefinition.prototype.isClosedByChild = function(name) {\n return this.isVoid || lang_1.normalizeBool(this.closedByChildren[name.toLowerCase()]);\n };\n return HtmlTagDefinition;\n})();\nexports.HtmlTagDefinition = HtmlTagDefinition;\nvar TAG_DEFINITIONS = {\n 'area': new HtmlTagDefinition({isVoid: true}),\n 'embed': new HtmlTagDefinition({isVoid: true}),\n 'link': new HtmlTagDefinition({isVoid: true}),\n 'img': new HtmlTagDefinition({isVoid: true}),\n 'input': new HtmlTagDefinition({isVoid: true}),\n 'param': new HtmlTagDefinition({isVoid: true}),\n 'hr': new HtmlTagDefinition({isVoid: true}),\n 'br': new HtmlTagDefinition({isVoid: true}),\n 'source': new HtmlTagDefinition({isVoid: true}),\n 'track': new HtmlTagDefinition({isVoid: true}),\n 'wbr': new HtmlTagDefinition({isVoid: true}),\n 'p': new HtmlTagDefinition({\n closedByChildren: ['address', 'article', 'aside', 'blockquote', 'div', 'dl', 'fieldset', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'main', 'nav', 'ol', 'p', 'pre', 'section', 'table', 'ul'],\n closedByParent: true\n }),\n 'thead': new HtmlTagDefinition({closedByChildren: ['tbody', 'tfoot']}),\n 'tbody': new HtmlTagDefinition({\n closedByChildren: ['tbody', 'tfoot'],\n closedByParent: true\n }),\n 'tfoot': new HtmlTagDefinition({\n closedByChildren: ['tbody'],\n closedByParent: true\n }),\n 'tr': new HtmlTagDefinition({\n closedByChildren: ['tr'],\n requiredParents: ['tbody', 'tfoot', 'thead'],\n closedByParent: true\n }),\n 'td': new HtmlTagDefinition({\n closedByChildren: ['td', 'th'],\n closedByParent: true\n }),\n 'th': new HtmlTagDefinition({\n closedByChildren: ['td', 'th'],\n closedByParent: true\n }),\n 'col': new HtmlTagDefinition({\n requiredParents: ['colgroup'],\n isVoid: true\n }),\n 'svg': new HtmlTagDefinition({implicitNamespacePrefix: 'svg'}),\n 'math': new HtmlTagDefinition({implicitNamespacePrefix: 'math'}),\n 'li': new HtmlTagDefinition({\n closedByChildren: ['li'],\n closedByParent: true\n }),\n 'dt': new HtmlTagDefinition({closedByChildren: ['dt', 'dd']}),\n 'dd': new HtmlTagDefinition({\n closedByChildren: ['dt', 'dd'],\n closedByParent: true\n }),\n 'rb': new HtmlTagDefinition({\n closedByChildren: ['rb', 'rt', 'rtc', 'rp'],\n closedByParent: true\n }),\n 'rt': new HtmlTagDefinition({\n closedByChildren: ['rb', 'rt', 'rtc', 'rp'],\n closedByParent: true\n }),\n 'rtc': new HtmlTagDefinition({\n closedByChildren: ['rb', 'rtc', 'rp'],\n closedByParent: true\n }),\n 'rp': new HtmlTagDefinition({\n closedByChildren: ['rb', 'rt', 'rtc', 'rp'],\n closedByParent: true\n }),\n 'optgroup': new HtmlTagDefinition({\n closedByChildren: ['optgroup'],\n closedByParent: true\n }),\n 'option': new HtmlTagDefinition({\n closedByChildren: ['option', 'optgroup'],\n closedByParent: true\n }),\n 'pre': new HtmlTagDefinition({ignoreFirstLf: true}),\n 'listing': new HtmlTagDefinition({ignoreFirstLf: true}),\n 'style': new HtmlTagDefinition({contentType: HtmlTagContentType.RAW_TEXT}),\n 'script': new HtmlTagDefinition({contentType: HtmlTagContentType.RAW_TEXT}),\n 'title': new HtmlTagDefinition({contentType: HtmlTagContentType.ESCAPABLE_RAW_TEXT}),\n 'textarea': new HtmlTagDefinition({\n contentType: HtmlTagContentType.ESCAPABLE_RAW_TEXT,\n ignoreFirstLf: true\n })\n};\nvar DEFAULT_TAG_DEFINITION = new HtmlTagDefinition();\nfunction getHtmlTagDefinition(tagName) {\n var result = TAG_DEFINITIONS[tagName.toLowerCase()];\n return lang_1.isPresent(result) ? result : DEFAULT_TAG_DEFINITION;\n}\nexports.getHtmlTagDefinition = getHtmlTagDefinition;\nvar NS_PREFIX_RE = /^@([^:]+):(.+)/g;\nfunction splitNsName(elementName) {\n if (elementName[0] != '@') {\n return [null, elementName];\n }\n var match = lang_1.RegExpWrapper.firstMatch(NS_PREFIX_RE, elementName);\n return [match[1], match[2]];\n}\nexports.splitNsName = splitNsName;\nfunction getNsPrefix(elementName) {\n return splitNsName(elementName)[0];\n}\nexports.getNsPrefix = getNsPrefix;\n","/* */ \n'use strict';var ElementSchemaRegistry = (function () {\r\n function ElementSchemaRegistry() {\r\n }\r\n ElementSchemaRegistry.prototype.hasProperty = function (tagName, propName) { return true; };\r\n ElementSchemaRegistry.prototype.getMappedPropName = function (propName) { return propName; };\r\n return ElementSchemaRegistry;\r\n})();\r\nexports.ElementSchemaRegistry = ElementSchemaRegistry;\r\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZWxlbWVudF9zY2hlbWFfcmVnaXN0cnkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJhbmd1bGFyMi9zcmMvY29tcGlsZXIvc2NoZW1hL2VsZW1lbnRfc2NoZW1hX3JlZ2lzdHJ5LnRzIl0sIm5hbWVzIjpbIkVsZW1lbnRTY2hlbWFSZWdpc3RyeSIsIkVsZW1lbnRTY2hlbWFSZWdpc3RyeS5jb25zdHJ1Y3RvciIsIkVsZW1lbnRTY2hlbWFSZWdpc3RyeS5oYXNQcm9wZXJ0eSIsIkVsZW1lbnRTY2hlbWFSZWdpc3RyeS5nZXRNYXBwZWRQcm9wTmFtZSJdLCJtYXBwaW5ncyI6IkFBQUE7SUFBQUE7SUFHQUMsQ0FBQ0E7SUFGQ0QsMkNBQVdBLEdBQVhBLFVBQVlBLE9BQWVBLEVBQUVBLFFBQWdCQSxJQUFhRSxNQUFNQSxDQUFDQSxJQUFJQSxDQUFDQSxDQUFDQSxDQUFDQTtJQUN4RUYsaURBQWlCQSxHQUFqQkEsVUFBa0JBLFFBQWdCQSxJQUFZRyxNQUFNQSxDQUFDQSxRQUFRQSxDQUFDQSxDQUFDQSxDQUFDQTtJQUNsRUgsNEJBQUNBO0FBQURBLENBQUNBLEFBSEQsSUFHQztBQUhZLDZCQUFxQix3QkFHakMsQ0FBQSIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjbGFzcyBFbGVtZW50U2NoZW1hUmVnaXN0cnkge1xuICBoYXNQcm9wZXJ0eSh0YWdOYW1lOiBzdHJpbmcsIHByb3BOYW1lOiBzdHJpbmcpOiBib29sZWFuIHsgcmV0dXJuIHRydWU7IH1cbiAgZ2V0TWFwcGVkUHJvcE5hbWUocHJvcE5hbWU6IHN0cmluZyk6IHN0cmluZyB7IHJldHVybiBwcm9wTmFtZTsgfVxufVxuIl19","/* */ \n'use strict';\nvar __extends = (this && this.__extends) || function(d, b) {\n for (var p in b)\n if (b.hasOwnProperty(p))\n d[p] = b[p];\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function(k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(k, v);\n};\nvar di_1 = require('../../core/di');\nvar lang_1 = require('../../facade/lang');\nvar collection_1 = require('../../facade/collection');\nvar dom_adapter_1 = require('../../platform/dom/dom_adapter');\nvar html_tags_1 = require('../html_tags');\nvar element_schema_registry_1 = require('./element_schema_registry');\nvar NAMESPACE_URIS = lang_1.CONST_EXPR({\n 'xlink': 'http://www.w3.org/1999/xlink',\n 'svg': 'http://www.w3.org/2000/svg'\n});\nvar DomElementSchemaRegistry = (function(_super) {\n __extends(DomElementSchemaRegistry, _super);\n function DomElementSchemaRegistry() {\n _super.apply(this, arguments);\n this._protoElements = new Map();\n }\n DomElementSchemaRegistry.prototype._getProtoElement = function(tagName) {\n var element = this._protoElements.get(tagName);\n if (lang_1.isBlank(element)) {\n var nsAndName = html_tags_1.splitNsName(tagName);\n element = lang_1.isPresent(nsAndName[0]) ? dom_adapter_1.DOM.createElementNS(NAMESPACE_URIS[nsAndName[0]], nsAndName[1]) : dom_adapter_1.DOM.createElement(nsAndName[1]);\n this._protoElements.set(tagName, element);\n }\n return element;\n };\n DomElementSchemaRegistry.prototype.hasProperty = function(tagName, propName) {\n if (tagName.indexOf('-') !== -1) {\n return true;\n } else {\n var elm = this._getProtoElement(tagName);\n return dom_adapter_1.DOM.hasProperty(elm, propName);\n }\n };\n DomElementSchemaRegistry.prototype.getMappedPropName = function(propName) {\n var mappedPropName = collection_1.StringMapWrapper.get(dom_adapter_1.DOM.attrToPropMap, propName);\n return lang_1.isPresent(mappedPropName) ? mappedPropName : propName;\n };\n DomElementSchemaRegistry = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], DomElementSchemaRegistry);\n return DomElementSchemaRegistry;\n})(element_schema_registry_1.ElementSchemaRegistry);\nexports.DomElementSchemaRegistry = DomElementSchemaRegistry;\n","/* */ \n'use strict';\nvar __decorate = (this && this.__decorate) || function(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function(k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(k, v);\n};\nvar __param = (this && this.__param) || function(paramIndex, decorator) {\n return function(target, key) {\n decorator(target, key, paramIndex);\n };\n};\nvar di_1 = require('../core/di');\nvar lang_1 = require('../facade/lang');\nvar application_tokens_1 = require('../core/application_tokens');\nvar di_2 = require('../core/di');\nfunction createWithoutPackagePrefix() {\n return new UrlResolver();\n}\nexports.createWithoutPackagePrefix = createWithoutPackagePrefix;\nexports.DEFAULT_PACKAGE_URL_PROVIDER = new di_2.Provider(application_tokens_1.PACKAGE_ROOT_URL, {useValue: \"/\"});\nvar UrlResolver = (function() {\n function UrlResolver(packagePrefix) {\n if (packagePrefix === void 0) {\n packagePrefix = null;\n }\n if (lang_1.isPresent(packagePrefix)) {\n this._packagePrefix = lang_1.StringWrapper.stripRight(packagePrefix, \"/\") + \"/\";\n }\n }\n UrlResolver.prototype.resolve = function(baseUrl, url) {\n var resolvedUrl = url;\n if (lang_1.isPresent(baseUrl) && baseUrl.length > 0) {\n resolvedUrl = _resolveUrl(baseUrl, resolvedUrl);\n }\n if (lang_1.isPresent(this._packagePrefix) && getUrlScheme(resolvedUrl) == \"package\") {\n resolvedUrl = resolvedUrl.replace(\"package:\", this._packagePrefix);\n }\n return resolvedUrl;\n };\n UrlResolver = __decorate([di_1.Injectable(), __param(0, di_1.Inject(application_tokens_1.PACKAGE_ROOT_URL)), __metadata('design:paramtypes', [String])], UrlResolver);\n return UrlResolver;\n})();\nexports.UrlResolver = UrlResolver;\nfunction getUrlScheme(url) {\n var match = _split(url);\n return (match && match[_ComponentIndex.Scheme]) || \"\";\n}\nexports.getUrlScheme = getUrlScheme;\nfunction _buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) {\n var out = [];\n if (lang_1.isPresent(opt_scheme)) {\n out.push(opt_scheme + ':');\n }\n if (lang_1.isPresent(opt_domain)) {\n out.push('//');\n if (lang_1.isPresent(opt_userInfo)) {\n out.push(opt_userInfo + '@');\n }\n out.push(opt_domain);\n if (lang_1.isPresent(opt_port)) {\n out.push(':' + opt_port);\n }\n }\n if (lang_1.isPresent(opt_path)) {\n out.push(opt_path);\n }\n if (lang_1.isPresent(opt_queryData)) {\n out.push('?' + opt_queryData);\n }\n if (lang_1.isPresent(opt_fragment)) {\n out.push('#' + opt_fragment);\n }\n return out.join('');\n}\nvar _splitRe = lang_1.RegExpWrapper.create('^' + '(?:' + '([^:/?#.]+)' + ':)?' + '(?://' + '(?:([^/?#]*)@)?' + '([\\\\w\\\\d\\\\-\\\\u0100-\\\\uffff.%]*)' + '(?::([0-9]+))?' + ')?' + '([^?#]+)?' + '(?:\\\\?([^#]*))?' + '(?:#(.*))?' + '$');\nvar _ComponentIndex;\n(function(_ComponentIndex) {\n _ComponentIndex[_ComponentIndex[\"Scheme\"] = 1] = \"Scheme\";\n _ComponentIndex[_ComponentIndex[\"UserInfo\"] = 2] = \"UserInfo\";\n _ComponentIndex[_ComponentIndex[\"Domain\"] = 3] = \"Domain\";\n _ComponentIndex[_ComponentIndex[\"Port\"] = 4] = \"Port\";\n _ComponentIndex[_ComponentIndex[\"Path\"] = 5] = \"Path\";\n _ComponentIndex[_ComponentIndex[\"QueryData\"] = 6] = \"QueryData\";\n _ComponentIndex[_ComponentIndex[\"Fragment\"] = 7] = \"Fragment\";\n})(_ComponentIndex || (_ComponentIndex = {}));\nfunction _split(uri) {\n return lang_1.RegExpWrapper.firstMatch(_splitRe, uri);\n}\nfunction _removeDotSegments(path) {\n if (path == '/')\n return '/';\n var leadingSlash = path[0] == '/' ? '/' : '';\n var trailingSlash = path[path.length - 1] === '/' ? '/' : '';\n var segments = path.split('/');\n var out = [];\n var up = 0;\n for (var pos = 0; pos < segments.length; pos++) {\n var segment = segments[pos];\n switch (segment) {\n case '':\n case '.':\n break;\n case '..':\n if (out.length > 0) {\n out.pop();\n } else {\n up++;\n }\n break;\n default:\n out.push(segment);\n }\n }\n if (leadingSlash == '') {\n while (up-- > 0) {\n out.unshift('..');\n }\n if (out.length === 0)\n out.push('.');\n }\n return leadingSlash + out.join('/') + trailingSlash;\n}\nfunction _joinAndCanonicalizePath(parts) {\n var path = parts[_ComponentIndex.Path];\n path = lang_1.isBlank(path) ? '' : _removeDotSegments(path);\n parts[_ComponentIndex.Path] = path;\n return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]);\n}\nfunction _resolveUrl(base, url) {\n var parts = _split(encodeURI(url));\n var baseParts = _split(base);\n if (lang_1.isPresent(parts[_ComponentIndex.Scheme])) {\n return _joinAndCanonicalizePath(parts);\n } else {\n parts[_ComponentIndex.Scheme] = baseParts[_ComponentIndex.Scheme];\n }\n for (var i = _ComponentIndex.Scheme; i <= _ComponentIndex.Port; i++) {\n if (lang_1.isBlank(parts[i])) {\n parts[i] = baseParts[i];\n }\n }\n if (parts[_ComponentIndex.Path][0] == '/') {\n return _joinAndCanonicalizePath(parts);\n }\n var path = baseParts[_ComponentIndex.Path];\n if (lang_1.isBlank(path))\n path = '/';\n var index = path.lastIndexOf('/');\n path = path.substring(0, index + 1) + parts[_ComponentIndex.Path];\n parts[_ComponentIndex.Path] = path;\n return _joinAndCanonicalizePath(parts);\n}\n","/* */ \n'use strict';\nfunction __export(m) {\n for (var p in m)\n if (!exports.hasOwnProperty(p))\n exports[p] = m[p];\n}\nvar runtime_compiler_1 = require('./runtime_compiler');\nvar template_compiler_1 = require('./template_compiler');\nexports.TemplateCompiler = template_compiler_1.TemplateCompiler;\nvar directive_metadata_1 = require('./directive_metadata');\nexports.CompileDirectiveMetadata = directive_metadata_1.CompileDirectiveMetadata;\nexports.CompileTypeMetadata = directive_metadata_1.CompileTypeMetadata;\nexports.CompileTemplateMetadata = directive_metadata_1.CompileTemplateMetadata;\nvar source_module_1 = require('./source_module');\nexports.SourceModule = source_module_1.SourceModule;\nexports.SourceWithImports = source_module_1.SourceWithImports;\nvar platform_directives_and_pipes_1 = require('../core/platform_directives_and_pipes');\nexports.PLATFORM_DIRECTIVES = platform_directives_and_pipes_1.PLATFORM_DIRECTIVES;\nexports.PLATFORM_PIPES = platform_directives_and_pipes_1.PLATFORM_PIPES;\n__export(require('./template_ast'));\nvar template_parser_1 = require('./template_parser');\nexports.TEMPLATE_TRANSFORMS = template_parser_1.TEMPLATE_TRANSFORMS;\nvar lang_1 = require('../facade/lang');\nvar di_1 = require('../core/di');\nvar template_parser_2 = require('./template_parser');\nvar html_parser_1 = require('./html_parser');\nvar template_normalizer_1 = require('./template_normalizer');\nvar runtime_metadata_1 = require('./runtime_metadata');\nvar change_detector_compiler_1 = require('./change_detector_compiler');\nvar style_compiler_1 = require('./style_compiler');\nvar view_compiler_1 = require('./view_compiler');\nvar proto_view_compiler_1 = require('./proto_view_compiler');\nvar template_compiler_2 = require('./template_compiler');\nvar change_detection_1 = require('../core/change_detection/change_detection');\nvar compiler_1 = require('../core/linker/compiler');\nvar runtime_compiler_2 = require('./runtime_compiler');\nvar element_schema_registry_1 = require('./schema/element_schema_registry');\nvar dom_element_schema_registry_1 = require('./schema/dom_element_schema_registry');\nvar url_resolver_1 = require('./url_resolver');\nvar change_detection_2 = require('../core/change_detection/change_detection');\nfunction _createChangeDetectorGenConfig() {\n return new change_detection_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), false, true);\n}\nexports.COMPILER_PROVIDERS = lang_1.CONST_EXPR([change_detection_2.Lexer, change_detection_2.Parser, html_parser_1.HtmlParser, template_parser_2.TemplateParser, template_normalizer_1.TemplateNormalizer, runtime_metadata_1.RuntimeMetadataResolver, url_resolver_1.DEFAULT_PACKAGE_URL_PROVIDER, style_compiler_1.StyleCompiler, proto_view_compiler_1.ProtoViewCompiler, view_compiler_1.ViewCompiler, change_detector_compiler_1.ChangeDetectionCompiler, new di_1.Provider(change_detection_1.ChangeDetectorGenConfig, {\n useFactory: _createChangeDetectorGenConfig,\n deps: []\n}), template_compiler_2.TemplateCompiler, new di_1.Provider(runtime_compiler_2.RuntimeCompiler, {useClass: runtime_compiler_1.RuntimeCompiler_}), new di_1.Provider(compiler_1.Compiler, {useExisting: runtime_compiler_2.RuntimeCompiler}), dom_element_schema_registry_1.DomElementSchemaRegistry, new di_1.Provider(element_schema_registry_1.ElementSchemaRegistry, {useExisting: dom_element_schema_registry_1.DomElementSchemaRegistry}), url_resolver_1.UrlResolver]);\n","/* */ \n'use strict';\nfunction __export(m) {\n for (var p in m)\n if (!exports.hasOwnProperty(p))\n exports[p] = m[p];\n}\n__export(require('./src/compiler/url_resolver'));\n__export(require('./src/compiler/xhr'));\n__export(require('./src/compiler/compiler'));\n","/* */ \n'use strict';// TODO: vsavkin rename it into TemplateLoader\r\n/**\r\n * An interface for retrieving documents by URL that the compiler uses\r\n * to load templates.\r\n */\r\nvar XHR = (function () {\r\n function XHR() {\r\n }\r\n XHR.prototype.get = function (url) { return null; };\r\n return XHR;\r\n})();\r\nexports.XHR = XHR;\r\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoieGhyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiYW5ndWxhcjIvc3JjL2NvbXBpbGVyL3hoci50cyJdLCJuYW1lcyI6WyJYSFIiLCJYSFIuY29uc3RydWN0b3IiLCJYSFIuZ2V0Il0sIm1hcHBpbmdzIjoiQUFFQSw4Q0FBOEM7QUFDOUM7OztHQUdHO0FBQ0g7SUFBQUE7SUFFQUMsQ0FBQ0E7SUFEQ0QsaUJBQUdBLEdBQUhBLFVBQUlBLEdBQVdBLElBQXFCRSxNQUFNQSxDQUFDQSxJQUFJQSxDQUFDQSxDQUFDQSxDQUFDQTtJQUNwREYsVUFBQ0E7QUFBREEsQ0FBQ0EsQUFGRCxJQUVDO0FBRlksV0FBRyxNQUVmLENBQUEiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQge1Byb21pc2V9IGZyb20gJ2FuZ3VsYXIyL3NyYy9mYWNhZGUvYXN5bmMnO1xuXG4vLyBUT0RPOiB2c2F2a2luIHJlbmFtZSBpdCBpbnRvIFRlbXBsYXRlTG9hZGVyXG4vKipcbiAqIEFuIGludGVyZmFjZSBmb3IgcmV0cmlldmluZyBkb2N1bWVudHMgYnkgVVJMIHRoYXQgdGhlIGNvbXBpbGVyIHVzZXNcbiAqIHRvIGxvYWQgdGVtcGxhdGVzLlxuICovXG5leHBvcnQgY2xhc3MgWEhSIHtcbiAgZ2V0KHVybDogc3RyaW5nKTogUHJvbWlzZTxzdHJpbmc+IHsgcmV0dXJuIG51bGw7IH1cbn1cbiJdfQ==","/* */ \n'use strict';\nvar __extends = (this && this.__extends) || function(d, b) {\n for (var p in b)\n if (b.hasOwnProperty(p))\n d[p] = b[p];\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar promise_1 = require('../../facade/promise');\nvar lang_1 = require('../../facade/lang');\nvar xhr_1 = require('../../compiler/xhr');\nvar XHRImpl = (function(_super) {\n __extends(XHRImpl, _super);\n function XHRImpl() {\n _super.apply(this, arguments);\n }\n XHRImpl.prototype.get = function(url) {\n var completer = promise_1.PromiseWrapper.completer();\n var xhr = new XMLHttpRequest();\n xhr.open('GET', url, true);\n xhr.responseType = 'text';\n xhr.onload = function() {\n var response = lang_1.isPresent(xhr.response) ? xhr.response : xhr.responseText;\n var status = xhr.status === 1223 ? 204 : xhr.status;\n if (status === 0) {\n status = response ? 200 : 0;\n }\n if (200 <= status && status <= 300) {\n completer.resolve(response);\n } else {\n completer.reject(\"Failed to load \" + url, null);\n }\n };\n xhr.onerror = function() {\n completer.reject(\"Failed to load \" + url, null);\n };\n xhr.send();\n return completer.promise;\n };\n return XHRImpl;\n})(xhr_1.XHR);\nexports.XHRImpl = XHRImpl;\n","/* */ \n(function(process) {\n 'use strict';\n var angular_entrypoint_1 = require('../src/core/angular_entrypoint');\n exports.AngularEntrypoint = angular_entrypoint_1.AngularEntrypoint;\n var browser_common_1 = require('../src/platform/browser_common');\n exports.BROWSER_PROVIDERS = browser_common_1.BROWSER_PROVIDERS;\n exports.ELEMENT_PROBE_PROVIDERS = browser_common_1.ELEMENT_PROBE_PROVIDERS;\n exports.ELEMENT_PROBE_PROVIDERS_PROD_MODE = browser_common_1.ELEMENT_PROBE_PROVIDERS_PROD_MODE;\n exports.inspectNativeElement = browser_common_1.inspectNativeElement;\n exports.BrowserDomAdapter = browser_common_1.BrowserDomAdapter;\n exports.By = browser_common_1.By;\n exports.Title = browser_common_1.Title;\n exports.DOCUMENT = browser_common_1.DOCUMENT;\n exports.enableDebugTools = browser_common_1.enableDebugTools;\n exports.disableDebugTools = browser_common_1.disableDebugTools;\n var lang_1 = require('../src/facade/lang');\n var browser_common_2 = require('../src/platform/browser_common');\n var compiler_1 = require('../compiler');\n var core_1 = require('../core');\n var reflection_capabilities_1 = require('../src/core/reflection/reflection_capabilities');\n var xhr_impl_1 = require('../src/platform/browser/xhr_impl');\n var compiler_2 = require('../compiler');\n var di_1 = require('../src/core/di');\n exports.BROWSER_APP_PROVIDERS = lang_1.CONST_EXPR([browser_common_2.BROWSER_APP_COMMON_PROVIDERS, compiler_1.COMPILER_PROVIDERS, new di_1.Provider(compiler_2.XHR, {useClass: xhr_impl_1.XHRImpl})]);\n function bootstrap(appComponentType, customProviders) {\n core_1.reflector.reflectionCapabilities = new reflection_capabilities_1.ReflectionCapabilities();\n var appProviders = lang_1.isPresent(customProviders) ? [exports.BROWSER_APP_PROVIDERS, customProviders] : exports.BROWSER_APP_PROVIDERS;\n return core_1.platform(browser_common_2.BROWSER_PROVIDERS).application(appProviders).bootstrap(appComponentType);\n }\n exports.bootstrap = bootstrap;\n})(require('process'));\n","'use strict';\n\nimport {isFunction, isString} from 'angular2/src/facade/lang';\nimport {BrowserDomAdapter} from 'angular2/platform/browser';\nimport {global} from 'angular2/src/facade/lang';\n\nvar defaults = {\n scrollYOffset: 0,\n disableLazySchemas: false,\n debugMode: global.redocDebugMode\n};\n\nvar OPTION_NAMES = new Set(['scrollYOffset', 'disableLazySchemas']);\n\n@Reflect.metadata('parameters', [[BrowserDomAdapter]])\nexport default class OptionsManager {\n constructor() {\n this._options = defaults;\n this.dom = new BrowserDomAdapter();\n }\n\n get options() {\n return this._options;\n }\n\n set options(opts) {\n this._options = Object.assign(this._options, opts);\n }\n\n parseOptions(el) {\n let parsedOpts;\n let attributesMap = this.dom.attributeMap(el);\n parsedOpts = {};\n Array.from(attributesMap.keys())\n //camelCasify\n .map(k => ({\n attrName: k,\n name: k.replace(/-(.)/g, (m, $1) => $1.toUpperCase())\n })\n )\n .filter(option => OPTION_NAMES.has(option.name))\n .forEach(option => {\n parsedOpts[option.name] = attributesMap.get(option.attrName);\n });\n\n this.options = parsedOpts;\n this._normalizeOptions();\n }\n\n _normalizeOptions() {\n // modify scrollYOffset to always be a function\n if (!isFunction(this._options.scrollYOffset)) {\n if (isFinite(this._options.scrollYOffset)) {\n // if number specified create function that returns this value\n let numberOffset = parseFloat(this._options.scrollYOffset);\n this.options.scrollYOffset = () => numberOffset;\n } else {\n // if selector or node function that returns bottom offset of this node\n let el = this._options.scrollYOffset;\n if (!(el instanceof Node)) {\n el = this.dom.query(el);\n }\n if (!el) {\n this._options.scrollYOffset = () => 0;\n } else {\n this._options.scrollYOffset = () => el.offsetTop + el.offsetHeight;\n }\n }\n }\n\n if (isString(this._options.disableLazySchemas)) this._options.disableLazySchemas = true;\n }\n}\n","'use strict';\n\nimport {NgZone, ChangeDetectionStrategy, ElementRef} from 'angular2/core';\nimport {document} from 'angular2/src/facade/browser';\nimport {BrowserDomAdapter} from 'angular2/platform/browser';\nimport {global} from 'angular2/src/facade/lang';\n\nimport {RedocComponent, BaseComponent, SchemaManager} from '../base';\nimport {redocEvents} from '../../events';\nimport OptionsManager from '../../options';\n\nconst CHANGE = {\n NEXT : 1,\n BACK : -1,\n INITIAL : 0\n};\n\nconst INVIEW_POSITION = {\n ABOVE : 1,\n BELLOW: -1,\n INVIEW: 0\n};\n\n@RedocComponent({\n selector: 'side-menu',\n template: `\n \n \n \n {{activeCatCaption}} \n {{activeItemCaption}}\n \n
\n \n \n \n
\n `,\n styles: [`\n .menu-header{text-transform:uppercase;color:#00329F;padding:0 20px;margin:10px 0;font-size:16px}.menu-cat-header{font-size:15px;cursor:pointer;color:#384248;text-transform:uppercase;background-color:#FAFAFA;display:block;padding:5px 20px}.menu-cat:nth-of-type(even) .menu-cat-header{background-color:#F0F0F0}.menu-cat .menu-cat-header.active{background-color:#d1d1d1}.menu-subitems{margin:0;padding:0;height:0;overflow:hidden}.menu-subitems.active{height:auto}.menu-subitems li{list-style:none inside none;cursor:pointer;padding:5px 20px;padding-left:40px;background-color:#FAFAFA;overflow:hidden;text-overflow:ellipsis}.menu-subitems li:nth-of-type(even){background-color:#F0F0F0}.menu-cat:nth-of-type(odd) .menu-subitems li{background-color:#F0F0F0}.menu-cat:nth-of-type(odd) .menu-subitems li:nth-of-type(even){background-color:#FAFAFA}.menu-cat .menu-subitems li.active,.menu-cat .menu-subitems li.active:nth-of-type(even){background-color:#DEDEDE}.mobile-nav{display:none;height:3em;line-height:3em;box-sizing:border-box;border-bottom:1px solid #ccc;cursor:pointer}.mobile-nav:after{content:\"\";display:inline-block;width:3em;height:3em;background:url('data:image/svg+xml;utf8,');background-size:70%;background-repeat:no-repeat;background-position:center;float:right;vertical-align:middle}.mobile-nav .menu-header{padding:0 10px 0 20px;font-size:0.95em}@media (max-width: 550px){.mobile-nav .menu-header{display:none}}@media (max-width: 1000px){.mobile-nav{display:block}#resources-nav{height:0;overflow-y:auto;transition:all 0.3s ease}#resources-nav .menu-header{display:none}.menu-subitems{height:auto}}.selected-tag{text-transform:capitalize}.selected-endpoint:before{content:\"/\";padding:0 2px;color:#ccc}.selected-endpoint:empty:before{display:none}.selected-item-info{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;box-sizing:border-box;max-width:350px}@media (max-width: 550px){.selected-item-info{display:inline-block;padding:0 20px;max-width:80%;max-width:calc(100% - 4em)}}\n `],\n changeDetection: ChangeDetectionStrategy.Default\n})\n@Reflect.metadata('parameters', [[SchemaManager], [ElementRef],\n [BrowserDomAdapter], [NgZone], OptionsManager])\nexport default class SideMenu extends BaseComponent {\n constructor(schemaMgr, elementRef, dom, zone, optionsMgr) {\n super(schemaMgr);\n this.$element = elementRef.nativeElement;\n this.dom = dom;\n this.options = optionsMgr.options;\n this.$scrollParent = this.options.$scrollParent;\n // for some reason constructor is not run inside zone\n // as workaround running it manually\n zone.run(() => {\n this.bindEvents();\n });\n this.activeCatIdx = 0;\n this.activeMethodIdx = -1;\n this.prevOffsetY = null;\n\n redocEvents.bootstrapped.subscribe(() => this.hashScroll());\n\n this.activeCatCaption = '';\n this.activeItemCaption = '';\n }\n\n scrollY() {\n return (this.$scrollParent.pageYOffset != null) ? this.$scrollParent.pageYOffset : this.$scrollParent.scrollTop;\n }\n\n hashScroll(evt) {\n let hash = this.dom.getLocation().hash;\n if (!hash) return;\n\n let $el;\n hash = hash.substr(1);\n let namespace = hash.split('/')[0];\n let ptr = hash.substr(namespace.length + 1);\n if (namespace === 'operation') {\n $el = this.getMethodElByOperId(ptr);\n } else if (namespace === 'tag') {\n let tag = ptr.split('/')[0];\n ptr = ptr.substr(tag.length);\n $el = this.getMethodElByPtr(ptr, tag);\n }\n\n if ($el) this.scrollTo($el);\n if (evt) evt.preventDefault();\n }\n\n bindEvents() {\n this.prevOffsetY = this.scrollY();\n\n //decorate option.scrollYOffset to account mobile nav\n this.scrollYOffset = () => {\n let mobileNavOffset = this.$mobileNav.clientHeight;\n return this.options.scrollYOffset() + mobileNavOffset;\n };\n this._cancel = {};\n this._cancel.scroll = this.dom.onAndCancel(this.$scrollParent, 'scroll', () => { this.scrollHandler(); });\n this._cancel.hash = this.dom.onAndCancel(global, 'hashchange', evt => this.hashScroll(evt));\n }\n\n destroy() {\n this._cancel.scroll();\n this._cancel.hash();\n }\n\n activateAndScroll(idx, methodIdx) {\n if (this.mobileMode()) {\n this.toggleMobileNav();\n }\n this.activate(idx, methodIdx);\n this.scrollToActive();\n }\n\n scrollTo($el) {\n // TODO: rewrite this to use offsetTop as more reliable solution\n let subjRect = $el.getBoundingClientRect();\n let offset = this.scrollY() + subjRect.top - this.scrollYOffset() + 1;\n if (this.$scrollParent.scrollTo) {\n this.$scrollParent.scrollTo(0, offset);\n } else {\n this.$scrollParent.scrollTop = offset;\n }\n }\n\n scrollToActive() {\n this.scrollTo(this.getCurrentMethodEl());\n }\n\n activate(catIdx, methodIdx) {\n let menu = this.data.menu;\n\n this.activeCatCaption = '';\n this.activeItemCaption = '';\n\n menu[this.activeCatIdx].active = false;\n if (menu[this.activeCatIdx].methods.length) {\n if (this.activeMethodIdx >= 0) {\n menu[this.activeCatIdx].methods[this.activeMethodIdx].active = false;\n }\n }\n\n this.activeCatIdx = catIdx;\n this.activeMethodIdx = methodIdx;\n menu[catIdx].active = true;\n this.activeCatCaption = menu[catIdx].name;\n this.activeMethodPtr = null;\n if (menu[catIdx].methods.length && (methodIdx > -1)) {\n let currentItem = menu[catIdx].methods[methodIdx];\n currentItem.active = true;\n this.activeMethodPtr = currentItem.pointer;\n this.activeItemCaption = currentItem.summary;\n }\n }\n\n _calcActiveIndexes(offset) {\n let menu = this.data.menu;\n let catCount = menu.length;\n let catLength = menu[this.activeCatIdx].methods.length;\n\n let resMethodIdx = this.activeMethodIdx + offset;\n let resCatIdx = this.activeCatIdx;\n\n if (resMethodIdx > catLength - 1) {\n resCatIdx++;\n resMethodIdx = -1;\n }\n if (resMethodIdx < -1) {\n let prevCatIdx = --resCatIdx;\n catLength = menu[Math.max(prevCatIdx, 0)].methods.length;\n resMethodIdx = catLength - 1;\n }\n if (resCatIdx > catCount - 1) {\n resCatIdx = catCount - 1;\n resMethodIdx = catLength - 1;\n }\n if (resCatIdx < 0) {\n resCatIdx = 0;\n resMethodIdx = 0;\n }\n\n return [resCatIdx, resMethodIdx];\n }\n\n changeActive(offset = 1) {\n let [catIdx, methodIdx] = this._calcActiveIndexes(offset);\n this.activate(catIdx, methodIdx);\n return (methodIdx === 0 && catIdx === 0);\n }\n\n getMethodElByPtr(ptr, tag) {\n let selector = ptr ? `[pointer=\"${ptr}\"][tag=\"${tag}\"]` : `[tag=\"${tag}\"]`;\n return document.querySelector(selector);\n }\n\n getMethodElByOperId(operationId) {\n let selector =`[operation-id=\"${operationId}\"]`;\n return document.querySelector(selector);\n }\n\n getCurrentMethodEl() {\n return this.getMethodElByPtr(this.activeMethodPtr, this.data.menu[this.activeCatIdx].name);\n }\n\n /* returns 1 if element if above the view, 0 if in view and -1 below the view */\n getElementInViewPos($el) {\n if (Math.floor($el.getBoundingClientRect().top) > this.scrollYOffset()) {\n return INVIEW_POSITION.ABOVE;\n }\n\n if ($el.getBoundingClientRect().bottom <= this.scrollYOffset()) {\n return INVIEW_POSITION.BELLOW;\n }\n return INVIEW_POSITION.INVIEW;\n }\n\n scrollHandler() {\n let isScrolledDown = (this.scrollY() - this.prevOffsetY > 0);\n this.prevOffsetY = this.scrollY();\n let stable = false;\n while(!stable) {\n let $activeMethodHost = this.getCurrentMethodEl();\n if (!$activeMethodHost) return;\n var elementInViewPos = this.getElementInViewPos($activeMethodHost);\n if(isScrolledDown && elementInViewPos === INVIEW_POSITION.BELLOW) {\n stable = this.changeActive(CHANGE.NEXT);\n continue;\n }\n if(!isScrolledDown && elementInViewPos === INVIEW_POSITION.ABOVE ) {\n stable = this.changeActive(CHANGE.BACK);\n continue;\n }\n stable = true;\n }\n }\n\n prepareModel() {\n this.data = {};\n this.data.menu = Array.from(this.schemaMgr.buildMenuTree().entries()).map(\n el => ({name: el[0], description: el[1].description, methods: el[1].methods})\n );\n }\n\n mobileMode() {\n return this.$mobileNav.clientHeight > 0;\n }\n\n toggleMobileNav() {\n let dom = this.dom;\n let $overflowParent = (this.$scrollParent === global) ? dom.defaultDoc().body : this.$scrollParent;\n if (dom.hasStyle(this.$resourcesNav, 'height')) {\n dom.removeStyle(this.$resourcesNav, 'height');\n dom.removeStyle($overflowParent, 'overflow-y');\n } else {\n let viewportHeight = this.$scrollParent.innerHeight || this.$scrollParent.clientHeight;\n let height = viewportHeight - this.$mobileNav.getBoundingClientRect().bottom;\n dom.setStyle($overflowParent, 'overflow-y', 'hidden');\n dom.setStyle(this.$resourcesNav, 'height', height + 'px');\n }\n }\n\n init() {\n this.$mobileNav = this.dom.querySelector(this.$element, '.mobile-nav');\n this.$resourcesNav = this.dom.querySelector(this.$element, '#resources-nav');\n this.changeActive(CHANGE.INITIAL);\n }\n}\n","/* */ \n'use strict';\nvar ctx = require('./$.ctx'),\n $export = require('./$.export'),\n toObject = require('./$.to-object'),\n call = require('./$.iter-call'),\n isArrayIter = require('./$.is-array-iter'),\n toLength = require('./$.to-length'),\n getIterFn = require('./core.get-iterator-method');\n$export($export.S + $export.F * !require('./$.iter-detect')(function(iter) {\n Array.from(iter);\n}), 'Array', {from: function from(arrayLike) {\n var O = toObject(arrayLike),\n C = typeof this == 'function' ? this : Array,\n $$ = arguments,\n $$len = $$.length,\n mapfn = $$len > 1 ? $$[1] : undefined,\n mapping = mapfn !== undefined,\n index = 0,\n iterFn = getIterFn(O),\n length,\n result,\n step,\n iterator;\n if (mapping)\n mapfn = ctx(mapfn, $$len > 2 ? $$[2] : undefined, 2);\n if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) {\n for (iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++) {\n result[index] = mapping ? call(iterator, mapfn, [step.value, index], true) : step.value;\n }\n } else {\n length = toLength(O.length);\n for (result = new C(length); length > index; index++) {\n result[index] = mapping ? mapfn(O[index], index) : O[index];\n }\n }\n result.length = index;\n return result;\n }});\n","/* */ \nrequire('../../modules/es6.string.iterator');\nrequire('../../modules/es6.array.from');\nmodule.exports = require('../../modules/$.core').Array.from;\n","/* */ \nmodule.exports = { \"default\": require(\"core-js/library/fn/array/from\"), __esModule: true };","/* */ \n\"use strict\";\nvar _Array$from = require('../core-js/array/from')[\"default\"];\nexports[\"default\"] = function(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0,\n arr2 = Array(arr.length); i < arr.length; i++)\n arr2[i] = arr[i];\n return arr2;\n } else {\n return _Array$from(arr);\n }\n};\nexports.__esModule = true;\n","// 7.2.9 SameValue(x, y)\nmodule.exports = Object.is || function is(x, y){\n return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;\n};","/* */ \nvar anObject = require('./$.an-object'),\n aFunction = require('./$.a-function'),\n SPECIES = require('./$.wks')('species');\nmodule.exports = function(O, D) {\n var C = anObject(O).constructor,\n S;\n return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);\n};\n","// fast apply, http://jsperf.lnkit.com/fast-apply/5\nmodule.exports = function(fn, args, that){\n var un = that === undefined;\n switch(args.length){\n case 0: return un ? fn()\n : fn.call(that);\n case 1: return un ? fn(args[0])\n : fn.call(that, args[0]);\n case 2: return un ? fn(args[0], args[1])\n : fn.call(that, args[0], args[1]);\n case 3: return un ? fn(args[0], args[1], args[2])\n : fn.call(that, args[0], args[1], args[2]);\n case 4: return un ? fn(args[0], args[1], args[2], args[3])\n : fn.call(that, args[0], args[1], args[2], args[3]);\n } return fn.apply(that, args);\n};","/* */ \nmodule.exports = require('./$.global').document && document.documentElement;\n","/* */ \nvar isObject = require('./$.is-object'),\n document = require('./$.global').document,\n is = isObject(document) && isObject(document.createElement);\nmodule.exports = function(it) {\n return is ? document.createElement(it) : {};\n};\n","/* */ \n(function(process) {\n var ctx = require('./$.ctx'),\n invoke = require('./$.invoke'),\n html = require('./$.html'),\n cel = require('./$.dom-create'),\n global = require('./$.global'),\n process = global.process,\n setTask = global.setImmediate,\n clearTask = global.clearImmediate,\n MessageChannel = global.MessageChannel,\n counter = 0,\n queue = {},\n ONREADYSTATECHANGE = 'onreadystatechange',\n defer,\n channel,\n port;\n var run = function() {\n var id = +this;\n if (queue.hasOwnProperty(id)) {\n var fn = queue[id];\n delete queue[id];\n fn();\n }\n };\n var listner = function(event) {\n run.call(event.data);\n };\n if (!setTask || !clearTask) {\n setTask = function setImmediate(fn) {\n var args = [],\n i = 1;\n while (arguments.length > i)\n args.push(arguments[i++]);\n queue[++counter] = function() {\n invoke(typeof fn == 'function' ? fn : Function(fn), args);\n };\n defer(counter);\n return counter;\n };\n clearTask = function clearImmediate(id) {\n delete queue[id];\n };\n if (require('./$.cof')(process) == 'process') {\n defer = function(id) {\n process.nextTick(ctx(run, id, 1));\n };\n } else if (MessageChannel) {\n channel = new MessageChannel;\n port = channel.port2;\n channel.port1.onmessage = listner;\n defer = ctx(port.postMessage, port, 1);\n } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {\n defer = function(id) {\n global.postMessage(id + '', '*');\n };\n global.addEventListener('message', listner, false);\n } else if (ONREADYSTATECHANGE in cel('script')) {\n defer = function(id) {\n html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function() {\n html.removeChild(this);\n run.call(id);\n };\n };\n } else {\n defer = function(id) {\n setTimeout(ctx(run, id, 1), 0);\n };\n }\n }\n module.exports = {\n set: setTask,\n clear: clearTask\n };\n})(require('process'));\n","/* */ \n(function(process) {\n var global = require('./$.global'),\n macrotask = require('./$.task').set,\n Observer = global.MutationObserver || global.WebKitMutationObserver,\n process = global.process,\n Promise = global.Promise,\n isNode = require('./$.cof')(process) == 'process',\n head,\n last,\n notify;\n var flush = function() {\n var parent,\n domain,\n fn;\n if (isNode && (parent = process.domain)) {\n process.domain = null;\n parent.exit();\n }\n while (head) {\n domain = head.domain;\n fn = head.fn;\n if (domain)\n domain.enter();\n fn();\n if (domain)\n domain.exit();\n head = head.next;\n }\n last = undefined;\n if (parent)\n parent.enter();\n };\n if (isNode) {\n notify = function() {\n process.nextTick(flush);\n };\n } else if (Observer) {\n var toggle = 1,\n node = document.createTextNode('');\n new Observer(flush).observe(node, {characterData: true});\n notify = function() {\n node.data = toggle = -toggle;\n };\n } else if (Promise && Promise.resolve) {\n notify = function() {\n Promise.resolve().then(flush);\n };\n } else {\n notify = function() {\n macrotask.call(global, flush);\n };\n }\n module.exports = function asap(fn) {\n var task = {\n fn: fn,\n next: undefined,\n domain: isNode && process.domain\n };\n if (last)\n last.next = task;\n if (!head) {\n head = task;\n notify();\n }\n last = task;\n };\n})(require('process'));\n","/* */ \nvar ITERATOR = require('./$.wks')('iterator'),\n SAFE_CLOSING = false;\ntry {\n var riter = [7][ITERATOR]();\n riter['return'] = function() {\n SAFE_CLOSING = true;\n };\n Array.from(riter, function() {\n throw 2;\n });\n} catch (e) {}\nmodule.exports = function(exec, skipClosing) {\n if (!skipClosing && !SAFE_CLOSING)\n return false;\n var safe = false;\n try {\n var arr = [7],\n iter = arr[ITERATOR]();\n iter.next = function() {\n safe = true;\n };\n arr[ITERATOR] = function() {\n return iter;\n };\n exec(arr);\n } catch (e) {}\n return safe;\n};\n","/* */ \n(function(process) {\n 'use strict';\n var $ = require('./$'),\n LIBRARY = require('./$.library'),\n global = require('./$.global'),\n ctx = require('./$.ctx'),\n classof = require('./$.classof'),\n $export = require('./$.export'),\n isObject = require('./$.is-object'),\n anObject = require('./$.an-object'),\n aFunction = require('./$.a-function'),\n strictNew = require('./$.strict-new'),\n forOf = require('./$.for-of'),\n setProto = require('./$.set-proto').set,\n same = require('./$.same-value'),\n SPECIES = require('./$.wks')('species'),\n speciesConstructor = require('./$.species-constructor'),\n asap = require('./$.microtask'),\n PROMISE = 'Promise',\n process = global.process,\n isNode = classof(process) == 'process',\n P = global[PROMISE],\n Wrapper;\n var testResolve = function(sub) {\n var test = new P(function() {});\n if (sub)\n test.constructor = Object;\n return P.resolve(test) === test;\n };\n var USE_NATIVE = function() {\n var works = false;\n function P2(x) {\n var self = new P(x);\n setProto(self, P2.prototype);\n return self;\n }\n try {\n works = P && P.resolve && testResolve();\n setProto(P2, P);\n P2.prototype = $.create(P.prototype, {constructor: {value: P2}});\n if (!(P2.resolve(5).then(function() {}) instanceof P2)) {\n works = false;\n }\n if (works && require('./$.descriptors')) {\n var thenableThenGotten = false;\n P.resolve($.setDesc({}, 'then', {get: function() {\n thenableThenGotten = true;\n }}));\n works = thenableThenGotten;\n }\n } catch (e) {\n works = false;\n }\n return works;\n }();\n var sameConstructor = function(a, b) {\n if (LIBRARY && a === P && b === Wrapper)\n return true;\n return same(a, b);\n };\n var getConstructor = function(C) {\n var S = anObject(C)[SPECIES];\n return S != undefined ? S : C;\n };\n var isThenable = function(it) {\n var then;\n return isObject(it) && typeof(then = it.then) == 'function' ? then : false;\n };\n var PromiseCapability = function(C) {\n var resolve,\n reject;\n this.promise = new C(function($$resolve, $$reject) {\n if (resolve !== undefined || reject !== undefined)\n throw TypeError('Bad Promise constructor');\n resolve = $$resolve;\n reject = $$reject;\n });\n this.resolve = aFunction(resolve), this.reject = aFunction(reject);\n };\n var perform = function(exec) {\n try {\n exec();\n } catch (e) {\n return {error: e};\n }\n };\n var notify = function(record, isReject) {\n if (record.n)\n return;\n record.n = true;\n var chain = record.c;\n asap(function() {\n var value = record.v,\n ok = record.s == 1,\n i = 0;\n var run = function(reaction) {\n var handler = ok ? reaction.ok : reaction.fail,\n resolve = reaction.resolve,\n reject = reaction.reject,\n result,\n then;\n try {\n if (handler) {\n if (!ok)\n record.h = true;\n result = handler === true ? value : handler(value);\n if (result === reaction.promise) {\n reject(TypeError('Promise-chain cycle'));\n } else if (then = isThenable(result)) {\n then.call(result, resolve, reject);\n } else\n resolve(result);\n } else\n reject(value);\n } catch (e) {\n reject(e);\n }\n };\n while (chain.length > i)\n run(chain[i++]);\n chain.length = 0;\n record.n = false;\n if (isReject)\n setTimeout(function() {\n var promise = record.p,\n handler,\n console;\n if (isUnhandled(promise)) {\n if (isNode) {\n process.emit('unhandledRejection', value, promise);\n } else if (handler = global.onunhandledrejection) {\n handler({\n promise: promise,\n reason: value\n });\n } else if ((console = global.console) && console.error) {\n console.error('Unhandled promise rejection', value);\n }\n }\n record.a = undefined;\n }, 1);\n });\n };\n var isUnhandled = function(promise) {\n var record = promise._d,\n chain = record.a || record.c,\n i = 0,\n reaction;\n if (record.h)\n return false;\n while (chain.length > i) {\n reaction = chain[i++];\n if (reaction.fail || !isUnhandled(reaction.promise))\n return false;\n }\n return true;\n };\n var $reject = function(value) {\n var record = this;\n if (record.d)\n return;\n record.d = true;\n record = record.r || record;\n record.v = value;\n record.s = 2;\n record.a = record.c.slice();\n notify(record, true);\n };\n var $resolve = function(value) {\n var record = this,\n then;\n if (record.d)\n return;\n record.d = true;\n record = record.r || record;\n try {\n if (record.p === value)\n throw TypeError(\"Promise can't be resolved itself\");\n if (then = isThenable(value)) {\n asap(function() {\n var wrapper = {\n r: record,\n d: false\n };\n try {\n then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));\n } catch (e) {\n $reject.call(wrapper, e);\n }\n });\n } else {\n record.v = value;\n record.s = 1;\n notify(record, false);\n }\n } catch (e) {\n $reject.call({\n r: record,\n d: false\n }, e);\n }\n };\n if (!USE_NATIVE) {\n P = function Promise(executor) {\n aFunction(executor);\n var record = this._d = {\n p: strictNew(this, P, PROMISE),\n c: [],\n a: undefined,\n s: 0,\n d: false,\n v: undefined,\n h: false,\n n: false\n };\n try {\n executor(ctx($resolve, record, 1), ctx($reject, record, 1));\n } catch (err) {\n $reject.call(record, err);\n }\n };\n require('./$.redefine-all')(P.prototype, {\n then: function then(onFulfilled, onRejected) {\n var reaction = new PromiseCapability(speciesConstructor(this, P)),\n promise = reaction.promise,\n record = this._d;\n reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;\n reaction.fail = typeof onRejected == 'function' && onRejected;\n record.c.push(reaction);\n if (record.a)\n record.a.push(reaction);\n if (record.s)\n notify(record, false);\n return promise;\n },\n 'catch': function(onRejected) {\n return this.then(undefined, onRejected);\n }\n });\n }\n $export($export.G + $export.W + $export.F * !USE_NATIVE, {Promise: P});\n require('./$.set-to-string-tag')(P, PROMISE);\n require('./$.set-species')(PROMISE);\n Wrapper = require('./$.core')[PROMISE];\n $export($export.S + $export.F * !USE_NATIVE, PROMISE, {reject: function reject(r) {\n var capability = new PromiseCapability(this),\n $$reject = capability.reject;\n $$reject(r);\n return capability.promise;\n }});\n $export($export.S + $export.F * (!USE_NATIVE || testResolve(true)), PROMISE, {resolve: function resolve(x) {\n if (x instanceof P && sameConstructor(x.constructor, this))\n return x;\n var capability = new PromiseCapability(this),\n $$resolve = capability.resolve;\n $$resolve(x);\n return capability.promise;\n }});\n $export($export.S + $export.F * !(USE_NATIVE && require('./$.iter-detect')(function(iter) {\n P.all(iter)['catch'](function() {});\n })), PROMISE, {\n all: function all(iterable) {\n var C = getConstructor(this),\n capability = new PromiseCapability(C),\n resolve = capability.resolve,\n reject = capability.reject,\n values = [];\n var abrupt = perform(function() {\n forOf(iterable, false, values.push, values);\n var remaining = values.length,\n results = Array(remaining);\n if (remaining)\n $.each.call(values, function(promise, index) {\n var alreadyCalled = false;\n C.resolve(promise).then(function(value) {\n if (alreadyCalled)\n return;\n alreadyCalled = true;\n results[index] = value;\n --remaining || resolve(results);\n }, reject);\n });\n else\n resolve(results);\n });\n if (abrupt)\n reject(abrupt.error);\n return capability.promise;\n },\n race: function race(iterable) {\n var C = getConstructor(this),\n capability = new PromiseCapability(C),\n reject = capability.reject;\n var abrupt = perform(function() {\n forOf(iterable, false, function(promise) {\n C.resolve(promise).then(capability.resolve, reject);\n });\n });\n if (abrupt)\n reject(abrupt.error);\n return capability.promise;\n }\n });\n})(require('process'));\n","/* */ \nrequire('../modules/es6.object.to-string');\nrequire('../modules/es6.string.iterator');\nrequire('../modules/web.dom.iterable');\nrequire('../modules/es6.promise');\nmodule.exports = require('../modules/$.core').Promise;\n","/* */ \nmodule.exports = { \"default\": require(\"core-js/library/fn/promise\"), __esModule: true };","/* */ \nvar anObject = require('./$.an-object'),\n get = require('./core.get-iterator-method');\nmodule.exports = require('./$.core').getIterator = function(it) {\n var iterFn = get(it);\n if (typeof iterFn != 'function')\n throw TypeError(it + ' is not iterable!');\n return anObject(iterFn.call(it));\n};\n","/* */ \nrequire('../modules/web.dom.iterable');\nrequire('../modules/es6.string.iterator');\nmodule.exports = require('../modules/core.get-iterator');\n","/* */ \nmodule.exports = { \"default\": require(\"core-js/library/fn/get-iterator\"), __esModule: true };","/* */ \n'use strict';\nvar strong = require('./$.collection-strong');\nrequire('./$.collection')('Map', function(get) {\n return function Map() {\n return get(this, arguments.length > 0 ? arguments[0] : undefined);\n };\n}, {\n get: function get(key) {\n var entry = strong.getEntry(this, key);\n return entry && entry.v;\n },\n set: function set(key, value) {\n return strong.def(this, key === 0 ? 0 : key, value);\n }\n}, strong, true);\n","/* */ \nvar $export = require('./$.export');\n$export($export.P, 'Map', {toJSON: require('./$.collection-to-json')('Map')});\n","/* */ \nrequire('../modules/es6.object.to-string');\nrequire('../modules/es6.string.iterator');\nrequire('../modules/web.dom.iterable');\nrequire('../modules/es6.map');\nrequire('../modules/es7.map.to-json');\nmodule.exports = require('../modules/$.core').Map;\n","/* */ \nmodule.exports = { \"default\": require(\"core-js/library/fn/map\"), __esModule: true };","/* */ \n\"format cjs\";\n// Number.isFinite polyfill\n// http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite\nif (typeof Number.isFinite !== \"function\") {\n Number.isFinite = function isFinite(value) {\n // 1. If Type(number) is not Number, return false.\n if (typeof value !== \"number\") {\n return false;\n }\n // 2. If number is NaN, +∞, or −∞, return false.\n if (value !== value || value === Infinity || value === -Infinity) {\n return false;\n }\n // 3. Otherwise, return true.\n return true;\n };\n}\n","/* */ \n(function(process) {\n \"use strict\";\n var Report = require('./Report');\n var SchemaCompilation = require('./SchemaCompilation');\n var SchemaValidation = require('./SchemaValidation');\n var Utils = require('./Utils');\n function decodeJSONPointer(str) {\n return decodeURIComponent(str).replace(/~[0-1]/g, function(x) {\n return x === \"~1\" ? \"/\" : \"~\";\n });\n }\n function getRemotePath(uri) {\n var io = uri.indexOf(\"#\");\n return io === -1 ? uri : uri.slice(0, io);\n }\n function getQueryPath(uri) {\n var io = uri.indexOf(\"#\");\n var res = io === -1 ? undefined : uri.slice(io + 1);\n return res;\n }\n function findId(schema, id) {\n if (typeof schema !== \"object\" || schema === null) {\n return;\n }\n if (!id) {\n return schema;\n }\n if (schema.id) {\n if (schema.id === id || schema.id[0] === \"#\" && schema.id.substring(1) === id) {\n return schema;\n }\n }\n var idx,\n result;\n if (Array.isArray(schema)) {\n idx = schema.length;\n while (idx--) {\n result = findId(schema[idx], id);\n if (result) {\n return result;\n }\n }\n } else {\n var keys = Object.keys(schema);\n idx = keys.length;\n while (idx--) {\n var k = keys[idx];\n if (k.indexOf(\"__$\") === 0) {\n continue;\n }\n result = findId(schema[k], id);\n if (result) {\n return result;\n }\n }\n }\n }\n exports.cacheSchemaByUri = function(uri, schema) {\n var remotePath = getRemotePath(uri);\n if (remotePath) {\n this.cache[remotePath] = schema;\n }\n };\n exports.removeFromCacheByUri = function(uri) {\n var remotePath = getRemotePath(uri);\n if (remotePath) {\n delete this.cache[remotePath];\n }\n };\n exports.checkCacheForUri = function(uri) {\n var remotePath = getRemotePath(uri);\n return remotePath ? this.cache[remotePath] != null : false;\n };\n exports.getSchema = function(report, schema) {\n if (typeof schema === \"object\") {\n schema = exports.getSchemaByReference.call(this, report, schema);\n }\n if (typeof schema === \"string\") {\n schema = exports.getSchemaByUri.call(this, report, schema);\n }\n return schema;\n };\n exports.getSchemaByReference = function(report, key) {\n var i = this.referenceCache.length;\n while (i--) {\n if (this.referenceCache[i][0] === key) {\n return this.referenceCache[i][1];\n }\n }\n var schema = Utils.cloneDeep(key);\n this.referenceCache.push([key, schema]);\n return schema;\n };\n exports.getSchemaByUri = function(report, uri, root) {\n var remotePath = getRemotePath(uri),\n queryPath = getQueryPath(uri),\n result = remotePath ? this.cache[remotePath] : root;\n if (result && remotePath) {\n var compileRemote = result !== root;\n if (compileRemote) {\n report.path.push(remotePath);\n var remoteReport = new Report(report);\n if (SchemaCompilation.compileSchema.call(this, remoteReport, result)) {\n SchemaValidation.validateSchema.call(this, remoteReport, result);\n }\n var remoteReportIsValid = remoteReport.isValid();\n if (!remoteReportIsValid) {\n report.addError(\"REMOTE_NOT_VALID\", [uri], remoteReport);\n }\n report.path.pop();\n if (!remoteReportIsValid) {\n return undefined;\n }\n }\n }\n if (result && queryPath) {\n var parts = queryPath.split(\"/\");\n for (var idx = 0,\n lim = parts.length; result && idx < lim; idx++) {\n var key = decodeJSONPointer(parts[idx]);\n if (idx === 0) {\n result = findId(result, key);\n } else {\n result = result[key];\n }\n }\n }\n return result;\n };\n exports.getRemotePath = getRemotePath;\n})(require('process'));\n","/* */ \n\"use strict\";\nvar Report = require('./Report');\nvar SchemaCache = require('./SchemaCache');\nvar Utils = require('./Utils');\nfunction mergeReference(scope, ref) {\n if (Utils.isAbsoluteUri(ref)) {\n return ref;\n }\n var joinedScope = scope.join(\"\"),\n isScopeAbsolute = Utils.isAbsoluteUri(joinedScope),\n isScopeRelative = Utils.isRelativeUri(joinedScope),\n isRefRelative = Utils.isRelativeUri(ref),\n toRemove;\n if (isScopeAbsolute && isRefRelative) {\n toRemove = joinedScope.match(/\\/[^\\/]*$/);\n if (toRemove) {\n joinedScope = joinedScope.slice(0, toRemove.index + 1);\n }\n } else if (isScopeRelative && isRefRelative) {\n joinedScope = \"\";\n } else {\n toRemove = joinedScope.match(/[^#/]+$/);\n if (toRemove) {\n joinedScope = joinedScope.slice(0, toRemove.index);\n }\n }\n var res = joinedScope + ref;\n res = res.replace(/##/, \"#\");\n return res;\n}\nfunction collectReferences(obj, results, scope, path) {\n results = results || [];\n scope = scope || [];\n path = path || [];\n if (typeof obj !== \"object\" || obj === null) {\n return results;\n }\n if (typeof obj.id === \"string\") {\n scope.push(obj.id);\n }\n if (typeof obj.$ref === \"string\" && typeof obj.__$refResolved === \"undefined\") {\n results.push({\n ref: mergeReference(scope, obj.$ref),\n key: \"$ref\",\n obj: obj,\n path: path.slice(0)\n });\n }\n if (typeof obj.$schema === \"string\" && typeof obj.__$schemaResolved === \"undefined\") {\n results.push({\n ref: mergeReference(scope, obj.$schema),\n key: \"$schema\",\n obj: obj,\n path: path.slice(0)\n });\n }\n var idx;\n if (Array.isArray(obj)) {\n idx = obj.length;\n while (idx--) {\n path.push(idx.toString());\n collectReferences(obj[idx], results, scope, path);\n path.pop();\n }\n } else {\n var keys = Object.keys(obj);\n idx = keys.length;\n while (idx--) {\n if (keys[idx].indexOf(\"__$\") === 0) {\n continue;\n }\n path.push(keys[idx]);\n collectReferences(obj[keys[idx]], results, scope, path);\n path.pop();\n }\n }\n if (typeof obj.id === \"string\") {\n scope.pop();\n }\n return results;\n}\nvar compileArrayOfSchemasLoop = function(mainReport, arr) {\n var idx = arr.length,\n compiledCount = 0;\n while (idx--) {\n var report = new Report(mainReport);\n var isValid = exports.compileSchema.call(this, report, arr[idx]);\n if (isValid) {\n compiledCount++;\n }\n mainReport.errors = mainReport.errors.concat(report.errors);\n }\n return compiledCount;\n};\nfunction findId(arr, id) {\n var idx = arr.length;\n while (idx--) {\n if (arr[idx].id === id) {\n return arr[idx];\n }\n }\n return null;\n}\nvar compileArrayOfSchemas = function(report, arr) {\n var compiled = 0,\n lastLoopCompiled;\n do {\n var idx = report.errors.length;\n while (idx--) {\n if (report.errors[idx].code === \"UNRESOLVABLE_REFERENCE\") {\n report.errors.splice(idx, 1);\n }\n }\n lastLoopCompiled = compiled;\n compiled = compileArrayOfSchemasLoop.call(this, report, arr);\n idx = arr.length;\n while (idx--) {\n var sch = arr[idx];\n if (sch.__$missingReferences) {\n var idx2 = sch.__$missingReferences.length;\n while (idx2--) {\n var refObj = sch.__$missingReferences[idx2];\n var response = findId(arr, refObj.ref);\n if (response) {\n refObj.obj[\"__\" + refObj.key + \"Resolved\"] = response;\n sch.__$missingReferences.splice(idx2, 1);\n }\n }\n if (sch.__$missingReferences.length === 0) {\n delete sch.__$missingReferences;\n }\n }\n }\n } while (compiled !== arr.length && compiled !== lastLoopCompiled);\n return report.isValid();\n};\nexports.compileSchema = function(report, schema) {\n report.commonErrorMessage = \"SCHEMA_COMPILATION_FAILED\";\n if (typeof schema === \"string\") {\n var loadedSchema = SchemaCache.getSchemaByUri.call(this, report, schema);\n if (!loadedSchema) {\n report.addError(\"SCHEMA_NOT_REACHABLE\", [schema]);\n return false;\n }\n schema = loadedSchema;\n }\n if (Array.isArray(schema)) {\n return compileArrayOfSchemas.call(this, report, schema);\n }\n if (schema.__$compiled && schema.id && SchemaCache.checkCacheForUri.call(this, schema.id) === false) {\n schema.__$compiled = undefined;\n }\n if (schema.__$compiled) {\n return true;\n }\n if (schema.id && typeof schema.id === \"string\") {\n SchemaCache.cacheSchemaByUri.call(this, schema.id, schema);\n }\n var isRoot = false;\n if (!report.rootSchema) {\n report.rootSchema = schema;\n isRoot = true;\n }\n var isValidExceptReferences = report.isValid();\n delete schema.__$missingReferences;\n var refs = collectReferences.call(this, schema),\n idx = refs.length;\n while (idx--) {\n var refObj = refs[idx];\n var response = SchemaCache.getSchemaByUri.call(this, report, refObj.ref, schema);\n if (!response) {\n var schemaReader = this.getSchemaReader();\n if (schemaReader) {\n var s = schemaReader(refObj.ref);\n if (s) {\n s.id = refObj.ref;\n var subreport = new Report(report);\n if (!exports.compileSchema.call(this, subreport, s)) {\n report.errors = report.errors.concat(subreport.errors);\n } else {\n response = SchemaCache.getSchemaByUri.call(this, report, refObj.ref, schema);\n }\n }\n }\n }\n if (!response) {\n var hasNotValid = report.hasError(\"REMOTE_NOT_VALID\", [refObj.ref]);\n var isAbsolute = Utils.isAbsoluteUri(refObj.ref);\n var isDownloaded = false;\n var ignoreUnresolvableRemotes = this.options.ignoreUnresolvableReferences === true;\n if (isAbsolute) {\n isDownloaded = SchemaCache.checkCacheForUri.call(this, refObj.ref);\n }\n if (hasNotValid) {} else if (ignoreUnresolvableRemotes && isAbsolute) {} else if (isDownloaded) {} else {\n Array.prototype.push.apply(report.path, refObj.path);\n report.addError(\"UNRESOLVABLE_REFERENCE\", [refObj.ref]);\n report.path = report.path.slice(0, -refObj.path.length);\n if (isValidExceptReferences) {\n schema.__$missingReferences = schema.__$missingReferences || [];\n schema.__$missingReferences.push(refObj);\n }\n }\n }\n refObj.obj[\"__\" + refObj.key + \"Resolved\"] = response;\n }\n var isValid = report.isValid();\n if (isValid) {\n schema.__$compiled = true;\n } else {\n if (schema.id && typeof schema.id === \"string\") {\n SchemaCache.removeFromCacheByUri.call(this, schema.id);\n }\n }\n if (isRoot) {\n report.rootSchema = undefined;\n }\n return isValid;\n};\n","/* */ \n\"format cjs\";\n/*!\n * Copyright (c) 2015 Chris O'Hara \n *\n * Permission is hereby granted, free of charge, to any person obtaining\n * a copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n(function (name, definition) {\n if (typeof exports !== 'undefined' && typeof module !== 'undefined') {\n module.exports = definition();\n } else if (typeof define === 'function' && typeof define.amd === 'object') {\n define(definition);\n } else if (typeof define === 'function' && typeof define.petal === 'object') {\n define(name, [], definition);\n } else {\n this[name] = definition();\n }\n})('validator', function (validator) {\n\n 'use strict';\n\n validator = { version: '4.5.0' };\n\n var emailUserPart = /^[a-z\\d!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]+$/i;\n var quotedEmailUser = /^([\\s\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f\\x21\\x23-\\x5b\\x5d-\\x7e]|(\\\\[\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]))*$/i;\n\n var emailUserUtf8Part = /^[a-z\\d!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+$/i;\n var quotedEmailUserUtf8 = /^([\\s\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f\\x21\\x23-\\x5b\\x5d-\\x7e\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]|(\\\\[\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))*$/i;\n\n var displayName = /^[a-z\\d!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~\\.\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+[a-z\\d!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~\\.\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF\\s]*<(.+)>$/i;\n\n var creditCard = /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11})$/;\n\n var isin = /^[A-Z]{2}[0-9A-Z]{9}[0-9]$/;\n\n var isbn10Maybe = /^(?:[0-9]{9}X|[0-9]{10})$/\n , isbn13Maybe = /^(?:[0-9]{13})$/;\n\n var macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/;\n\n var ipv4Maybe = /^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$/\n , ipv6Block = /^[0-9A-F]{1,4}$/i;\n\n var uuid = {\n '3': /^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i\n , '4': /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i\n , '5': /^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i\n , all: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i\n };\n\n var alpha = /^[A-Z]+$/i\n , alphanumeric = /^[0-9A-Z]+$/i\n , numeric = /^[-+]?[0-9]+$/\n , int = /^(?:[-+]?(?:0|[1-9][0-9]*))$/\n , float = /^(?:[-+]?(?:[0-9]+))?(?:\\.[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$/\n , hexadecimal = /^[0-9A-F]+$/i\n , decimal = /^[-+]?([0-9]+|\\.[0-9]+|[0-9]+\\.[0-9]+)$/\n , hexcolor = /^#?([0-9A-F]{3}|[0-9A-F]{6})$/i;\n\n var ascii = /^[\\x00-\\x7F]+$/\n , multibyte = /[^\\x00-\\x7F]/\n , fullWidth = /[^\\u0020-\\u007E\\uFF61-\\uFF9F\\uFFA0-\\uFFDC\\uFFE8-\\uFFEE0-9a-zA-Z]/\n , halfWidth = /[\\u0020-\\u007E\\uFF61-\\uFF9F\\uFFA0-\\uFFDC\\uFFE8-\\uFFEE0-9a-zA-Z]/;\n\n var surrogatePair = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/;\n\n var base64 = /^(?:[A-Z0-9+\\/]{4})*(?:[A-Z0-9+\\/]{2}==|[A-Z0-9+\\/]{3}=|[A-Z0-9+\\/]{4})$/i;\n\n var phones = {\n 'zh-CN': /^(\\+?0?86\\-?)?((13\\d|14[57]|15[^4,\\D]|17[678]|18\\d)\\d{8}|170[059]\\d{7})$/,\n 'zh-TW': /^(\\+?886\\-?|0)?9\\d{8}$/,\n 'en-ZA': /^(\\+?27|0)\\d{9}$/,\n 'en-AU': /^(\\+?61|0)4\\d{8}$/,\n 'en-HK': /^(\\+?852\\-?)?[569]\\d{3}\\-?\\d{4}$/,\n 'fr-FR': /^(\\+?33|0)[67]\\d{8}$/,\n 'pt-PT': /^(\\+351)?9[1236]\\d{7}$/,\n 'el-GR': /^(\\+?30)?(69\\d{8})$/,\n 'en-GB': /^(\\+?44|0)7\\d{9}$/,\n 'en-US': /^(\\+?1)?[2-9]\\d{2}[2-9](?!11)\\d{6}$/,\n 'en-ZM': /^(\\+26)?09[567]\\d{7}$/,\n 'ru-RU': /^(\\+?7|8)?9\\d{9}$/,\n 'nb-NO': /^(\\+?47)?[49]\\d{7}$/,\n 'nn-NO': /^(\\+?47)?[49]\\d{7}$/,\n 'vi-VN': /^(0|\\+?84)?((1(2([0-9])|6([2-9])|88|99))|(9((?!5)[0-9])))([0-9]{7})$/,\n 'en-NZ': /^(\\+?64|0)2\\d{7,9}$/,\n 'en-IN': /^(\\+?91|0)?[789]\\d{9}$/\n };\n\n // from http://goo.gl/0ejHHW\n var iso8601 = /^([\\+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T\\s]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24\\:?00)([\\.,]\\d+(?!:))?)?(\\17[0-5]\\d([\\.,]\\d+)?)?([zZ]|([\\+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?$/;\n\n validator.extend = function (name, fn) {\n validator[name] = function () {\n var args = Array.prototype.slice.call(arguments);\n args[0] = validator.toString(args[0]);\n return fn.apply(validator, args);\n };\n };\n\n //Right before exporting the validator object, pass each of the builtins\n //through extend() so that their first argument is coerced to a string\n validator.init = function () {\n for (var name in validator) {\n if (typeof validator[name] !== 'function' || name === 'toString' ||\n name === 'toDate' || name === 'extend' || name === 'init') {\n continue;\n }\n validator.extend(name, validator[name]);\n }\n };\n\n validator.toString = function (input) {\n if (typeof input === 'object' && input !== null && input.toString) {\n input = input.toString();\n } else if (input === null || typeof input === 'undefined' || (isNaN(input) && !input.length)) {\n input = '';\n }\n return '' + input;\n };\n\n validator.toDate = function (date) {\n if (Object.prototype.toString.call(date) === '[object Date]') {\n return date;\n }\n date = Date.parse(date);\n return !isNaN(date) ? new Date(date) : null;\n };\n\n validator.toFloat = function (str) {\n return parseFloat(str);\n };\n\n validator.toInt = function (str, radix) {\n return parseInt(str, radix || 10);\n };\n\n validator.toBoolean = function (str, strict) {\n if (strict) {\n return str === '1' || str === 'true';\n }\n return str !== '0' && str !== 'false' && str !== '';\n };\n\n validator.equals = function (str, comparison) {\n return str === validator.toString(comparison);\n };\n\n validator.contains = function (str, elem) {\n return str.indexOf(validator.toString(elem)) >= 0;\n };\n\n validator.matches = function (str, pattern, modifiers) {\n if (Object.prototype.toString.call(pattern) !== '[object RegExp]') {\n pattern = new RegExp(pattern, modifiers);\n }\n return pattern.test(str);\n };\n\n var default_email_options = {\n allow_display_name: false,\n allow_utf8_local_part: true,\n require_tld: true\n };\n\n validator.isEmail = function (str, options) {\n options = merge(options, default_email_options);\n\n if (options.allow_display_name) {\n var display_email = str.match(displayName);\n if (display_email) {\n str = display_email[1];\n }\n }\n\n var parts = str.split('@')\n , domain = parts.pop()\n , user = parts.join('@');\n\n var lower_domain = domain.toLowerCase();\n if (lower_domain === 'gmail.com' || lower_domain === 'googlemail.com') {\n user = user.replace(/\\./g, '').toLowerCase();\n }\n\n if (!validator.isByteLength(user, 0, 64) ||\n !validator.isByteLength(domain, 0, 256)) {\n return false;\n }\n\n if (!validator.isFQDN(domain, {require_tld: options.require_tld})) {\n return false;\n }\n\n if (user[0] === '\"') {\n user = user.slice(1, user.length - 1);\n return options.allow_utf8_local_part ?\n quotedEmailUserUtf8.test(user) :\n quotedEmailUser.test(user);\n }\n\n var pattern = options.allow_utf8_local_part ?\n emailUserUtf8Part : emailUserPart;\n\n var user_parts = user.split('.');\n for (var i = 0; i < user_parts.length; i++) {\n if (!pattern.test(user_parts[i])) {\n return false;\n }\n }\n\n return true;\n };\n\n var default_url_options = {\n protocols: [ 'http', 'https', 'ftp' ]\n , require_tld: true\n , require_protocol: false\n , require_valid_protocol: true\n , allow_underscores: false\n , allow_trailing_dot: false\n , allow_protocol_relative_urls: false\n };\n\n validator.isURL = function (url, options) {\n if (!url || url.length >= 2083 || /\\s/.test(url)) {\n return false;\n }\n if (url.indexOf('mailto:') === 0) {\n return false;\n }\n options = merge(options, default_url_options);\n var protocol, auth, host, hostname, port,\n port_str, split;\n split = url.split('://');\n if (split.length > 1) {\n protocol = split.shift();\n if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) {\n return false;\n }\n } else if (options.require_protocol) {\n return false;\n } else if (options.allow_protocol_relative_urls && url.substr(0, 2) === '//') {\n split[0] = url.substr(2);\n }\n url = split.join('://');\n split = url.split('#');\n url = split.shift();\n\n split = url.split('?');\n url = split.shift();\n\n split = url.split('/');\n url = split.shift();\n split = url.split('@');\n if (split.length > 1) {\n auth = split.shift();\n if (auth.indexOf(':') >= 0 && auth.split(':').length > 2) {\n return false;\n }\n }\n hostname = split.join('@');\n split = hostname.split(':');\n host = split.shift();\n if (split.length) {\n port_str = split.join(':');\n port = parseInt(port_str, 10);\n if (!/^[0-9]+$/.test(port_str) || port <= 0 || port > 65535) {\n return false;\n }\n }\n if (!validator.isIP(host) && !validator.isFQDN(host, options) &&\n host !== 'localhost') {\n return false;\n }\n if (options.host_whitelist &&\n options.host_whitelist.indexOf(host) === -1) {\n return false;\n }\n if (options.host_blacklist &&\n options.host_blacklist.indexOf(host) !== -1) {\n return false;\n }\n return true;\n };\n\n validator.isMACAddress = function (str) {\n return macAddress.test(str);\n };\n\n validator.isIP = function (str, version) {\n version = validator.toString(version);\n if (!version) {\n return validator.isIP(str, 4) || validator.isIP(str, 6);\n } else if (version === '4') {\n if (!ipv4Maybe.test(str)) {\n return false;\n }\n var parts = str.split('.').sort(function (a, b) {\n return a - b;\n });\n return parts[3] <= 255;\n } else if (version === '6') {\n var blocks = str.split(':');\n var foundOmissionBlock = false; // marker to indicate ::\n\n // At least some OS accept the last 32 bits of an IPv6 address\n // (i.e. 2 of the blocks) in IPv4 notation, and RFC 3493 says\n // that '::ffff:a.b.c.d' is valid for IPv4-mapped IPv6 addresses,\n // and '::a.b.c.d' is deprecated, but also valid.\n var foundIPv4TransitionBlock = validator.isIP(blocks[blocks.length - 1], 4);\n var expectedNumberOfBlocks = foundIPv4TransitionBlock ? 7 : 8;\n\n if (blocks.length > expectedNumberOfBlocks)\n return false;\n\n // initial or final ::\n if (str === '::') {\n return true;\n } else if (str.substr(0, 2) === '::') {\n blocks.shift();\n blocks.shift();\n foundOmissionBlock = true;\n } else if (str.substr(str.length - 2) === '::') {\n blocks.pop();\n blocks.pop();\n foundOmissionBlock = true;\n }\n\n for (var i = 0; i < blocks.length; ++i) {\n // test for a :: which can not be at the string start/end\n // since those cases have been handled above\n if (blocks[i] === '' && i > 0 && i < blocks.length -1) {\n if (foundOmissionBlock)\n return false; // multiple :: in address\n foundOmissionBlock = true;\n } else if (foundIPv4TransitionBlock && i == blocks.length - 1) {\n // it has been checked before that the last\n // block is a valid IPv4 address\n } else if (!ipv6Block.test(blocks[i])) {\n return false;\n }\n }\n\n if (foundOmissionBlock) {\n return blocks.length >= 1;\n } else {\n return blocks.length === expectedNumberOfBlocks;\n }\n }\n return false;\n };\n\n var default_fqdn_options = {\n require_tld: true\n , allow_underscores: false\n , allow_trailing_dot: false\n };\n\n validator.isFQDN = function (str, options) {\n options = merge(options, default_fqdn_options);\n\n /* Remove the optional trailing dot before checking validity */\n if (options.allow_trailing_dot && str[str.length - 1] === '.') {\n str = str.substring(0, str.length - 1);\n }\n var parts = str.split('.');\n if (options.require_tld) {\n var tld = parts.pop();\n if (!parts.length || !/^([a-z\\u00a1-\\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) {\n return false;\n }\n }\n for (var part, i = 0; i < parts.length; i++) {\n part = parts[i];\n if (options.allow_underscores) {\n if (part.indexOf('__') >= 0) {\n return false;\n }\n part = part.replace(/_/g, '');\n }\n if (!/^[a-z\\u00a1-\\uffff0-9-]+$/i.test(part)) {\n return false;\n }\n if (/[\\uff01-\\uff5e]/.test(part)) {\n // disallow full-width chars\n return false;\n }\n if (part[0] === '-' || part[part.length - 1] === '-') {\n return false;\n }\n if (part.indexOf('---') >= 0 && part.slice(0, 4) !== 'xn--') {\n return false;\n }\n }\n return true;\n };\n\n validator.isBoolean = function(str) {\n return (['true', 'false', '1', '0'].indexOf(str) >= 0);\n };\n\n validator.isAlpha = function (str) {\n return alpha.test(str);\n };\n\n validator.isAlphanumeric = function (str) {\n return alphanumeric.test(str);\n };\n\n validator.isNumeric = function (str) {\n return numeric.test(str);\n };\n\n validator.isDecimal = function (str) {\n return str !== '' && decimal.test(str);\n };\n\n validator.isHexadecimal = function (str) {\n return hexadecimal.test(str);\n };\n\n validator.isHexColor = function (str) {\n return hexcolor.test(str);\n };\n\n validator.isLowercase = function (str) {\n return str === str.toLowerCase();\n };\n\n validator.isUppercase = function (str) {\n return str === str.toUpperCase();\n };\n\n validator.isInt = function (str, options) {\n options = options || {};\n return int.test(str) && (!options.hasOwnProperty('min') || str >= options.min) && (!options.hasOwnProperty('max') || str <= options.max);\n };\n\n validator.isFloat = function (str, options) {\n options = options || {};\n if (str === '' || str === '.') {\n return false;\n }\n return float.test(str) && (!options.hasOwnProperty('min') || str >= options.min) && (!options.hasOwnProperty('max') || str <= options.max);\n };\n\n validator.isDivisibleBy = function (str, num) {\n return validator.toFloat(str) % validator.toInt(num) === 0;\n };\n\n validator.isNull = function (str) {\n return str.length === 0;\n };\n\n validator.isLength = function (str, min, max) {\n var surrogatePairs = str.match(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g) || [];\n var len = str.length - surrogatePairs.length;\n return len >= min && (typeof max === 'undefined' || len <= max);\n };\n\n validator.isByteLength = function (str, min, max) {\n var len = encodeURI(str).split(/%..|./).length - 1;\n return len >= min && (typeof max === 'undefined' || len <= max);\n };\n\n validator.isUUID = function (str, version) {\n var pattern = uuid[version ? version : 'all'];\n return pattern && pattern.test(str);\n };\n\n function getTimezoneOffset(str) {\n var iso8601Parts = str.match(iso8601)\n , timezone, sign, hours, minutes;\n if (!iso8601Parts) {\n str = str.toLowerCase();\n timezone = str.match(/(?:\\s|gmt\\s*)(-|\\+)(\\d{1,4})(\\s|$)/);\n if (!timezone) {\n return str.indexOf('gmt') !== -1 ? 0 : null;\n }\n sign = timezone[1];\n var offset = timezone[2];\n if (offset.length === 3) {\n offset = '0' + offset;\n }\n if (offset.length <= 2) {\n hours = 0;\n minutes = parseInt(offset);\n } else {\n hours = parseInt(offset.slice(0, 2));\n minutes = parseInt(offset.slice(2, 4));\n }\n } else {\n timezone = iso8601Parts[21];\n if (!timezone) {\n return null;\n }\n if (timezone === 'z' || timezone === 'Z') {\n return 0;\n }\n sign = iso8601Parts[22];\n if (timezone.indexOf(':') !== -1) {\n hours = parseInt(iso8601Parts[23]);\n minutes = parseInt(iso8601Parts[24]);\n } else {\n hours = 0;\n minutes = parseInt(iso8601Parts[23]);\n }\n }\n return (hours * 60 + minutes) * (sign === '-' ? 1 : -1);\n }\n\n validator.isDate = function (str) {\n var normalizedDate = new Date(Date.parse(str));\n if (isNaN(normalizedDate)) {\n return false;\n }\n\n // normalizedDate is in the user's timezone. Apply the input\n // timezone offset to the date so that the year and day match\n // the input\n var timezoneOffset = getTimezoneOffset(str);\n if (timezoneOffset !== null) {\n var timezoneDifference = normalizedDate.getTimezoneOffset() -\n timezoneOffset;\n normalizedDate = new Date(normalizedDate.getTime() +\n 60000 * timezoneDifference);\n }\n\n var day = String(normalizedDate.getDate());\n var dayOrYear, dayOrYearMatches, year;\n //check for valid double digits that could be late days\n //check for all matches since a string like '12/23' is a valid date\n //ignore everything with nearby colons\n dayOrYearMatches = str.match(/(^|[^:\\d])[23]\\d([^:\\d]|$)/g);\n if (!dayOrYearMatches) {\n return true;\n }\n dayOrYear = dayOrYearMatches.map(function(digitString) {\n return digitString.match(/\\d+/g)[0];\n }).join('/');\n\n year = String(normalizedDate.getFullYear()).slice(-2);\n if (dayOrYear === day || dayOrYear === year) {\n return true;\n } else if ((dayOrYear === (day + '/' + year)) || (dayOrYear === (year + '/' + day))) {\n return true;\n }\n return false;\n };\n\n validator.isAfter = function (str, date) {\n var comparison = validator.toDate(date || new Date())\n , original = validator.toDate(str);\n return !!(original && comparison && original > comparison);\n };\n\n validator.isBefore = function (str, date) {\n var comparison = validator.toDate(date || new Date())\n , original = validator.toDate(str);\n return !!(original && comparison && original < comparison);\n };\n\n validator.isIn = function (str, options) {\n var i;\n if (Object.prototype.toString.call(options) === '[object Array]') {\n var array = [];\n for (i in options) {\n array[i] = validator.toString(options[i]);\n }\n return array.indexOf(str) >= 0;\n } else if (typeof options === 'object') {\n return options.hasOwnProperty(str);\n } else if (options && typeof options.indexOf === 'function') {\n return options.indexOf(str) >= 0;\n }\n return false;\n };\n\n validator.isWhitelisted = function (str, chars) {\n for (var i = str.length - 1; i >= 0; i--) {\n if (chars.indexOf(str[i]) === -1) {\n return false;\n }\n }\n\n return true;\n };\n\n validator.isCreditCard = function (str) {\n var sanitized = str.replace(/[^0-9]+/g, '');\n if (!creditCard.test(sanitized)) {\n return false;\n }\n var sum = 0, digit, tmpNum, shouldDouble;\n for (var i = sanitized.length - 1; i >= 0; i--) {\n digit = sanitized.substring(i, (i + 1));\n tmpNum = parseInt(digit, 10);\n if (shouldDouble) {\n tmpNum *= 2;\n if (tmpNum >= 10) {\n sum += ((tmpNum % 10) + 1);\n } else {\n sum += tmpNum;\n }\n } else {\n sum += tmpNum;\n }\n shouldDouble = !shouldDouble;\n }\n return !!((sum % 10) === 0 ? sanitized : false);\n };\n\n validator.isISIN = function (str) {\n if (!isin.test(str)) {\n return false;\n }\n\n var checksumStr = str.replace(/[A-Z]/g, function(character) {\n return parseInt(character, 36);\n });\n\n var sum = 0, digit, tmpNum, shouldDouble = true;\n for (var i = checksumStr.length - 2; i >= 0; i--) {\n digit = checksumStr.substring(i, (i + 1));\n tmpNum = parseInt(digit, 10);\n if (shouldDouble) {\n tmpNum *= 2;\n if (tmpNum >= 10) {\n sum += tmpNum + 1;\n } else {\n sum += tmpNum;\n }\n } else {\n sum += tmpNum;\n }\n shouldDouble = !shouldDouble;\n }\n\n return parseInt(str.substr(str.length - 1), 10) === (10000 - sum) % 10;\n };\n\n validator.isISBN = function (str, version) {\n version = validator.toString(version);\n if (!version) {\n return validator.isISBN(str, 10) || validator.isISBN(str, 13);\n }\n var sanitized = str.replace(/[\\s-]+/g, '')\n , checksum = 0, i;\n if (version === '10') {\n if (!isbn10Maybe.test(sanitized)) {\n return false;\n }\n for (i = 0; i < 9; i++) {\n checksum += (i + 1) * sanitized.charAt(i);\n }\n if (sanitized.charAt(9) === 'X') {\n checksum += 10 * 10;\n } else {\n checksum += 10 * sanitized.charAt(9);\n }\n if ((checksum % 11) === 0) {\n return !!sanitized;\n }\n } else if (version === '13') {\n if (!isbn13Maybe.test(sanitized)) {\n return false;\n }\n var factor = [ 1, 3 ];\n for (i = 0; i < 12; i++) {\n checksum += factor[i % 2] * sanitized.charAt(i);\n }\n if (sanitized.charAt(12) - ((10 - (checksum % 10)) % 10) === 0) {\n return !!sanitized;\n }\n }\n return false;\n };\n\n validator.isMobilePhone = function(str, locale) {\n if (locale in phones) {\n return phones[locale].test(str);\n }\n return false;\n };\n\n var default_currency_options = {\n symbol: '$'\n , require_symbol: false\n , allow_space_after_symbol: false\n , symbol_after_digits: false\n , allow_negatives: true\n , parens_for_negatives: false\n , negative_sign_before_digits: false\n , negative_sign_after_digits: false\n , allow_negative_sign_placeholder: false\n , thousands_separator: ','\n , decimal_separator: '.'\n , allow_space_after_digits: false\n };\n\n validator.isCurrency = function (str, options) {\n options = merge(options, default_currency_options);\n\n return currencyRegex(options).test(str);\n };\n\n validator.isJSON = function (str) {\n try {\n var obj = JSON.parse(str);\n return !!obj && typeof obj === 'object';\n } catch (e) {}\n return false;\n };\n\n validator.isMultibyte = function (str) {\n return multibyte.test(str);\n };\n\n validator.isAscii = function (str) {\n return ascii.test(str);\n };\n\n validator.isFullWidth = function (str) {\n return fullWidth.test(str);\n };\n\n validator.isHalfWidth = function (str) {\n return halfWidth.test(str);\n };\n\n validator.isVariableWidth = function (str) {\n return fullWidth.test(str) && halfWidth.test(str);\n };\n\n validator.isSurrogatePair = function (str) {\n return surrogatePair.test(str);\n };\n\n validator.isBase64 = function (str) {\n return base64.test(str);\n };\n\n validator.isMongoId = function (str) {\n return validator.isHexadecimal(str) && str.length === 24;\n };\n\n validator.isISO8601 = function (str) {\n return iso8601.test(str);\n };\n\n validator.ltrim = function (str, chars) {\n var pattern = chars ? new RegExp('^[' + chars + ']+', 'g') : /^\\s+/g;\n return str.replace(pattern, '');\n };\n\n validator.rtrim = function (str, chars) {\n var pattern = chars ? new RegExp('[' + chars + ']+$', 'g') : /\\s+$/g;\n return str.replace(pattern, '');\n };\n\n validator.trim = function (str, chars) {\n var pattern = chars ? new RegExp('^[' + chars + ']+|[' + chars + ']+$', 'g') : /^\\s+|\\s+$/g;\n return str.replace(pattern, '');\n };\n\n validator.escape = function (str) {\n return (str.replace(/&/g, '&')\n .replace(/\"/g, '"')\n .replace(/'/g, ''')\n .replace(//g, '>')\n .replace(/\\//g, '/')\n .replace(/\\`/g, '`'));\n };\n\n validator.stripLow = function (str, keep_new_lines) {\n var chars = keep_new_lines ? '\\\\x00-\\\\x09\\\\x0B\\\\x0C\\\\x0E-\\\\x1F\\\\x7F' : '\\\\x00-\\\\x1F\\\\x7F';\n return validator.blacklist(str, chars);\n };\n\n validator.whitelist = function (str, chars) {\n return str.replace(new RegExp('[^' + chars + ']+', 'g'), '');\n };\n\n validator.blacklist = function (str, chars) {\n return str.replace(new RegExp('[' + chars + ']+', 'g'), '');\n };\n\n var default_normalize_email_options = {\n lowercase: true,\n remove_dots: true,\n remove_extension: true\n };\n\n validator.normalizeEmail = function (email, options) {\n options = merge(options, default_normalize_email_options);\n if (!validator.isEmail(email)) {\n return false;\n }\n var parts = email.split('@', 2);\n parts[1] = parts[1].toLowerCase();\n if (parts[1] === 'gmail.com' || parts[1] === 'googlemail.com') {\n if (options.remove_extension) {\n parts[0] = parts[0].split('+')[0];\n }\n if (options.remove_dots) {\n parts[0] = parts[0].replace(/\\./g, '');\n }\n if (!parts[0].length) {\n return false;\n }\n parts[0] = parts[0].toLowerCase();\n parts[1] = 'gmail.com';\n } else if (options.lowercase) {\n parts[0] = parts[0].toLowerCase();\n }\n return parts.join('@');\n };\n\n function merge(obj, defaults) {\n obj = obj || {};\n for (var key in defaults) {\n if (typeof obj[key] === 'undefined') {\n obj[key] = defaults[key];\n }\n }\n return obj;\n }\n\n function currencyRegex(options) {\n var symbol = '(\\\\' + options.symbol.replace(/\\./g, '\\\\.') + ')' + (options.require_symbol ? '' : '?')\n , negative = '-?'\n , whole_dollar_amount_without_sep = '[1-9]\\\\d*'\n , whole_dollar_amount_with_sep = '[1-9]\\\\d{0,2}(\\\\' + options.thousands_separator + '\\\\d{3})*'\n , valid_whole_dollar_amounts = ['0', whole_dollar_amount_without_sep, whole_dollar_amount_with_sep]\n , whole_dollar_amount = '(' + valid_whole_dollar_amounts.join('|') + ')?'\n , decimal_amount = '(\\\\' + options.decimal_separator + '\\\\d{2})?';\n var pattern = whole_dollar_amount + decimal_amount;\n // default is negative sign before symbol, but there are two other options (besides parens)\n if (options.allow_negatives && !options.parens_for_negatives) {\n if (options.negative_sign_after_digits) {\n pattern += negative;\n }\n else if (options.negative_sign_before_digits) {\n pattern = negative + pattern;\n }\n }\n // South African Rand, for example, uses R 123 (space) and R-123 (no space)\n if (options.allow_negative_sign_placeholder) {\n pattern = '( (?!\\\\-))?' + pattern;\n }\n else if (options.allow_space_after_symbol) {\n pattern = ' ?' + pattern;\n }\n else if (options.allow_space_after_digits) {\n pattern += '( (?!$))?';\n }\n if (options.symbol_after_digits) {\n pattern += symbol;\n } else {\n pattern = symbol + pattern;\n }\n if (options.allow_negatives) {\n if (options.parens_for_negatives) {\n pattern = '(\\\\(' + pattern + '\\\\)|' + pattern + ')';\n }\n else if (!(options.negative_sign_before_digits || options.negative_sign_after_digits)) {\n pattern = negative + pattern;\n }\n }\n return new RegExp(\n '^' +\n // ensure there's a dollar and/or decimal amount, and that it doesn't start with a space or a negative sign followed by a space\n '(?!-? )(?=.*\\\\d)' +\n pattern +\n '$'\n );\n }\n\n validator.init();\n\n return validator;\n\n});\n","module.exports = require(\"npm:validator@4.5.0/validator.js\");","/*jshint maxlen: false*/\n\nvar validator = require(\"validator\");\n\nvar FormatValidators = {\n \"date\": function (date) {\n if (typeof date !== \"string\") {\n return true;\n }\n // full-date from http://tools.ietf.org/html/rfc3339#section-5.6\n var matches = /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/.exec(date);\n if (matches === null) {\n return false;\n }\n // var year = matches[1];\n // var month = matches[2];\n // var day = matches[3];\n if (matches[2] < \"01\" || matches[2] > \"12\" || matches[3] < \"01\" || matches[3] > \"31\") {\n return false;\n }\n return true;\n },\n \"date-time\": function (dateTime) {\n if (typeof dateTime !== \"string\") {\n return true;\n }\n // date-time from http://tools.ietf.org/html/rfc3339#section-5.6\n var s = dateTime.toLowerCase().split(\"t\");\n if (!FormatValidators.date(s[0])) {\n return false;\n }\n var matches = /^([0-9]{2}):([0-9]{2}):([0-9]{2})(.[0-9]+)?(z|([+-][0-9]{2}:[0-9]{2}))$/.exec(s[1]);\n if (matches === null) {\n return false;\n }\n // var hour = matches[1];\n // var minute = matches[2];\n // var second = matches[3];\n // var fraction = matches[4];\n // var timezone = matches[5];\n if (matches[1] > \"23\" || matches[2] > \"59\" || matches[3] > \"59\") {\n return false;\n }\n return true;\n },\n \"email\": function (email) {\n if (typeof email !== \"string\") {\n return true;\n }\n return validator.isEmail(email, { \"require_tld\": true });\n },\n \"hostname\": function (hostname) {\n if (typeof hostname !== \"string\") {\n return true;\n }\n /*\n http://json-schema.org/latest/json-schema-validation.html#anchor114\n A string instance is valid against this attribute if it is a valid\n representation for an Internet host name, as defined by RFC 1034, section 3.1 [RFC1034].\n\n http://tools.ietf.org/html/rfc1034#section-3.5\n\n ::= any one of the ten digits 0 through 9\n var digit = /[0-9]/;\n\n ::= any one of the 52 alphabetic characters A through Z in upper case and a through z in lower case\n var letter = /[a-zA-Z]/;\n\n ::= | \n var letDig = /[0-9a-zA-Z]/;\n\n ::= | \"-\"\n var letDigHyp = /[-0-9a-zA-Z]/;\n\n ::= | \n var ldhStr = /[-0-9a-zA-Z]+/;\n\n